Wraps a HeapBlock, but additionally provides a copy constructor and remembers its size. More...
#include <juce_CopyableHeapBlock.h>
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.
|
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.
CopyableHeapBlock< ElementType, throwOnFailure >::CopyableHeapBlock | ( | const CopyableHeapBlock< ElementType, throwOnFailure > & | other | ) |
Copies the contents of another block into this one.
|
noexcept |
Moves the contents of another block into this one.
|
noexcept |
Copies the contents of another block into this one.
ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::data | ( | ) |
Returns a pointer to the first element in the block.
Referenced by CopyableHeapBlock< ElementType, throwOnFailure >::begin(), CopyableHeapBlock< ElementType, throwOnFailure >::begin(), CopyableHeapBlock< ElementType, throwOnFailure >::cbegin(), CopyableHeapBlock< ElementType, throwOnFailure >::cend(), CopyableHeapBlock< ElementType, throwOnFailure >::end(), CopyableHeapBlock< ElementType, throwOnFailure >::end(), CopyableHeapBlock< ElementType, throwOnFailure >::operator[](), and CopyableHeapBlock< ElementType, throwOnFailure >::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 |
Returns the number of elements in the block.
Referenced by CopyableHeapBlock< ElementType, throwOnFailure >::cend(), CopyableHeapBlock< ElementType, throwOnFailure >::end(), CopyableHeapBlock< ElementType, throwOnFailure >::end(), and CopyableHeapBlock< ElementType, throwOnFailure >::isEmpty().
bool CopyableHeapBlock< ElementType, throwOnFailure >::isEmpty | ( | ) | const |
Returns true if the size of the block is zero.
References CopyableHeapBlock< ElementType, throwOnFailure >::size().
ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::begin | ( | ) |
Returns a pointer to the first element in the block.
References CopyableHeapBlock< ElementType, throwOnFailure >::data().
const ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::begin | ( | ) | const |
Returns a pointer to the first element in the block.
References CopyableHeapBlock< ElementType, throwOnFailure >::data().
const ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::cbegin | ( | ) | const |
Returns a pointer to the first element in the block.
References CopyableHeapBlock< ElementType, throwOnFailure >::data().
ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::end | ( | ) |
Returns a pointer immediately after the last element in the block.
References CopyableHeapBlock< ElementType, throwOnFailure >::data(), and CopyableHeapBlock< ElementType, throwOnFailure >::size().
const ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::end | ( | ) | const |
Returns a pointer immediately after the last element in the block.
References CopyableHeapBlock< ElementType, throwOnFailure >::data(), and CopyableHeapBlock< ElementType, throwOnFailure >::size().
const ElementType * CopyableHeapBlock< ElementType, throwOnFailure >::cend | ( | ) | const |
Returns a pointer immediately after the last element in the block.
References CopyableHeapBlock< ElementType, throwOnFailure >::data(), and CopyableHeapBlock< ElementType, throwOnFailure >::size().
ElementType & CopyableHeapBlock< ElementType, throwOnFailure >::operator[] | ( | size_t | index | ) |
Returns a reference to the element at the provided index.
References CopyableHeapBlock< ElementType, throwOnFailure >::data().
const ElementType & CopyableHeapBlock< ElementType, throwOnFailure >::operator[] | ( | size_t | index | ) | const |
Returns a reference to the element at the provided index.
References CopyableHeapBlock< ElementType, throwOnFailure >::data().