forked from boostorg/unordered
Merge to release several changes for 1.48.
[SVN r75293]
This commit is contained in:
@ -36,9 +36,7 @@ A full implementation of `allocator_traits` requires sophisticated
|
|||||||
member function detection so that the fallback is used whenever the
|
member function detection so that the fallback is used whenever the
|
||||||
member function call is not well formed.
|
member function call is not well formed.
|
||||||
This requires support for SFINAE expressions, which are available on
|
This requires support for SFINAE expressions, which are available on
|
||||||
GCC from version 4.4 and Clang. They aren't supported by
|
GCC from version 4.4 and Clang.
|
||||||
Visual C++ 2008/2010, but with a bit of hacking it's possible to support
|
|
||||||
certain use cases.
|
|
||||||
|
|
||||||
On other compilers, there's just a test to see if the allocator has
|
On other compilers, there's just a test to see if the allocator has
|
||||||
a member, but no check that it can be called. So rather than using a
|
a member, but no check that it can be called. So rather than using a
|
||||||
|
@ -108,7 +108,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
convert_from_anything(T const&);
|
convert_from_anything(T const&);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(BOOST_NO_SFINAE_EXPR) || BOOST_WORKAROUND(BOOST_MSVC, >= 1500)
|
#if !defined(BOOST_NO_SFINAE_EXPR)
|
||||||
|
|
||||||
# define BOOST_UNORDERED_HAVE_CALL_DETECTION 1
|
# define BOOST_UNORDERED_HAVE_CALL_DETECTION 1
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
{ \
|
{ \
|
||||||
BOOST_PP_REPEAT_##z(n, BOOST_UNORDERED_EARGS_MEMBER, _) \
|
BOOST_PP_REPEAT_##z(n, BOOST_UNORDERED_EARGS_MEMBER, _) \
|
||||||
BOOST_PP_CAT(emplace_args, n) ( \
|
BOOST_PP_CAT(emplace_args, n) ( \
|
||||||
BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, B, a) \
|
BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, Arg, a) \
|
||||||
) : BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_EARGS_INIT, _) \
|
) : BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_EARGS_INIT, _) \
|
||||||
{} \
|
{} \
|
||||||
\
|
\
|
||||||
@ -112,8 +112,8 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||||
|
|
||||||
#define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \
|
#define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \
|
||||||
typedef BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(B, n); \
|
typedef BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(Arg, n); \
|
||||||
BOOST_PP_CAT(B, n) BOOST_PP_CAT(a, n);
|
BOOST_PP_CAT(Arg, n) BOOST_PP_CAT(a, n);
|
||||||
|
|
||||||
#define BOOST_UNORDERED_EARGS_INIT(z, n, _) \
|
#define BOOST_UNORDERED_EARGS_INIT(z, n, _) \
|
||||||
BOOST_PP_CAT(a, n)( \
|
BOOST_PP_CAT(a, n)( \
|
||||||
@ -123,8 +123,8 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
#define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \
|
#define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \
|
||||||
typedef typename boost::add_lvalue_reference<BOOST_PP_CAT(A, n)>::type \
|
typedef typename boost::add_lvalue_reference<BOOST_PP_CAT(A, n)>::type \
|
||||||
BOOST_PP_CAT(B, n); \
|
BOOST_PP_CAT(Arg, n); \
|
||||||
BOOST_PP_CAT(B, n) BOOST_PP_CAT(a, n);
|
BOOST_PP_CAT(Arg, n) BOOST_PP_CAT(a, n);
|
||||||
|
|
||||||
#define BOOST_UNORDERED_EARGS_INIT(z, n, _) \
|
#define BOOST_UNORDERED_EARGS_INIT(z, n, _) \
|
||||||
BOOST_PP_CAT(a, n)(BOOST_PP_CAT(a, n))
|
BOOST_PP_CAT(a, n)(BOOST_PP_CAT(a, n))
|
||||||
|
@ -178,6 +178,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
typedef typename table::key_type key_type;
|
typedef typename table::key_type key_type;
|
||||||
typedef typename table::node_constructor node_constructor;
|
typedef typename table::node_constructor node_constructor;
|
||||||
typedef typename table::extractor extractor;
|
typedef typename table::extractor extractor;
|
||||||
|
typedef typename table::iterator iterator;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
@ -255,13 +256,15 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<node_pointer, node_pointer>
|
std::pair<iterator, iterator>
|
||||||
equal_range(key_type const& k) const
|
equal_range(key_type const& k) const
|
||||||
{
|
{
|
||||||
node_pointer n = this->find_node(k);
|
node_pointer n = this->find_node(k);
|
||||||
return std::make_pair(n,
|
return std::make_pair(
|
||||||
n ? static_cast<node_pointer>(
|
iterator(n), iterator(n ?
|
||||||
static_cast<node_pointer>(n->group_prev_)->next_) : n);
|
static_cast<node_pointer>(
|
||||||
|
static_cast<node_pointer>(n->group_prev_)->next_) :
|
||||||
|
n));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Equality
|
// Equality
|
||||||
|
@ -174,8 +174,9 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
typedef typename table::key_type key_type;
|
typedef typename table::key_type key_type;
|
||||||
typedef typename table::node_constructor node_constructor;
|
typedef typename table::node_constructor node_constructor;
|
||||||
typedef typename table::extractor extractor;
|
typedef typename table::extractor extractor;
|
||||||
|
typedef typename table::iterator iterator;
|
||||||
|
|
||||||
typedef std::pair<node_pointer, bool> emplace_return;
|
typedef std::pair<iterator, bool> emplace_return;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
@ -253,12 +254,12 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
std::out_of_range("Unable to find key in unordered_map."));
|
std::out_of_range("Unable to find key in unordered_map."));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<node_pointer, node_pointer>
|
std::pair<iterator, iterator>
|
||||||
equal_range(key_type const& k) const
|
equal_range(key_type const& k) const
|
||||||
{
|
{
|
||||||
node_pointer n = this->find_node(k);
|
node_pointer n = this->find_node(k);
|
||||||
return std::make_pair(n,
|
return std::make_pair(iterator(n),
|
||||||
n ? static_cast<node_pointer>(n->next_) : n);
|
iterator(n ? static_cast<node_pointer>(n->next_) : n));
|
||||||
}
|
}
|
||||||
|
|
||||||
// equals
|
// equals
|
||||||
@ -354,7 +355,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
boost::unordered::detail::please_ignore_this_overload> const&)
|
boost::unordered::detail::please_ignore_this_overload> const&)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(false);
|
BOOST_ASSERT(false);
|
||||||
return emplace_return(this->begin(), false);
|
return emplace_return(iterator(this->begin()), false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -389,7 +390,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
std::size_t hash = this->hash_function()(k);
|
std::size_t hash = this->hash_function()(k);
|
||||||
node_pointer pos = this->find_node(hash, k);
|
node_pointer pos = this->find_node(hash, k);
|
||||||
|
|
||||||
if (pos) return emplace_return(pos, false);
|
if (pos) return emplace_return(iterator(pos), false);
|
||||||
|
|
||||||
// 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).
|
||||||
@ -400,7 +401,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
// reserve has basic exception safety if the hash function
|
// reserve has basic exception safety if the hash function
|
||||||
// throws, strong otherwise.
|
// throws, strong otherwise.
|
||||||
this->reserve_for_insert(this->size_ + 1);
|
this->reserve_for_insert(this->size_ + 1);
|
||||||
return emplace_return(this->add_node(a, hash), true);
|
return emplace_return(iterator(this->add_node(a, hash)), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
emplace_return emplace_impl_with_node(node_constructor& a)
|
emplace_return emplace_impl_with_node(node_constructor& a)
|
||||||
@ -409,12 +410,12 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
std::size_t hash = this->hash_function()(k);
|
std::size_t hash = this->hash_function()(k);
|
||||||
node_pointer pos = this->find_node(hash, k);
|
node_pointer pos = this->find_node(hash, k);
|
||||||
|
|
||||||
if (pos) return emplace_return(pos, false);
|
if (pos) return emplace_return(iterator(pos), false);
|
||||||
|
|
||||||
// reserve has basic exception safety if the hash function
|
// reserve has basic exception safety if the hash function
|
||||||
// throws, strong otherwise.
|
// throws, strong otherwise.
|
||||||
this->reserve_for_insert(this->size_ + 1);
|
this->reserve_for_insert(this->size_ + 1);
|
||||||
return emplace_return(this->add_node(a, hash), true);
|
return emplace_return(iterator(this->add_node(a, hash)), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
|
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
|
||||||
|
Reference in New Issue
Block a user