raisim::DynamicArray
class · #include <raisim/math.hpp>
Derived by: raisim::MatDyn, raisim::VecDyn
Owning heap buffer of doubles; the common base of VecDyn and MatDyn.
On Linux and macOS the buffer is 32-byte aligned. Copy construction and copy assignment of this base class deliberately do not copy the data (the copy constructor leaves the new object empty, copy assignment is a no-op); VecDyn and MatDyn implement their own deep copies. Moving transfers ownership of the buffer.
Constructors & destructor
DynamicArray
DynamicArray() = defaultDynamicArray(const DynamicArray &)Does not copy the data: the new array is empty. Derived classes implement the deep copy.
DynamicArray(DynamicArray &&other) noexceptTakes ownership of other's buffer and leaves other empty.
Parameters
| Parameter | Description |
|---|---|
other (in, out) | array to move from |
~DynamicArray
~DynamicArray()Public member functions
operator=
DynamicArray &operator=(const DynamicArray &)No-op: the data is not copied. Derived classes implement the deep copy.
Returns *this
DynamicArray &operator=(DynamicArray &&other) noexceptReleases this buffer, then takes ownership of other's buffer and leaves other empty.
Parameters
| Parameter | Description |
|---|---|
other (in, out) | array to move from |
Returns *this
ElementRef<DynamicArray> operator=(double a)Starts an Eigen-style comma initializer, e.g. array = 1., 2., 3.;, which writes consecutive elements. The buffer must already hold enough elements; no bounds check is done.
Parameters
| Parameter | Description |
|---|---|
a (in) | value of the first element |
Returns proxy that receives the following elements
ptr
double *ptr()Returns pointer to the first element.
const double *ptr() constReturns pointer to the first element.
data
double *data()Returns pointer to the first element (Eigen-compatible name).
const double *data() constReturns pointer to the first element (Eigen-compatible name).
operator[]
double operator[](size_t i) constParameters
| Parameter | Description |
|---|---|
i (in) | element index |
Returns element i (no bounds check).
double &operator[](size_t i)Parameters
| Parameter | Description |
|---|---|
i (in) | element index |
Returns reference to element i (no bounds check).
Public attributes
v
double *vRaw data pointer (nullptr until allocated).