다음을 통해 공유


allocator_traits 클래스

The template class describes an object that supplements an allocator type. An allocator type is any type that describes an allocator object that is used for managing allocated storage. Specifically, for any allocator type Alloc, you can use allocator_traits<Alloc> to determine all the information that is needed by an allocator-enabled container. For more information, see the default allocator 클래스.

template<class Alloc>
    class allocator_traits;

형식 정의

Name

설명

allocator_traits::allocator_type

This type is a synonym for the template parameter Alloc.

allocator_traits::const_pointer

This type is Alloc::const_pointer, if that type is well-formed; otherwise, this type is pointer_traits<pointer>::rebind<const value_type>.

allocator_traits::const_void_pointer

This type is Alloc::const_void_pointer, if that type is well-formed; otherwise, this type is pointer_traits<pointer>::rebind<const void>.

allocator_traits::difference_type

This type is Alloc::difference_type, if that type is well-formed; otherwise, this type is pointer_traits<pointer>::difference_type.

allocator_traits::pointer

This type is Alloc::pointer, if that type is well-formed; otherwise, this type is value_type *.

allocator_traits::propagate_on_container_copy_assignment

This type is Alloc::propagate_on_container_copy_assignment, if that type is well-formed; otherwise, this type is false_type.

allocator_traits::propagate_on_container_move_assignment

This type is Alloc::propagate_on_container_move_assignment, if that type is well-formed; otherwise, this type is false_type. If the type holds true, an allocator-enabled container copies its stored allocator on a move assignment.

allocator_traits::propagate_on_container_swap

This type is Alloc::propagate_on_container_swap, if that type is well-formed; otherwise, this type is false_type. If the type holds true, an allocator-enabled container swaps its stored allocator on a swap.

allocator_traits::size_type

This type is Alloc::size_type, if that type is well-formed; otherwise, this type is make_unsigned<difference_type>::type.

allocator_traits::value_type

This type is a synonym for Alloc::value_type.

allocator_traits::void_pointer

This type is Alloc::void_pointer, if that type is well-formed; otherwise, this type is pointer_traits<pointer>::rebind<void>.

정적 메서드

The following static methods call the corresponding method on a given allocator parameter.

Name

설명

allocator_traits::allocate 메서드

Static method that allocates memory by using the given allocator parameter.

allocator_traits::construct 메서드

Static method that uses a specified allocator to construct an object.

allocator_traits::deallocate 메서드

Static method that uses a specified allocator to deallocate a specified number of objects.

allocator_traits::destroy 메서드

Static method that uses a specified allocator to call the destructor on an object without deallocating its memory.

allocator_traits::max_size 메서드

Static method that uses a specified allocator to determine the maximum number of objects that can be allocated.

allocator_traits::select_on_container_copy_construction 메서드

Static method that calls select_on_container_copy_construction on the specified allocator.

요구 사항

헤더 <memory>

네임스페이스: std

참고 항목

참조

<memory>

pointer_traits 구조체

scoped_allocator_adaptor 클래스