94 template<
typename InputIterator>
103 TVector(std::initializer_list<value_type> list)
202 return base_type::empty();
210 base_type::erase(base_type::begin(), base_type::end());
221 base_type::erase(base_type::begin() + start, base_type::end() + ((stop >= base_type::size()) ? (base_type::size() - 1) : stop));
238 return base_type::size();
247 assert(!base_type::empty());
248 return *base_type::begin();
255 inline const T&
first() const noexcept
257 static_assert(!base_type::empty());
258 return *base_type::begin();
267 assert(!base_type::empty());
268 return *(base_type::end() - 1);
275 inline const T&
last() const noexcept
277 assert(!base_type::empty());
278 return *(base_type::end() - 1);
286 return !base_type::empty() &&
first() == t;
294 return !base_type::empty() &&
last() == t;
305 return base_type::at(i);
316 return base_type::at(i);
349 return base_type::at(i);
362 return base_type::at(i);
371 std::ostream&
write(std::ostream& os,
bool inc_hex)
const;
378 for (
const auto& x: *
this)
381 if (inc_hex && std::is_integral<T>::value)
384 for (
int i = 0; i <
sizeof(T); i++)
386 ((uint8_t*) &_x)[i] = ((uint8_t*) &x)[i];
388 os <<
" (" << std::hex <<
"0x" << _x <<
')';
391 if (&(*(base_type::end() - 1)) != &x)
396 return os << std::dec <<
'}';
410 return v.
write(os,
true);
425 _vector =
const_cast<base_t*
>(&v);
437 return _cur < _upper;
442 return (*_vector)[_cur];
447 return (*_vector)[_cur];
470 _cur = _lower = start;
485 base_type::push_back(t);
487 return base_type::size() - 1;
494 base_type::push_back(t);
496 return base_type::size() - 1;
503 base_type::push_back(t);
511 base_type::push_back(std::move(t));
519 auto index = base_type::size();
521 base_type::insert(base_type::end(), tv.begin(), tv.end());
529 if (index > base_type::size())
533 if (index == base_type::size())
535 base_type::insert(base_type::end(), t);
539 base_type::insert(base_type::begin() + index, t);
548 if (index > base_type::size())
552 if (index == base_type::size())
554 base_type::insert(base_type::end(), t);
558 base_type::insert(base_type::begin() + index, t);
567 if (index >= base_type::size())
571 base_type::erase(base_type::begin() + index, base_type::begin() + index + 1);
578 for (
size_type i = 0; i < base_type::size(); i++)
580 if (base_type::at(i) == t)
582 base_type::erase(base_type::begin() + i, base_type::begin() + i + 1);
592 for (
size_type i = 0; i < base_type::size(); i++)
594 if (base_type::at(i) == t)
Counted vector having function names compatible with Borland C++ templates.
Definition TVector.h:419
void restart(unsigned start, unsigned stop)
Definition TVector.h:468
TIterator(const base_t &v)
Definition TVector.h:423
std::vector< T > base_t
Definition TVector.h:421
void restart()
Definition TVector.h:463
T & current()
Definition TVector.h:445
const T & operator++()
Definition TVector.h:457
const T & operator++(int)
Definition TVector.h:450
const T & current() const
Definition TVector.h:440
TIterator(const base_t &v, size_t start, size_t stop)
Definition TVector.h:429
Counted vector having additional methods and operators for ease of usage.
Definition TVector.h:28
base_type::size_type size_type
Size type of this template.
Definition TVector.h:37
base_type getBase()
Returns the base type to access it methods explicitly.
Definition TVector.h:324
T & first()
Gets the first element of the vector.
Definition TVector.h:245
TVector(TVector &&) noexcept=default
Move constructor.
void flush(size_type stop, size_type start=0)
Removes specific range of entries from the vector.
Definition TVector.h:219
std::vector< T > base_type
Base type of this template .
Definition TVector.h:33
const T & last() const noexcept
Gets the last element of the vector.
Definition TVector.h:275
TVector< T > & append(const T &t)
Appends an entry to the vectors items at the end of the vector but returns itself.
Definition TVector.h:500
bool detachAt(size_type index)
Removes specific item from the list by index.
Definition TVector.h:564
T & get(size_type i)
Gets entry from index position.
Definition TVector.h:303
bool endsWith(T t) const
Checks if the last element is of the passed value.
Definition TVector.h:292
const T & operator[](size_type i) const
Const array operator.
Definition TVector.h:360
base_type::value_type value_type
Value type contained by this vector template.
Definition TVector.h:41
const iter_type const_iter_type
Iteration const type of the template.
Definition TVector.h:49
bool isEmpty() const
Returns true when empty false otherwise.
Definition TVector.h:200
bool addAt(const T &t, size_type index)
Adds an item at index position.
Definition TVector.h:526
static const size_t npos
Value returned by various member functions when they fail.
Definition TVector.h:54
size_type find(const T &) const
Finds an entry by instance in the vector.
Definition TVector.h:590
TVector(const TVector &v)
Copy constructor.
Definition TVector.h:64
std::ostream & write(std::ostream &os, bool inc_hex) const
Definition TVector.h:375
TVector()=default
Default constructor.
size_type add(T &&t)
Adds item at the end of the vector.
Definition TVector.h:491
TVector(std::initializer_list< value_type > list)
Initializing constructor using list like: TVector vect{1,2,3,4,5,6,7}
Definition TVector.h:103
void flush()
Removes all entries from the vector.
Definition TVector.h:208
const T & first() const noexcept
Gets the first element of the vector.
Definition TVector.h:255
TVector(InputIterator first, InputIterator last)
Initializing constructor using an iterator.
Definition TVector.h:95
size_type count() const
Returns the amount of entries in the vector.
Definition TVector.h:236
bool addAt(T &&t, size_type index)
Adds an item at index position.
Definition TVector.h:545
bool startsWith(T t) const
Checks if the first element is of the passed value.
Definition TVector.h:284
size_type add(const T &t)
Adds item at the end of the vector.
Definition TVector.h:482
TVector & operator=(TVector &&v) noexcept
Assignment move operator.
Definition TVector.h:85
TVector(const base_type &sv)
Copy constructor for base type.
Definition TVector.h:110
bool detach(const T &t)
Removes specific item from the list by instance.
Definition TVector.h:576
TVector< T > & append(T &&t)
Appends an entry to the vectors items at the end of the vector but returns itself.
Definition TVector.h:508
TIterator< value_type > iter_type
Iteration type of the template.
Definition TVector.h:45
size_type add(const TVector< T > &)
Adds the vectors items at the end of the vector.
Definition TVector.h:516
base_type getBase() const
Returns the constant const base type.
Definition TVector.h:334
TVector(size_type sz)
Initializing constructor.
Definition TVector.h:119
const T & get(size_type i) const
Const version of getting entry from index position.
Definition TVector.h:314
T & last()
Gets the last element of the vector.
Definition TVector.h:265
T & operator[](size_type i)
Array operator.
Definition TVector.h:347
Definition Application.h:11
_GII_FUNC std::ostream & operator<<(std::ostream &os, const ResultData &)
Stream operator for the setup std::string.