Sane C++ Libraries: SC::Array< T, N (original) (raw)
A contiguous sequence of elements kept inside its inline storage. More...
#include <[Array.h](Array%5F8h%5Fsource.html)>

| Public Types | |
|---|---|
| using | Parent = Segment<detail::ArrayVTable<T, N>> |
| Public Member Functions | |
|---|---|
| Array (std::initializer_list< T > list) | |
| Array (const Array &other) | |
| Array (Array &&other) | |
| Array & | operator= (const Array &other) |
| Array & | operator= (Array &&other) |
| template | |
| Array (const Array< T, M > &other) | |
| template | |
| Array (Array< T, M > &&other) | |
| template | |
| Array & | operator= (const Array< T, M > &other) |
| template | |
| Array & | operator= (Array< T, M > &&other) |
| Array (Span< const T > span) | |
| template | |
| Array (Span< const U > span) | |
| template | |
| bool | contains (const U &value, size_t *index=nullptr) const |
| Check if the current array contains a given value. | |
| template | |
| bool | find (Lambda &&lambda, size_t *index=nullptr) const |
| Finds the first item in array matching criteria given by the lambda. | |
| template | |
| bool | removeAll (Lambda &&criteria) |
| Removes all items matching criteria given by Lambda. | |
| template | |
| bool | remove (const U &value) |
| Removes all values equal to value | |
template<typename T, int N>
struct SC::Array< T, N >
A contiguous sequence of elements kept inside its inline storage.
Template Parameters
| T | Type of single element of the Array |
|---|---|
| N | Number of elements contained inside this Array inline storage |
SC::Array is like a SC::Vector but it will only allow up to N elements in the array, using inline storage, without resorting to heap allocation.
Trying to push or insert more than N elements will fail.
Only up to SC::Array::size elements are valid (and N - [size()](structSC%5F1%5F1Segment.html#a3141efbbe65178600af0fc97cff59e77) are initialized).
SC_TRY(myVector.push_back(1));
SC_TRY(myVector.push_back(2));
SC_TRY(myVector.push_back(3));
(void)myVector.push_back(4);
SC_TRY(myVector.pop_back());
SC_TRY(myVector.pop_front());
SC_TRY(myVector.pop_front());
(void)myVector.pop_front();
console.print("Array<int, 3> is {}", myVector.isEmpty() ? "empty" : "not empty");
◆ contains()
template<typename T , int N>
template
| bool SC::Array< T, N >::contains ( const U & value, size_t * index = nullptr ) const | inlinenodiscard |
|---|
Check if the current array contains a given value.
See also
Algorithms::contains
◆ find()
template<typename T , int N>
template
| bool SC::Array< T, N >::find ( Lambda && lambda, size_t * index = nullptr ) const | inlinenodiscard |
|---|
Finds the first item in array matching criteria given by the lambda.
See also
Algorithms::findIf
◆ remove()
template<typename T , int N>
template
| bool SC::Array< T, N >::remove ( const U & value) | inlinenodiscard |
|---|
Removes all values equal to value
See also
Algorithms::removeIf
◆ removeAll()
template<typename T , int N>
template
| bool SC::Array< T, N >::removeAll ( Lambda && criteria) | inlinenodiscard |
|---|
Removes all items matching criteria given by Lambda.
See also
Algorithms::removeIf
The documentation for this struct was generated from the following file: