std:: uses_allocator <std::tuple>
From cppreference.net
C++
Utilities library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::tuple
| Member functions | ||||
| Non-member functions | ||||
|
(until C++20)
(until C++20)
(until C++20)
(until C++20)
(until C++20)
(C++20)
|
||||
| Helper concepts | ||||
|
(C++23)
|
||||
| Helper classes | ||||
|
uses_allocator
<std::tuple>
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Deduction guides (C++17) |
|
헤더 파일에 정의됨
<tuple>
|
||
|
template
<
class
...
Types
,
class
Alloc
>
struct uses_allocator < std:: tuple < Types... > , Alloc > : std:: true_type { } ; |
(C++11부터) | |
이
std::uses_allocator
특수화는 튜플이 내부에
allocator_type
을 가지고 있지 않더라도
uses-allocator construction
을 지원한다는 사실을 다른 라이브러리 구성 요소에 알립니다.
목차 |
std:: integral_constant 에서 상속됨
멤버 상수
|
value
[static]
|
true
(public static member constant) |
멤버 함수
|
operator bool
|
객체를
bool
로 변환,
value
반환
(public member function) |
|
operator()
(C++14)
|
value
반환
(public member function) |
멤버 타입
| 타입 | 정의 |
value_type
|
bool |
type
|
std:: integral_constant < bool , value > |
예제
// myalloc은 단일 인자 생성자를 가지는 상태 저장 Allocator입니다 // 생성자는 int를 받으며 기본 생성자는 없습니다 using innervector_t = std::vector<int, myalloc<int>>; using elem_t = std::tuple<int, innervector_t>; using Alloc = std::scoped_allocator_adaptor< myalloc<elem_t>, myalloc<int>>; Alloc a(1,2); std::vector<elem_t, Alloc> v(a); v.resize(1); // v의 요소에 대해 allocator #1을 사용합니다 std::get<1>(v[0]).resize(10); // innervector_t에 대해 allocator #2를 사용합니다
참고 항목
|
(C++11)
|
지정된 타입이 uses-allocator 생성 방식을 지원하는지 확인합니다
(클래스 템플릿) |