다음을 통해 공유


scoped_allocator_adaptor 클래스

Represents a nest of allocators.

template<class Outer, class... Inner>
    class scoped_allocator_adaptor;

설명

The template class encapsulates a nest of one or more allocators. Each such class has an outermost allocator of type outer_allocator_type, a synonym for Outer, which is a public base of the scoped_allocator_adaptor object. Outer is used to allocate memory to be used by a container. You can obtain a reference to this allocator base object by calling outer_allocator.

The remainder of the nest has type inner_allocator_type. An inner allocator is used to allocate memory for elements within a container. You can obtain a reference to the stored object of this type by calling inner_allocator. If Inner... is not empty, inner_allocator_type has type scoped_allocator_adaptor<Inner...>, and inner_allocator designates a member object. Otherwise, inner_allocator_type has type scoped_allocator_adaptor<Outer>, and inner_allocator designates the entire object.

The nest behaves as if it has arbitrary depth, replicating its innermost encapsulated allocator as needed.

Several concepts that are not a part of the visible interface aid in describing the behavior of this template class. An outermost allocator mediates all calls to the construct and destroy methods. It is effectively defined by the recursive function OUTERMOST(X), where OUTERMOST(X) is one of the following.

  • If X.outer_allocator() is well formed, then OUTERMOST(X) is OUTERMOST(X.outer_allocator()).

  • 그렇지 않으면 OUTERMOST(X)는 X입니다.

Three types are defined for the sake of exposition:

형식

설명

Outermost

OUTERMOST(*this)의 형식입니다.

Outermost_traits

allocator_traits<Outermost>

Outer_traits

allocator_traits<Outer>

생성자

Name

설명

scoped_allocator_adaptor::scoped_allocator_adaptor 생성자

scoped_allocator_adaptor 개체를 생성합니다.

형식 정의

Name

설명

const_pointer

This type is a synonym for the const_pointer that is associated with the allocator Outer.

const_void_pointer

This type is a synonym for the const_void_pointer that is associated with the allocator Outer.

difference_type

This type is a synonym for the difference_type that is associated with the allocator Outer.

inner_allocator_type

This type is a synonym for the type of the nested adaptor scoped_allocator_adaptor<Inner...>.

outer_allocator_type

This type is a synonym for the type of the base allocator Outer.

pointer

This type is a synonym for the pointer associated with the allocator Outer.

propagate_on_container_copy_assignment

The type holds true only if Outer_traits::propagate_on_container_copy_assignment holds true or inner_allocator_type::propagate_on_container_copy_assignment holds true.

propagate_on_container_move_assignment

The type holds true only if Outer_traits::propagate_on_container_move_assignment holds true or inner_allocator_type::propagate_on_container_move_assignment holds true.

propagate_on_container_swap

The type holds true only if Outer_traits::propagate_on_container_swap holds true or inner_allocator_type::propagate_on_container_swap holds true.

size_type

This type is a synonym for the size_type associated with the allocator Outer.

value_type

This type is a synonym for the value_type associated with the allocator Outer.

void_pointer

This type is a synonym for the void_pointer associated with the allocator Outer.

Structs

Name

설명

scoped_allocator_adaptor::rebind 구조체

Defines the type Outer::rebind<Other>::other as a synonym for scoped_allocator_adaptor<Other, Inner...>.

메서드

Name

설명

scoped_allocator_adaptor::allocate 메서드

Allocates memory by using the Outer allocator.

scoped_allocator_adaptor::construct 메서드

Constructs an object.

scoped_allocator_adaptor::deallocate 메서드

Deallocates objects by using the outer allocator.

scoped_allocator_adaptor::destroy 메서드

Destroys a specified object.

scoped_allocator_adaptor::inner_allocator 메서드

Retrieves a reference to the stored object of type inner_allocator_type.

scoped_allocator_adaptor::max_size 메서드

Determines the maximum number of objects that can be allocated by the outer allocator.

scoped_allocator_adaptor::outer_allocator 메서드

Retrieves a reference to the stored object of type outer_allocator_type.

scoped_allocator_adaptor::select_on_container_copy_construction 메서드

Creates a new scoped_allocator_adaptor object with each stored allocator object initialized by calling select_on_container_copy_construction for each corresponding allocator.

요구 사항

Header: <scoped_allocator>

네임스페이스: std

참고 항목

기타 리소스

C++ 표준 라이브러리 헤더 파일