Ticket #3972: unordered-adjacency_list.3.patch

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

Same as unordered-adjacency_list.2.patch with updated copyright notices.

  • boost/pending/container_traits.hpp

    http://svn.boost.org/svn/boost/trunk
    
     graph/adjacency_list.hpp        |   13 ++++++++++++-
     graph/detail/adjacency_list.hpp |   38 +++++++++++++++++++++++++++++++++-----
     pending/container_traits.hpp    |   30 ++++++++++++++++++++++++++++++
     3 files changed, 75 insertions(+), 6 deletions(-)
    
     
     1//  (C) Copyright Thomas Claveirole 2010
    12//  (C) Copyright Jeremy Siek 2004
    23//  Distributed under the Boost Software License, Version 1.0. (See
    34//  accompanying file LICENSE_1_0.txt or copy at
     
    274275    typedef map_tag category;
    275276    typedef stable_tag iterator_stability; // is this right?
    276277  };
     278  template <class Key, class Eq, class Hash, class Alloc>
     279  struct container_traits< boost::unordered_multiset<Key,Eq,Hash,Alloc> > {
     280    typedef multiset_tag category;
     281    typedef stable_tag iterator_stability; // is this right?
     282  };
     283  template <class Key, class T, class Eq, class Hash, class Alloc>
     284  struct container_traits< boost::unordered_multimap<Key,T,Eq,Hash,Alloc> > {
     285    typedef multimap_tag category;
     286    typedef stable_tag iterator_stability; // is this right?
     287  };
    277288#endif
    278289  template <class Key, class Eq, class Hash, class Alloc>
    279290  set_tag container_category(const boost::unordered_set<Key,Eq,Hash,Alloc>&)
     
    290301  template <class Key, class T, class Eq, class Hash, class Alloc>
    291302  stable_tag iterator_stability(const boost::unordered_map<Key,T,Eq,Hash,Alloc>&)
    292303  { return stable_tag(); }
     304  template <class Key, class Eq, class Hash, class Alloc>
     305  multiset_tag
     306  container_category(const boost::unordered_multiset<Key,Eq,Hash,Alloc>&)
     307  { return multiset_tag(); }
     308
     309  template <class Key, class T, class Eq, class Hash, class Alloc>
     310  multimap_tag
     311  container_category(const boost::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
     312  { return multimap_tag(); }
     313
     314  template <class Key, class Eq, class Hash, class Alloc>
     315  stable_tag
     316  iterator_stability(const boost::unordered_multiset<Key,Eq,Hash,Alloc>&)
     317  { return stable_tag(); }
     318
     319  template <class Key, class T, class Eq, class Hash, class Alloc>
     320  stable_tag
     321  iterator_stability(const boost::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
     322  { return stable_tag(); }
    293323#endif
    294324
    295325
  • boost/graph/detail/adjacency_list.hpp

     
    11// -*- c++ -*-
    22//=======================================================================
     3// Copyright 2010 Thomas Claveirole
    34// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
    4 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
     5// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Thomas Claveirole
    56//
    67// Distributed under the Boost Software License, Version 1.0. (See
    78// accompanying file LICENSE_1_0.txt or copy at
     
    16331634      const Graph& g = static_cast<const Graph&>(g_);
    16341635      return g_.edge_dispatch(g, u, v, Cat());
    16351636    }
     1637
     1638    namespace graph_detail {
     1639
     1640      template <class Container,
     1641                class LessThanComparable,
     1642                class ContainerCategory>
     1643      std::pair<typename Container::iterator, typename Container::iterator>
     1644      equal_range_dispatch(Container& c,
     1645                           const LessThanComparable& value,
     1646                           const ContainerCategory&)
     1647      {
     1648        // c must be sorted for std::equal_range to behave properly.
     1649        return std::equal_range(c.begin(), c.end(), value);
     1650      }
     1651
     1652      template <class AssociativeContainer, class LessThanComparable>
     1653      std::pair<typename AssociativeContainer::iterator,
     1654                typename AssociativeContainer::iterator>
     1655      equal_range_dispatch(AssociativeContainer& c,
     1656                           const LessThanComparable& value,
     1657                           const associative_container_tag&)
     1658      {
     1659        return c.equal_range(value);
     1660      }
     1661
     1662    } // namespace graph_detail
     1663
    16361664    template <class Config, class Base>
    16371665    inline std::pair<typename Config::out_edge_iterator,
    16381666                     typename Config::out_edge_iterator>
     
    16481676      typename Config::OutEdgeList& el = g.out_edge_list(u);
    16491677      typename Config::OutEdgeList::iterator first, last;
    16501678      typename Config::EdgeContainer fake_edge_container;
    1651       tie(first, last) =
    1652         std::equal_range(el.begin(), el.end(),
    1653                          StoredEdge(v, fake_edge_container.end(),
    1654                                     &fake_edge_container));
     1679      tie(first, last) = graph_detail::
     1680        equal_range_dispatch(el, StoredEdge(v, fake_edge_container.end(),
     1681                                            &fake_edge_container),
     1682                             graph_detail::container_category(el));
    16551683      return std::make_pair(out_edge_iterator(first, u),
    16561684                            out_edge_iterator(last, u));
    16571685    }
  • boost/graph/adjacency_list.hpp

     
    11//=======================================================================
     2// Copyright 2010 Thomas Claveirole
    23// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
    3 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
     4// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Thomas Claveirole
    45//
    56// Distributed under the Boost Software License, Version 1.0. (See
    67// accompanying file LICENSE_1_0.txt or copy at
     
    254255    typedef disallow_parallel_edge_tag type;
    255256  };
    256257
     258  template <>
     259  struct parallel_edge_traits<hash_multisetS> {
     260    typedef allow_parallel_edge_tag type;
     261  };
     262
     263  template <>
     264  struct parallel_edge_traits<hash_multimapS> {
     265    typedef allow_parallel_edge_tag type;
     266  };
     267
    257268  namespace detail {
    258269    template <class Directed> struct is_random_access {
    259270      enum { value = false};