epoc32/include/stdapis/boost/graph/detail/incidence_iterator.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 //
     2 //=======================================================================
     3 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
     4 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
     5 //
     6 // Distributed under the Boost Software License, Version 1.0. (See
     7 // accompanying file LICENSE_1_0.txt or copy at
     8 // http://www.boost.org/LICENSE_1_0.txt)
     9 //=======================================================================
    10 //
    11 #ifndef BOOST_GRAPH_DETAIL_INCIDENCE_ITERATOR_HPP
    12 #define BOOST_GRAPH_DETAIL_INCIDENCE_ITERATOR_HPP
    13 
    14 #include <utility>
    15 #include <iterator>
    16 
    17 // OBSOLETE
    18 
    19 namespace boost {
    20 
    21   namespace detail {
    22     // EdgeDir tags
    23     struct in_edge_tag { };
    24     struct out_edge_tag { };
    25     
    26     template <class Vertex, class Edge, class Iterator1D, class EdgeDir>
    27     struct bidir_incidence_iterator {
    28       typedef bidir_incidence_iterator self;
    29       typedef Edge edge_type;
    30       typedef typename Edge::property_type EdgeProperty;
    31     public:
    32       typedef int difference_type;
    33       typedef std::forward_iterator_tag iterator_category;
    34       typedef edge_type reference;
    35       typedef edge_type value_type;
    36       typedef value_type* pointer;
    37       inline bidir_incidence_iterator() {}
    38       inline bidir_incidence_iterator(Iterator1D ii, Vertex src) 
    39         : i(ii), _src(src) { }
    40       
    41       inline self& operator++() { ++i; return *this; }
    42       inline self operator++(int) { self tmp = *this; ++(*this); return tmp; }
    43       
    44       inline reference operator*() const {
    45         return deref_helper(EdgeDir());
    46       }
    47       inline self* operator->() { return this; }
    48       
    49       Iterator1D& iter() { return i; }
    50       const Iterator1D& iter() const { return i; }
    51 
    52       Iterator1D i;
    53       Vertex _src;
    54     protected:
    55       inline reference deref_helper(out_edge_tag) const {
    56         return edge_type( _src, (*i).get_target(), &(*i).get_property() );
    57       }
    58       inline reference deref_helper(in_edge_tag) const {
    59         return edge_type((*i).get_target(), _src, &(*i).get_property() );
    60       }
    61     };
    62 
    63     template <class V, class E, class Iter, class Dir>
    64     inline bool operator==(const bidir_incidence_iterator<V,E,Iter,Dir>& x,
    65                            const bidir_incidence_iterator<V,E,Iter,Dir>& y)
    66     {
    67       return x.i == y.i;
    68     }
    69     template <class V, class E, class Iter, class Dir>
    70     inline bool operator!=(const bidir_incidence_iterator<V,E,Iter,Dir>& x,
    71                            const bidir_incidence_iterator<V,E,Iter,Dir>& y)
    72     {
    73       return x.i != y.i;
    74     }
    75 
    76 
    77   }
    78 } 
    79 #endif