Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
TVector.h
Go to the documentation of this file.
1#pragma once
2#include <ostream>
3#include <vector>
4
5namespace sf
6{
7
8template<typename T>
10
17template<typename T>
18class TVector : public std::vector<T>
19{
20 public:
24 typedef std::vector<T> base_type;
28 typedef typename base_type::size_type size_type;
32 typedef typename base_type::value_type value_type;
41
45 static const size_t npos = static_cast<size_type>(-1);
46
50 TVector() = default;
51
55 TVector(const TVector& v);
56
60 TVector(TVector&&) noexcept = default;
61
65 TVector& operator=(const TVector& v) noexcept;
66
70 TVector& operator=(TVector&& v) noexcept;
71
75 template<typename InputIterator>
76 TVector(InputIterator first, InputIterator last);
77
82 TVector(std::initializer_list<value_type> list);
83
87 explicit TVector(const base_type& sv);
88
93 explicit TVector(size_type sz);
94
99 size_type add(const T& t);
100
106
111 TVector& append(const T& t);
112
118
123 TVector& prepend(const T& t);
124
130
136
143 bool addAt(const T& t, size_type index);
144
151 bool addAt(T&& t, size_type index);
152
159 bool detach(const T& t);
160
166 bool detachAt(size_type index);
167
172 [[nodiscard]] bool isEmpty() const;
173
177 void flush();
178
184 void flush(size_type stop, size_type start = 0);
185
190 size_type find(const T&) const;
191
196 [[nodiscard]] size_type count() const;
197
202 T& first();
203
208 const T& first() const noexcept;
209
214 T& last();
215
220 const T& last() const noexcept;
221
225 bool startsWith(T t) const;
226
230 bool endsWith(T t) const;
231
238
244 const T& get(size_type i) const;
245
251
257
264 T& operator[](size_type i);
265
273 const T& operator[](size_type i) const;
274
281 std::ostream& write(std::ostream& os, bool inc_hex) const;
282};
283
284}// namespace sf
285
286#ifndef __JETBRAINS_IDE__
287 // Include all inlined functions and template implementations.
288 #include <misc/gen/TVector.hpp>
289#endif
Definition TVector.h:9
base_type::size_type size_type
Definition TVector.h:28
TVector(TVector &&) noexcept=default
Move constructor.
std::vector< id_type > base_type
Definition TVector.h:24
bool detachAt(size_type index)
id_type & get(size_type i)
bool endsWith(id_type t) const
base_type::value_type value_type
Definition TVector.h:32
const iter_type const_iter_type
Definition TVector.h:40
bool addAt(const id_type &t, size_type index)
static const size_t npos
Definition TVector.h:45
TVector(const TVector &v)
Copy constructor.
std::ostream & write(std::ostream &os, bool inc_hex) const
TVector()=default
Default constructor.
TVector & prepend(const id_type &t)
size_type count() const
bool startsWith(id_type t) const
size_type add(const id_type &t)
bool detach(const id_type &t)
TIterator< value_type > iter_type
Definition TVector.h:36
size_type find(const id_type &) const
TVector & append(const id_type &t)
Definition Application.h:10