mirror of
https://github.com/boostorg/unordered.git
synced 2025-11-07 19:21:42 +01:00
Merge unordered changes, including fixes for Boost.TR1.
Merged revisions 55099-55100,55132,55138,55184-55185 via svnmerge from https://svn.boost.org/svn/boost/trunk ........ r55099 | danieljames | 2009-07-22 23:37:52 +0100 (Wed, 22 Jul 2009) | 1 line Fix the insert tests when there is a small number of buckets. ........ r55100 | danieljames | 2009-07-22 23:38:08 +0100 (Wed, 22 Jul 2009) | 1 line Adjust the unordered defaults so that emplace takes more parameters and less buckets are created by default. ........ r55132 | danieljames | 2009-07-23 18:53:59 +0100 (Thu, 23 Jul 2009) | 1 line Remove the emulation of single argument C++0x std::pair constructor. ........ r55138 | danieljames | 2009-07-23 23:17:20 +0100 (Thu, 23 Jul 2009) | 1 line Try to work around an odd Visual C++ 8 bug. ........ r55184 | danieljames | 2009-07-26 19:59:33 +0100 (Sun, 26 Jul 2009) | 1 line Some extra changelog notes. ........ r55185 | danieljames | 2009-07-26 20:00:40 +0100 (Sun, 26 Jul 2009) | 1 line Update the reference documentation to mention that emplace is now emulated. ........ [SVN r55189]
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
#include <boost/unordered/detail/config.hpp>
|
||||
|
||||
#if !defined(BOOST_UNORDERED_EMPLACE_LIMIT)
|
||||
#define BOOST_UNORDERED_EMPLACE_LIMIT 5
|
||||
#define BOOST_UNORDERED_EMPLACE_LIMIT 10
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
@@ -85,7 +85,7 @@ namespace boost {
|
||||
namespace unordered_detail {
|
||||
template <class T> struct type_wrapper {};
|
||||
|
||||
static const std::size_t default_initial_bucket_count = 50;
|
||||
static const std::size_t default_initial_bucket_count = 11;
|
||||
static const float minimum_max_load_factor = 1e-3f;
|
||||
|
||||
inline std::size_t double_to_size_t(double f)
|
||||
|
||||
@@ -206,55 +206,6 @@ namespace boost {
|
||||
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 @@ namespace boost {
|
||||
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 @@ namespace boost {
|
||||
// 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.
|
||||
|
||||
@@ -105,8 +105,17 @@ namespace boost
|
||||
unordered_map(InputIterator f, InputIterator l,
|
||||
size_type n,
|
||||
const hasher &hf = hasher(),
|
||||
const key_equal &eql = key_equal(),
|
||||
const allocator_type &a = allocator_type())
|
||||
const key_equal &eql = key_equal())
|
||||
: base(f, l, n, hf, eql, allocator_type())
|
||||
{
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
unordered_map(InputIterator f, InputIterator l,
|
||||
size_type n,
|
||||
const hasher &hf,
|
||||
const key_equal &eql,
|
||||
const allocator_type &a)
|
||||
: base(f, l, n, hf, eql, a)
|
||||
{
|
||||
}
|
||||
@@ -560,8 +569,17 @@ namespace boost
|
||||
unordered_multimap(InputIterator f, InputIterator l,
|
||||
size_type n,
|
||||
const hasher &hf = hasher(),
|
||||
const key_equal &eql = key_equal(),
|
||||
const allocator_type &a = allocator_type())
|
||||
const key_equal &eql = key_equal())
|
||||
: base(f, l, n, hf, eql, allocator_type())
|
||||
{
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
unordered_multimap(InputIterator f, InputIterator l,
|
||||
size_type n,
|
||||
const hasher &hf,
|
||||
const key_equal &eql,
|
||||
const allocator_type &a)
|
||||
: base(f, l, n, hf, eql, a)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -103,8 +103,16 @@ namespace boost
|
||||
template <class InputIterator>
|
||||
unordered_set(InputIterator f, InputIterator l, size_type n,
|
||||
const hasher &hf = hasher(),
|
||||
const key_equal &eql = key_equal(),
|
||||
const allocator_type &a = allocator_type())
|
||||
const key_equal &eql = key_equal())
|
||||
: base(f, l, n, hf, eql, allocator_type())
|
||||
{
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
unordered_set(InputIterator f, InputIterator l, size_type n,
|
||||
const hasher &hf,
|
||||
const key_equal &eql,
|
||||
const allocator_type &a)
|
||||
: base(f, l, n, hf, eql, a)
|
||||
{
|
||||
}
|
||||
@@ -530,8 +538,16 @@ namespace boost
|
||||
template <class InputIterator>
|
||||
unordered_multiset(InputIterator f, InputIterator l, size_type n,
|
||||
const hasher &hf = hasher(),
|
||||
const key_equal &eql = key_equal(),
|
||||
const allocator_type &a = allocator_type())
|
||||
const key_equal &eql = key_equal())
|
||||
: base(f, l, n, hf, eql, allocator_type())
|
||||
{
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
unordered_multiset(InputIterator f, InputIterator l, size_type n,
|
||||
const hasher &hf,
|
||||
const key_equal &eql,
|
||||
const allocator_type &a)
|
||||
: base(f, l, n, hf, eql, a)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user