FreeBSD Manual Pages
deductiongu...rstd::stack(3) C++ Standard Libary deductiongu...rstd::stack(3) NAME deductionguidesforstd::stack - deductionguidesforstd::stack Synopsis Defined in header <stack> template< class Container > stack( Container ) (1) (since C++17) -> stack<typename Container::value_type, Container>; template< class InputIt > stack( InputIt, InputIt ) (2) (since C++23) -> stack<typename std::iterator_traits<InputIt>::value_type>; template< class Container, class Alloc > stack( Container, Alloc ) (3) (since C++17) -> stack<typename Container::value_type, Container>; template< class InputIt, class Alloc > stack( InputIt, InputIt, Alloc ) -> stack<typename std::iterator_traits<InputIt>::value_type, (4) (since C++23) std::deque<typename std::iterator_traits<InputIt>::value_type, Alloc>>; These deduction guides are provided for stack to allow deduction from underlying container type. 1) Deduces underlying container type from the argument. 2) Deduces the element type from the iterator, using std::deque<typename std::iterator_traits<InputIt>::value_type> as the underlying con- tainer type. 3-4) Same as (1-2), except that the allocator is provided. These overloads participate in overload resolution only if * InputIt (if exists) satisfies LegacyInputIterator, * Container (if exists) does not satisfy Allocator, * for (3) (until C++23) (4) (since C++23), Alloc satisfies Allocator, and * std::uses_allocator_v<Container, Alloc> is true if both Con- tainer and Alloc exist. Note: the extent to which the library determines that a type does not satisfy LegacyInputIterator is unspecified, except that as a minimum inte- gral types do not qualify as input iterators. Likewise, the extent to which it deter- mines that a type does not satisfy Allocator is unspecified, except that as a minimum the member type Alloc::value_type must exist and the expression std::declval<Alloc&>().allocate(std::size_t{}) must be well-formed when treated as an unevaluated operand. Example // Run this code #include <vector> #include <stack> int main() { std::vector<int> v = {1,2,3,4}; std::stack s{v}; // guide #1 deduces std::stack<int, vec- tor<int>> } http://cppreference.com 2022.07.31 deductiongu...rstd::stack(3)
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=deductionguidesforstd::stack&sektion=3&manpath=FreeBSD+Ports+15.0>
