81 template<typename InputIterator>
226 const T&
last() const noexcept;
288 std::ostream&
write(std::ostream& os,
bool inc_hex) const;
294 assert(!base_type::empty());
295 return *(base_type::end() - 1);
301 assert(!base_type::empty());
302 return *(base_type::end() - 1);
308 return !base_type::empty() &&
first() == t;
314 return !base_type::empty() &&
last() == t;
320 return base_type::at(i);
326 return base_type::at(i);
344 return base_type::at(i);
350 return base_type::at(i);
357 for (
const auto& x: *
this)
360 if (inc_hex && std::is_integral_v<T>)
363 for (
int i = 0; i <
sizeof(T); i++)
366 ((uint8_t*) &_x)[i] = ((uint8_t*) &x)[i];
368 os <<
" (" << std::hex <<
"0x" << _x <<
')';
371 if (&(*(base_type::end() - 1)) != &x)
376 return os << std::dec <<
'}';
389 return v.
write(os,
true);
406 operator int()
const;
408 const T& current()
const;
412 const T& operator++(
int);
414 const T& operator++();
420 _cur = _lower = start;
451template<
typename InputIterator>
475 base_type::push_back(t);
477 return base_type::size() - 1;
484 base_type::push_back(t);
486 return base_type::size() - 1;
493 base_type::push_back(t);
501 base_type::push_back(std::move(t));
508 base_type::insert(base_type::begin(), t);
515 base_type::insert(base_type::begin(), std::move(t));
523 auto index = base_type::size();
525 base_type::insert(base_type::end(), tv.begin(), tv.end());
533 if (index > base_type::size())
537 if (index == base_type::size())
539 base_type::insert(base_type::end(), t);
543 base_type::insert(base_type::begin() + index, t);
552 if (index > base_type::size())
556 if (index == base_type::size())
558 base_type::insert(base_type::end(), t);
562 base_type::insert(base_type::begin() + index, t);
571 if (index >= base_type::size())
575 base_type::erase(base_type::begin() + index, base_type::begin() + index + 1);
582 return base_type::empty();
588 base_type::erase(base_type::begin(), base_type::end());
594 for (
size_type i = 0; i < base_type::size(); ++i)
596 if (base_type::at(i) == t)
598 base_type::erase(base_type::begin() + i, base_type::begin() + i + 1);
608 base_type::erase(base_type::begin() + start, base_type::end() + ((stop >= base_type::size()) ? (base_type::size() - 1) : stop));
614 for (
size_type i = 0; i < base_type::size(); ++i)
616 if (base_type::at(i) == t)
627 return base_type::size();
633 assert(!base_type::empty());
634 return *base_type::begin();
640 static_assert(!base_type::empty());
641 return *base_type::begin();
647 _vector =
const_cast<base_t*
>(&v);
648 restart(0, _vector->size());
655 restart(start, stop);
661 return _cur < _upper;
667 return (*_vector)[_cur];
673 return (*_vector)[_cur];
679 const T& temp = current();
694 restart(_lower, _upper);
Counted vector having function names compatible with Borland C++ templates.
Definition TVector.h:398
void restart(unsigned start, unsigned stop)
Definition TVector.h:418
TIterator(const base_t &v)
Definition TVector.h:645
std::vector< T > base_t
Definition TVector.h:400
void restart()
Definition TVector.h:692
const T & operator++()
Definition TVector.h:685
const T & current() const
Definition TVector.h:665
Counted vector having additional methods and operators for ease of usage.
Definition TVector.h:25
base_type::size_type size_type
Size type of this template.
Definition TVector.h:34
T & first()
Gets the first element of the vector.
Definition TVector.h:631
TVector(TVector &&) noexcept=default
Move constructor.
TVector & operator=(const TVector &v) noexcept
Assignment operator.
Definition TVector.h:437
std::vector< T > base_type
Base type of this template .
Definition TVector.h:30
TVector & append(const T &t)
Appends an entry to the vectors items at the end of the vector.
Definition TVector.h:490
bool detachAt(size_type index)
Removes specific item from the list by index.
Definition TVector.h:568
T & get(size_type i)
Gets entry from index position.
Definition TVector.h:318
bool endsWith(T t) const
Checks if the last element is of the passed value.
Definition TVector.h:312
base_type::value_type value_type
Value type contained by this vector template.
Definition TVector.h:38
const iter_type const_iter_type
Iteration const type of the template.
Definition TVector.h:46
bool isEmpty() const
Returns true when empty false otherwise.
Definition TVector.h:580
bool addAt(const T &t, size_type index)
Adds an item at index position.
Definition TVector.h:530
static const size_t npos
Value returned by various member functions when they fail.
Definition TVector.h:51
size_type find(const T &) const
Finds an entry by instance in the vector.
Definition TVector.h:612
TVector(const TVector &v)
Copy constructor.
Definition TVector.h:432
std::ostream & write(std::ostream &os, bool inc_hex) const
Definition TVector.h:354
TVector()=default
Default constructor.
void flush()
Removes all entries from the vector.
Definition TVector.h:586
bool startsWith(T t) const
Checks if the first element is of the passed value.
Definition TVector.h:306
size_type add(const T &t)
Adds item at the end of the vector.
Definition TVector.h:472
base_type getBase()
Returns the base type to access it methods explicitly.
Definition TVector.h:330
bool detach(const T &t)
Removes specific item from the list by instance. Uses the compare operator from type T to find it.
Definition TVector.h:592
TIterator< value_type > iter_type
Iteration type of the template.
Definition TVector.h:42
T & last()
Gets the last element of the vector.
Definition TVector.h:292
size_type count() const
Returns the amount of entries in the vector.
Definition TVector.h:625
T & operator[](size_type i)
Array operator Array operator needs reimplementation using std::vector::at() which does a range check...
Definition TVector.h:342
TVector & prepend(const T &t)
Prepends an entry to the vectors items at the beginning of the vector.
Definition TVector.h:506
Definition Application.h:10
_GII_FUNC std::ostream & operator<<(std::ostream &os, const ResultData &)
Stream operator for the setup std::string.