Move everything from table_unique/table_equiv into table

This commit is contained in:
Daniel James
2017-04-24 09:46:05 +01:00
parent e518120104
commit b070bb5e49
6 changed files with 663 additions and 757 deletions

File diff suppressed because it is too large Load Diff

View File

@ -29,8 +29,12 @@ template <typename A, typename K, typename M, typename H, typename P> struct map
typedef typename pick::link_pointer link_pointer;
typedef typename pick::node_algo node_algo;
typedef boost::unordered::detail::table_unique<types> table;
typedef boost::unordered::detail::table<types> table;
typedef boost::unordered::detail::map_extractor<value_type> extractor;
enum
{
is_unique = true
};
typedef typename boost::unordered::detail::pick_policy<K>::type policy;
@ -71,8 +75,12 @@ struct multimap
typedef typename pick::link_pointer link_pointer;
typedef typename pick::node_algo node_algo;
typedef boost::unordered::detail::table_equiv<types> table;
typedef boost::unordered::detail::table<types> table;
typedef boost::unordered::detail::map_extractor<value_type> extractor;
enum
{
is_unique = false
};
typedef typename boost::unordered::detail::pick_policy<K>::type policy;

View File

@ -29,8 +29,12 @@ template <typename A, typename T, typename H, typename P> struct set
typedef typename pick::link_pointer link_pointer;
typedef typename pick::node_algo node_algo;
typedef boost::unordered::detail::table_unique<types> table;
typedef boost::unordered::detail::table<types> table;
typedef boost::unordered::detail::set_extractor<value_type> extractor;
enum
{
is_unique = true
};
typedef typename boost::unordered::detail::pick_policy<T>::type policy;
@ -70,8 +74,12 @@ template <typename A, typename T, typename H, typename P> struct multiset
typedef typename pick::link_pointer link_pointer;
typedef typename pick::node_algo node_algo;
typedef boost::unordered::detail::table_equiv<types> table;
typedef boost::unordered::detail::table<types> table;
typedef boost::unordered::detail::set_extractor<value_type> extractor;
enum
{
is_unique = false
};
typedef typename boost::unordered::detail::pick_policy<T>::type policy;

View File

@ -1378,7 +1378,9 @@ unordered_map<K, T, H, P, A>::unordered_map(InputIt f, InputIt l, size_type n,
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::unordered_map(unordered_map const& other)
: table_(other.table_)
: table_(other.table_,
unordered_map::value_allocator_traits::
select_on_container_copy_construction(other.get_allocator()))
{
if (other.table_.size_) {
table_.copy_buckets_unique(other.table_);
@ -1866,7 +1868,9 @@ unordered_multimap<K, T, H, P, A>::unordered_multimap(InputIt f, InputIt l,
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
unordered_multimap const& other)
: table_(other.table_)
: table_(other.table_,
unordered_multimap::value_allocator_traits::
select_on_container_copy_construction(other.get_allocator()))
{
if (other.table_.size_) {
table_.copy_buckets_equiv(other.table_);
@ -1897,7 +1901,7 @@ unordered_multimap<K, T, H, P, A>::unordered_multimap(
{
if (table_.node_alloc() == other.table_.node_alloc()) {
table_.move_buckets_from(other.table_);
} else if (other.table_.size()) {
} else if (other.table_.size_) {
// TODO: Could pick new bucket size?
table_.move_buckets_equiv(other.table_);
}
@ -2294,10 +2298,7 @@ template <typename N, class K, class T, class A> class node_handle_map
{
BOOST_MOVABLE_BUT_NOT_COPYABLE(node_handle_map)
template <typename Types>
friend struct ::boost::unordered::detail::table_unique;
template <typename Types>
friend struct ::boost::unordered::detail::table_equiv;
template <typename Types> friend struct ::boost::unordered::detail::table;
template <class K2, class T2, class H2, class P2, class A2>
friend class boost::unordered::unordered_map;
template <class K2, class T2, class H2, class P2, class A2>

View File

@ -1077,7 +1077,9 @@ unordered_set<T, H, P, A>::unordered_set(InputIt f, InputIt l, size_type n,
template <class T, class H, class P, class A>
unordered_set<T, H, P, A>::unordered_set(unordered_set const& other)
: table_(other.table_)
: table_(other.table_,
unordered_set::value_allocator_traits::
select_on_container_copy_construction(other.get_allocator()))
{
if (other.table_.size_) {
table_.copy_buckets_unique(other.table_);
@ -1480,7 +1482,9 @@ unordered_multiset<T, H, P, A>::unordered_multiset(InputIt f, InputIt l,
template <class T, class H, class P, class A>
unordered_multiset<T, H, P, A>::unordered_multiset(
unordered_multiset const& other)
: table_(other.table_)
: table_(other.table_,
unordered_multiset::value_allocator_traits::
select_on_container_copy_construction(other.get_allocator()))
{
if (other.table_.size_) {
table_.copy_buckets_equiv(other.table_);
@ -1511,7 +1515,7 @@ unordered_multiset<T, H, P, A>::unordered_multiset(
{
if (table_.node_alloc() == other.table_.node_alloc()) {
table_.move_buckets_from(other.table_);
} else if (other.table_.size()) {
} else if (other.table_.size_) {
// TODO: Could pick new bucket size?
table_.move_buckets_equiv(other.table_);
}
@ -1869,10 +1873,7 @@ template <typename N, typename T, typename A> class node_handle_set
{
BOOST_MOVABLE_BUT_NOT_COPYABLE(node_handle_set)
template <typename Types>
friend struct ::boost::unordered::detail::table_unique;
template <typename Types>
friend struct ::boost::unordered::detail::table_equiv;
template <typename Types> friend struct ::boost::unordered::detail::table;
template <class T2, class H2, class P2, class A2>
friend class unordered_set;
template <class T2, class H2, class P2, class A2>

View File

@ -65,6 +65,11 @@ template <typename T> struct allocator : std::allocator<T>
allocator(const allocator<T2>& other) : std::allocator<T>(other)
{
}
template <typename T2>
allocator(const std::allocator<T2>& other) : std::allocator<T>(other)
{
}
};
// Declare some members of a structs.