An unowned array wrapper - a mutable "view" of something else, that cannot be resized. Construction parameters are referenced directly, and no copies of data are ever taken / made. This also means you should take care to ensure referred-to data outlives any uarray. Following that, uarrays should probably only ever exist on the stack.
More...
#include <misc.h>
|
| | uarray (std::vector< T > &source) |
| | Construct from a mutable vector. More...
|
| |
| | uarray (const std::vector< typename std::remove_const_t< T >> &source) |
| | Construct a read-only uarray from a const-qualified vector. More...
|
| |
| | uarray (T *buffer, std::size_t length) |
| | Construct from a possibly cv-qualified source More...
|
| |
| | uarray (T *begin, T *end) |
| | Construct from a possibly cv-qualified iterator pair More...
|
| |
| T & | operator[] (std::size_t index) |
| | Access a potential read-only element at index More...
|
| |
| const T & | operator[] (std::size_t index) const |
| | Access a read-only element at index More...
|
| |
| T * | begin () noexcept |
| | Returns an iterator to the beginning of the array pointed to More...
|
| |
| const T * | begin () const noexcept |
| | Returns a const iterator to the beginning of the array pointed to More...
|
| |
| T * | end () noexcept |
| | Returns an iterator pointing to 1 element past the end of the array pointed to More...
|
| |
| const T * | end () const noexcept |
| | Returns a const iterator pointing to 1 element past the end of the array pointed to More...
|
| |
| T * | data () noexcept |
| | Retrieve a raw pointer to the array pointed to More...
|
| |
| const T * | data () const noexcept |
| | Retrieve a const raw pointer to the array pointed to More...
|
| |
| std::size_t | size () const noexcept |
| | Returns the size of the array pointed to by this uarray More...
|
| |
| uarray< T > | slice (std::size_t offset, std::size_t newLength=-1) noexcept |
| | Returns a new, constant uarray formed from a slice of the original. More...
|
| |
| template<typename Other > |
| std::enable_if< std::is_standard_layout< Other >::value &&!std::is_const< T >::value, uarray< Other > >::type | reinterpret () noexcept |
| |
| template<typename Other > |
| std::enable_if< std::is_standard_layout< Other >::value &&std::is_const< T >::value, uarray< const Other > >::type | reinterpret () const noexcept |
| |
| uarray< const T > | slice (std::size_t offset, std::size_t newLength=-1) const noexcept |
| | Returns a new, constant uarray formed from a slice of the original. More...
|
| |
| | operator uarray< const T > () const noexcept |
| | Implicit conversion operator to a const / read-only version of this uarray More...
|
| |
template<typename T>
struct ape::uarray< T >
An unowned array wrapper - a mutable "view" of something else, that cannot be resized. Construction parameters are referenced directly, and no copies of data are ever taken / made. This also means you should take care to ensure referred-to data outlives any uarray. Following that, uarrays should probably only ever exist on the stack.
- Template Parameters
-
| T | The source content type. Append const to the type for perfectly enforced read-only access to the contents. |
◆ value_type
◆ uarray() [1/4]
Construct from a mutable vector.
◆ uarray() [2/4]
template<typename T>
| ape::uarray< T >::uarray |
( |
const std::vector< typename std::remove_const_t< T >> & |
source | ) |
|
|
inline |
Construct a read-only uarray from a const-qualified vector.
◆ uarray() [3/4]
Construct from a possibly cv-qualified source
◆ uarray() [4/4]
Construct from a possibly cv-qualified iterator pair
◆ begin() [1/2]
Returns a const iterator to the beginning of the array pointed to
◆ begin() [2/2]
Returns an iterator to the beginning of the array pointed to
◆ data() [1/2]
Retrieve a const raw pointer to the array pointed to
◆ data() [2/2]
Retrieve a raw pointer to the array pointed to
◆ end() [1/2]
Returns a const iterator pointing to 1 element past the end of the array pointed to
◆ end() [2/2]
Returns an iterator pointing to 1 element past the end of the array pointed to
◆ operator uarray< const T >()
Implicit conversion operator to a const / read-only version of this uarray
◆ operator[]() [1/2]
Access a potential read-only element at index
◆ operator[]() [2/2]
template<typename T>
| const T& ape::uarray< T >::operator[] |
( |
std::size_t |
index | ) |
const |
|
inline |
Access a read-only element at index
◆ reinterpret() [1/2]
template<typename T>
template<typename Other >
| std::enable_if<std::is_standard_layout<Other>::value && std::is_const<T>::value, uarray<const Other> >::type ape::uarray< T >::reinterpret |
( |
| ) |
const |
|
inlinenoexcept |
◆ reinterpret() [2/2]
template<typename T>
template<typename Other >
| std::enable_if<std::is_standard_layout<Other>::value && !std::is_const<T>::value, uarray<Other> >::type ape::uarray< T >::reinterpret |
( |
| ) |
|
|
inlinenoexcept |
◆ size()
Returns the size of the array pointed to by this uarray
◆ slice() [1/2]
template<typename T>
| uarray<const T> ape::uarray< T >::slice |
( |
std::size_t |
offset, |
|
|
std::size_t |
newLength = -1 |
|
) |
| const |
|
inlinenoexcept |
Returns a new, constant uarray formed from a slice of the original.
- Parameters
-
| offset | How much to skip from the start |
| newLength | The length of the slice, starting from offset . The default value adopts the current length, and substract the offset (ie. the remaining). |
◆ slice() [2/2]
Returns a new, constant uarray formed from a slice of the original.
- Parameters
-
| offset | How much to skip from the start |
| newLength | The length of the slice, starting from offset . The default value adopts the current length, and substract the offset (ie. the remaining). |
The documentation for this struct was generated from the following file:
- C:/Code/ape/make/skeleton/includes/misc.h