![]() |
Vulpes
0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
|
#include <crs_map.hpp>
Public Types | |
| using | iterator = T* |
| Iterator for mutable access. | |
| using | const_iterator = const T* |
| Iterator for constant access. | |
Public Member Functions | |
| iterator | begin () |
| Returns an iterator pointing to the beginning of the storage. | |
| iterator | end () |
| Returns an iterator pointing to the end of the storage. | |
| const_iterator | begin () const |
| Returns a const iterator pointing to the beginning of the storage. | |
| const_iterator | end () const |
| Returns a const iterator pointing to the end of the storage. | |
| SmallVector () | |
| Default constructor. | |
| SmallVector (std::initializer_list< T > init_list) | |
| Constructor to initialize the vector with an initializer list. | |
| SmallVector (const T *begin, const T *end) | |
| void | push_back (const T &value) |
| Add an element to the end of the vector. | |
| template<typename... Args> | |
| void | emplace_back (Args &&... args) |
| Constructs an element in-place at the end of the vector. | |
| template<class InputIt> | |
| void | assign (InputIt first, InputIt last) |
| Assign the values in range [first, last) to the container. | |
| T & | operator[] (std::size_t index) |
| Access an element by index (mutable). | |
| const T & | operator[] (std::size_t index) const |
| Access an element by index (constant). | |
| constexpr std::size_t | size () const |
| Get the number of elements in the vector. | |
Private Types | |
| using | StaticStorage = std::array<T, N> |
| Static array for small sizes. | |
| using | DynamicStorage = std::vector<T> |
| Dynamic storage for larger sizes. | |
Private Attributes | |
| std::variant< StaticStorage, DynamicStorage > | m_storage |
| Variant storing either static or dynamic memory. | |
| std::size_t | m_size |
| Number of elements in the vector. | |
| T | The type of the elements to be stored. |
| N | The maximum size before switching to dynamic storage. |
This class behaves like a vector but uses coalesced memory for small sizes (up to N elements). Beyond that, it switches to dynamic memory.
| using vulpes::datastructure::SmallVector< T, N >::const_iterator = const T* |
Iterator for constant access.
|
private |
Dynamic storage for larger sizes.
| using vulpes::datastructure::SmallVector< T, N >::iterator = T* |
Iterator for mutable access.
|
private |
Static array for small sizes.
|
inline |
Default constructor.
|
inline |
Constructor to initialize the vector with an initializer list.
| init_list | List of elements to initialize the vector. |
|
inline |
|
inline |
Assign the values in range [first, last) to the container.
| InputIt | The iterator type. |
| first | The begin of the assign range. |
| last | The end of the assign range. |
|
inline |
Returns an iterator pointing to the beginning of the storage.
This function provides an iterator to the first element of the underlying storage, whether it's statically or dynamically allocated. The type of storage (either StaticStorage or DynamicStorage) is determined at runtime using std::variant.
|
inline |
Returns a const iterator pointing to the beginning of the storage.
This const-qualified version provides a constant iterator to the first element of the storage, ensuring that the data cannot be modified. It supports both StaticStorage and DynamicStorage.
|
inline |
Constructs an element in-place at the end of the vector.
This method constructs an element directly in the storage without the need for creating a temporary object, providing better performance in some cases.
| Args | Types of the arguments to forward to the constructor of T. |
| args | Arguments to forward to the constructor of T. |
|
inline |
Returns an iterator pointing to the end of the storage.
This function provides an iterator to one past the last element of the underlying storage. It ensures that the iterator points to the correct end, whether using StaticStorage or DynamicStorage.
|
inline |
Returns a const iterator pointing to the end of the storage.
This const-qualified version provides a constant iterator to the last element of the storage, ensuring that the data cannot be modified. It supports both StaticStorage and DynamicStorage.
|
inline |
Access an element by index (mutable).
| index | The index of the element to access. |
|
inline |
Access an element by index (constant).
| index | The index of the element to access. |
|
inline |
Add an element to the end of the vector.
| value | The value to be added. |
|
inlineconstexpr |
Get the number of elements in the vector.
|
private |
Number of elements in the vector.
|
private |
Variant storing either static or dynamic memory.