Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72391 - in trunk/boost/unordered: . detail
From: dnljms_at_[hidden]
Date: 2011-06-04 12:17:10


Author: danieljames
Date: 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
New Revision: 72391
URL: http://svn.boost.org/trac/boost/changeset/72391

Log:
Unordered: Move the implementation into a namespace.

Although it typically won't prevent ADL, because of boost::hash.
Added:
   trunk/boost/unordered/detail/fwd.hpp (contents, props changed)
Text files modified:
   trunk/boost/unordered/detail/allocator_helpers.hpp | 2 +-
   trunk/boost/unordered/detail/buckets.hpp | 20 +-------------------
   trunk/boost/unordered/detail/equivalent.hpp | 2 +-
   trunk/boost/unordered/detail/extract_key.hpp | 2 +-
   trunk/boost/unordered/detail/node.hpp | 2 +-
   trunk/boost/unordered/detail/table.hpp | 13 +++++++++++--
   trunk/boost/unordered/detail/unique.hpp | 2 +-
   trunk/boost/unordered/detail/util.hpp | 2 +-
   trunk/boost/unordered/unordered_map.hpp | 26 ++++++++------------------
   trunk/boost/unordered/unordered_map_fwd.hpp | 40 ++++------------------------------------
   trunk/boost/unordered/unordered_set.hpp | 25 ++++++++-----------------
   trunk/boost/unordered/unordered_set_fwd.hpp | 38 ++++----------------------------------
   12 files changed, 42 insertions(+), 132 deletions(-)

Modified: trunk/boost/unordered/detail/allocator_helpers.hpp
==============================================================================
--- trunk/boost/unordered/detail/allocator_helpers.hpp (original)
+++ trunk/boost/unordered/detail/allocator_helpers.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,5 +1,5 @@
 
-// Copyright 2005-2009 Daniel James.
+// Copyright 2005-2011 Daniel James.
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 

Modified: trunk/boost/unordered/detail/buckets.hpp
==============================================================================
--- trunk/boost/unordered/detail/buckets.hpp (original)
+++ trunk/boost/unordered/detail/buckets.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,6 +1,6 @@
 
 // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
-// Copyright (C) 2005-2009 Daniel James
+// Copyright (C) 2005-2011 Daniel James
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
@@ -635,24 +635,6 @@
             }
         }
     }
-
- ///////////////////////////////////////////////////////////////////
- //
- // Iterators
-
- // iterator_access is used to access the internal iterator without
- // making it publicly available.
-
- class iterator_access
- {
- public:
- template <class Iterator>
- static BOOST_DEDUCED_TYPENAME Iterator::node_ptr const&
- get(Iterator const& it)
- {
- return it.node_;
- }
- };
 }}}
 
 #endif

Modified: trunk/boost/unordered/detail/equivalent.hpp
==============================================================================
--- trunk/boost/unordered/detail/equivalent.hpp (original)
+++ trunk/boost/unordered/detail/equivalent.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,6 +1,6 @@
 
 // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
-// Copyright (C) 2005-2009 Daniel James
+// Copyright (C) 2005-2011 Daniel James
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 

Modified: trunk/boost/unordered/detail/extract_key.hpp
==============================================================================
--- trunk/boost/unordered/detail/extract_key.hpp (original)
+++ trunk/boost/unordered/detail/extract_key.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,5 +1,5 @@
 
-// Copyright (C) 2005-2009 Daniel James
+// Copyright (C) 2005-2011 Daniel James
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 

Added: trunk/boost/unordered/detail/fwd.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/unordered/detail/fwd.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -0,0 +1,87 @@
+
+// Copyright (C) 2008-2011 Daniel James.
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNORDERED_FWD_HPP_INCLUDED
+#define BOOST_UNORDERED_FWD_HPP_INCLUDED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/config.hpp>
+#include <memory>
+#include <functional>
+#include <boost/functional/hash_fwd.hpp>
+
+namespace boost
+{
+namespace unordered
+{
+ template <class K,
+ class T,
+ class H = hash<K>,
+ class P = std::equal_to<K>,
+ class A = std::allocator<std::pair<const K, T> > >
+ class unordered_map;
+ template <class K, class T, class H, class P, class A>
+ inline bool operator==(unordered_map<K, T, H, P, A> const&,
+ unordered_map<K, T, H, P, A> const&);
+ template <class K, class T, class H, class P, class A>
+ inline bool operator!=(unordered_map<K, T, H, P, A> const&,
+ unordered_map<K, T, H, P, A> const&);
+ template <class K, class T, class H, class P, class A>
+ inline void swap(unordered_map<K, T, H, P, A>&,
+ unordered_map<K, T, H, P, A>&);
+
+ template <class K,
+ class T,
+ class H = hash<K>,
+ class P = std::equal_to<K>,
+ class A = std::allocator<std::pair<const K, T> > >
+ class unordered_multimap;
+ template <class K, class T, class H, class P, class A>
+ inline bool operator==(unordered_multimap<K, T, H, P, A> const&,
+ unordered_multimap<K, T, H, P, A> const&);
+ template <class K, class T, class H, class P, class A>
+ inline bool operator!=(unordered_multimap<K, T, H, P, A> const&,
+ unordered_multimap<K, T, H, P, A> const&);
+ template <class K, class T, class H, class P, class A>
+ inline void swap(unordered_multimap<K, T, H, P, A>&,
+ unordered_multimap<K, T, H, P, A>&);
+
+ template <class T,
+ class H = hash<T>,
+ class P = std::equal_to<T>,
+ class A = std::allocator<T> >
+ class unordered_set;
+ template <class T, class H, class P, class A>
+ inline bool operator==(unordered_set<T, H, P, A> const&,
+ unordered_set<T, H, P, A> const&);
+ template <class T, class H, class P, class A>
+ inline bool operator!=(unordered_set<T, H, P, A> const&,
+ unordered_set<T, H, P, A> const&);
+ template <class T, class H, class P, class A>
+ inline void swap(unordered_set<T, H, P, A> &m1,
+ unordered_set<T, H, P, A> &m2);
+
+ template <class T,
+ class H = hash<T>,
+ class P = std::equal_to<T>,
+ class A = std::allocator<T> >
+ class unordered_multiset;
+ template <class T, class H, class P, class A>
+ inline bool operator==(unordered_multiset<T, H, P, A> const&,
+ unordered_multiset<T, H, P, A> const&);
+ template <class T, class H, class P, class A>
+ inline bool operator!=(unordered_multiset<T, H, P, A> const&,
+ unordered_multiset<T, H, P, A> const&);
+ template <class T, class H, class P, class A>
+ inline void swap(unordered_multiset<T, H, P, A> &m1,
+ unordered_multiset<T, H, P, A> &m2);
+
+}
+}
+
+#endif

Modified: trunk/boost/unordered/detail/node.hpp
==============================================================================
--- trunk/boost/unordered/detail/node.hpp (original)
+++ trunk/boost/unordered/detail/node.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,6 +1,6 @@
 
 // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
-// Copyright (C) 2005-2009 Daniel James
+// Copyright (C) 2005-2011 Daniel James
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 

Modified: trunk/boost/unordered/detail/table.hpp
==============================================================================
--- trunk/boost/unordered/detail/table.hpp (original)
+++ trunk/boost/unordered/detail/table.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,6 +1,6 @@
 
 // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
-// Copyright (C) 2005-2009 Daniel James
+// Copyright (C) 2005-2011 Daniel James
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
@@ -801,7 +801,16 @@
         typedef ::boost::unordered::iterator_detail::iterator<A, Unique>
             iterator;
         friend class ::boost::unordered::iterator_detail::iterator<A, Unique>;
- friend class ::boost::unordered::detail::iterator_access;
+
+ template <class K, class T, class H, class P, class A2>
+ friend class ::boost::unordered::unordered_map;
+ template <class K, class T, class H, class P, class A2>
+ friend class ::boost::unordered::unordered_multimap;
+ template <class T, class H, class P, class A2>
+ friend class ::boost::unordered::unordered_set;
+ template <class T, class H, class P, class A2>
+ friend class ::boost::unordered::unordered_multiset;
+
         node_ptr node_;
 
     public:

Modified: trunk/boost/unordered/detail/unique.hpp
==============================================================================
--- trunk/boost/unordered/detail/unique.hpp (original)
+++ trunk/boost/unordered/detail/unique.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,6 +1,6 @@
 
 // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
-// Copyright (C) 2005-2010 Daniel James
+// Copyright (C) 2005-2011 Daniel James
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 

Modified: trunk/boost/unordered/detail/util.hpp
==============================================================================
--- trunk/boost/unordered/detail/util.hpp (original)
+++ trunk/boost/unordered/detail/util.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,6 +1,6 @@
 
 // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
-// Copyright (C) 2005-2009 Daniel James
+// Copyright (C) 2005-2011 Daniel James
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 

Modified: trunk/boost/unordered/unordered_map.hpp
==============================================================================
--- trunk/boost/unordered/unordered_map.hpp (original)
+++ trunk/boost/unordered/unordered_map.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,6 +1,6 @@
 
 // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
-// Copyright (C) 2005-2009 Daniel James.
+// Copyright (C) 2005-2011 Daniel James.
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
@@ -38,6 +38,8 @@
 
 namespace boost
 {
+namespace unordered
+{
     template <class K, class T, class H, class P, class A>
     class unordered_map
     {
@@ -93,12 +95,6 @@
 
         table table_;
         
- BOOST_DEDUCED_TYPENAME types::node_ptr const&
- get(const_iterator const& it)
- {
- return ::boost::unordered::detail::iterator_access::get(it);
- }
-
     public:
 
         // construct/destroy/copy
@@ -425,12 +421,6 @@
 
         table table_;
         
- BOOST_DEDUCED_TYPENAME types::node_ptr const&
- get(const_iterator const& it)
- {
- return ::boost::unordered::detail::iterator_access::get(it);
- }
-
     public:
 
         // construct/destroy/copy
@@ -957,7 +947,7 @@
     BOOST_DEDUCED_TYPENAME unordered_map<K,T,H,P,A>::iterator
         unordered_map<K,T,H,P,A>::erase(const_iterator position)
     {
- return iterator(table_.erase(get(position)));
+ return iterator(table_.erase(position.node_));
     }
 
     template <class K, class T, class H, class P, class A>
@@ -972,7 +962,7 @@
         unordered_map<K,T,H,P,A>::erase(
             const_iterator first, const_iterator last)
     {
- return iterator(table_.erase_range(get(first), get(last)));
+ return iterator(table_.erase_range(first.node_, last.node_));
     }
 
     template <class K, class T, class H, class P, class A>
@@ -1411,7 +1401,7 @@
     BOOST_DEDUCED_TYPENAME unordered_multimap<K,T,H,P,A>::iterator
         unordered_multimap<K,T,H,P,A>::erase(const_iterator position)
     {
- return iterator(table_.erase(get(position)));
+ return iterator(table_.erase(position.node_));
     }
 
     template <class K, class T, class H, class P, class A>
@@ -1426,7 +1416,7 @@
         unordered_multimap<K,T,H,P,A>::erase(
             const_iterator first, const_iterator last)
     {
- return iterator(table_.erase_range(get(first), get(last)));
+ return iterator(table_.erase_range(first.node_, last.node_));
     }
 
     template <class K, class T, class H, class P, class A>
@@ -1584,7 +1574,7 @@
         m1.swap(m2);
     }
 
-
+} // namespace unordered
 } // namespace boost
 
 #if defined(BOOST_MSVC)

Modified: trunk/boost/unordered/unordered_map_fwd.hpp
==============================================================================
--- trunk/boost/unordered/unordered_map_fwd.hpp (original)
+++ trunk/boost/unordered/unordered_map_fwd.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,5 +1,5 @@
 
-// Copyright (C) 2008-2009 Daniel James.
+// Copyright (C) 2008-2011 Daniel James.
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
@@ -10,44 +10,12 @@
 # pragma once
 #endif
 
-#include <boost/config.hpp>
-#include <memory>
-#include <functional>
-#include <boost/functional/hash_fwd.hpp>
+#include <boost/unordered/detail/fwd.hpp>
 
 namespace boost
 {
- template <class K,
- class T,
- class H = hash<K>,
- class P = std::equal_to<K>,
- class A = std::allocator<std::pair<const K, T> > >
- class unordered_map;
- template <class K, class T, class H, class P, class A>
- inline bool operator==(unordered_map<K, T, H, P, A> const&,
- unordered_map<K, T, H, P, A> const&);
- template <class K, class T, class H, class P, class A>
- inline bool operator!=(unordered_map<K, T, H, P, A> const&,
- unordered_map<K, T, H, P, A> const&);
- template <class K, class T, class H, class P, class A>
- inline void swap(unordered_map<K, T, H, P, A>&,
- unordered_map<K, T, H, P, A>&);
-
- template <class K,
- class T,
- class H = hash<K>,
- class P = std::equal_to<K>,
- class A = std::allocator<std::pair<const K, T> > >
- class unordered_multimap;
- template <class K, class T, class H, class P, class A>
- inline bool operator==(unordered_multimap<K, T, H, P, A> const&,
- unordered_multimap<K, T, H, P, A> const&);
- template <class K, class T, class H, class P, class A>
- inline bool operator!=(unordered_multimap<K, T, H, P, A> const&,
- unordered_multimap<K, T, H, P, A> const&);
- template <class K, class T, class H, class P, class A>
- inline void swap(unordered_multimap<K, T, H, P, A>&,
- unordered_multimap<K, T, H, P, A>&);
+ using ::boost::unordered::unordered_map;
+ using ::boost::unordered::unordered_multimap;
 }
 
 #endif

Modified: trunk/boost/unordered/unordered_set.hpp
==============================================================================
--- trunk/boost/unordered/unordered_set.hpp (original)
+++ trunk/boost/unordered/unordered_set.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,6 +1,6 @@
 
 // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
-// Copyright (C) 2005-2009 Daniel James.
+// Copyright (C) 2005-2011 Daniel James.
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
@@ -38,6 +38,8 @@
 
 namespace boost
 {
+namespace unordered
+{
     template <class T, class H, class P, class A>
     class unordered_set
     {
@@ -90,12 +92,6 @@
 #endif
 
         table table_;
-
- BOOST_DEDUCED_TYPENAME types::node_ptr const&
- get(const_iterator const& it)
- {
- return ::boost::unordered::detail::iterator_access::get(it);
- }
 
     public:
 
@@ -402,12 +398,6 @@
 #endif
 
         table table_;
-
- BOOST_DEDUCED_TYPENAME types::node_ptr const&
- get(const_iterator const& it)
- {
- return ::boost::unordered::detail::iterator_access::get(it);
- }
 
     public:
 
@@ -919,7 +909,7 @@
     BOOST_DEDUCED_TYPENAME unordered_set<T,H,P,A>::iterator
         unordered_set<T,H,P,A>::erase(const_iterator position)
     {
- return iterator(table_.erase(get(position)));
+ return iterator(table_.erase(position.node_));
     }
 
     template <class T, class H, class P, class A>
@@ -933,7 +923,7 @@
     BOOST_DEDUCED_TYPENAME unordered_set<T,H,P,A>::iterator
         unordered_set<T,H,P,A>::erase(const_iterator first, const_iterator last)
     {
- return iterator(table_.erase_range(get(first), get(last)));
+ return iterator(table_.erase_range(first.node_, last.node_));
     }
 
     template <class T, class H, class P, class A>
@@ -1318,7 +1308,7 @@
     BOOST_DEDUCED_TYPENAME unordered_multiset<T,H,P,A>::iterator
         unordered_multiset<T,H,P,A>::erase(const_iterator position)
     {
- return iterator(table_.erase(get(position)));
+ return iterator(table_.erase(position.node_));
     }
 
     template <class T, class H, class P, class A>
@@ -1332,7 +1322,7 @@
     BOOST_DEDUCED_TYPENAME unordered_multiset<T,H,P,A>::iterator
         unordered_multiset<T,H,P,A>::erase(const_iterator first, const_iterator last)
     {
- return iterator(table_.erase_range(get(first), get(last)));
+ return iterator(table_.erase_range(first.node_, last.node_));
     }
 
     template <class T, class H, class P, class A>
@@ -1461,6 +1451,7 @@
         m1.swap(m2);
     }
 
+} // namespace unordered
 } // namespace boost
 
 #if defined(BOOST_MSVC)

Modified: trunk/boost/unordered/unordered_set_fwd.hpp
==============================================================================
--- trunk/boost/unordered/unordered_set_fwd.hpp (original)
+++ trunk/boost/unordered/unordered_set_fwd.hpp 2011-06-04 12:17:07 EDT (Sat, 04 Jun 2011)
@@ -1,5 +1,5 @@
 
-// Copyright (C) 2008-2009 Daniel James.
+// Copyright (C) 2008-2011 Daniel James.
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
@@ -10,42 +10,12 @@
 # pragma once
 #endif
 
-#include <boost/config.hpp>
-#include <memory>
-#include <functional>
-#include <boost/functional/hash_fwd.hpp>
+#include <boost/unordered/detail/fwd.hpp>
 
 namespace boost
 {
- template <class T,
- class H = hash<T>,
- class P = std::equal_to<T>,
- class A = std::allocator<T> >
- class unordered_set;
- template <class T, class H, class P, class A>
- inline bool operator==(unordered_set<T, H, P, A> const&,
- unordered_set<T, H, P, A> const&);
- template <class T, class H, class P, class A>
- inline bool operator!=(unordered_set<T, H, P, A> const&,
- unordered_set<T, H, P, A> const&);
- template <class T, class H, class P, class A>
- inline void swap(unordered_set<T, H, P, A> &m1,
- unordered_set<T, H, P, A> &m2);
-
- template <class T,
- class H = hash<T>,
- class P = std::equal_to<T>,
- class A = std::allocator<T> >
- class unordered_multiset;
- template <class T, class H, class P, class A>
- inline bool operator==(unordered_multiset<T, H, P, A> const&,
- unordered_multiset<T, H, P, A> const&);
- template <class T, class H, class P, class A>
- inline bool operator!=(unordered_multiset<T, H, P, A> const&,
- unordered_multiset<T, H, P, A> const&);
- template <class T, class H, class P, class A>
- inline void swap(unordered_multiset<T, H, P, A> &m1,
- unordered_multiset<T, H, P, A> &m2);
+ using ::boost::unordered::unordered_set;
+ using ::boost::unordered::unordered_multiset;
 }
 
 #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk