std::vector<T> with the QVector-style member names the CDT kernel and plan model use.
More...
#include <meshkit/detail/storage.hpp>
Public Member Functions | |
| Vector ()=default | |
| Empty vector. | |
| Vector (const std::vector< T > &v) | |
| Copy the elements of a std::vector. | |
| Vector (std::vector< T > &&v) | |
| Take over the buffer of a std::vector without copying elements. | |
| decltype(auto) | first () |
| Reference to the first element (front()); the vector must not be empty. | |
| decltype(auto) | first () const |
| Read-only reference to the first element; the vector must not be empty. | |
| decltype(auto) | last () |
| Reference to the last element (back()); the vector must not be empty. | |
| decltype(auto) | last () const |
| Read-only reference to the last element; the vector must not be empty. | |
| const T * | constData () const |
| Read-only pointer to the contiguous elements (data()). | |
| Vector | mid (std::ptrdiff_t at, std::ptrdiff_t count=-1) const |
| Copy of a contiguous run of elements. | |
| void | prepend (const T &v) |
Insert a copy of v before the first element; linear in size(). | |
| void | append (const Vector &v) |
Append copies of all elements of v. | |
| Vector & | operator+= (const Vector &v) |
Append copies of all elements of v; same as append(const Vector &). | |
| Vector & | operator<< (const T &v) |
| Append one element. | |
| std::ptrdiff_t | size () const noexcept |
| Number of elements as a signed std::ptrdiff_t. | |
| bool | isEmpty () const |
| True when the vector holds no elements. | |
| void | append (const T &v) |
Append a copy of v (push_back). | |
| void | append (T &&v) |
Append v by move (push_back). | |
| T | takeLast () |
| Remove the last element and return it by move; the vector must not be empty. | |
| T | takeFirst () |
| Remove the first element and return it by move; linear in size(). | |
| void | removeLast () |
| Remove the last element (pop_back); the vector must not be empty. | |
| void | removeAt (int at) |
| Erase one element; the elements after it shift down by one. | |
| void | fill (const T &v) |
Assign v to every existing element; the size is unchanged. | |
| void | fill (const T &v, std::size_t size) |
Replace the contents with size copies of v (assign()). | |
| bool | contains (const T &v) const |
| Linear search with operator==. | |
std::vector<T> with the QVector-style member names the CDT kernel and plan model use.
Lets the same kernel code compile against StandardStorage and against QVector in the Qt storage. Storage, iterator and reference invalidation are those of std::vector, and there is no internal synchronization. size() hides std::vector::size() and returns a signed count. The element helpers (first(), last(), takeFirst(), takeLast(), removeLast(), removeAt()) keep std::vector's preconditions: they do not check for an empty vector or an out-of-range index.
| T | Element type. |
|
default |
Empty vector.
|
inline |
Copy the elements of a std::vector.
| [in] | v | Source; copied, not retained. |
|
inline |
Take over the buffer of a std::vector without copying elements.
| [in,out] | v | Source; left empty. |
|
inline |
Append a copy of v (push_back).
| [in] | v | Element to copy. |
|
inline |
Append copies of all elements of v.
| [in] | v | Source vector; must not be this vector (self-insertion through std::vector::insert is undefined behaviour). |
|
inline |
Append v by move (push_back).
| [in,out] | v | Element to move from. |
|
inline |
Read-only pointer to the contiguous elements (data()).
|
inline |
Linear search with operator==.
| [in] | v | Value to look for. |
v.
|
inline |
Assign v to every existing element; the size is unchanged.
| [in] | v | Value to copy. |
|
inline |
Replace the contents with size copies of v (assign()).
| [in] | v | Value to copy; must not refer to an element of this vector. |
| [in] | size | New element count. |
|
inline |
Reference to the first element (front()); the vector must not be empty.
|
inline |
Read-only reference to the first element; the vector must not be empty.
|
inline |
True when the vector holds no elements.
|
inline |
Reference to the last element (back()); the vector must not be empty.
|
inline |
Read-only reference to the last element; the vector must not be empty.
|
inline |
Copy of a contiguous run of elements.
| [in] | at | Zero-based start index; must be in [0, size()] (not clamped). |
| [in] | count | Number of elements; negative (the default -1) means up to the end. A run past the end is cut at size(). |
count is negative.
|
inline |
Append copies of all elements of v; same as append(const Vector &).
| [in] | v | Source vector; must not be this vector. |
|
inline |
Append one element.
| [in] | v | Element to copy. |
|
inline |
Insert a copy of v before the first element; linear in size().
| [in] | v | Element to copy. |
|
inline |
Erase one element; the elements after it shift down by one.
| [in] | at | Zero-based index in [0, size()); not checked. |
|
inline |
Remove the last element (pop_back); the vector must not be empty.
|
inlinenoexcept |
Number of elements as a signed std::ptrdiff_t.
|
inline |
Remove the first element and return it by move; linear in size().
The vector must not be empty.
|
inline |
Remove the last element and return it by move; the vector must not be empty.