# deduction guides for `std::queue`

From cppreference.com
< cpp‎ | container‎ | queue

Defined in header `<queue>` |  |
template<class Container> queue(Container) -> queue<typename Container::value_type, Container>; | (1) | (since C++17)
template<class Container, class Allocator> queue(Container, Allocator) -> queue<typename Container::value_type, Container>; | (2) | (since C++17)

These deduction guides are provided for queue to allow deduction from underlying container type. This overload only participates in overload resolution if `Alloc` satisfies Allocator, and `Container` does not satisfy Allocator and, for overload (2), if std::uses_allocator_v<Container, Allocator> is `true`

Note: the extent to which the library determines that a type does not satisfy LegacyInputIterator is unspecified, except that as a minimum integral types do not qualify as input iterators. Likewise, the extent to which it determines 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 <queue>
    int main() {
       std::vector<int> v = {1,2,3,4};
       std::queue s{v};    // guide #1 deduces std::queue<int, vector<int>>
    }

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/container/queue/deduction_guides&oldid=104923"