.TH "std::allocator_traits< _Alloc >" 3cxx "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::allocator_traits< _Alloc > \- Uniform interface to all allocator types\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits __allocator_traits_base\&. .PP Inherited by \fB__gnu_cxx::__alloc_traits< _Tp_alloc_type >\fP, and \fB__gnu_cxx::__alloc_traits< _Alloc, typename >\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "\fBtypedef\fP _Alloc \fBallocator_type\fP" .br .RI "The allocator type\&. " .ti -1c .RI "\fBusing\fP \fBconst_pointer\fP = \fBtypename\fP _Ptr< \fB__c_pointer\fP, \fBconst\fP \fBvalue_type\fP >::type" .br .RI "The allocator's const pointer type\&. " .ti -1c .RI "\fBusing\fP \fBconst_void_pointer\fP = \fBtypename\fP _Ptr< \fB__cv_pointer\fP, \fBconst\fP \fBvoid\fP >::type" .br .RI "The allocator's const void pointer type\&. " .ti -1c .RI "\fBusing\fP \fBdifference_type\fP = \fBtypename\fP _Diff< _Alloc, \fBpointer\fP >::type" .br .RI "The allocator's difference type\&. " .ti -1c .RI "\fBusing\fP \fBis_always_equal\fP = \fB__detected_or_t\fP< \fBtypename\fP \fBis_empty\fP< _Alloc >::type, __equal, _Alloc >" .br .RI "Whether all instances of the allocator type compare equal\&. " .ti -1c .RI "\fBusing\fP \fBpointer\fP = \fB__detected_or_t\fP< \fBvalue_type\fP *, __pointer, _Alloc >" .br .RI "The allocator's pointer type\&. " .ti -1c .RI "\fBusing\fP \fBpropagate_on_container_copy_assignment\fP = \fB__detected_or_t\fP< \fBfalse_type\fP, \fB__pocca\fP, _Alloc >" .br .RI "How the allocator is propagated on copy assignment\&. " .ti -1c .RI "\fBusing\fP \fBpropagate_on_container_move_assignment\fP = \fB__detected_or_t\fP< \fBfalse_type\fP, \fB__pocma\fP, _Alloc >" .br .RI "How the allocator is propagated on move assignment\&. " .ti -1c .RI "\fBusing\fP \fBpropagate_on_container_swap\fP = \fB__detected_or_t\fP< \fBfalse_type\fP, \fB__pocs\fP, _Alloc >" .br .RI "How the allocator is propagated on swap\&. " .ti -1c .RI "template<\fBtypename\fP _Tp > \fBusing\fP \fBrebind_alloc\fP = \fB__alloc_rebind\fP< _Alloc, _Tp >" .br .ti -1c .RI "template<\fBtypename\fP _Tp > \fBusing\fP \fBrebind_traits\fP = \fBallocator_traits\fP< \fBrebind_alloc\fP< _Tp > >" .br .ti -1c .RI "\fBusing\fP \fBsize_type\fP = \fBtypename\fP _Size< _Alloc, \fBdifference_type\fP >::type" .br .RI "The allocator's size type\&. " .ti -1c .RI "\fBtypedef\fP _Alloc::value_type \fBvalue_type\fP" .br .RI "The allocated type\&. " .ti -1c .RI "\fBusing\fP \fBvoid_pointer\fP = \fBtypename\fP _Ptr< \fB__v_pointer\fP, \fBvoid\fP >::type" .br .RI "The allocator's void pointer type\&. " .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP \fBpointer\fP \fBallocate\fP (_Alloc &__a, \fBsize_type\fP __n)" .br .RI "Allocate memory\&. " .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP \fBpointer\fP \fBallocate\fP (_Alloc &__a, \fBsize_type\fP __n, \fBconst_void_pointer\fP \fB__hint\fP)" .br .RI "Allocate memory\&. " .ti -1c .RI "template<\fBtypename\fP _Tp , typename\&.\&.\&. _Args> \fBstatic\fP \fBconstexpr\fP \fBauto\fP \fBconstruct\fP (_Alloc &__a, _Tp *__p, \fB_Args\fP &&\&.\&.\&. \fB__args\fP) \fBnoexcept\fP(\fBnoexcept\fP(_S_construct(__a, __p, \fBstd::forward\fP< \fB_Args\fP >(\fB__args\fP)\&.\&.\&.))) \-> \fBdecltype\fP(_S_construct(__a, __p, \fBstd::forward\fP< \fB_Args\fP >(\fB__args\fP)\&.\&.\&.))" .br .RI "Construct an object of type \fC_Tp\fP " .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP \fBvoid\fP \fBdeallocate\fP (_Alloc &__a, \fBpointer\fP __p, \fBsize_type\fP __n)" .br .RI "Deallocate memory\&. " .ti -1c .RI "template<\fBtypename\fP _Tp > \fBstatic\fP \fBconstexpr\fP \fBvoid\fP \fBdestroy\fP (_Alloc &__a, _Tp *__p) \fBnoexcept\fP(\fBnoexcept\fP(_S_destroy(__a, __p, 0)))" .br .RI "Destroy an object of type \fI_Tp\fP\&. " .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP \fBsize_type\fP \fBmax_size\fP (\fBconst\fP _Alloc &__a) \fBnoexcept\fP" .br .RI "The maximum supported allocation size\&. " .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP _Alloc \fBselect_on_container_copy_construction\fP (\fBconst\fP _Alloc &\fB__rhs\fP)" .br .RI "Obtain an allocator to use when copying a container\&. " .in -1c .SH "Detailed Description" .PP .SS "template<\fBtypename\fP _Alloc> .br struct std::allocator_traits< _Alloc >"Uniform interface to all allocator types\&. .PP \fBSince\fP .RS 4 C++11 .RE .PP .SH "Member Typedef Documentation" .PP .SS "template<\fBtypename\fP _Alloc > \fBtypedef\fP _Alloc \fBstd::allocator_traits\fP< _Alloc >::allocator_type" .PP The allocator type\&. .SS "template<\fBtypename\fP _Alloc > \fBusing\fP \fBstd::allocator_traits\fP< _Alloc >::const_pointer = \fBtypename\fP _Ptr<\fB__c_pointer\fP, \fBconst\fP \fBvalue_type\fP>::type" .PP The allocator's const pointer type\&. \fCAlloc::const_pointer\fP if that type exists, otherwise \fC pointer_traits::rebind \fP .SS "template<\fBtypename\fP _Alloc > \fBusing\fP \fBstd::allocator_traits\fP< _Alloc >::const_void_pointer = \fBtypename\fP _Ptr<\fB__cv_pointer\fP, \fBconst\fP \fBvoid\fP>::type" .PP The allocator's const void pointer type\&. \fCAlloc::const_void_pointer\fP if that type exists, otherwise \fC pointer_traits::rebind \fP .SS "template<\fBtypename\fP _Alloc > \fBusing\fP \fBstd::allocator_traits\fP< _Alloc >::difference_type = \fBtypename\fP _Diff<_Alloc, \fBpointer\fP>::type" .PP The allocator's difference type\&. \fCAlloc::difference_type\fP if that type exists, otherwise \fC pointer_traits::difference_type \fP .SS "template<\fBtypename\fP _Alloc > \fBusing\fP \fBstd::allocator_traits\fP< _Alloc >::is_always_equal = \fB__detected_or_t\fP<\fBtypename\fP \fBis_empty\fP<_Alloc>::type, __equal, _Alloc>" .PP Whether all instances of the allocator type compare equal\&. \fCAlloc::is_always_equal\fP if that type exists, otherwise \fCis_empty::type\fP .SS "template<\fBtypename\fP _Alloc > \fBusing\fP \fBstd::allocator_traits\fP< _Alloc >::pointer = \fB__detected_or_t\fP<\fBvalue_type\fP*, __pointer, _Alloc>" .PP The allocator's pointer type\&. \fCAlloc::pointer\fP if that type exists, otherwise \fCvalue_type*\fP .SS "template<\fBtypename\fP _Alloc > \fBusing\fP \fBstd::allocator_traits\fP< _Alloc >::propagate_on_container_copy_assignment = \fB__detected_or_t\fP<\fBfalse_type\fP, \fB__pocca\fP, _Alloc>" .PP How the allocator is propagated on copy assignment\&. \fCAlloc::propagate_on_container_copy_assignment\fP if that type exists, otherwise \fCfalse_type\fP .SS "template<\fBtypename\fP _Alloc > \fBusing\fP \fBstd::allocator_traits\fP< _Alloc >::propagate_on_container_move_assignment = \fB__detected_or_t\fP<\fBfalse_type\fP, \fB__pocma\fP, _Alloc>" .PP How the allocator is propagated on move assignment\&. \fCAlloc::propagate_on_container_move_assignment\fP if that type exists, otherwise \fCfalse_type\fP .SS "template<\fBtypename\fP _Alloc > \fBusing\fP \fBstd::allocator_traits\fP< _Alloc >::propagate_on_container_swap = \fB__detected_or_t\fP<\fBfalse_type\fP, \fB__pocs\fP, _Alloc>" .PP How the allocator is propagated on swap\&. \fCAlloc::propagate_on_container_swap\fP if that type exists, otherwise \fCfalse_type\fP .SS "template<\fBtypename\fP _Alloc > \fBusing\fP \fBstd::allocator_traits\fP< _Alloc >::size_type = \fBtypename\fP _Size<_Alloc, \fBdifference_type\fP>::type" .PP The allocator's size type\&. \fCAlloc::size_type\fP if that type exists, otherwise \fC make_unsigned::type \fP .SS "template<\fBtypename\fP _Alloc > \fBtypedef\fP _Alloc::value_type \fBstd::allocator_traits\fP< _Alloc >::value_type" .PP The allocated type\&. .SS "template<\fBtypename\fP _Alloc > \fBusing\fP \fBstd::allocator_traits\fP< _Alloc >::void_pointer = \fBtypename\fP _Ptr<\fB__v_pointer\fP, \fBvoid\fP>::type" .PP The allocator's void pointer type\&. \fCAlloc::void_pointer\fP if that type exists, otherwise \fC pointer_traits::rebind \fP .SH "Member Function Documentation" .PP .SS "template<\fBtypename\fP _Alloc > \fBstatic\fP \fBconstexpr\fP \fBpointer\fP \fBstd::allocator_traits\fP< _Alloc >::allocate (_Alloc & __a, \fBsize_type\fP __n)\fC [inline]\fP, \fC [static]\fP, \fC [constexpr]\fP" .PP Allocate memory\&. .PP \fBParameters\fP .RS 4 \fI__a\fP An allocator\&. .br \fI__n\fP The number of objects to allocate space for\&. .RE .PP Calls \fCa\&.allocate(n)\fP .SS "template<\fBtypename\fP _Alloc > \fBstatic\fP \fBconstexpr\fP \fBpointer\fP \fBstd::allocator_traits\fP< _Alloc >::allocate (_Alloc & __a, \fBsize_type\fP __n, \fBconst_void_pointer\fP __hint)\fC [inline]\fP, \fC [static]\fP, \fC [constexpr]\fP" .PP Allocate memory\&. .PP \fBParameters\fP .RS 4 \fI__a\fP An allocator\&. .br \fI__n\fP The number of objects to allocate space for\&. .br \fI__hint\fP Aid to locality\&. .RE .PP \fBReturns\fP .RS 4 Memory of suitable size and alignment for \fIn\fP objects of type \fCvalue_type\fP .RE .PP Returns \fC a\&.allocate(n, hint) \fP if that expression is well-formed, otherwise returns \fCa\&.allocate(n)\fP .SS "template<\fBtypename\fP _Alloc > template<\fBtypename\fP _Tp , typename\&.\&.\&. _Args> \fBstatic\fP \fBconstexpr\fP \fBauto\fP \fBstd::allocator_traits\fP< _Alloc >::construct (_Alloc & __a, _Tp * __p, \fB_Args\fP &&\&.\&.\&. __args) \-> \fBdecltype\fP(_S_construct(__a, __p, \fBstd::forward\fP<\fB_Args\fP>(\fB__args\fP)\&.\&.\&.)) \fC [inline]\fP, \fC [static]\fP, \fC [constexpr]\fP, \fC [noexcept]\fP" .PP Construct an object of type \fC_Tp\fP .PP \fBParameters\fP .RS 4 \fI__a\fP An allocator\&. .br \fI__p\fP Pointer to memory of suitable size and alignment for Tp .br \fI__args\fP Constructor arguments\&. .RE .PP Calls \fC __a\&.construct(__p, std::forward(__args)\&.\&.\&.) \fP if that expression is well-formed, otherwise uses placement-new to construct an object of type \fI_Tp\fP at location \fI__p\fP from the arguments \fI__args\fP\&.\&.\&. .SS "template<\fBtypename\fP _Alloc > \fBstatic\fP \fBconstexpr\fP \fBvoid\fP \fBstd::allocator_traits\fP< _Alloc >::deallocate (_Alloc & __a, \fBpointer\fP __p, \fBsize_type\fP __n)\fC [inline]\fP, \fC [static]\fP, \fC [constexpr]\fP" .PP Deallocate memory\&. .PP \fBParameters\fP .RS 4 \fI__a\fP An allocator\&. .br \fI__p\fP Pointer to the memory to deallocate\&. .br \fI__n\fP The number of objects space was allocated for\&. .RE .PP Calls \fC a\&.deallocate(p, n) \fP .SS "template<\fBtypename\fP _Alloc > template<\fBtypename\fP _Tp > \fBstatic\fP \fBconstexpr\fP \fBvoid\fP \fBstd::allocator_traits\fP< _Alloc >::destroy (_Alloc & __a, _Tp * __p)\fC [inline]\fP, \fC [static]\fP, \fC [constexpr]\fP, \fC [noexcept]\fP" .PP Destroy an object of type \fI_Tp\fP\&. .PP \fBParameters\fP .RS 4 \fI__a\fP An allocator\&. .br \fI__p\fP Pointer to the object to destroy .RE .PP Calls \fC__a\&.destroy(__p)\fP if that expression is well-formed, otherwise calls \fC__p->~_Tp()\fP .PP Referenced by \fBstd::_Destroy()\fP\&. .SS "template<\fBtypename\fP _Alloc > \fBstatic\fP \fBconstexpr\fP \fBsize_type\fP \fBstd::allocator_traits\fP< _Alloc >::max_size (\fBconst\fP _Alloc & __a)\fC [inline]\fP, \fC [static]\fP, \fC [constexpr]\fP, \fC [noexcept]\fP" .PP The maximum supported allocation size\&. .PP \fBParameters\fP .RS 4 \fI__a\fP An allocator\&. .RE .PP \fBReturns\fP .RS 4 \fC__a\&.max_size()\fP or \fCnumeric_limits::max()\fP .RE .PP Returns \fC__a\&.max_size()\fP if that expression is well-formed, otherwise returns \fCnumeric_limits::max()\fP .SS "template<\fBtypename\fP _Alloc > \fBstatic\fP \fBconstexpr\fP _Alloc \fBstd::allocator_traits\fP< _Alloc >::select_on_container_copy_construction (\fBconst\fP _Alloc & __rhs)\fC [inline]\fP, \fC [static]\fP, \fC [constexpr]\fP" .PP Obtain an allocator to use when copying a container\&. .PP \fBParameters\fP .RS 4 \fI__rhs\fP An allocator\&. .RE .PP \fBReturns\fP .RS 4 \fC__rhs\&.select_on_container_copy_construction()\fP or \fI__rhs\fP .RE .PP Returns \fC__rhs\&.select_on_container_copy_construction()\fP if that expression is well-formed, otherwise returns \fI__rhs\fP .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.