|
| Data1D (size_t d_size) |
| Constructor which sets the initial size to d_size. More...
|
|
| Data1D (const Data1D< T > ©) |
| Copy constructor that copies all elements. More...
|
|
| Data1D (const std::initializer_list< T > &new_data) |
| Initializer list constructor, for initializing with bracketed data. More...
|
|
| Data1D (Data1D< T > &&other) |
| Move constructor that reassigns all the data to this Data1D. More...
|
|
| Data1D (size_t d_size, T *new_data, bool auto_delete=false) |
| Efficiently wraps in-place C-pointer data in a bounds-safe container. More...
|
|
void | Delete () |
| Delete all the elements and free all allocated memory.
|
|
| ~Data1D () |
| Deletes all contents upon destruction. More...
|
|
bool | IsEmpty () const |
| Returns true if there are no elements / the size is 0.
|
|
template<class T2 > |
size_t | Find (const T2 &elem, size_t start_at=0) const |
| Returns the first index at or after start_at for which the data equals elem. More...
|
|
template<class T2 > |
bool | Contains (const T2 &elem) const |
| Returns true if at least one entry equals elem.
|
|
bool | Check (const size_t x) const |
| Check if index x is in bounds. More...
|
|
void | Assert (const size_t x) const |
| Throws an ErrorMsgBounds exception if x is out of bounds. More...
|
|
void | Reserve (const size_t reserve_size) |
| Reserve storage without resizing the array. More...
|
|
void | Resize (const size_t resize_size) |
| Resize the array, reallocating if necessary. More...
|
|
void | SetOffset (const size_t new_offset) |
| Set a new offset position for index 0. More...
|
|
void | SetRange (const size_t new_offset, const size_t new_size) |
| Set a new offset and data size, resizing if necessary. More...
|
|
T * | Raw () const |
| Access a raw unprotected C-pointer to the enclosed data. More...
|
|
size_t | size () const |
| Returns the current number of elements.
|
|
size_t | TypeSize () const |
| Returns the size of this Data1D's type.
|
|
size_t | ByteSize () const |
| Returns the current size in bytes.
|
|
size_t | reserved () const |
| Returns the number of elements for which space is reserved.
|
|
size_t | ByteReserved () const |
| Returns the current allocated storage in bytes.
|
|
size_t | GetOffset () const |
| Returns the current offset for index 0. More...
|
|
Data1D | Copy (const size_t pos=0, const size_t amnt=npos) const |
| Creates a duplicate copy of the contents, with up to amnt elements from pos.
|
|
template<class T2 > |
Data1D & | CopyFrom (const Data1D< T2 > &other) |
| Copy data from any type with a compatible assignment operator. More...
|
|
template<class T2 > |
Data1D & | CopyFrom (const Data1D< T2 > &other, size_t pos, size_t num_elem=npos) |
| assignment operator. More...
|
|
template<class T2 > |
void | CopyAt (const size_t pos, const Data1D< T2 > &other) |
| Overwrite a range of data using all data from any compatible type, expanding if necessary. More...
|
|
template<class T2 > |
void | CopyAt (const size_t pos, const Data1D< T2 > &other, const size_t other_start, const size_t amnt=npos) |
| Overwrite a range of data from any compatible type, expanding if necessary. More...
|
|
void | CopyData (const size_t dest, const size_t source, const size_t amnt=npos) |
| Copy data from any location in this Data1D to another location, handling overlap automatically. More...
|
|
Data1D & | operator= (const Data1D &other) |
| Assignment operator which copies all contents from other, respecting offsets. More...
|
|
Data1D & | operator= (Data1D &&other) |
| Assignment operator which copies all contents from other, respecting offsets. More...
|
|
template<class T2 > |
Data1D< T2 > | Cast () |
| Returns a new array with all the elements of this array assigned to type T2. More...
|
|
template<class Conv > |
auto | CastWith (Conv converter) -> Data1D< decltype(converter(*data))> |
| Returns a new array with all the elements of this array converted to another type by converter.
|
|
template<class T2 > |
Data1D< T2 > | Reinterpret () const |
| Returns a new array with the raw data of this Data1D reinterpreted as type T2. More...
|
|
RAIter< Data1D< T >, T > | begin () |
| Copy data from any other object of a type with a compatible. More...
|
|
const RAIter< Data1D< T >, T > | begin () const |
| Const version of begin.
|
|
RAIter< Data1D< T >, T > | end () |
| Return a bounds-checked random-access iterator starting just past the last element. More...
|
|
const RAIter< Data1D< T >, T > | end () const |
| Const version end.
|
|
T & | operator[] (size_t x) |
| Bounds-checked access of the element at index x from the offset (default 0). More...
|
|
T & | operator() (size_t x) |
| Identical to Data1D::operator[].
|
|
const T & | operator[] (size_t x) const |
| Const version of Data1D::operator[].
|
|
const T & | operator() (size_t x) const |
| Const version of Data1D::operator[].
|
|
T & | At (size_t x) |
| Identical to Data1D::operator[].
|
|
const T & | At (size_t x) const |
| Const version of Data1D::operator[].
|
|
T & | Last () |
| Provides the last element. More...
|
|
const T & | Last () const |
| Const version of last()
|
|
void | Zero () |
| Sets all elements equal to 0. More...
|
|
void | ZeroRange (const size_t start, const size_t end=npos) |
| Like Zero() but operating only between index start and end, inclusive. More...
|
|
void | Sort () |
| Sorts the elements according to T::operator< in N*log2(N) time.
|
|
template<class Comparator > |
void | Sort (Comparator comp) |
| Sorts the elements according to the binary comparitor comp. More...
|
|
void | Shuffle () |
| Randomizes the order of all the elements. More...
|
|
void | URandShuffle () |
| Randomizes the order of all the elements using /dev/urandom. More...
|
|
T * | Extract () |
| Removes ownership of the contained data from the Data1D object. More...
|
|
void | Crop () |
| Reduces memory consumption to only that necessary for size() elements. More...
|
|
void | Clear () |
| Identical to Delete().
|
|
void | Append (const T &newT) |
| Add an element to the end, expanding if necessary. More...
|
|
template<class T2 > |
void | AppendFrom (const Data1D< T2 > &other) |
| Append data from any type with a compatible assignment operator. More...
|
|
void | Append (const Data1D &other) |
| Appends all elements in other to the end, expanding if necessary. More...
|
|
void | ExpandSet (size_t pos, const T &newT) |
| Assign newT to index pos, expanding if necessary to reach that index. More...
|
|
void | Insert (size_t pos, const T &newT) |
| Inserts newT at position pos, shifting the other elements. More...
|
|
void | Remove (size_t pos) |
| Removes the element at pos from the array, shrinking the size. More...
|
|
Data1D< T > & | operator+= (const T &newT) |
| Add an element to the end, expanding if necessary. More...
|
|
Data1D< T > & | operator+= (const Data1D &other) |
| Appends all elements in other to the end, expanding if necessary. More...
|
|
Data1D< T > | operator+ (const Data1D &other) const |
| Create a new array from this Data1D concatenated with other after it.
|
|
void | ToLilEndian () |
| Convert endianness of all elements if needed, for supported types.
|
|
void | FromLilEndian () |
| Convert endianness of all elements if needed, for supported types.
|
|
void | ToBigEndian () |
| Convert endianness of all elements if needed, for supported types.
|
|
void | FromBigEndian () |
| Convert endianness of all elements if needed, for supported types.
|
|
template<class AnyValidType > |
bool | operator== (const Data1D< AnyValidType > &other) const |
| Comparison operator for all elements. More...
|
|
template<class AnyValidType > |
bool | operator< (const Data1D< AnyValidType > &other) const |
| Returns true if the first different element for this is less than for other. More...
|
|
template<class AnyValidType > |
bool | operator!= (const AnyValidType &other) const |
| True if not equal.
|
|
template<class AnyValidType > |
bool | operator> (const AnyValidType &other) const |
| True if other is less than this object.
|
|
template<class AnyValidType > |
bool | operator<= (const AnyValidType &other) const |
| True if other is not less than this object.
|
|
template<class AnyValidType > |
bool | operator>= (const AnyValidType &other) const |
| True if this object is not less than other.
|
|
template<class T2 > |
void | Get (T2 &store_at, size_t index_T) const |
| Direct raw data extraction of type T2 at index. More...
|
|
template<class T2 > |
T2 | Get (size_t index_T=0) const |
| Identical to the Get which receives store_at, but this returns the extracted value.
|
|
template<class T2 > |
void | Get (Data1D< T2 > &store_at, size_t index_T=0) const |
| Fills the array store_at to its current size with raw assigned data of type T2 from this Data1D. More...
|
|
template<class T2 > |
Data1D< T > & | Put (const T2 &read_from, size_t index_T) |
| Direct raw data insertion of type T2 at index. More...
|
|
template<class T2 > |
Data1D< T > & | Put (const Data1D< T2 > &read_from, size_t index_T=0) |
| Like Get for a T2 type, but places sequential packed data. More...
|
|
template<class T>
class RC::Data1D< T >
A bounds-safe one-dimensional vector-like structure.
It provides efficient resizing and offsets, as well as convenience functions for assignments and comparisons. It also provides bounds-safe iterators. Note: Non-POD classes stored in Data1D containers must have a default constructor with default values or no arguments, which is necessary for efficient resizing. This requirement also permits safe use of offsets and temporary shrinking, because all allocated space contains defined data with properly constructed objects.
- See also
- Data2D
-
Data3D