Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55132 - in trunk: boost/unordered/detail libs/unordered/test/helpers
From: daniel_james_at_[hidden]
Date: 2009-07-23 13:54:00


Author: danieljames
Date: 2009-07-23 13:53:59 EDT (Thu, 23 Jul 2009)
New Revision: 55132
URL: http://svn.boost.org/trac/boost/changeset/55132

Log:
Remove the emulation of single argument C++0x std::pair constructor.
Text files modified:
   trunk/boost/unordered/detail/hash_table_impl.hpp | 64 +++++-----------------------------------
   trunk/libs/unordered/test/helpers/input_iterator.hpp | 19 ++++++++++-
   2 files changed, 25 insertions(+), 58 deletions(-)

Modified: trunk/boost/unordered/detail/hash_table_impl.hpp
==============================================================================
--- trunk/boost/unordered/detail/hash_table_impl.hpp (original)
+++ trunk/boost/unordered/detail/hash_table_impl.hpp 2009-07-23 13:53:59 EDT (Thu, 23 Jul 2009)
@@ -206,55 +206,6 @@
                     new(node_->address()) value_type(std::forward<Args>(args)...);
                     value_constructed_ = true;
                 }
-
-#if defined(__GLIBCPP__) || defined(__GLIBCXX__)
- // The GCC C++0x standard library implementation does not have
- // a single argument pair constructor, so this works around that.
-
- template <typename Arg>
- void construct(Arg&& arg)
- {
- construct_preamble();
- construct_impl(std::forward<Arg>(arg),
- (value_type const*) 0,
- (typename boost::remove_reference<Arg>::type const*) 0);
- value_constructed_ = true;
- }
-
- template <
- typename Arg,
- typename ValueType,
- typename Type>
- void construct_impl(Arg&& arg, ValueType const*, Type const*)
- {
- new(node_->address()) value_type(std::forward<Arg>(arg));
- }
-
- template <
- typename Arg,
- typename ValueFirst, typename ValueSecond,
- typename TypeFirst, typename TypeSecond>
- void construct_impl(
- Arg&& arg,
- std::pair<ValueFirst, ValueSecond> const*,
- std::pair<TypeFirst, TypeSecond> const*)
- {
- new(node_->address()) value_type(std::forward<Arg>(arg));
- }
-
- template <
- typename Arg,
- typename ValueFirst, typename ValueSecond,
- typename Type>
- void construct_impl(
- Arg&& arg,
- std::pair<ValueFirst, ValueSecond> const*,
- Type const*)
- {
- new(node_->address()) value_type(std::forward<Arg>(arg), ValueSecond());
- }
-#endif
-
 #else
 
 #define BOOST_UNORDERED_CONSTRUCT_IMPL(z, n, _) \
@@ -316,15 +267,16 @@
                     new(node_->address()) value_type(arg0);
                 }
 
- template <typename First, typename Second, typename Key>
- void construct_impl(std::pair<First, Second>*, Key const& k)
- {
- new(node_->address()) value_type(First(k), Second());
- }
-
 #undef BOOST_UNORDERED_CONSTRUCT_IMPL
 
 #endif
+ template <typename K, typename M>
+ void construct_pair(K const& k, M*)
+ {
+ construct_preamble();
+ new(node_->address()) value_type(k, M());
+ value_constructed_ = true;
+ }
 
                 node_ptr get() const
                 {
@@ -1922,7 +1874,7 @@
                     // Create the node before rehashing in case it throws an
                     // exception (need strong safety in such a case).
                     node_constructor a(data_.allocators_);
- a.construct(k);
+ a.construct_pair(k, (mapped_type*) 0);
 
                     // reserve has basic exception safety if the hash function
                     // throws, strong otherwise.

Modified: trunk/libs/unordered/test/helpers/input_iterator.hpp
==============================================================================
--- trunk/libs/unordered/test/helpers/input_iterator.hpp (original)
+++ trunk/libs/unordered/test/helpers/input_iterator.hpp 2009-07-23 13:53:59 EDT (Thu, 23 Jul 2009)
@@ -6,19 +6,34 @@
 #if !defined(BOOST_UNORDERED_TEST_HELPERS_INPUT_ITERATOR_HEADER)
 #define BOOST_UNORDERED_TEST_HELPERS_INPUT_ITERATOR_HEADER
 
+#include <boost/config.hpp>
 #include <boost/iterator_adaptors.hpp>
 
 namespace test
 {
     template <class Iterator>
+ struct proxy
+ {
+ typedef BOOST_DEDUCED_TYPENAME Iterator::value_type value_type;
+
+ proxy(value_type const& v) : v_(v) {}
+ proxy(proxy const& x) : v_(x.v_) {}
+ operator value_type const&() const { return v_; }
+
+ value_type v_;
+ };
+
+ template <class Iterator>
     struct input_iterator_adaptor
         : boost::iterator_adaptor<
             input_iterator_adaptor<Iterator>, Iterator,
- boost::use_default, std::input_iterator_tag>
+ boost::use_default, std::input_iterator_tag,
+ proxy<Iterator> >
     {
         typedef boost::iterator_adaptor<
             input_iterator_adaptor<Iterator>, Iterator,
- boost::use_default, std::input_iterator_tag> base;
+ boost::use_default, std::input_iterator_tag,
+ proxy<Iterator> > base;
 
         explicit input_iterator_adaptor(Iterator it = Iterator())
             : base(it) {}


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