forked from boostorg/unordered
Remove the emulation of single argument C++0x std::pair constructor.
[SVN r55132]
This commit is contained in:
@ -206,55 +206,6 @@ namespace boost {
|
|||||||
new(node_->address()) value_type(std::forward<Args>(args)...);
|
new(node_->address()) value_type(std::forward<Args>(args)...);
|
||||||
value_constructed_ = true;
|
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
|
#else
|
||||||
|
|
||||||
#define BOOST_UNORDERED_CONSTRUCT_IMPL(z, n, _) \
|
#define BOOST_UNORDERED_CONSTRUCT_IMPL(z, n, _) \
|
||||||
@ -316,15 +267,16 @@ namespace boost {
|
|||||||
new(node_->address()) value_type(arg0);
|
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
|
#undef BOOST_UNORDERED_CONSTRUCT_IMPL
|
||||||
|
|
||||||
#endif
|
#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
|
node_ptr get() const
|
||||||
{
|
{
|
||||||
@ -1922,7 +1874,7 @@ namespace boost {
|
|||||||
// Create the node before rehashing in case it throws an
|
// Create the node before rehashing in case it throws an
|
||||||
// exception (need strong safety in such a case).
|
// exception (need strong safety in such a case).
|
||||||
node_constructor a(data_.allocators_);
|
node_constructor a(data_.allocators_);
|
||||||
a.construct(k);
|
a.construct_pair(k, (mapped_type*) 0);
|
||||||
|
|
||||||
// reserve has basic exception safety if the hash function
|
// reserve has basic exception safety if the hash function
|
||||||
// throws, strong otherwise.
|
// throws, strong otherwise.
|
||||||
|
@ -6,19 +6,34 @@
|
|||||||
#if !defined(BOOST_UNORDERED_TEST_HELPERS_INPUT_ITERATOR_HEADER)
|
#if !defined(BOOST_UNORDERED_TEST_HELPERS_INPUT_ITERATOR_HEADER)
|
||||||
#define BOOST_UNORDERED_TEST_HELPERS_INPUT_ITERATOR_HEADER
|
#define BOOST_UNORDERED_TEST_HELPERS_INPUT_ITERATOR_HEADER
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
#include <boost/iterator_adaptors.hpp>
|
#include <boost/iterator_adaptors.hpp>
|
||||||
|
|
||||||
namespace test
|
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>
|
template <class Iterator>
|
||||||
struct input_iterator_adaptor
|
struct input_iterator_adaptor
|
||||||
: boost::iterator_adaptor<
|
: boost::iterator_adaptor<
|
||||||
input_iterator_adaptor<Iterator>, Iterator,
|
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<
|
typedef boost::iterator_adaptor<
|
||||||
input_iterator_adaptor<Iterator>, Iterator,
|
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())
|
explicit input_iterator_adaptor(Iterator it = Iterator())
|
||||||
: base(it) {}
|
: base(it) {}
|
||||||
|
Reference in New Issue
Block a user