Utility¶
-
template<typename
T>
structttor::view¶ A non-owning view of a memory buffer.
A view if a pair (buffer, size) representing a view of a memory buffer. The view does not take ownership of the buffer; the user is responsible for the buffer to be valid anytime it is used through the view. A view’s pointer should always be aligned (so that
T *startcan be dereferenced).Public Functions
-
view(T *start, size_t size)¶ Creates a view.
- Pre
size >= 0- Pre
if
size > 0,startis a valid pointer of typeT*and can be dereferenced.- Parameters
[in] start: A pointer to the start of the buffer of elementT.startshould be aligned, so thatT *startis valid (unlesssize = 0).[in] size: The number of element of typeTin the buffer.
-
view()¶ Creates an empty view.
-
size_t
size() const¶ The size of the view.
- Return
The number of elements (of type
T) of the view.
-