Ticket #3972: unordered-adjacency_list.patch

File unordered-adjacency_list.patch, 5.5 KB (added by Thomas Claveirole <thomas@…>, 13 years ago)

Patch that solves the described issue.

  • boost/pending/container_traits.hpp

    http://svn.boost.org/svn/boost/trunk
    
     graph/adjacency_list.hpp        |   12 +++++++++++-
     graph/detail/adjacency_list.hpp |   37 +++++++++++++++++++++++++++++++++----
     pending/container_traits.hpp    |   31 ++++++++++++++++++++++++++++++-
     3 files changed, 74 insertions(+), 6 deletions(-)
    
     
    1 //  (C) Copyright Jeremy Siek 2004 
     1//  (C) Copyright Jeremy Siek 2004, 2010
    22//  Distributed under the Boost Software License, Version 1.0. (See
    33//  accompanying file LICENSE_1_0.txt or copy at
    44//  http://www.boost.org/LICENSE_1_0.txt)
     
    274274    typedef map_tag category;
    275275    typedef stable_tag iterator_stability; // is this right?
    276276  };
     277  template <class Key, class Eq, class Hash, class Alloc>
     278  struct container_traits< boost::unordered_multiset<Key,Eq,Hash,Alloc> > {
     279    typedef multiset_tag category;
     280    typedef stable_tag iterator_stability; // is this right?
     281  };
     282  template <class Key, class T, class Eq, class Hash, class Alloc>
     283  struct container_traits< boost::unordered_multimap<Key,T,Eq,Hash,Alloc> > {
     284    typedef multimap_tag category;
     285    typedef stable_tag iterator_stability; // is this right?
     286  };
    277287#endif
    278288  template <class Key, class Eq, class Hash, class Alloc>
    279289  set_tag container_category(const boost::unordered_set<Key,Eq,Hash,Alloc>&)
     
    290300  template <class Key, class T, class Eq, class Hash, class Alloc>
    291301  stable_tag iterator_stability(const boost::unordered_map<Key,T,Eq,Hash,Alloc>&)
    292302  { return stable_tag(); }
     303  template <class Key, class Eq, class Hash, class Alloc>
     304  multiset_tag
     305  container_category(const boost::unordered_multiset<Key,Eq,Hash,Alloc>&)
     306  { return multiset_tag(); }
     307
     308  template <class Key, class T, class Eq, class Hash, class Alloc>
     309  multimap_tag
     310  container_category(const boost::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
     311  { return multimap_tag(); }
     312
     313  template <class Key, class Eq, class Hash, class Alloc>
     314  stable_tag
     315  iterator_stability(const boost::unordered_multiset<Key,Eq,Hash,Alloc>&)
     316  { return stable_tag(); }
     317
     318  template <class Key, class T, class Eq, class Hash, class Alloc>
     319  stable_tag
     320  iterator_stability(const boost::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
     321  { return stable_tag(); }
    293322#endif
    294323
    295324
  • boost/graph/detail/adjacency_list.hpp

     
    11// -*- c++ -*-
    22//=======================================================================
    3 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
     3// Copyright 1997, 1998, 1999, 2000, 2010 University of Notre Dame.
    44// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
    55//
    66// Distributed under the Boost Software License, Version 1.0. (See
     
    16331633      const Graph& g = static_cast<const Graph&>(g_);
    16341634      return g_.edge_dispatch(g, u, v, Cat());
    16351635    }
     1636
     1637    namespace graph_detail {
     1638
     1639      template <class Container,
     1640                class LessThanComparable,
     1641                class ContainerCategory>
     1642      std::pair<typename Container::iterator, typename Container::iterator>
     1643      equal_range_dispatch(Container& c,
     1644                           const LessThanComparable& value,
     1645                           const ContainerCategory&)
     1646      {
     1647        // c must be sorted for std::equal_range to behave properly.
     1648        return std::equal_range(c.begin(), c.end(), value);
     1649      }
     1650
     1651      template <class AssociativeContainer, class LessThanComparable>
     1652      std::pair<typename AssociativeContainer::iterator,
     1653                typename AssociativeContainer::iterator>
     1654      equal_range_dispatch(AssociativeContainer& c,
     1655                           const LessThanComparable& value,
     1656                           const associative_container_tag&)
     1657      {
     1658        return c.equal_range(value);
     1659      }
     1660
     1661    } // namespace graph_detail
     1662
    16361663    template <class Config, class Base>
    16371664    inline std::pair<typename Config::out_edge_iterator,
    16381665                     typename Config::out_edge_iterator>
     
    16491676      typename Config::OutEdgeList::iterator first, last;
    16501677      typename Config::EdgeContainer fake_edge_container;
    16511678      tie(first, last) =
    1652         std::equal_range(el.begin(), el.end(),
    1653                          StoredEdge(v, fake_edge_container.end(),
    1654                                     &fake_edge_container));
     1679        graph_detail::equal_range_dispatch(el,
     1680                                           StoredEdge(v,
     1681                                                      fake_edge_container.end(),
     1682                                                      &fake_edge_container),
     1683                                           container_category(el));
    16551684      return std::make_pair(out_edge_iterator(first, u),
    16561685                            out_edge_iterator(last, u));
    16571686    }
  • boost/graph/adjacency_list.hpp

     
    11//=======================================================================
    2 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
     2// Copyright 1997, 1998, 1999, 2000, 2010 University of Notre Dame.
    33// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
    44//
    55// Distributed under the Boost Software License, Version 1.0. (See
     
    254254    typedef disallow_parallel_edge_tag type;
    255255  };
    256256
     257  template <>
     258  struct parallel_edge_traits<hash_multisetS> {
     259    typedef allow_parallel_edge_tag type;
     260  };
     261
     262  template <>
     263  struct parallel_edge_traits<hash_multimapS> {
     264    typedef allow_parallel_edge_tag type;
     265  };
     266
    257267  namespace detail {
    258268    template <class Directed> struct is_random_access {
    259269      enum { value = false};