17#include <initializer_list>
78 Queue(
const std::initializer_list<T>& init_list);
151 [[nodiscard]] auto
empty() const ->
bool;
158 [[nodiscard]] auto
size() const ->
size_t;
172 void push(T&& value);
192 auto operator+=(const
Queue<T>& other) ->
Queue<T>&;
200 auto operator+=(const std::initializer_list<T>& init_list) ->
Queue<T>&;
207 friend auto operator==<T>(const
Queue<T>& queue1, const
Queue<T>& queue2) ->
bool;
212 friend auto operator< <T>(const
Queue<T>& queue1, const
Queue<T>& queue2) ->
bool;
220 for (
const auto& item : init_list)
222 container.push_back(item);
229 if (other.
size() >= 1)
231 for (
const auto& item : other.container)
233 container.push_back(item);
243 while (!container.empty())
245 container.pop_front();
248 for (
const auto& item : other.container)
250 container.push_back(item);
259 : container{ std::move(other.container) }
268 container = std::move(other.container);
277 return container.front();
283 return container.front();
289 return container.back();
295 return container.back();
301 return container.size() == 0;
307 return container.size();
313 container.push_back(value);
319 container.push_back(std::move(value));
325 container.pop_front();
333 std::swap(container, other.container);
340 for (
const auto& item : other.container)
361 while (!temp.
empty())
363 out << temp.
front() <<
' ';
382 return queue1.container == queue2.container;
413 return queue1.container < queue2.container;
constexpr auto operator==(const Array< T, N > &lhs, const Array< T, N > &rhs) noexcept(noexcept(*lhs.begin()== *rhs.begin())) -> bool
The relational operator compares two Array objects.
auto operator<<(std::ostream &out, const Array< T, N > &array) -> std::ostream &
Overloads operator to print all elements of Array.
Implements List using Node with pointer to adjacent elements as internal base.
auto operator=(const Queue< T > &other) -> Queue &
Constructs Queue using copy assignment.
void push(const_reference value)
Function add new element at the end of Queue.
auto empty() const -> bool
Function checks if container has no elements.
T & reference
Alias for reference to data type used in class.
void pop()
Function removes the first element of Queue.
auto back() -> reference
Function returns pointer to Queue last object.
void swap(Queue< T > &other) noexcept
Function swaps content of two Queue objects.
T value_type
Alias for data type used in class.
const T & const_reference
Alias for const reference to data type used in class.
friend auto operator==(const Queue< T > &queue1, const Queue< T > &queue2) -> bool
Forward friend declaration to access internal container comparison operator.
auto front() -> reference
Function returns pointer to Queue first object.
~Queue()=default
Destroy the Queue object.
friend auto operator<(const Queue< T > &queue1, const Queue< T > &queue2) -> bool
Forward friend declaration to access internal container comparison operator.
auto size() const -> size_t
Function returns Queue size.
Queue()=default
Construct a new Queue object.
auto operator+=(const Queue< T > &other) -> Queue< T > &
Function add range of elements at the end of Queue.
This file contains implementation of List class.
auto operator>(const List< T > &list1, const List< T > &list2) -> bool
The relational operator compares two List objects.
auto operator>=(const List< T > &list1, const List< T > &list2) -> bool
The relational operator compares two List objects.
auto operator<=(const List< T > &list1, const List< T > &list2) -> bool
The relational operator compares two List objects.
auto operator!=(const List< T > &list1, const List< T > &list2) -> bool
The relational operator compares two List objects.
auto operator<(const List< T > &list1, const List< T > &list2) -> bool
The relational operator compares two List objects.