Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::container::constructible_with_allocator_prefix< T > Struct Template Reference

Remark: if a specialization is derived from true_type, indicates that T may be constructed with allocator_arg and T::allocator_type as its first two constructor arguments. More...

#include <scoped_allocator_fwd.hpp>

Inheritance diagram for boost::container::constructible_with_allocator_prefix< T >:
Collaboration diagram for boost::container::constructible_with_allocator_prefix< T >:

Public Types

typedef integral_constant
< bool, false > 
type
 

Detailed Description

template<class T>
struct boost::container::constructible_with_allocator_prefix< T >

Remark: if a specialization is derived from true_type, indicates that T may be constructed with allocator_arg and T::allocator_type as its first two constructor arguments.

Ideally, all constructors of T (including the copy and move constructors) should have a variant that accepts these two initial arguments.

Requires: if a specialization is derived from true_type, T must have a nested type, allocator_type and at least one constructor for which allocator_arg_t is the first parameter and allocator_type is the second parameter. If not all constructors of T can be called with these initial arguments, and if T is used in a context where a container must call such a constructor, then the program is ill-formed.

template <class T, class Allocator = allocator<T> > class Y { public: typedef Allocator allocator_type;

// Default constructor with and allocator-extended default constructor Y(); Y(allocator_arg_t, const allocator_type& a);

// Copy constructor and allocator-extended copy constructor Y(const Y& yy); Y(allocator_arg_t, const allocator_type& a, const Y& yy);

// Variadic constructor and allocator-extended variadic constructor template<class ...Args> Y(Args&& args...); template<class ...Args> Y(allocator_arg_t, const allocator_type& a, Args&&... args); };

// Specialize trait for class template Y template <class T, class Allocator = allocator<T> > struct constructible_with_allocator_prefix<Y<T,Allocator> > : boost::true_type { };

Note: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)" (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments. Applications aiming portability with several compilers should always define this trait.

In conforming C++11 compilers or compilers supporting SFINAE expressions (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used to detect if a type should be constructed with suffix or prefix allocator arguments.

Member Typedef Documentation

typedef integral_constant<bool,false> boost::integral_constant< bool, false >::type
inherited

The documentation for this struct was generated from the following file: