Section
std::stack
The std::stack class is a container adaptor that gives the programmer the functionality of a stack - specifically, a LIFO (last-in, first-out) data structure.
# Declarations
template<
class T,
class Container = std::deque<T>
> class stack;
# Notes
Feature-test macro Value Std Feature __cpp_lib_containers_ranges 202202L (C++23) Ranges construction and insertion for containers
# Defect reports
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 307 | C++98 | Container could not be std::vector | allowed |
| LWG 2566 | C++98 | Missing the requirement for Container::value_type | ill-formed if T is not the same type as Container::value_type |