(C++17) | ||||
| Sequence | ||||
(C++11) | ||||
(C++26) | ||||
(C++26) | ||||
(C++11) | ||||
| Associative | ||||
| Unordered associative | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
| Adaptors | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
| Views | ||||
(C++20) | ||||
(C++23) | ||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
std::queue| Member functions | ||||
| Element access | ||||
| Capacity | ||||
| Modifiers | ||||
queue::push_range (C++23) | ||||
(C++11) | ||||
(C++11) | ||||
| Non-member functions | ||||
(C++11) | ||||
| Helper classes | ||||
(C++11) | ||||
(C++23) | ||||
| Deduction guides(C++17) |
template<container-compatible-range<value_type> R> void push_range( R&& rg); | (since C++23) | |
Inserts a copy of each element ofrg inqueue, as if by:
append_range member function), or
Each iterator in the rangerg is dereferenced exactly once.
Contents |
| rg | - | acontainer compatible range, that is, aninput_range whose elements are convertible toT |
Identical to the complexity ofc.append_range orranges::copy(rg,std::back_inserter(c)) (depending on what function is used internally).
| Feature-test macro | Value | Std | Feature |
|---|---|---|---|
__cpp_lib_containers_ranges | 202202L | (C++23) | Ranges-aware construction and insertion |
#include <initializer_list>#include <queue>#include <version>#ifdef __cpp_lib_format_ranges#include <print>usingstd::println;#else#define FMT_HEADER_ONLY#include <fmt/ranges.h>using fmt::println;#endif int main(){std::queue<int> adaptor;constauto rg={1,3,2,4}; #ifdef __cpp_lib_containers_ranges adaptor.push_range(rg);#elsefor(int e: rg) adaptor.push(e);#endif println("{}", adaptor);}
Output:
[1, 3, 2, 4]
| inserts element at the end (public member function)[edit] |