A type-safe accessible collection of generic opaque pointers that can receive the buffer from outside (loan). More...
#include <LoanableTypedCollection.hpp>
Public Member Functions | |
template<typename Enabler = _NonConstEnabler> | |
std::enable_if< Enabler::value, T >::type & | operator[] (size_type n) |
Set an element of the sequence. | |
const T & | operator[] (size_type n) const |
Get an element of the sequence. | |
![]() | |
const element_type * | buffer () const |
Get the pointer to the elements buffer. | |
bool | has_ownership () const |
Get the ownership flag. | |
size_type | maximum () const |
Get the maximum number of elements currently allocated. | |
size_type | length () const |
Get the number of elements currently accessible. | |
bool | length (size_type new_length) |
Set the number of elements currently accessible. | |
bool | loan (element_type *buffer, size_type new_maximum, size_type new_length) |
Loan a buffer to the collection. | |
element_type * | unloan (size_type &maximum, size_type &length) |
Remove the loan from the collection. | |
element_type * | unloan () |
Remove the loan from the collection. | |
Additional Inherited Members | |
![]() | |
using | size_type = int32_t |
using | element_type = void * |
![]() | |
LoanableCollection ()=default | |
Default constructor. | |
virtual void | resize (size_type new_length)=0 |
![]() | |
size_type | maximum_ = 0 |
size_type | length_ = 0 |
element_type * | elements_ = nullptr |
bool | has_ownership_ = true |
A type-safe accessible collection of generic opaque pointers that can receive the buffer from outside (loan).
This is an abstract class. See LoanableSequence for details.
|
inline |
Set an element of the sequence.
This is the operator that is invoked when the application indexes into a non-const sequence:
Note that a reference to the element is returned (and not a copy)
[in] | n | index of element to access, must be >= 0 and less than length(). |
n
|
inline |
Get an element of the sequence.
This is the operator that is invoked when the application indexes into a const sequence:
Note that a reference to the element is returned (and not a copy)
[in] | n | index of element to access, must be >= 0 and less than length(). |