tuple_uses_allocator (tuple 전용 std::uses_allocator 특수화)
이 페이지는 std::uses_allocator의 tuple 전용 특수화를 다뤄요. 이 특수화는 tuple이 중첩된 allocator_type을 갖고 있지 않더라도 uses-allocator 생성을 지원한다는 사실을 다른 라이브러리 구성 요소에 알려주는 역할을 해요. C++11부터 사용할 수 있어요.
출처: cppreference
본문
개요
<tuple> 헤더에 정의됨 |
|
|
| template < class ... Types , class Alloc > struct uses_allocator < std :: tuple < Types ... > , Alloc > : std :: true_type { }; |
|
(C++11부터) |
이 std::uses_allocator 특수화는 tuple이 중첩된 allocator_type을 갖고 있지 않더라도 uses-allocator 생성을 지원한다는 것을 다른 라이브러리 구성 요소에 알려줘요.
std::integral_constant에서 상속됨
멤버 상수
| value [static] |
true (공용 정적 멤버 상수) |
멤버 함수
| operator bool |
객체를 bool로 변환하고 value를 반환해요 (공용 멤버 함수) |
| operator() (C++14) |
value를 반환해요 (공용 멤버 함수) |
멤버 타입
| Type |
Definition |
| value_type |
bool |
| type |
std :: integral_constant < bool , value > |
예제
// myalloc is a stateful Allocator with a single-argument constructor
// that takes an int. It has no default constructor.
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); // uses allocator #1 for elements of v
std::get<1>(v[0]).resize(10); // uses allocator #2 for innervector_t
같이 보기
| uses_allocator (C++11) |
지정된 타입이 uses-allocator 생성을 지원하는지 확인해요 (클래스 템플릿) [편집] |
더 알아보기 (Learn more)
cppreference