Ticket #3972: unordered_equal_range_dispatch.2.patch

File unordered_equal_range_dispatch.2.patch, 4.6 KB (added by i@…, 13 years ago)

Corrected copyright lines.

  • boost/pending/container_traits.hpp

     
    11//  (C) Copyright Jeremy Siek 2004
    22//  (C) Copyright Thomas Claveirole 2010
     3//  (C) Copyright Ignacy Gawedzki 2010
    34//  Distributed under the Boost Software License, Version 1.0. (See
    45//  accompanying file LICENSE_1_0.txt or copy at
    56//  http://www.boost.org/LICENSE_1_0.txt)
     
    263264
    264265 // hash_set, hash_map
    265266
     267  struct unordered_set_tag :
     268    virtual public simple_associative_container_tag,
     269    virtual public unique_associative_container_tag
     270    { };
     271
     272  struct unordered_multiset_tag :
     273    virtual public simple_associative_container_tag,
     274    virtual public multiple_associative_container_tag
     275    { };
     276
     277
     278  struct unordered_map_tag :
     279    virtual public pair_associative_container_tag,
     280    virtual public unique_associative_container_tag
     281    { };
     282
     283  struct unordered_multimap_tag :
     284    virtual public pair_associative_container_tag,
     285    virtual public multiple_associative_container_tag
     286    { };
     287
     288
    266289#ifndef BOOST_NO_HASH
    267290#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
    268291  template <class Key, class Eq, class Hash, class Alloc>
    269292  struct container_traits< boost::unordered_set<Key,Eq,Hash,Alloc> > {
    270     typedef set_tag category;
     293    typedef unordered_set_tag category;
    271294    typedef unstable_tag iterator_stability;
    272295  };
    273296  template <class Key, class T, class Eq, class Hash, class Alloc>
    274297  struct container_traits< boost::unordered_map<Key,T,Eq,Hash,Alloc> > {
    275     typedef map_tag category;
     298    typedef unordered_map_tag category;
    276299    typedef unstable_tag iterator_stability;
    277300  };
    278301  template <class Key, class Eq, class Hash, class Alloc>
    279302  struct container_traits< boost::unordered_multiset<Key,Eq,Hash,Alloc> > {
    280     typedef multiset_tag category;
     303    typedef unordered_multiset_tag category;
    281304    typedef unstable_tag iterator_stability;
    282305  };
    283306  template <class Key, class T, class Eq, class Hash, class Alloc>
    284307  struct container_traits< boost::unordered_multimap<Key,T,Eq,Hash,Alloc> > {
    285     typedef multimap_tag category;
     308    typedef unordered_multimap_tag category;
    286309    typedef unstable_tag iterator_stability;
    287310  };
    288311#endif
    289312  template <class Key, class Eq, class Hash, class Alloc>
    290   set_tag container_category(const boost::unordered_set<Key,Eq,Hash,Alloc>&)
    291   { return set_tag(); }
     313  unordered_set_tag
     314  container_category(const boost::unordered_set<Key,Eq,Hash,Alloc>&)
     315  { return unordered_set_tag(); }
    292316
    293317  template <class Key, class T, class Eq, class Hash, class Alloc>
    294   map_tag container_category(const boost::unordered_map<Key,T,Eq,Hash,Alloc>&)
    295   { return map_tag(); }
     318  unordered_map_tag
     319  container_category(const boost::unordered_map<Key,T,Eq,Hash,Alloc>&)
     320  { return unordered_map_tag(); }
    296321
    297322  template <class Key, class Eq, class Hash, class Alloc>
    298323  unstable_tag iterator_stability(const boost::unordered_set<Key,Eq,Hash,Alloc>&)
     
    302327  unstable_tag iterator_stability(const boost::unordered_map<Key,T,Eq,Hash,Alloc>&)
    303328  { return unstable_tag(); }
    304329  template <class Key, class Eq, class Hash, class Alloc>
    305   multiset_tag
     330  unordered_multiset_tag
    306331  container_category(const boost::unordered_multiset<Key,Eq,Hash,Alloc>&)
    307   { return multiset_tag(); }
     332  { return unordered_multiset_tag(); }
    308333
    309334  template <class Key, class T, class Eq, class Hash, class Alloc>
    310   multimap_tag
     335  unordered_multimap_tag
    311336  container_category(const boost::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
    312   { return multimap_tag(); }
     337  { return unordered_multimap_tag(); }
    313338
    314339  template <class Key, class Eq, class Hash, class Alloc>
    315340  unstable_tag
     
    435460
    436461  // Equal range
    437462  template <class Container,
    438             class LessThanComparable,
    439             class ContainerCategory>
     463            class LessThanComparable>
    440464  std::pair<typename Container::iterator, typename Container::iterator>
    441465  equal_range_dispatch(Container& c,
    442466                       const LessThanComparable& value,
    443                        const ContainerCategory&)
     467                       container_tag)
    444468  {
    445469    // c must be sorted for std::equal_range to behave properly.
    446470    return std::equal_range(c.begin(), c.end(), value);
     
    451475            typename AssociativeContainer::iterator>
    452476  equal_range_dispatch(AssociativeContainer& c,
    453477                       const LessThanComparable& value,
    454                        const associative_container_tag&)
     478                       associative_container_tag)
    455479  {
    456480    return c.equal_range(value);
    457481  }