std:: from_range, std:: from_range_t
From cppreference.net
|
헤더에 정의됨
<ranges>
|
||
|
struct
from_range_t
{
explicit
from_range_t
(
)
=
default
;
}
;
|
(C++23부터) | |
|
inline
constexpr
std
::
from_range_t
from_range
{
}
;
|
(C++23부터) | |
std::from_range
는 적절한 컨테이너들의 생성자에 전달될 수 있는 명확화 태그로, 포함된 멤버가 범위 생성되었음을 나타냅니다.
해당 타입
std::from_range_t
은 생성자의 매개변수 목록에서 의도된 태그와 매칭하기 위해 사용될 수 있습니다.
목차 |
표준 라이브러리
다음 표준 라이브러리 타입들은 생성자에서
std::from_range_t
타입을 사용합니다:
컨테이너 라이브러리 |
|
|
(C++23)
|
범위에서
vector
를 생성함
(
std::vector<T,Allocator>
의 public 멤버 함수)
|
|
(C++26)
|
범위로부터
inplace_vector
를 생성함
(
std::inplace_vector<T,N>
의 public 멤버 함수)
|
|
(C++26)
|
범위로부터
hive
를 생성함
(
Template:cpp/container/hive/title
의 공개 멤버 함수)
|
|
(C++23)
|
범위에서
deque
를 생성합니다
(
std::deque<T,Allocator>
의 public 멤버 함수)
|
|
(C++23)
|
범위로부터
forward_list
를 생성함
(
std::forward_list<T,Allocator>
의 public 멤버 함수)
|
|
(C++23)
|
범위에서
list
를 생성함
(
std::list<T,Allocator>
의 public 멤버 함수)
|
|
(C++23)
|
범위에서
set
을 생성함
(
std::set<Key,Compare,Allocator>
의 public 멤버 함수)
|
|
(C++23)
|
범위에서
map
을 생성합니다
(
std::map<Key,T,Compare,Allocator>
의 public 멤버 함수)
|
|
(C++23)
|
범위로부터
multiset
을 생성함
(
std::multiset<Key,Compare,Allocator>
의 public 멤버 함수)
|
|
(C++23)
|
범위로부터
multimap
을 생성함
(
std::multimap<Key,T,Compare,Allocator>
의 public 멤버 함수)
|
|
(C++23)
|
범위로부터
unordered_set
을 생성함
(
std::unordered_set<Key,Hash,KeyEqual,Allocator>
의 public 멤버 함수)
|
|
(C++23)
|
범위로부터
unordered_map
을 생성함
(
std::unordered_map<Key,T,Hash,KeyEqual,Allocator>
의 public 멤버 함수)
|
|
(C++23)
|
범위로부터
unordered_multiset
을 생성함
(
std::unordered_multiset<Key,Hash,KeyEqual,Allocator>
의 public 멤버 함수)
|
|
(C++23)
|
범위로부터
unordered_multimap
을 생성함
(
std::unordered_multimap<Key,T,Hash,KeyEqual,Allocator>
의 public 멤버 함수)
|
|
(C++23)
|
범위로부터
priority_queue
를 생성함
(
std::priority_queue<T,Container,Compare>
의 public 멤버 함수)
|
|
(C++23)
|
범위로부터
queue
를 생성함
(
std::queue<T,Container>
의 public 멤버 함수)
|
|
(C++23)
|
범위에서
stack
을 생성합니다
(
std::stack<T,Container>
의 public 멤버 함수)
|
|
(C++23)
|
범위에서
flat_set
을(를) 생성함
(
std::flat_set<Key,Compare,KeyContainer>
의 public 멤버 함수)
|
|
(C++23)
|
범위에서
flat_map
을 생성함
(
std::flat_map<Key,T,Compare,KeyContainer,MappedContainer>
의 공개 멤버 함수)
|
|
(C++23)
|
범위로부터
flat_multiset
을 생성함
(
std::flat_multiset<Key,Compare,KeyContainer>
의 public 멤버 함수)
|
|
(C++23)
|
범위로부터
flat_multimap
을 생성함
(
std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>
의 public 멤버 함수)
|
문자열 라이브러리 |
|
|
(C++23)
|
범위로부터
basic_string
을 생성함
(
std::basic_string<CharT,Traits,Allocator>
의 public 멤버 함수)
|
참고 사항
| 기능 테스트 매크로 | 값 | 표준 | 기능 |
|---|---|---|---|
__cpp_lib_containers_ranges
|
202202L
|
(C++23) | 컨테이너 호환 범위 에서 생성하기 위한 태그 생성자 |
예제
이 코드 실행
#include <cassert> #include <string> int main() { #ifdef __cpp_lib_containers_ranges auto const range = {0x43, 43, 43}; std::string str{std::from_range, range}; // 태그된 생성자 사용 assert(str == "C++"); #endif }
참고 항목
|
인-플레이스 생성 태그
(태그) |
|
|
범위의 요소들이 정렬되어 있음을 나타냄 (유일성은 요구되지 않음)
(태그) |
|
|
(C++23)
|
범위의 요소들이 정렬되어 있고 유일함을 나타냄
(태그) |
|
(C++23)
|
입력 범위로부터 새로운 비-뷰 객체를 생성함
(함수 템플릿) |