The ConstArray class provides functionality similar to std::vector, except that it does not construct or destruct elements, does not allow insertions or appending, and can use memory it does not own for storage. This is for performance reasons when initialization is not required. However, this makes it unsuitable for anything other than primitive datatypes or other structures movemable with a simple memcpy().
More...
#include <ConstArray.hpp>
template<typename T>
class sl::ConstArray< T >
The ConstArray class provides functionality similar to std::vector, except that it does not construct or destruct elements, does not allow insertions or appending, and can use memory it does not own for storage. This is for performance reasons when initialization is not required. However, this makes it unsuitable for anything other than primitive datatypes or other structures movemable with a simple memcpy().
- Template Parameters
-
◆ ConstArray() [1/5]
Create a new non-mutable array with a default value for each element.
- Parameters
-
| size | The size of the array. |
◆ ConstArray() [2/5]
Create a new non-owning array. If the pointer is null, then size must 0.
- Parameters
-
| ptr | The pointer. |
| size | The number of elements in the array. |
◆ ConstArray() [3/5]
Create a new constant array.
- Parameters
-
| ptr | The data to move into the array. |
| size | The size of the array. |
◆ ConstArray() [4/5]
Move constructor.
- Parameters
-
◆ ConstArray() [5/5]
Deleted copy-assignment operator.
- Parameters
-
◆ back()
Get the back of the array.
- Returns
- The last element.
◆ begin()
Get the beginning iterator.
- Returns
- The iterator/pointer.
◆ data()
Get the underlying memory.
- Returns
- The underlying memory.
◆ end()
Get the end iterator.
- Returns
- The iterator/pointer.
◆ front()
Get the front of the array.
- Returns
- The first element.
◆ operator=() [1/2]
Deleted assignment operator.
- Parameters
-
- Returns
- This array.
◆ operator=() [2/2]
Assignment operator (move).
- Parameters
-
| lhs | The array to assign (and destroy) to this one. |
- Returns
- This array.
◆ operator[]()
Get the element at the given index.
- Parameters
-
| index | The index of the element. |
- Returns
- A reference to the element.
◆ size()
Get the size of the underlying memory allocation.
- Returns
- The size of the memory allocation.
The documentation for this class was generated from the following file: