4#ifndef _Stroika_Foundation_Containers_Queue_h_
5#define _Stroika_Foundation_Containers_Queue_h_ 1
7#include "Stroika/Foundation/StroikaPreComp.h"
10#include "Stroika/Foundation/Containers/Common.h"
38 using Traversal::IInputIterator;
39 using Traversal::IIterableOfTo;
40 using Traversal::Iterable;
41 using Traversal::Iterator;
126 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
127 requires (not derived_from<remove_cvref_t<ITERABLE_OF_ADDABLE>,
Queue<T>>)
128 explicit
Queue (ITERABLE_OF_ADDABLE&& src)
129#if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
133 _AssertRepValidType ();
137 template <IInputIterator<T> ITERATOR_OF_ADDABLE>
138 Queue (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&&
end);
141 explicit Queue (shared_ptr<_IRep>&& rep)
noexcept;
142 explicit Queue (
const shared_ptr<_IRep>& rep)
noexcept;
147 nonvirtual
Queue& operator= (
Queue&&) noexcept = default;
148 nonvirtual
Queue& operator= (const
Queue&) = default;
178 nonvirtual T
front () const;
183 nonvirtual optional<
value_type> HeadIf () const;
237 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
239 template <IInputIterator<T> ITERATOR_OF_ADDABLE>
240 nonvirtual
void AddAllToTail (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&&
end);
254 nonvirtual
void clear ();
260 template <typename T_EQUALS_COMPARER = equal_to<T>>
266 template <typename ELEMENT_COMPARER = compare_three_way>
273 nonvirtual
bool operator== (const
Queue& rhs) const
274 requires (equality_comparable<T>);
280 nonvirtual auto operator<=> (const
Queue& rhs) const
281 requires (three_way_comparable<T>);
286 template <typename T2>
287 using _SafeReadRepAccessor = typename
inherited::template _SafeReadRepAccessor<T2>;
292 template <typename T2>
293 using _SafeReadWriteRepAccessor = typename
inherited::template _SafeReadWriteRepAccessor<T2>;
296 nonvirtual
void _AssertRepValidType () const noexcept;
305 template <typename T>
314 virtual ~_IRep () =
default;
317 virtual shared_ptr<_IRep> CloneEmpty ()
const = 0;
318 virtual void AddTail (ArgByValueType<value_type> item) = 0;
322 virtual optional<value_type> HeadIf ()
const = 0;
Implementation detail for Queue<T> implementors.
A Queue is a first-in-first-out (FIFO) data structure, where elements are arranged in well-ordered fa...
nonvirtual value_type Head() const
nonvirtual T front() const
nonvirtual void AddAllToTail(ITERABLE_OF_ADDABLE &&s)
nonvirtual void push_back(ArgByValueType< value_type > item)
Add the given item to the end of the Q, so it will be removed last of all the items currently in the ...
nonvirtual void RemoveAll()
nonvirtual value_type Dequeue()
Alias for RemoveHead () - remove item from the head of the Q (line).
nonvirtual optional< value_type > RemoveHeadIf()
typename inherited::value_type value_type
typename Iterable< T >::template SequentialEqualsComparer< T_EQUALS_COMPARER > EqualsComparer
Simply indirect to @Iterable<T>::SequentialEqualsComparer.
nonvirtual value_type RemoveHead()
nonvirtual void Enqueue(ArgByValueType< value_type > item)
add item to the end of the Q (line).
nonvirtual void AddTail(ArgByValueType< value_type > item)
nonvirtual void clear()
STL-ish alias for RemoveAll ().
nonvirtual value_type pop_back()
Implementation detail for iterator implementors.
Iterable<T> is a base class for containers which easily produce an Iterator<T> to traverse them.
T value_type
value_type is an alias for the type iterated over - like vector<T>::value_type
static constexpr default_sentinel_t end() noexcept
Support for ranged for, and STL syntax in general.
conditional_t<(sizeof(CHECK_T)<=2 *sizeof(void *)) and is_trivially_copyable_v< CHECK_T >, CHECK_T, const CHECK_T & > ArgByValueType
This is an alias for 'T' - but how we want to pass it on stack as formal parameter.