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_suffix< T > Struct Template Reference

Remark: if a specialization is derived from true_type, indicates that T may be constructed with an allocator as its last constructor argument. More...

#include <scoped_allocator_fwd.hpp>

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

Public Types

typedef integral_constant
< bool, false > 
type
 

Detailed Description

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

Remark: if a specialization is derived from true_type, indicates that T may be constructed with an allocator as its last constructor argument.

Ideally, all constructors of T (including the copy and move constructors) should have a variant that accepts a final argument of allocator_type.

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_type is the last parameter. If not all constructors of T can be called with a final allocator_type argument, 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 Z { public: typedef Allocator allocator_type;

// Default constructor with optional allocator suffix Z(const allocator_type& a = allocator_type());

// Copy constructor and allocator-extended copy constructor Z(const Z& zz); Z(const Z& zz, const allocator_type& a); };

// Specialize trait for class template Z template <class T, class Allocator = allocator<T> > struct constructible_with_allocator_suffix<Z<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: