qxLib
|
Continuous 2d vector. More...
#include <vector2d.h>
Public Member Functions | |
vector2d (size_type rows, size_type cols, const_pointer pData=nullptr) | |
vector2d object constructor More... | |
vector2d (size_type rows, size_type cols, const_reference data) | |
vector2d object constructor More... | |
void | assign (vector2d &&other) noexcept |
Assign by moving from other vector. More... | |
void | assign (const vector2d &other) |
Assign by copying another vector. More... | |
void | assign (size_type rows, size_type cols, const_pointer pData=nullptr) |
Assign by size and data pointer. More... | |
void | assign (size_type rows, size_type cols, const_reference data) |
Assign by size and fill element. More... | |
bool | reserve (size_type nElements) |
Reserve vector size. More... | |
bool | resize (size_type rows, size_type cols) |
Resize vector. More... | |
bool | resize (size_type rows, size_type cols, const_reference data) |
Resize vector. More... | |
void | free () |
Clear vector and free memory. | |
void | fill (const_reference elem) |
Fill vector with element. More... | |
pointer | operator[] (size_type nRow) noexcept |
operator[] More... | |
const_pointer | operator[] (size_type nRow) const noexcept |
operator[] More... | |
const_reference | get (size_type nRow, size_type nCol) const noexcept |
Get element. More... | |
void | set (size_type nRow, size_type nCol, const_reference data) noexcept |
Set element. More... | |
size_type | rows () const noexcept |
Get num of rows in vector. More... | |
size_type | cols () const noexcept |
Get num of cols in vector. More... | |
size_type | size_x () const noexcept |
Get num of rows in vector. More... | |
size_type | size_y () const noexcept |
Get num of cols in vector. More... | |
size_type | capacity () const noexcept |
Get allocated size. More... | |
Continuous 2d vector.
Stores in memory like one big array and makes container cache friendly
T | - value type |
Definition at line 30 of file vector2d.h.
|
inline |
vector2d object constructor
rows | - num of rows in new vector |
cols | - num of cols in new vector |
pData | - data to copy, may be nullptr |
Definition at line 26 of file vector2d.inl.
|
inline |
vector2d object constructor
rows | - num of rows in new vector |
cols | - num of cols in new vector |
data | - element to fill in every vector cell |
Definition at line 32 of file vector2d.inl.
|
inline |
Assign by copying another vector.
other | - another vector |
Definition at line 67 of file vector2d.inl.
|
inline |
Assign by size and data pointer.
Data is being copied from pData with size rows * cols
rows | - num of rows in new vector |
cols | - num of cols in new vector |
pData | - data to copy, may be nullptr |
Definition at line 74 of file vector2d.inl.
|
inline |
Assign by size and fill element.
rows | - num of rows in new vector |
cols | - num of cols in new vector |
data | - element to fill in every vector cell |
Definition at line 81 of file vector2d.inl.
|
inlinenoexcept |
Assign by moving from other vector.
other | - other vector rvalue ref |
Definition at line 58 of file vector2d.inl.
|
inlinenoexcept |
|
inlinenoexcept |
Get num of cols in vector.
- | num of cols in vector |
Definition at line 191 of file vector2d.inl.
|
inline |
Fill vector with element.
elem | - element for filling |
Definition at line 154 of file vector2d.inl.
|
inlinenoexcept |
Get element.
nRow | - row number |
nCol | - col number |
- | element |
Definition at line 173 of file vector2d.inl.
|
inlinenoexcept |
operator[]
nRow | - row number |
- | row |
Definition at line 167 of file vector2d.inl.
|
inlinenoexcept |
operator[]
nRow | - row number |
- | row |
Definition at line 161 of file vector2d.inl.
|
inline |
Reserve vector size.
nElements | - num elements |
- | true if reserved successfully |
Definition at line 88 of file vector2d.inl.
|
inline |
Resize vector.
rows | - num of rows |
cols | - num of cols |
- | true if resized successfully |
Definition at line 106 of file vector2d.inl.
|
inline |
Resize vector.
If new size is bigger, new elements are not constructed If new size is smaller, truncated elements are destructed If ols cols != new cols, elements are moving from one col to another
rows | - num of rows in new vector |
cols | - num of cols in new vector |
data | - data to fill |
- | true if resized successfully |
Definition at line 134 of file vector2d.inl.
|
inlinenoexcept |
Get num of rows in vector.
- | num of rows in vector |
Definition at line 185 of file vector2d.inl.
|
inlinenoexcept |
Set element.
nRow | - row number |
nCol | - col number |
data | - element |
Definition at line 179 of file vector2d.inl.
|
inlinenoexcept |
Get num of rows in vector.
- | num of rows in vector |
Definition at line 197 of file vector2d.inl.
|
inlinenoexcept |
Get num of cols in vector.
- | num of cols in vector |
Definition at line 203 of file vector2d.inl.