Block< T, STRIDED, MOVE > Class Template Reference

#include <block.h>

Inheritance diagram for Block< T, STRIDED, MOVE >:

Detailed Description

template<typename T, Bool STRIDED, Bool MOVE>
class maxon::Block< T, STRIDED, MOVE >

A Block stands for a number of elements with a regular memory layout. It consists of a pointer for the first element, the element count and optionally a stride. All elements are placed consecutively in memory, but with a possible padding inbetween: The stride is the pointer difference between consecutive elements in bytes. By default, the stride is just SIZEOF(T).

You can use an alternative stride length to access only specific elements of your array. For example if you have an array with XYZ vectors and want to access only the X-values as a block, you could use the pointer to the first X-value and a stride length of SIZEOF(Vector). Or for a Block whose elements are all the same, you can use a stride of 0 and a pointer to a single value.

There is an important difference between a Block and arrays such as BaseArray with respect to the meaning of a const Block: A const block can't be modified itself, so its pointer and length cannot be changed, but the memory to which the block points is still non-const (if #T is a non-const type). So you can modify the memory through a const block. In other words, a[13] = 42; is OK for a const Block<Int> a, but not for a const BaseArray<Int> a. Therefore you have to use Block<const Int> whenever the memory of the block shall be read-only. A typical case is an input parameter to a function such as

static Result<Int32> StringConversion::ToInt32(const Block<const Utf32Char>& str, STRINGCONVERSION flags);
PyCompilerFlags * flags
Definition: ast.h:14
static MAXON_METHOD Result< Int32 > ToInt32(const Block< const Utf32Char > &str, STRINGCONVERSION flags)
void * str
Definition: bytesobject.h:77
STRINGCONVERSION
Flags for the string to value conversion.
Definition: string.h:40

A Block supports the usual array functions which do not modify the length. Also it can be converted to the Array interface. If unsupported functions are invoked then, they will cause a DebugStop and indicate a failure on return.

Template Parameters
TType of elements of the block. If the memory must not be modified through this block, use a const type.
STRIDEDTrue if a stride other than SIZEOF(T) shall be supported.
MOVETrue if the values of this block shall be moved (only useful when used as a parameter type, see MoveBlock).
See also
$ref blocks

Classes

class  ResultFunctions
 

Public Types

using Super = ArrayBase< Block< T, STRIDED, MOVE >, T, BlockBase< T, STRIDED >, DefaultCompare >
 
using StrideType = typename std::conditional< GENERIC, Char, T >::type
 
using IsBlock = std::true_type
 
using Iterator = BaseIterator< Block, STRIDED >
 
using ConstIterator = BaseIterator< Block, STRIDED >
 
using SwapByteChar = typename std::conditional< std::is_same< const Byte, const T >::value, Char, Byte >::type
 
- Public Types inherited from Collection< COLLECTION, VALUETYPE, SUPER >
using Super = BaseCollection< COLLECTION, SUPER >
 
using ValueType = VALUETYPE
 
- Public Types inherited from BaseCollection< COLLECTION, SUPER >
using IsCollection = std::true_type
 
using IsBaseArray = std::false_type
 

Public Member Functions

 Block ()
 
 Block (T *ptr, Int size, Int stride=(STRIDED &&GENERIC) ? -1 :SIZEOF(StrideType))
 
 Block (Iterator start, Int size, Int stride=(STRIDED &&GENERIC) ? -1 :SIZEOF(StrideType))
 
template<Int N>
MAXON_IMPLICIT Block (T(&array)[N])
 
MAXON_IMPLICIT Block (const std::initializer_list< typename std::remove_const< T >::type > &list)
 
template<typename ANY , typename = typename std::enable_if<BYTE_BLOCK, ANY>::type>
 Block (ANY *ptr, Int size)
 
template<typename ANY , typename = typename std::enable_if<BYTE_BLOCK, ANY>::type>
 Block (const Block< ANY > &src)
 
template<typename ANY , Int N, typename = typename std::enable_if<BYTE_BLOCK, ANY>::type>
MAXON_IMPLICIT Block (ANY(&array)[N])
 
 Block (const Block &src)=default
 
Blockoperator= (const Block &src)=default
 
Result< void > CopyFrom (const Block &src)=delete
 
 operator ArrayImpl< Block & > ()=delete
 
 operator ArrayImpl< const Block & > () const =delete
 
Int GetStride () const
 
Bool IsStrided () const
 
void Set (T *ptr, Int size, Int stride=(STRIDED &&GENERIC) ? -1 :SIZEOF(StrideType))
 
void Reset ()
 
 operator typename std::conditional< STRIDED, DeleteReturnType01, Block< T, true, MOVE >>::type () const
 
 operator typename std::conditional< STRIDED||CONSTBLOCK, DeleteReturnType02, Block< const T, true, MOVE >>::type () const
 
 operator typename std::conditional< CONSTBLOCK, DeleteReturnType03, const Block< const T, STRIDED, MOVE > & >::type () const
 
 operator typename std::conditional< STRIDED||!MOVE, DeleteReturnType04, Block< T, true, false >>::type () const
 
 operator typename std::conditional< STRIDED||!MOVE||CONSTBLOCK, DeleteReturnType05, Block< const T, true, false >>::type () const
 
 operator typename std::conditional<!MOVE||CONSTBLOCK, DeleteReturnType06, const Block< const T, STRIDED, false > & >::type () const
 
 operator typename std::conditional<!MOVE, DeleteReturnType07, const Block< T, STRIDED, false > & >::type () const
 
 operator typename std::conditional< GENERIC, DeleteReturnType08, const Block< typename InheritConst< Generic, T >::type, STRIDED > & >::type () const
 
 operator typename std::conditional< BYTE_OR_CHAR, const Block< typename InheritConst< SwapByteChar, T >::type, STRIDED >, DeleteReturnType09 >::type & () const
 
 operator typename std::conditional< BYTE_OR_CHAR &&!CONSTBLOCK, const Block< const SwapByteChar, STRIDED >, const DeleteReturnType09 >::type & () const
 
T * GetFirst () const
 
void SetFirst (T *value)
 
T * GetLast () const
 
T & operator[] (Int index) const
 
Block Slice (Int start) const
 
Block Slice (Int start, Int end) const
 
Bool StartsWith (const Block &prefix) const
 
Bool EndsWith (const Block &suffix) const
 
Iterator Begin () const
 
Iterator End () const
 
Int GetCapacityCount () const
 
template<typename T2 , Bool S2, Bool M2>
Result< void > CopyValuesFrom (const Block< T2, S2, M2 > &other)
 
template<typename T2 , Bool S2, Bool M2>
Result< void > ConstructValuesFrom (const Block< T2, S2, M2 > &other)
 
template<typename COLLECTION >
Result< void > CopyValuesFrom (const COLLECTION &other)
 
Int GetMemorySize () const
 
Int GetBlock (Int index, Block< const T, false > &block) const
 
Int GetBlock (Int index, typename std::conditional< CONSTBLOCK, DeleteReturnType01, Block< T, false > & >::type block) const
 
Int GetBlock (Int index, typename std::conditional< CONSTBLOCK, DeleteReturnType02, StridedBlock< T > & >::type block) const
 
Int GetBlock (Int index, StridedBlock< const T > &block) const
 
UniqueHash GetUniqueHashCode () const
 
template<typename HASH = DefaultCompare>
void CombineUniqueHash (UniqueHasher &hash) const
 
template<typename BLOCK , typename COMPARE >
std::enable_if<!STRIDED &&std::is_same< BLOCK, Block >::value, Bool >::type IsEqualImpl (const BLOCK &other, COMPARE &&cmp, OverloadRank1) const
 
T * GetPtr (Int index) const
 
- Public Member Functions inherited from ArrayBase< Block< T, STRIDED, MOVE >, T, BlockBase< T, STRIDED >, DefaultCompare >
MAXON_ATTRIBUTE_FORCE_INLINE ArrayBase (ARGS &&... args)
 
ArrayImpl< Block< T, STRIDED, MOVE > & > ToArray ()
 
ArrayImpl< const Block< T, STRIDED, MOVE > & > ToArray () const
 
MAXON_ATTRIBUTE_FORCE_INLINE operator ArrayImpl< Block< T, STRIDED, MOVE > & > ()
 
MAXON_ATTRIBUTE_FORCE_INLINE operator ArrayImpl< const Block< T, STRIDED, MOVE > & > () const
 
- Public Member Functions inherited from ArrayBase0< COLLECTION, VALUETYPE, SUPER, HASH >
template<typename... ARGS>
MAXON_ATTRIBUTE_FORCE_INLINE ArrayBase0 (ARGS &&... args)
 
Bool IsValidIndex (Int index) const
 
Result< void > CheckValidIndex (Int index) const
 
Int FindIndex (typename ByValueParam< VALUETYPE >::type v, Int start) const
 
Int FindLastIndex (typename ByValueParam< VALUETYPE >::type v) const
 
Int FindLastIndex (typename ByValueParam< VALUETYPE >::type v, Int start) const
 
Bool EraseFirst (typename ByValueParam< VALUETYPE >::type v)
 
Int EraseAll (typename ByValueParam< VALUETYPE >::type v)
 
template<typename COLLECTION2 >
Result< void > AppendAllImpl (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags, Bool overwrite, OverloadRank0)
 
template<typename COLLECTION2 >
Result< void > InsertAll (Int index, COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY)
 
template<typename COLLECTION2 >
Result< void > Add (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY)
 
template<typename COLLECTION2 >
Result< void > SubtractImpl (COLLECTION2 &&other, OverloadRank0)
 
template<typename COLLECTION2 , typename COMPARE >
Bool IsEqualImpl (const COLLECTION2 &other, COMPARE &&cmp, OverloadRank0) const
 
HashInt GetHashCode () const
 
UniqueHash GetUniqueHashCode () const
 
MAXON_ATTRIBUTE_FORCE_INLINE AutoIterator< COLLECTION > Slice (Int start)
 
MAXON_ATTRIBUTE_FORCE_INLINE AutoIterator< const COLLECTION > Slice (Int start) const
 
MAXON_ATTRIBUTE_FORCE_INLINE AutoIterator< COLLECTION > Slice (Int start, Int end)
 
MAXON_ATTRIBUTE_FORCE_INLINE AutoIterator< const COLLECTION > Slice (Int start, Int end) const
 
BlockIterator< COLLECTION, VALUETYPE, false, false > GetBlocks ()
 
BlockIterator< COLLECTION, VALUETYPE, true, false > GetBlocks () const
 
BlockIterator< COLLECTION, VALUETYPE, false, true > GetStridedBlocks ()
 
BlockIterator< COLLECTION, VALUETYPE, true, true > GetStridedBlocks () const
 
- Public Member Functions inherited from Collection< COLLECTION, VALUETYPE, SUPER >
template<typename... ARGS>
MAXON_ATTRIBUTE_FORCE_INLINE Collection (ARGS &&... args)
 
ResultOk< void > VariadicAppend ()
 
template<typename V , typename... VALUES>
Result< void > VariadicAppend (V &&value, VALUES &&... rest)
 
 operator ValueReceiver< const VALUETYPE & > ()
 
 operator ValueReceiver< VALUETYPE && > ()
 
 operator ValueReceiver< typename std::conditional< STD_IS_REPLACEMENT (scalar, VALUETYPE)
 
DummyParamType & type ()
 
template<typename FN >
Result< BoolForEach (FN &&callback) const
 
template<typename FN >
Result< BoolForEach (FN &&callback)
 
template<typename H = COLLECTION>
H::Iterator Find (typename ByValueParam< VALUETYPE >::type v)
 
template<typename H = COLLECTION>
H::ConstIterator Find (typename ByValueParam< VALUETYPE >::type v) const
 
Int FindIndex (typename ByValueParam< VALUETYPE >::type v) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Bool Contains (typename ByValueParam< VALUETYPE >::type v) const
 
- Public Member Functions inherited from BaseCollection< COLLECTION, SUPER >
template<typename... ARGS>
MAXON_ATTRIBUTE_FORCE_INLINE BaseCollection (ARGS &&... args)
 
template<typename COLLECTION2 >
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value, Bool >::type operator== (const COLLECTION2 &other) const
 
template<typename COLLECTION2 >
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value, Bool >::type operator!= (const COLLECTION2 &other) const
 
template<typename COMPARE = EqualityCompare, typename COLLECTION2 >
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value &&!STD_IS_REPLACEMENT(same, typename std::decay< COMPARE >::type, EQUALITY), Bool >::type IsEqual (const COLLECTION2 &other, COMPARE &&cmp=COMPARE()) const
 
template<typename COLLECTION2 >
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > AppendAll (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY)
 
template<typename COLLECTION2 >
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > CopyFrom (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::FIT_TO_SIZE)
 
template<typename COLLECTION2 >
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > Subtract (COLLECTION2 &&other)
 
template<typename COLLECTION2 >
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > Intersect (const COLLECTION2 &other)
 
template<typename COLLECTION2 >
Bool Intersects (const COLLECTION2 &other) const
 
template<typename COLLECTION2 >
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > CopyFromImpl (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags, OverloadRank0)
 
template<typename COLLECTION2 >
Result< void > AppendAllImpl (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags, Bool overwrite, OverloadRank0)
 
template<typename COLLECTION2 >
Result< void > IntersectImpl (COLLECTION2 &&other, OverloadRank0)
 
MAXON_ATTRIBUTE_FORCE_INLINE Bool IsEmpty () const
 
MAXON_ATTRIBUTE_FORCE_INLINE Bool IsPopulated () const
 
String ToString (const FormatStatement *formatStatement=nullptr) const
 
template<typename COLLECTION2 >
MAXON_ATTRIBUTE_FORCE_INLINE Bool ContainsAll (COLLECTION2 &&other) const
 
template<typename COLLECTION2 >
Bool ContainsAllImpl (COLLECTION2 &&other, OverloadRank0) const
 

Static Public Member Functions

static const BlockNullValueRef ()
 
- Static Public Member Functions inherited from Collection< COLLECTION, VALUETYPE, SUPER >
static const VALUETYPEGetMapKey (const VALUETYPE &key)
 

Static Public Attributes

static constexpr Bool GENERIC
 
static constexpr Bool CONSTBLOCK
 
static constexpr Bool BYTE_BLOCK
 
static constexpr Bool BYTE_OR_CHAR
 
- Static Public Attributes inherited from ArrayBase0< COLLECTION, VALUETYPE, SUPER, HASH >
static const COLLECTION_KIND KIND
 

Private Member Functions

ResultRef< T > Insert (Int index)
 
ResultMem Insert (Int index, const Block< const T > &values)
 
ResultRef< T > Append ()
 
ResultMem Erase (Int index, Int count)
 
ResultMem SwapErase (Int index, Int count)
 
ResultMem SetCapacityHint (Int requestedCapacity, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY)
 
ResultMem Resize (Int count, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::DEFAULT)
 
void Flush ()
 

Friends

template<typename ARRAY >
class ArrayImpl
 

Additional Inherited Members

- Public Attributes inherited from Collection< COLLECTION, VALUETYPE, SUPER >
 VALUETYPE
 

Member Typedef Documentation

◆ Super

using Super = ArrayBase<Block<T, STRIDED, MOVE>, T, BlockBase<T, STRIDED>, DefaultCompare>

◆ StrideType

using StrideType = typename std::conditional<GENERIC, Char, T>::type

◆ IsBlock

using IsBlock = std::true_type

◆ Iterator

using Iterator = BaseIterator<Block, STRIDED>

◆ ConstIterator

using ConstIterator = BaseIterator<Block, STRIDED>

◆ SwapByteChar

using SwapByteChar = typename std::conditional<std::is_same<const Byte, const T>::value, Char, Byte>::type

Constructor & Destructor Documentation

◆ Block() [1/9]

Block ( )

Constructs an empty block with a nullptr pointer and zero count.

◆ Block() [2/9]

Block ( T *  ptr,
Int  size,
Int  stride = (STRIDED && GENERIC) ? -1 : SIZEOF(StrideType) 
)

Constructs a block using the given values.

Parameters
[in]ptrPointer to the first element.
[in]sizeNumber of elements.
[in]strideElement stride. If the STRIDED parameter of the Block class is false, this has to be SIZEOF(T).

◆ Block() [3/9]

Block ( Iterator  start,
Int  size,
Int  stride = (STRIDED && GENERIC) ? -1 : SIZEOF(StrideType) 
)

Constructs a block from iterator and size. Equivalent to Block(static_cast<T*>(&*start), size, stride).

◆ Block() [4/9]

MAXON_IMPLICIT Block ( T(&)  array[N])

Constructs a block for a C++ fixed-size array. The length is automatically set to the full length of the array.

◆ Block() [5/9]

MAXON_IMPLICIT Block ( const std::initializer_list< typename std::remove_const< T >::type > &  list)

◆ Block() [6/9]

Block ( ANY *  ptr,
Int  size 
)

Constructs a Byte block of raw bytes using the given values. This constructor can only be used for Byte blocks.

Parameters
[in]ptrPointer to the first object of type ANY.
[in]sizeNumber of elements of type ANY.

◆ Block() [7/9]

Block ( const Block< ANY > &  src)

Constructs a Byte block of raw bytes from the given block of type ANY. This constructor can only be used for Byte blocks.

Parameters
[in]srcA block of type ANY.

◆ Block() [8/9]

MAXON_IMPLICIT Block ( ANY(&)  array[N])

Constructs a Byte block of raw bytes from the given array of type ANY. This constructor can only be used for Byte blocks.

Parameters
[in]arrayAn array of type ANY.

◆ Block() [9/9]

Block ( const Block< T, STRIDED, MOVE > &  src)
default

Member Function Documentation

◆ operator=()

Block& operator= ( const Block< T, STRIDED, MOVE > &  src)
default

◆ CopyFrom()

Result<void> CopyFrom ( const Block< T, STRIDED, MOVE > &  src)
delete

◆ operator ArrayImpl< Block & >()

operator ArrayImpl< Block & > ( )
delete

◆ operator ArrayImpl< const Block & >()

operator ArrayImpl< const Block & > ( ) const
delete

◆ GetStride()

Int GetStride ( ) const

Returns the stride of this block. If the STRIDED parameter of the Block class is false, this will always be SIZEOF(T).

Returns
Element stride of this block, i.e., the difference in bytes between two consecutive elements.

◆ IsStrided()

Bool IsStrided ( ) const

Returns true if this block uses a stride other than SIZEOF(T).

Returns
True if the stride differs from the element size.

◆ Set()

void Set ( T *  ptr,
Int  size,
Int  stride = (STRIDED && GENERIC) ? -1 : SIZEOF(StrideType) 
)

Sets this block to new values.

Parameters
[in]ptrPointer to the first element.
[in]sizeNumber of elements.
[in]strideElement stride. If the STRIDED parameter of the Block class is false, this has to be SIZEOF(T).

◆ Reset()

void Reset ( void  )

Resets this block so that is points to nullptr and has zero length.

◆ operator typename std::conditional< STRIDED, DeleteReturnType01, Block< T, true, MOVE >>::type()

operator typename std::conditional< STRIDED, DeleteReturnType01, Block< T, true, MOVE >>::type ( ) const

Converts this block to a strided block.

◆ operator typename std::conditional< STRIDED||CONSTBLOCK, DeleteReturnType02, Block< const T, true, MOVE >>::type()

operator typename std::conditional< STRIDED||CONSTBLOCK, DeleteReturnType02, Block< const T, true, MOVE >>::type ( ) const

Converts this block to a strided block with constant elements.

◆ operator typename std::conditional< CONSTBLOCK, DeleteReturnType03, const Block< const T, STRIDED, MOVE > & >::type()

operator typename std::conditional< CONSTBLOCK, DeleteReturnType03, const Block< const T, STRIDED, MOVE > & >::type ( ) const

Converts this block to a block with constant elements.

◆ operator typename std::conditional< STRIDED||!MOVE, DeleteReturnType04, Block< T, true, false >>::type()

operator typename std::conditional< STRIDED||!MOVE, DeleteReturnType04, Block< T, true, false >>::type ( ) const

Converts this block to a strided non-movable block.

◆ operator typename std::conditional< STRIDED||!MOVE||CONSTBLOCK, DeleteReturnType05, Block< const T, true, false >>::type()

operator typename std::conditional< STRIDED||!MOVE||CONSTBLOCK, DeleteReturnType05, Block< const T, true, false >>::type ( ) const

Converts this block to a strided non-movable block with constant elements.

◆ operator typename std::conditional<!MOVE||CONSTBLOCK, DeleteReturnType06, const Block< const T, STRIDED, false > & >::type()

operator typename std::conditional<!MOVE||CONSTBLOCK, DeleteReturnType06, const Block< const T, STRIDED, false > & >::type ( ) const

Converts this block to a non-movable block with constant elements.

◆ operator typename std::conditional<!MOVE, DeleteReturnType07, const Block< T, STRIDED, false > & >::type()

operator typename std::conditional<!MOVE, DeleteReturnType07, const Block< T, STRIDED, false > & >::type ( ) const

Converts this block to a non-movable block.

◆ operator typename std::conditional< GENERIC, DeleteReturnType08, const Block< typename InheritConst< Generic, T >::type, STRIDED > & >::type()

operator typename std::conditional< GENERIC, DeleteReturnType08, const Block< typename InheritConst< Generic, T >::type, STRIDED > & >::type ( ) const

Converts this block to a generic block.

◆ operator typename std::conditional< BYTE_OR_CHAR, const Block< typename InheritConst< SwapByteChar, T >::type, STRIDED >, DeleteReturnType09 >::type &()

operator typename std::conditional< BYTE_OR_CHAR, const Block< typename InheritConst< SwapByteChar, T >::type, STRIDED >, DeleteReturnType09 >::type & ( ) const

Converts this Byte/Char block to a Char/Byte block.

◆ operator typename std::conditional< BYTE_OR_CHAR &&!CONSTBLOCK, const Block< const SwapByteChar, STRIDED >, const DeleteReturnType09 >::type &()

operator typename std::conditional< BYTE_OR_CHAR &&!CONSTBLOCK, const Block< const SwapByteChar, STRIDED >, const DeleteReturnType09 >::type & ( ) const

Converts this Byte/Char block to a const Char/Byte block.

◆ GetFirst()

T* GetFirst ( ) const

Returns the first element of this block. For an empty block, this is undefined and might be nullptr or any other value.

Returns
Pointer to the first element of this block (undefined if the block is empty).

◆ SetFirst()

void SetFirst ( T *  value)

Sets the first element of this block, may be nullptr.

Parameters
[in]valuePointer to first element of this block.

◆ GetLast()

T* GetLast ( ) const

Returns the last element of this block. For an empty block, this is undefined and might be nullptr or any other value.

Returns
Pointer to the last element of this block (undefined if the block is empty).

◆ operator[]()

T& operator[] ( Int  index) const

Returns the element at the given index of this block.

Parameters
[in]indexIndex into the block.
Returns
Reference to the value at index.

◆ Slice() [1/2]

Block Slice ( Int  start) const

Returns a sub block of this block with contains the elements from the given start index up to the end of the block.

Parameters
[in]startStart index of the sub block.
Returns
Sub block starting at start.

◆ Slice() [2/2]

Block Slice ( Int  start,
Int  end 
) const

Returns a sub block of this block with contains the elements from the given start index up to but not including the given end index.

Parameters
[in]startStart index of the sub block.
[in]endEnd index of the sub block. The end index is exclusive.
Returns
Sub block with elements from start up to end.

◆ StartsWith()

Bool StartsWith ( const Block< T, STRIDED, MOVE > &  prefix) const

◆ EndsWith()

Bool EndsWith ( const Block< T, STRIDED, MOVE > &  suffix) const

◆ Begin()

Iterator Begin ( ) const

Gets an iterator for the first element.

Returns
Iterator for the first element (equal to End() if the array is empty).

◆ End()

Iterator End ( ) const

Gets an iterator for the end (End() - 1 is the last element if the array is not empty).

Returns
Iterator for the array end (this is behind the last element).

◆ NullValueRef()

static const Block& NullValueRef ( )
static

◆ GetCapacityCount()

Int GetCapacityCount ( ) const

◆ CopyValuesFrom() [1/2]

Result<void> CopyValuesFrom ( const Block< T2, S2, M2 > &  other)

◆ ConstructValuesFrom()

Result<void> ConstructValuesFrom ( const Block< T2, S2, M2 > &  other)

◆ CopyValuesFrom() [2/2]

Result<void> CopyValuesFrom ( const COLLECTION &  other)

◆ GetMemorySize()

Int GetMemorySize ( void  ) const

◆ GetBlock() [1/4]

Int GetBlock ( Int  index,
Block< const T, false > &  block 
) const

◆ GetBlock() [2/4]

Int GetBlock ( Int  index,
typename std::conditional< CONSTBLOCK, DeleteReturnType01, Block< T, false > & >::type  block 
) const

◆ GetBlock() [3/4]

Int GetBlock ( Int  index,
typename std::conditional< CONSTBLOCK, DeleteReturnType02, StridedBlock< T > & >::type  block 
) const

◆ GetBlock() [4/4]

Int GetBlock ( Int  index,
StridedBlock< const T > &  block 
) const

◆ GetUniqueHashCode()

UniqueHash GetUniqueHashCode ( ) const

Returns the 128-bit hash value of this @CLASS. The implementation ensures uniform distribution, so for practical purposes you can safely assume that two objects are equal if their hash values are equal.

Returns
Hash value of this @CLASS.

◆ CombineUniqueHash()

void CombineUniqueHash ( UniqueHasher hash) const

Mixes the content of this block into hash. If this block has trivially hashable elements and no stride, the raw bytes are taken. Otherwise each element e is mixed into hash using {hash.CombineHash<HASH>(e)}.

Parameters
[in]hashA hasher to mix into.
Template Parameters
HASHThe HASH class to use for the computation of UniqueHashes of the elements.

◆ IsEqualImpl()

std::enable_if<!STRIDED && std::is_same<BLOCK, Block>::value, Bool>::type IsEqualImpl ( const BLOCK &  other,
COMPARE &&  cmp,
OverloadRank1   
) const

◆ GetPtr()

T* GetPtr ( Int  index) const

◆ Insert() [1/2]

ResultRef<T> Insert ( Int  index)
private

◆ Insert() [2/2]

ResultMem Insert ( Int  index,
const Block< const T > &  values 
)
private

◆ Append()

ResultRef<T> Append ( )
private

◆ Erase()

ResultMem Erase ( Int  index,
Int  count 
)
private

◆ SwapErase()

ResultMem SwapErase ( Int  index,
Int  count 
)
private

◆ SetCapacityHint()

ResultMem SetCapacityHint ( Int  requestedCapacity,
COLLECTION_RESIZE_FLAGS  resizeFlags = COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY 
)
private

◆ Resize()

ResultMem Resize ( Int  count,
COLLECTION_RESIZE_FLAGS  resizeFlags = COLLECTION_RESIZE_FLAGS::DEFAULT 
)
private

◆ Flush()

void Flush ( void  )
private

Friends And Related Function Documentation

◆ ArrayImpl

friend class ArrayImpl
friend

Member Data Documentation

◆ GENERIC

constexpr Bool GENERIC
staticconstexpr

◆ CONSTBLOCK

constexpr Bool CONSTBLOCK
staticconstexpr

◆ BYTE_BLOCK

constexpr Bool BYTE_BLOCK
staticconstexpr

◆ BYTE_OR_CHAR

constexpr Bool BYTE_OR_CHAR
staticconstexpr