Skip to content

Commit 8bce1f9

Browse files
committed
Remove constructible_with_allocator_suffix/constructible_with_allocator_prefix from documentation as they are not needed now. Utilities will reman anonymous to maintain a minimum backwards compatibility.
1 parent e2d3cf7 commit 8bce1f9

File tree

5 files changed

+15
-153
lines changed

5 files changed

+15
-153
lines changed

include/boost/container/uses_allocator.hpp

Lines changed: 14 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -17,99 +17,6 @@
1717
namespace boost {
1818
namespace container {
1919

20-
//! <b>Remark</b>: if a specialization constructible_with_allocator_suffix<X>::value is true, indicates that T may be constructed
21-
//! with an allocator as its last constructor argument. Ideally, all constructors of T (including the
22-
//! copy and move constructors) should have a variant that accepts a final argument of
23-
//! allocator_type.
24-
//!
25-
//! <b>Requires</b>: if a specialization constructible_with_allocator_suffix<X>::value is true, T must have a nested type,
26-
//! allocator_type and at least one constructor for which allocator_type is the last
27-
//! parameter. If not all constructors of T can be called with a final allocator_type argument,
28-
//! and if T is used in a context where a container must call such a constructor, then the program is
29-
//! ill-formed.
30-
//!
31-
//! <code>
32-
//! template <class T, class Allocator = allocator<T> >
33-
//! class Z {
34-
//! public:
35-
//! typedef Allocator allocator_type;
36-
//!
37-
//! // Default constructor with optional allocator suffix
38-
//! Z(const allocator_type& a = allocator_type());
39-
//!
40-
//! // Copy constructor and allocator-extended copy constructor
41-
//! Z(const Z& zz);
42-
//! Z(const Z& zz, const allocator_type& a);
43-
//! };
44-
//!
45-
//! // Specialize trait for class template Z
46-
//! template <class T, class Allocator = allocator<T> >
47-
//! struct constructible_with_allocator_suffix<Z<T,Allocator> >
48-
//! { static const bool value = true; };
49-
//! </code>
50-
//!
51-
//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped A Model (Rev 2)"
52-
//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as
53-
//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments.
54-
//! Applications aiming portability with several compilers should always define this trait.
55-
//!
56-
//! In conforming C++11 compilers or compilers supporting SFINAE expressions
57-
//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used
58-
//! to detect if a type should be constructed with suffix or prefix allocator arguments.
59-
template <class T>
60-
struct constructible_with_allocator_suffix
61-
{ BOOST_STATIC_CONSTEXPR bool value = false; };
62-
63-
//! <b>Remark</b>: if a specialization constructible_with_allocator_prefix<X>::value is true, indicates that T may be constructed
64-
//! with allocator_arg and T::allocator_type as its first two constructor arguments.
65-
//! Ideally, all constructors of T (including the copy and move constructors) should have a variant
66-
//! that accepts these two initial arguments.
67-
//!
68-
//! <b>Requires</b>: specialization constructible_with_allocator_prefix<X>::value is true, T must have a nested type,
69-
//! allocator_type and at least one constructor for which allocator_arg_t is the first
70-
//! parameter and allocator_type is the second parameter. If not all constructors of T can be
71-
//! called with these initial arguments, and if T is used in a context where a container must call such
72-
//! a constructor, then the program is ill-formed.
73-
//!
74-
//! <code>
75-
//! template <class T, class Allocator = allocator<T> >
76-
//! class Y {
77-
//! public:
78-
//! typedef Allocator allocator_type;
79-
//!
80-
//! // Default constructor with and allocator-extended default constructor
81-
//! Y();
82-
//! Y(allocator_arg_t, const allocator_type& a);
83-
//!
84-
//! // Copy constructor and allocator-extended copy constructor
85-
//! Y(const Y& yy);
86-
//! Y(allocator_arg_t, const allocator_type& a, const Y& yy);
87-
//!
88-
//! // Variadic constructor and allocator-extended variadic constructor
89-
//! template<class ...Args> Y(Args&& args...);
90-
//! template<class ...Args>
91-
//! Y(allocator_arg_t, const allocator_type& a, BOOST_FWD_REF(Args)... args);
92-
//! };
93-
//!
94-
//! // Specialize trait for class template Y
95-
//! template <class T, class Allocator = allocator<T> >
96-
//! struct constructible_with_allocator_prefix<Y<T,Allocator> >
97-
//! { static const bool value = true; };
98-
//!
99-
//! </code>
100-
//!
101-
//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
102-
//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as
103-
//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments.
104-
//! Applications aiming portability with several compilers should always define this trait.
105-
//!
106-
//! In conforming C++11 compilers or compilers supporting SFINAE expressions
107-
//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used
108-
//! to detect if a type should be constructed with suffix or prefix allocator arguments.
109-
template <class T>
110-
struct constructible_with_allocator_prefix
111-
{ BOOST_STATIC_CONSTEXPR bool value = false; };
112-
11320
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
11421

11522
namespace dtl {
@@ -147,18 +54,26 @@ struct uses_allocator_imp
14754

14855
} //namespace dtl {
14956

57+
template <class T>
58+
struct constructible_with_allocator_prefix
59+
{ BOOST_STATIC_CONSTEXPR bool value = false; };
60+
61+
template <class T>
62+
struct constructible_with_allocator_suffix
63+
{ BOOST_STATIC_CONSTEXPR bool value = false; };
64+
15065
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
15166

15267
//! <b>Remark</b>: Automatically detects whether T has a nested allocator_type that is convertible from
15368
//! Allocator. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may
154-
//! specialize this type to define uses_allocator<X>::value as true for a T of user-defined type if T does not
69+
//! specialize this type to define `uses_allocator<X>::value` as true for a T of user-defined type if T does not
15570
//! have a nested allocator_type but is nonetheless constructible using the specified Allocator where either:
156-
//! the first argument of a constructor has type allocator_arg_t and the second argument has type Alloc or
157-
//! the last argument of a constructor has type Alloc.
71+
//! the first argument of a constructor has type `allocator_arg_t` and the second argument has type `Allocator` or
72+
//! the last argument of a constructor has type `Allocator`.
15873
//!
159-
//! <b>Result</b>: uses_allocator<T, Allocator>::value== true if a type T::allocator_type
160-
//! exists and either is_convertible<Alloc, T::allocator_type>::value != false or T::allocator_type
161-
//! is an alias `erased_type`. False otherwise.
74+
//! <b>Result</b>: `uses_allocator<T, Allocator>::value == true` if a type `T::allocator_type`
75+
//! exists and either `is_convertible<Allocator, T::allocator_type>::value != false` or `T::allocator_type`
76+
//! is an alias of `erased_type`. False otherwise.
16277
template <typename T, typename Allocator>
16378
struct uses_allocator
16479
: dtl::uses_allocator_imp<T, Allocator>

include/boost/container/uses_allocator_fwd.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
#include <boost/container/detail/std_fwd.hpp>
1616

1717
//! \file
18-
//! This header forward declares boost::container::constructible_with_allocator_prefix,
19-
//! boost::container::constructible_with_allocator_suffix and
20-
//! boost::container::uses_allocator. Also defines the following types:
18+
//! This header forward declares boost::container::uses_allocator. Also defines the following types:
2119

2220
namespace boost {
2321
namespace container {

test/propagate_allocator_test.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ bool test_propagate_allocator()
138138
PropagateCont c2(c); //should propagate 223
139139
BOOST_TEST (c2.get_stored_allocator().id_ == 223);
140140
BOOST_TEST (c2.get_stored_allocator().ctr_copies_ >= 1);
141-
BOOST_TEST (c2.get_stored_allocator().ctr_moves_ >= 0);
142141
BOOST_TEST (c2.get_stored_allocator().assign_copies_ == 0);
143142
BOOST_TEST (c2.get_stored_allocator().assign_moves_ == 0);
144143
BOOST_TEST (c2.get_stored_allocator().swaps_ == 0);
@@ -237,8 +236,6 @@ bool test_propagate_allocator()
237236
BOOST_TEST (c.get_stored_allocator().id_ == 223);
238237
NoPropagateCont c2(c); //should NOT propagate 223
239238
BOOST_TEST (c2.get_stored_allocator().id_ == 224);
240-
BOOST_TEST (c2.get_stored_allocator().ctr_copies_ >= 0);
241-
BOOST_TEST (c2.get_stored_allocator().ctr_moves_ >= 0);
242239
BOOST_TEST (c2.get_stored_allocator().assign_copies_ == 0);
243240
BOOST_TEST (c2.get_stored_allocator().assign_moves_ == 0);
244241
BOOST_TEST (c2.get_stored_allocator().swaps_ == 0);
@@ -249,8 +246,6 @@ bool test_propagate_allocator()
249246
NoPropagateCont c; //stored 334
250247
BOOST_TEST (c.get_stored_allocator().id_ == 334);
251248
NoPropagateCont c2(boost::move(c)); // should NOT propagate 334
252-
BOOST_TEST (c2.get_stored_allocator().ctr_copies_ >= 0);
253-
BOOST_TEST (c2.get_stored_allocator().ctr_moves_ >= 0);
254249
BOOST_TEST (c2.get_stored_allocator().assign_copies_ == 0);
255250
BOOST_TEST (c2.get_stored_allocator().assign_moves_ == 0);
256251
BOOST_TEST (c2.get_stored_allocator().swaps_ == 0);

test/propagation_test_allocator.hpp

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -230,39 +230,4 @@ struct allocator_argument_tester
230230
int value;
231231
};
232232

233-
namespace boost {
234-
namespace container {
235-
236-
template<unsigned int AllocatorTag>
237-
struct constructible_with_allocator_prefix
238-
< ::allocator_argument_tester<ConstructiblePrefix, AllocatorTag> >
239-
{
240-
static const bool value = true;
241-
};
242-
243-
template<unsigned int AllocatorTag>
244-
struct constructible_with_allocator_prefix
245-
< ::allocator_argument_tester<ErasedTypePrefix, AllocatorTag> >
246-
{
247-
static const bool value = true;
248-
};
249-
250-
251-
template<unsigned int AllocatorTag>
252-
struct constructible_with_allocator_suffix
253-
< ::allocator_argument_tester<ConstructibleSuffix, AllocatorTag> >
254-
{
255-
static const bool value = true;
256-
};
257-
258-
template<unsigned int AllocatorTag>
259-
struct constructible_with_allocator_suffix
260-
< ::allocator_argument_tester<ErasedTypeSuffix, AllocatorTag> >
261-
{
262-
static const bool value = true;
263-
};
264-
265-
} //namespace container {
266-
} //namespace boost {
267-
268233
#endif //BOOST_CONTAINER_TEST_ALLOCATOR_ARGUMENT_TESTER_HPP

test/uses_allocator_test.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,5 @@ int main()
6767
< allocator_argument_tester<ErasedTypePrefix, 0>
6868
, propagation_test_allocator<float, 0>
6969
>::value ));
70-
BOOST_CONTAINER_STATIC_ASSERT(( true == constructible_with_allocator_prefix
71-
< allocator_argument_tester<ConstructiblePrefix, 0> >::value ));
72-
73-
BOOST_CONTAINER_STATIC_ASSERT(( true == constructible_with_allocator_suffix
74-
< allocator_argument_tester<ConstructibleSuffix, 0> >::value ));
75-
76-
BOOST_CONTAINER_STATIC_ASSERT(( true == constructible_with_allocator_prefix
77-
< allocator_argument_tester<ErasedTypePrefix, 0> >::value ));
78-
79-
BOOST_CONTAINER_STATIC_ASSERT(( true == constructible_with_allocator_suffix
80-
< allocator_argument_tester<ErasedTypeSuffix, 0> >::value ));
8170
return 0;
8271
}

0 commit comments

Comments
 (0)