cubos::core::memory namespace

Memory module.

Classes

class AnyValue
Stores a blob of a given reflected type.
class AnyVector
Stores a dynamically sized array of blobs of a given reflected type.
class BufferStream
Stream implementation which writes to/reads from a buffer.
template<typename R, typename... Ts>
class Function<R(Ts...)>
Generic function pointer which can also store capturing lambda functions.
template<typename T, typename Lock>
class ReadGuard
Provides safe read-only access to an object using a lock.
template<typename T, typename Lock>
class WriteGuard
Provides safe read-write access to an object using a lock.
template<typename T>
struct RemoveReference
Provides a type which is the same as the given type, but without any references.
template<typename T>
struct IsLValueReference
Used to check if a type is an rvalue reference.
template<typename T>
class Opt
Wrapper for reference types to indicate that the given argument type is optional.
class StandardStream
Stream implementation which wraps a libc file pointer.
class Stream
Interface class for memory streams. Abstracts away sources or destinations of data.
template<typename V>
class TypeMap
A map that stores values of type V, using reflection types as keys.
template<typename L, typename R, typename LHash = std::hash<L>, typename RHash = std::hash<R>>
class UnorderedBimap
A bidirectional hash table.

Enums

enum class SeekOrigin { Begin, Current, End }
Stream seek origin.

Functions

template<typename T>
auto swapBytes(T value) -> T
Swaps the bytes of a value, changing its endianness.
auto isLittleEndian() -> bool
Checks if the current platform is little endian.
template<typename T>
auto fromLittleEndian(T value) -> T
Converts a value from little endianness to local endianness.
template<typename T>
auto toLittleEndian(T value) -> T
Converts a value from local endianness to little endianness.
template<typename T>
auto fromBigEndian(T value) -> T
Converts a value from big endianness to local endianness.
template<typename T>
auto toBigEndian(T value) -> T
Converts a value from local endianness to big endianness.
template<typename T>
auto move(T&& value) -> RemoveReference<T>::Type&& noexcept
Returns an R-value reference to the given value.
template<typename T>
auto forward(typename RemoveReference<T>::Type& argument) -> T&& noexcept
Used to cast a templated function parameter to the value category the caller used to pass it, which allows rvalues to be passed as rvalues and lvalues as lvalues.
template<typename T>
auto forward(typename RemoveReference<T>::Type&& argument) -> T&& noexcept
Used to cast a templated function parameter to the value category the caller used to pass it, which allows rvalues to be passed as rvalues and lvalues as lvalues.

Function documentation

template<typename T>
T&& cubos::core::memory::forward(typename RemoveReference<T>::Type&& argument) noexcept

Used to cast a templated function parameter to the value category the caller used to pass it, which allows rvalues to be passed as rvalues and lvalues as lvalues.

Template parameters
T Argument type.
Parameters
argument Argument to forward.
Returns Forwarded argument.