Ticket #3972: unordered-adjacency_list.3.patch
File unordered-adjacency_list.3.patch, 5.7 KB (added by , 13 years ago) |
---|
-
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 1 2 // (C) Copyright Jeremy Siek 2004 2 3 // Distributed under the Boost Software License, Version 1.0. (See 3 4 // accompanying file LICENSE_1_0.txt or copy at … … 274 275 typedef map_tag category; 275 276 typedef stable_tag iterator_stability; // is this right? 276 277 }; 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 }; 277 288 #endif 278 289 template <class Key, class Eq, class Hash, class Alloc> 279 290 set_tag container_category(const boost::unordered_set<Key,Eq,Hash,Alloc>&) … … 290 301 template <class Key, class T, class Eq, class Hash, class Alloc> 291 302 stable_tag iterator_stability(const boost::unordered_map<Key,T,Eq,Hash,Alloc>&) 292 303 { 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(); } 293 323 #endif 294 324 295 325 -
boost/graph/detail/adjacency_list.hpp
1 1 // -*- c++ -*- 2 2 //======================================================================= 3 // Copyright 2010 Thomas Claveirole 3 4 // 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 5 6 // 6 7 // Distributed under the Boost Software License, Version 1.0. (See 7 8 // accompanying file LICENSE_1_0.txt or copy at … … 1633 1634 const Graph& g = static_cast<const Graph&>(g_); 1634 1635 return g_.edge_dispatch(g, u, v, Cat()); 1635 1636 } 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 1636 1664 template <class Config, class Base> 1637 1665 inline std::pair<typename Config::out_edge_iterator, 1638 1666 typename Config::out_edge_iterator> … … 1648 1676 typename Config::OutEdgeList& el = g.out_edge_list(u); 1649 1677 typename Config::OutEdgeList::iterator first, last; 1650 1678 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)); 1655 1683 return std::make_pair(out_edge_iterator(first, u), 1656 1684 out_edge_iterator(last, u)); 1657 1685 } -
boost/graph/adjacency_list.hpp
1 1 //======================================================================= 2 // Copyright 2010 Thomas Claveirole 2 3 // 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 4 5 // 5 6 // Distributed under the Boost Software License, Version 1.0. (See 6 7 // accompanying file LICENSE_1_0.txt or copy at … … 254 255 typedef disallow_parallel_edge_tag type; 255 256 }; 256 257 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 257 268 namespace detail { 258 269 template <class Directed> struct is_random_access { 259 270 enum { value = false};