epoc32/include/stdapis/boost/graph/adjacency_iterator.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/graph/adjacency_iterator.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,102 @@
     1.4 +//=======================================================================
     1.5 +// Copyright 2002 Indiana University.
     1.6 +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
     1.7 +//
     1.8 +// Distributed under the Boost Software License, Version 1.0. (See
     1.9 +// accompanying file LICENSE_1_0.txt or copy at
    1.10 +// http://www.boost.org/LICENSE_1_0.txt)
    1.11 +//=======================================================================
    1.12 +
    1.13 +#ifndef BOOST_ADJACENCY_ITERATOR_HPP
    1.14 +#define BOOST_ADJACENCY_ITERATOR_HPP
    1.15 +
    1.16 +#include <boost/iterator/iterator_adaptor.hpp>
    1.17 +#include <boost/graph/graph_traits.hpp>
    1.18 +
    1.19 +namespace boost
    1.20 +{
    1.21 +
    1.22 +  template <class Graph, class Vertex, class OutEdgeIter, class Difference>
    1.23 +  struct adjacency_iterator
    1.24 +    : iterator_adaptor<
    1.25 +          adjacency_iterator<Graph,Vertex,OutEdgeIter,Difference>
    1.26 +        , OutEdgeIter
    1.27 +        , Vertex
    1.28 +        , use_default
    1.29 +        , Vertex
    1.30 +        , Difference
    1.31 +      >
    1.32 +  {
    1.33 +      typedef iterator_adaptor<
    1.34 +          adjacency_iterator<Graph,Vertex,OutEdgeIter,Difference>
    1.35 +        , OutEdgeIter
    1.36 +        , Vertex
    1.37 +        , use_default
    1.38 +        , Vertex
    1.39 +        , Difference
    1.40 +      > super_t;
    1.41 +      
    1.42 +      inline adjacency_iterator() {}
    1.43 +      inline adjacency_iterator(OutEdgeIter const& i, const Graph* g) : super_t(i), m_g(g) { }
    1.44 +
    1.45 +      inline Vertex
    1.46 +      dereference() const
    1.47 +        { return target(*this->base(), *m_g); }
    1.48 +
    1.49 +      const Graph* m_g;
    1.50 +  };
    1.51 +
    1.52 +  template <class Graph,
    1.53 +            class Vertex = typename graph_traits<Graph>::vertex_descriptor,
    1.54 +            class OutEdgeIter=typename graph_traits<Graph>::out_edge_iterator>
    1.55 +  class adjacency_iterator_generator
    1.56 +  {
    1.57 +    typedef typename boost::detail::iterator_traits<OutEdgeIter>
    1.58 +      ::difference_type difference_type;
    1.59 +  public:
    1.60 +      typedef adjacency_iterator<Graph,Vertex,OutEdgeIter,difference_type> type;
    1.61 +  };
    1.62 +
    1.63 +  template <class Graph, class Vertex, class InEdgeIter, class Difference>
    1.64 +  struct inv_adjacency_iterator
    1.65 +    : iterator_adaptor<
    1.66 +          inv_adjacency_iterator<Graph,Vertex,InEdgeIter,Difference>
    1.67 +        , InEdgeIter
    1.68 +        , Vertex
    1.69 +        , use_default
    1.70 +        , Vertex
    1.71 +        , Difference
    1.72 +      >
    1.73 +    {
    1.74 +      typedef iterator_adaptor<
    1.75 +                  inv_adjacency_iterator<Graph,Vertex,InEdgeIter,Difference>
    1.76 +                , InEdgeIter
    1.77 +                , Vertex
    1.78 +                , use_default
    1.79 +                , Vertex
    1.80 +                , Difference
    1.81 +              > super_t;
    1.82 +
    1.83 +      inline inv_adjacency_iterator() { }
    1.84 +      inline inv_adjacency_iterator(InEdgeIter const& i, const Graph* g) : super_t(i), m_g(g) { }
    1.85 +
    1.86 +      inline Vertex
    1.87 +      dereference() const
    1.88 +        { return source(*this->base(), *m_g); }
    1.89 +
    1.90 +      const Graph* m_g;
    1.91 +    };
    1.92 +
    1.93 +  template <class Graph,
    1.94 +            class Vertex = typename graph_traits<Graph>::vertex_descriptor,
    1.95 +            class InEdgeIter = typename graph_traits<Graph>::in_edge_iterator>
    1.96 +  class inv_adjacency_iterator_generator {
    1.97 +    typedef typename boost::detail::iterator_traits<InEdgeIter>
    1.98 +      ::difference_type difference_type;
    1.99 +  public:
   1.100 +      typedef inv_adjacency_iterator<Graph, Vertex, InEdgeIter, difference_type> type;
   1.101 +  };
   1.102 +
   1.103 +} // namespace boost
   1.104 +
   1.105 +#endif // BOOST_DETAIL_ADJACENCY_ITERATOR_HPP