tmp/tmp1bk1f34e/{from.md → to.md}
RENAMED
|
@@ -7,49 +7,49 @@ particular, `list` [[list]] and `deque` [[deque]] can be used.
|
|
| 7 |
``` cpp
|
| 8 |
namespace std {
|
| 9 |
template<class T, class Container = deque<T>>
|
| 10 |
class queue {
|
| 11 |
public:
|
| 12 |
-
using value_type =
|
| 13 |
-
using reference =
|
| 14 |
-
using const_reference =
|
| 15 |
-
using size_type =
|
| 16 |
using container_type = Container;
|
| 17 |
|
| 18 |
protected:
|
| 19 |
Container c;
|
| 20 |
|
| 21 |
public:
|
| 22 |
-
queue() : queue(Container()) {}
|
| 23 |
-
explicit queue(const Container&);
|
| 24 |
-
explicit queue(Container&&);
|
| 25 |
-
template<class InputIterator> queue(InputIterator first, InputIterator last);
|
| 26 |
-
template<container-compatible-range<T> R> queue(from_range_t, R&& rg);
|
| 27 |
-
template<class Alloc> explicit queue(const Alloc&);
|
| 28 |
-
template<class Alloc> queue(const Container&, const Alloc&);
|
| 29 |
-
template<class Alloc> queue(Container&&, const Alloc&);
|
| 30 |
-
template<class Alloc> queue(const queue&, const Alloc&);
|
| 31 |
-
template<class Alloc> queue(queue&&, const Alloc&);
|
| 32 |
template<class InputIterator, class Alloc>
|
| 33 |
-
queue(InputIterator first, InputIterator last, const Alloc&);
|
| 34 |
template<container-compatible-range<T> R, class Alloc>
|
| 35 |
-
queue(from_range_t, R&& rg, const Alloc&);
|
| 36 |
|
| 37 |
-
|
| 38 |
-
size_type size() const { return c.size(); }
|
| 39 |
-
reference front() { return c.front(); }
|
| 40 |
-
const_reference front() const { return c.front(); }
|
| 41 |
-
reference back() { return c.back(); }
|
| 42 |
-
const_reference back() const { return c.back(); }
|
| 43 |
-
void push(const value_type& x) { c.push_back(x); }
|
| 44 |
-
void push(value_type&& x) { c.push_back(std::move(x)); }
|
| 45 |
-
template<container-compatible-range<T> R> void push_range(R&& rg);
|
| 46 |
template<class... Args>
|
| 47 |
-
decltype(auto) emplace(Args&&... args)
|
| 48 |
{ return c.emplace_back(std::forward<Args>(args)...); }
|
| 49 |
-
void pop() { c.pop_front(); }
|
| 50 |
-
void swap(queue& q) noexcept(is_nothrow_swappable_v<Container>)
|
| 51 |
{ using std::swap; swap(c, q.c); }
|
| 52 |
};
|
| 53 |
|
| 54 |
template<class Container>
|
| 55 |
queue(Container) -> queue<typename Container::value_type, Container>;
|
|
|
|
| 7 |
``` cpp
|
| 8 |
namespace std {
|
| 9 |
template<class T, class Container = deque<T>>
|
| 10 |
class queue {
|
| 11 |
public:
|
| 12 |
+
using value_type = Container::value_type;
|
| 13 |
+
using reference = Container::reference;
|
| 14 |
+
using const_reference = Container::const_reference;
|
| 15 |
+
using size_type = Container::size_type;
|
| 16 |
using container_type = Container;
|
| 17 |
|
| 18 |
protected:
|
| 19 |
Container c;
|
| 20 |
|
| 21 |
public:
|
| 22 |
+
constexpr queue() : queue(Container()) {}
|
| 23 |
+
constexpr explicit queue(const Container&);
|
| 24 |
+
constexpr explicit queue(Container&&);
|
| 25 |
+
template<class InputIterator> constexpr queue(InputIterator first, InputIterator last);
|
| 26 |
+
template<container-compatible-range<T> R> constexpr queue(from_range_t, R&& rg);
|
| 27 |
+
template<class Alloc> constexpr explicit queue(const Alloc&);
|
| 28 |
+
template<class Alloc> constexpr queue(const Container&, const Alloc&);
|
| 29 |
+
template<class Alloc> constexpr queue(Container&&, const Alloc&);
|
| 30 |
+
template<class Alloc> constexpr queue(const queue&, const Alloc&);
|
| 31 |
+
template<class Alloc> constexpr queue(queue&&, const Alloc&);
|
| 32 |
template<class InputIterator, class Alloc>
|
| 33 |
+
constexpr queue(InputIterator first, InputIterator last, const Alloc&);
|
| 34 |
template<container-compatible-range<T> R, class Alloc>
|
| 35 |
+
constexpr queue(from_range_t, R&& rg, const Alloc&);
|
| 36 |
|
| 37 |
+
constexpr bool empty() const { return c.empty(); }
|
| 38 |
+
constexpr size_type size() const { return c.size(); }
|
| 39 |
+
constexpr reference front() { return c.front(); }
|
| 40 |
+
constexpr const_reference front() const { return c.front(); }
|
| 41 |
+
constexpr reference back() { return c.back(); }
|
| 42 |
+
constexpr const_reference back() const { return c.back(); }
|
| 43 |
+
constexpr void push(const value_type& x) { c.push_back(x); }
|
| 44 |
+
constexpr void push(value_type&& x) { c.push_back(std::move(x)); }
|
| 45 |
+
template<container-compatible-range<T> R> constexpr void push_range(R&& rg);
|
| 46 |
template<class... Args>
|
| 47 |
+
constexpr decltype(auto) emplace(Args&&... args)
|
| 48 |
{ return c.emplace_back(std::forward<Args>(args)...); }
|
| 49 |
+
constexpr void pop() { c.pop_front(); }
|
| 50 |
+
constexpr void swap(queue& q) noexcept(is_nothrow_swappable_v<Container>)
|
| 51 |
{ using std::swap; swap(c, q.c); }
|
| 52 |
};
|
| 53 |
|
| 54 |
template<class Container>
|
| 55 |
queue(Container) -> queue<typename Container::value_type, Container>;
|