forked from boostorg/unordered
		
	Allocator aware constructors
This commit is contained in:
		@@ -123,6 +123,8 @@ void container_test(X& r, T const&)
 | 
			
		||||
    sink(X(a));
 | 
			
		||||
    X u2(a);
 | 
			
		||||
    X u3 = a;
 | 
			
		||||
    X u4(rvalue(a_const));
 | 
			
		||||
    X u5 = rvalue(a_const);
 | 
			
		||||
 | 
			
		||||
    a.swap(b);
 | 
			
		||||
    boost::swap(a, b);
 | 
			
		||||
@@ -132,12 +134,25 @@ void container_test(X& r, T const&)
 | 
			
		||||
 | 
			
		||||
    typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
 | 
			
		||||
    test::check_return_type<allocator_type>::equals(a_const.get_allocator());
 | 
			
		||||
 | 
			
		||||
    allocator_type m = a.get_allocator();
 | 
			
		||||
    sink(X(m));
 | 
			
		||||
    X c(m);
 | 
			
		||||
    sink(X(a_const, m));
 | 
			
		||||
    X c2(a_const, m);
 | 
			
		||||
    sink(X(rvalue(a_const), m));
 | 
			
		||||
    X c3(rvalue(a_const), m);
 | 
			
		||||
    
 | 
			
		||||
    // Avoid unused variable warnings:
 | 
			
		||||
 | 
			
		||||
    sink(u);
 | 
			
		||||
    sink(u2);
 | 
			
		||||
    sink(u3);
 | 
			
		||||
    sink(u4);
 | 
			
		||||
    sink(u5);
 | 
			
		||||
    sink(c);
 | 
			
		||||
    sink(c2);
 | 
			
		||||
    sink(c3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <class X>
 | 
			
		||||
@@ -369,6 +384,7 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
 | 
			
		||||
    typedef BOOST_DEDUCED_TYPENAME
 | 
			
		||||
        boost::iterator_reference<const_local_iterator>::type
 | 
			
		||||
        const_local_iterator_reference;
 | 
			
		||||
    typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
 | 
			
		||||
 | 
			
		||||
    BOOST_STATIC_ASSERT((boost::is_same<Key, key_type>::value));
 | 
			
		||||
    //boost::function_requires<boost::CopyConstructibleConcept<key_type> >();
 | 
			
		||||
@@ -401,8 +417,13 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
 | 
			
		||||
    BOOST_STATIC_ASSERT((boost::is_same<const_local_iterator_reference,
 | 
			
		||||
        const_iterator_reference>::value));
 | 
			
		||||
 | 
			
		||||
    X a;
 | 
			
		||||
    allocator_type m = a.get_allocator();
 | 
			
		||||
 | 
			
		||||
    // Constructors
 | 
			
		||||
 | 
			
		||||
    X(10, hf, eq);
 | 
			
		||||
    X a(10, hf, eq);
 | 
			
		||||
    X a1(10, hf, eq);
 | 
			
		||||
    X(10, hf);
 | 
			
		||||
    X a2(10, hf);
 | 
			
		||||
    X(10);
 | 
			
		||||
@@ -410,6 +431,15 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
 | 
			
		||||
    X();
 | 
			
		||||
    X a4;
 | 
			
		||||
 | 
			
		||||
    X(10, hf, eq, m);
 | 
			
		||||
    X a1a(10, hf, eq, m);
 | 
			
		||||
    X(10, hf, m);
 | 
			
		||||
    X a2a(10, hf, m);
 | 
			
		||||
    X(10, m);
 | 
			
		||||
    X a3a(10, m);
 | 
			
		||||
    sink(X(m));
 | 
			
		||||
    X a4a(m);
 | 
			
		||||
 | 
			
		||||
    test::check_return_type<size_type>::equals(a.erase(k));
 | 
			
		||||
 | 
			
		||||
    const_iterator q1 = a.cbegin(), q2 = a.cend();
 | 
			
		||||
@@ -452,9 +482,14 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
 | 
			
		||||
    // Avoid unused variable warnings:
 | 
			
		||||
 | 
			
		||||
    sink(a);
 | 
			
		||||
    sink(a1);
 | 
			
		||||
    sink(a2);
 | 
			
		||||
    sink(a3);
 | 
			
		||||
    sink(a4);
 | 
			
		||||
    sink(a1a);
 | 
			
		||||
    sink(a2a);
 | 
			
		||||
    sink(a3a);
 | 
			
		||||
    sink(a4a);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <class X, class Key, class T, class Hash, class Pred>
 | 
			
		||||
@@ -464,14 +499,17 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
 | 
			
		||||
 | 
			
		||||
    typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
 | 
			
		||||
    typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
 | 
			
		||||
    typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
 | 
			
		||||
 | 
			
		||||
    X a;
 | 
			
		||||
    allocator_type m = a.get_allocator();
 | 
			
		||||
 | 
			
		||||
    BOOST_DEDUCED_TYPENAME X::value_type* i = 0;
 | 
			
		||||
    BOOST_DEDUCED_TYPENAME X::value_type* j = 0;
 | 
			
		||||
 | 
			
		||||
    X(i, j, 10, hf, eq);
 | 
			
		||||
    // Constructors
 | 
			
		||||
 | 
			
		||||
    X(i, j, 10, hf, eq);
 | 
			
		||||
    X a5(i, j, 10, hf, eq);
 | 
			
		||||
    X(i, j, 10, hf);
 | 
			
		||||
    X a6(i, j, 10, hf);
 | 
			
		||||
@@ -480,11 +518,38 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
 | 
			
		||||
    X(i, j);
 | 
			
		||||
    X a8(i, j);
 | 
			
		||||
 | 
			
		||||
    X(i, j, 10, hf, eq, m);
 | 
			
		||||
    X a5a(i, j, 10, hf, eq, m);
 | 
			
		||||
    X(i, j, 10, hf, m);
 | 
			
		||||
    X a6a(i, j, 10, hf, m);
 | 
			
		||||
    X(i, j, 10, m);
 | 
			
		||||
    X a7a(i, j, 10, m);
 | 
			
		||||
 | 
			
		||||
    // Not specified for some reason (maybe ambiguity with another constructor?)
 | 
			
		||||
    //X(i, j, m);
 | 
			
		||||
    //X a8a(i, j, m);
 | 
			
		||||
    //sink(a8a);
 | 
			
		||||
 | 
			
		||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
 | 
			
		||||
    std::size_t min_buckets = 10;
 | 
			
		||||
    X({t});
 | 
			
		||||
    X({t}, min_buckets);
 | 
			
		||||
    X({t}, min_buckets, hf);
 | 
			
		||||
    X({t}, min_buckets, hf, eq);
 | 
			
		||||
    //X({t}, m);
 | 
			
		||||
    X({t}, min_buckets, m);
 | 
			
		||||
    X({t}, min_buckets, hf, m);
 | 
			
		||||
    X({t}, min_buckets, hf, eq, m);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    X const b;
 | 
			
		||||
    sink(X(b));
 | 
			
		||||
    X a9(b);
 | 
			
		||||
    a = b;
 | 
			
		||||
 | 
			
		||||
    sink(X(b, m));
 | 
			
		||||
    X a9a(b, m);
 | 
			
		||||
 | 
			
		||||
    const_iterator q = a.cbegin();
 | 
			
		||||
 | 
			
		||||
    test::check_return_type<iterator>::equals(a.insert(q, t));
 | 
			
		||||
@@ -516,6 +581,10 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
 | 
			
		||||
    sink(a7);
 | 
			
		||||
    sink(a8);
 | 
			
		||||
    sink(a9);
 | 
			
		||||
    sink(a5a);
 | 
			
		||||
    sink(a6a);
 | 
			
		||||
    sink(a7a);
 | 
			
		||||
    sink(a9a);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <class X, class Key, class T, class Hash, class Pred>
 | 
			
		||||
@@ -525,6 +594,7 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
 | 
			
		||||
 | 
			
		||||
    typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
 | 
			
		||||
    typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
 | 
			
		||||
    typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
 | 
			
		||||
 | 
			
		||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
 | 
			
		||||
    X x1(rvalue_default<X>());
 | 
			
		||||
@@ -533,9 +603,14 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
 | 
			
		||||
    x2 = boost::move(x1);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    X a;
 | 
			
		||||
    allocator_type m = a.get_allocator();
 | 
			
		||||
 | 
			
		||||
    test::minimal::constructor_param* i = 0; 
 | 
			
		||||
    test::minimal::constructor_param* j = 0;
 | 
			
		||||
 | 
			
		||||
    // Constructors
 | 
			
		||||
 | 
			
		||||
    X(i, j, 10, hf, eq);
 | 
			
		||||
    X a5(i, j, 10, hf, eq);
 | 
			
		||||
    X(i, j, 10, hf);
 | 
			
		||||
@@ -545,7 +620,17 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
 | 
			
		||||
    X(i, j);
 | 
			
		||||
    X a8(i, j);
 | 
			
		||||
 | 
			
		||||
    X a;
 | 
			
		||||
    X(i, j, 10, hf, eq, m);
 | 
			
		||||
    X a5a(i, j, 10, hf, eq, m);
 | 
			
		||||
    X(i, j, 10, hf, m);
 | 
			
		||||
    X a6a(i, j, 10, hf, m);
 | 
			
		||||
    X(i, j, 10, m);
 | 
			
		||||
    X a7a(i, j, 10, m);
 | 
			
		||||
 | 
			
		||||
    // Not specified for some reason (maybe ambiguity with another constructor?)
 | 
			
		||||
    //X(i, j, m);
 | 
			
		||||
    //X a8a(i, j, m);
 | 
			
		||||
    //sink(a8a);
 | 
			
		||||
 | 
			
		||||
    const_iterator q = a.cbegin();
 | 
			
		||||
 | 
			
		||||
@@ -579,6 +664,9 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
 | 
			
		||||
    sink(a6);
 | 
			
		||||
    sink(a7);
 | 
			
		||||
    sink(a8);
 | 
			
		||||
    sink(a5a);
 | 
			
		||||
    sink(a6a);
 | 
			
		||||
    sink(a7a);
 | 
			
		||||
    sink(a10);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user