struct from_range_t { explicit from_range_t() = default; };
(since C++23)inline constexpr std::from_range_t from_range {};
(since C++23)std::from_range
is a disambiguation tag that can be passed to the constructors of the suitable containers to indicate that the contained member is range constructed.
The corresponding type std::from_range_t
can be used in the constructor's parameter list to match the intended tag.
The following standard library types use std::from_range_t
type in their constructors:
vector
from a range
std::vector<T,Allocator>
) constructs the inplace_vector
from a range
std::inplace_vector<T,N>
) constructs the hive
from a range
Template:cpp/container/hive/title
) constructs the deque
from a range
std::deque<T,Allocator>
) constructs the forward_list
from a range
std::forward_list<T,Allocator>
) constructs the list
from a range
std::list<T,Allocator>
) constructs the set
from a range
std::set<Key,Compare,Allocator>
) constructs the map
from a range
std::map<Key,T,Compare,Allocator>
) constructs the multiset
from a range
std::multiset<Key,Compare,Allocator>
) constructs the multimap
from a range
std::multimap<Key,T,Compare,Allocator>
) constructs the unordered_set
from a range
std::unordered_set<Key,Hash,KeyEqual,Allocator>
) constructs the unordered_map
from a range
std::unordered_map<Key,T,Hash,KeyEqual,Allocator>
) constructs the unordered_multiset
from a range
std::unordered_multiset<Key,Hash,KeyEqual,Allocator>
) constructs the unordered_multimap
from a range
std::unordered_multimap<Key,T,Hash,KeyEqual,Allocator>
) constructs the priority_queue
from a range
std::priority_queue<T,Container,Compare>
) constructs the queue
from a range
std::queue<T,Container>
) constructs the stack
from a range
std::stack<T,Container>
) constructs the flat_set
from a range
std::flat_set<Key,Compare,KeyContainer>
) constructs the flat_map
from a range
std::flat_map<Key,T,Compare,KeyContainer,MappedContainer>
) constructs the flat_multiset
from a range
std::flat_multiset<Key,Compare,KeyContainer>
) constructs the flat_multimap
from a range
std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>
) Strings library constructs the basic_string
from a range
std::basic_string<CharT,Traits,Allocator>
) [edit] Notes [edit] Example
#include <cassert> #include <string> int main() { #ifdef __cpp_lib_containers_ranges auto const range = {0x43, 43, 43}; std::string str{std::from_range, range}; // uses tagged constructor assert(str == "C++"); #endif }[edit] See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4