17#include <AUI/Traits/containers.h>
24template <
class StoredType,
25 class Allocator = std::allocator<StoredType>>
26class ADeque:
public std::deque<StoredType, Allocator>
29 using p = std::deque<StoredType, Allocator>;
33 using iterator =
typename p::iterator;
42 template<
typename OtherContainer>
43 iterator
insertAll(
const OtherContainer& c)
noexcept {
55 template<
typename OtherContainer>
56 iterator
insertAll(iterator at,
const OtherContainer& c)
noexcept {
57 return p::insert(at, c.begin(), c.end());
82 template<
typename OtherContainer>
91 bool contains(
const StoredType& value)
const noexcept {
114 p::push_back(std::move(rhs));
123 template<
typename OtherContainer, std::enable_if_t<!std::is_convertible_v<OtherContainer, StoredType>,
bool> = true>
140 AUI_ASSERTX(!p::empty(),
"empty container could not have the first element");
151 const StoredType&
first() const noexcept
153 AUI_ASSERTX(!p::empty(),
"empty container could not have the first element");
166 AUI_ASSERTX(!p::empty(),
"empty container could not have the last element");
177 const StoredType&
last() const noexcept
179 AUI_ASSERTX(!p::empty(),
"empty container could not have the last element");
188 size_t indexOf(
const StoredType& value)
const noexcept
194 void sort() noexcept {
195 std::sort(p::begin(), p::end());
198 template<
typename Comparator>
199 void sort(Comparator&& comparator)
noexcept {
200 std::sort(p::begin(), p::end(), std::forward<Comparator>(comparator));
220 template<
typename Predicate>
223 p::erase(std::remove_if(p::begin(), p::end(), std::forward<Predicate>(predicate)), p::end());
233inline std::ostream& operator<<(std::ostream& o,
const ADeque<T>& v) {
237 o <<
"[ " << v.
first();
238 for (
auto it = v.begin() + 1; it != v.end(); ++it) {
A std::deque with AUI extensions.
Definition: ADeque.h:27
StoredType & last() noexcept
Definition: ADeque.h:164
void removeAt(size_t index) noexcept
Definition: ADeque.h:211
self & operator<<(const OtherContainer &c) noexcept
Definition: ADeque.h:124
const StoredType & last() const noexcept
Definition: ADeque.h:177
bool contains(const StoredType &value) const noexcept
Definition: ADeque.h:91
self & operator<<(const StoredType &rhs) noexcept
Definition: ADeque.h:101
self & operator<<(StoredType &&rhs) noexcept
Definition: ADeque.h:112
iterator insertAll(iterator at, const OtherContainer &c) noexcept
Definition: ADeque.h:56
iterator insertAll(const OtherContainer &c) noexcept
Definition: ADeque.h:43
bool isSubsetOf(const OtherContainer &c) const noexcept
Definition: ADeque.h:83
void removeAll(const StoredType &item) noexcept
Definition: ADeque.h:65
void removeIf(Predicate &&predicate) noexcept
Definition: ADeque.h:221
const StoredType & first() const noexcept
Definition: ADeque.h:151
StoredType & first() noexcept
Definition: ADeque.h:138
size_t indexOf(const StoredType &value) const noexcept
Definition: ADeque.h:188
void removeFirst(const StoredType &item) noexcept
Definition: ADeque.h:74
A std::set with AUI extensions.
Definition: ASet.h:25
bool is_subset(LContainer &l, RContainer &r) noexcept
Definition: containers.h:233
bool contains(const Container &c, const typename Container::const_reference value) noexcept
Definition: containers.h:153
AOptional< std::size_t > remove_first(Container &container, typename Container::const_reference value) noexcept
Removes first occurrence of value.
Definition: containers.h:200
size_t index_of(const Container &c, const typename Container::const_reference value) noexcept
Finds the index of the first occurrence of the value.
Definition: containers.h:141
void remove_at(Container &c, size_t index) noexcept
Removes element at the specified index.
Definition: containers.h:128
void remove_all(Container &container, typename Container::const_reference value) noexcept
Removes all occurrences of value.
Definition: containers.h:172
#define AUI_ASSERTX(condition, what)
Asserts that the passed condition evaluates to true. Adds extra message string.
Definition: Assert.h:74