Skip to content

Storage

Storage<T> is a storage template class which can handle any type T of values. It wraps around the std::vector for consistency of interface with other storages.

Constructors

cpp
Storage();

Default constructor. Creates empty storage.

cpp
Storage(const Storage<T>& rhs);

Copy constructor. Initializes current storage with the copy of the rhs.

cpp
void Allocate(const size_t size_in);

Allocates storage to the given size_in.

cpp
void Reallocate(const size_t new_size);

Reallocates storage to the new_size. Erases old data.

Data access and manipulation

cpp
Storage<T>& operator=(const Storage<T>& rhs);

Assignment operator. Assigns the content of the rhs to the current Storage.

cpp
T& operator[](const size_t idx);

Random access operator. Returns the reference to the value pointed to by the idx.

cpp
T const& operator[](const size_t idx) const;

Random access operator. Returns const reference to the value pointed to by the idx.

Container properties

cpp
size_t size() const;

Returns storage size.

cpp
bool IsAllocated() const;

Returns true if storage is allocated.

cpp
bool IsNotAllocated() const;

Returns true if storage is not allocated.

Released under the GNU GPLv3 License.