Wraps a HeapBlock, but additionally provides a copy constructor and remembers its size. More...
Public Member Functions | |
CopyableHeapBlock ()=default | |
Creates an empty block. | |
CopyableHeapBlock (size_t numElementsIn) | |
Creates a block large enough to hold the specified number of elements. | |
CopyableHeapBlock (CopyableHeapBlock &&other) noexcept | |
Moves the contents of another block into this one. | |
CopyableHeapBlock (const CopyableHeapBlock &other) | |
Copies the contents of another block into this one. | |
CopyableHeapBlock & | operator= (CopyableHeapBlock &&other) noexcept |
Moves the contents of another block into this one. | |
CopyableHeapBlock & | operator= (const CopyableHeapBlock &other) noexcept |
Copies the contents of another block into this one. | |
ElementType * | data () |
Returns a pointer to the first element in the block. | |
const ElementType * | data () const |
Returns a pointer to the first element in the block. | |
size_t | size () const |
Returns the number of elements in the block. | |
bool | isEmpty () const |
Returns true if the size of the block is zero. | |
ElementType * | begin () |
Returns a pointer to the first element in the block. | |
const ElementType * | begin () const |
Returns a pointer to the first element in the block. | |
const ElementType * | cbegin () const |
Returns a pointer to the first element in the block. | |
ElementType * | end () |
Returns a pointer immediately after the last element in the block. | |
const ElementType * | end () const |
Returns a pointer immediately after the last element in the block. | |
const ElementType * | cend () const |
Returns a pointer immediately after the last element in the block. | |
ElementType & | operator[] (size_t index) |
Returns a reference to the element at the provided index. | |
const ElementType & | operator[] (size_t index) const |
Returns a reference to the element at the provided index. | |
Wraps a HeapBlock, but additionally provides a copy constructor and remembers its size.
This class is not intended for use as a general-purpose container - in most cases, a std::vector or juce::Array is a better choice. However, CopyableHeapBlock may be handy for optimisation in situations where the container elements don't need to be value-initialised and the container doesn't need to be resized.
|
default |
Creates an empty block.
Referenced by CopyableHeapBlock(), CopyableHeapBlock(), operator=(), and operator=().
|
explicit |
Creates a block large enough to hold the specified number of elements.
The contents of the block are unspecified, and must be written before they are first read.
|
noexcept |
Moves the contents of another block into this one.
References CopyableHeapBlock().
CopyableHeapBlock< ElementType, throwOnFailure >::CopyableHeapBlock | ( | const CopyableHeapBlock< ElementType, throwOnFailure > & | other | ) |
Copies the contents of another block into this one.
References CopyableHeapBlock().
|
noexcept |
Moves the contents of another block into this one.
References CopyableHeapBlock().
|
noexcept |
Copies the contents of another block into this one.
References CopyableHeapBlock().
ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::data | ( | ) |
Returns a pointer to the first element in the block.
Referenced by begin(), begin(), cbegin(), cend(), end(), end(), operator[](), and operator[]().
const ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::data | ( | ) | const |
Returns a pointer to the first element in the block.
size_t CopyableHeapBlock< ElementType, throwOnFailure >::size | ( | ) | const |
bool CopyableHeapBlock< ElementType, throwOnFailure >::isEmpty | ( | ) | const |
Returns true if the size of the block is zero.
References size().
ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::begin | ( | ) |
Returns a pointer to the first element in the block.
References data().
const ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::begin | ( | ) | const |
Returns a pointer to the first element in the block.
References data().
const ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::cbegin | ( | ) | const |
Returns a pointer to the first element in the block.
References data().
ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::end | ( | ) |
const ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::end | ( | ) | const |
const ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::cend | ( | ) | const |
ElementType & CopyableHeapBlock< ElementType, throwOnFailure >::operator[] | ( | size_t | index | ) |
Returns a reference to the element at the provided index.
References data().
const ElementType & CopyableHeapBlock< ElementType, throwOnFailure >::operator[] | ( | size_t | index | ) | const |
Returns a reference to the element at the provided index.
References data().