50 template<
typename InputIterator>
51 TDeque(InputIterator first, InputIterator last)
59 TDeque(std::initializer_list<value_type> list)
126 return base_type::empty();
134 base_type::erase(base_type::begin(), base_type::end());
145 base_type::erase(base_type::begin() + start, base_type::end() + ((stop >= base_type::size()) ? (base_type::size() - 1) : stop));
162 return base_type::size();
173 return base_type::at(i);
184 return base_type::at(i);
207#pragma clang diagnostic push
208#pragma ide diagnostic ignored "HidingNonVirtualFunction"
220 return base_type::at(i);
233 return base_type::at(i);
236#pragma clang diagnostic pop
244 std::ostream&
write(std::ostream& os,
bool inc_hex)
const;
251 for (
const auto& x: *
this)
254 if (inc_hex && std::is_integral<T>::value)
256 os <<
" (" << std::hex <<
"0x" << x <<
')';
259 if (&(*(base_type::end() - 1)) != &x)
264 return os << std::dec <<
'}';
278 return v.
write(os,
true);
285 return std::distance(base_type::begin(), base_type::insert(base_type::end(), t));
292 return std::distance(base_type::begin(), base_type::insert(base_type::end(), tv.begin(), tv.end()));
299 if (index > base_type::size())
303 if (index == base_type::size())
305 base_type::insert(base_type::end(), t);
309 base_type::insert(base_type::begin() + index, t);
318 if (index >= base_type::size())
322 base_type::erase(base_type::begin() + index, base_type::begin() + index + 1);
329 for (
unsigned i = 0; i < base_type::size(); i++)
331 if (base_type::at(i) == t)
333 base_type::erase(base_type::begin() + i, base_type::begin() + i + 1);
343 for (
size_type i = 0; i < base_type::size(); i++)
345 if (base_type::at(i) == t)
Counted deque having additional methods and operators for ease of usage.
Definition TDeque.h:22
std::deque< T > base_type
Base type of this template .
Definition TDeque.h:27
void flush(size_type stop, size_type start=0)
Removes specific range of entries from the deque.
Definition TDeque.h:143
bool isEmpty() const
Returns true when empty false otherwise.
Definition TDeque.h:124
base_type::size_type size_type
Size type of this template.
Definition TDeque.h:31
size_type add(const T &)
Adds item at the end of the deque.
Definition TDeque.h:282
base_type getBase() const
Returns the constant const base type.
Definition TDeque.h:202
T & operator[](size_type i)
Array operator.
Definition TDeque.h:218
TDeque(std::initializer_list< value_type > list)
Initializing constructor using list like: TDeque que{1,2,3,4,5,6,7}
Definition TDeque.h:59
size_type count() const
Returns the amount of entries in the deque.
Definition TDeque.h:160
TDeque(size_type sz)
Initializing constructor.
Definition TDeque.h:75
base_type::value_type value_type
Value type contained by this deque template.
Definition TDeque.h:35
bool detachAt(size_type index)
Removes specific item from the list by index.
Definition TDeque.h:315
bool detach(const T &t)
Removes specific item from the list by instance.
Definition TDeque.h:327
const T & get(size_type i) const
Const version of getting entry from index position.
Definition TDeque.h:182
size_type find(const T &) const
Finds an entry by instance in the deque.
Definition TDeque.h:341
base_type getBase()
Returns the base type to access it methods explicitly.
Definition TDeque.h:192
std::ostream & write(std::ostream &os, bool inc_hex) const
Definition TDeque.h:248
TDeque(InputIterator first, InputIterator last)
Initializing constructor using an iterator.
Definition TDeque.h:51
const T & operator[](size_type i) const
Const array operator.
Definition TDeque.h:231
bool addAt(const T &t, size_type index)
Adds an item at index position.
Definition TDeque.h:296
void flush()
Removes all entries from the deque.
Definition TDeque.h:132
T & get(size_type i)
Gets entry from index position.
Definition TDeque.h:171
static const size_t npos
Value returned by various member functions when they fail.
Definition TDeque.h:40
TDeque()=default
Default constructor.
TDeque(const base_type &sv)
Copy constructor for base type.
Definition TDeque.h:66
Definition Application.h:10
_GII_FUNC std::ostream & operator<<(std::ostream &os, const ResultData &)
Stream operator for the setup std::string.