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);
static MAXON_METHOD Result< Int32 > ToInt32(const Block< const Utf32Char > &str, STRINGCONVERSION flags)
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 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

MAXON_ATTRIBUTE_FORCE_INLINE Block ()
 
constexpr MAXON_ATTRIBUTE_FORCE_INLINE Block (T *ptr, Int size, Int stride=(STRIDED &&GENERIC) ? -1 :SIZEOF(StrideType))
 
MAXON_ATTRIBUTE_FORCE_INLINE Block (Iterator start, Int size, Int stride=(STRIDED &&GENERIC) ? -1 :SIZEOF(StrideType))
 
template<Int N>
MAXON_ATTRIBUTE_FORCE_INLINE MAXON_IMPLICIT Block (T(&array)[N])
 
MAXON_IMPLICIT Block (const std::initializer_list< typename std::remove_const< T >::type > &list)
 
template<typename ANY1 , typename = typename std::enable_if<BYTE_BLOCK && (SIZEOF(std::conditional_t<std::is_void<ANY1>::value, Char, ANY1>) == 1), ANY1>::type>
MAXON_ATTRIBUTE_FORCE_INLINE Block (ANY1 *ptr, Int size)
 
template<typename ANY , typename = typename std::enable_if<BYTE_BLOCK, ANY>::type>
MAXON_ATTRIBUTE_FORCE_INLINE MAXON_IMPLICIT Block (const Block< ANY > &src)
 
template<typename ANY , Int N, typename = typename std::enable_if<BYTE_BLOCK, ANY>::type>
MAXON_ATTRIBUTE_FORCE_INLINE 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
 
MAXON_ATTRIBUTE_FORCE_INLINE Int GetStride () const
 
MAXON_ATTRIBUTE_FORCE_INLINE Bool IsStrided () const
 
void Set (T *ptr, Int size, Int stride=(STRIDED &&GENERIC) ? -1 :SIZEOF(StrideType))
 
void Reset ()
 
MAXON_ATTRIBUTE_FORCE_INLINE operator typename std::conditional< STRIDED, DeleteReturnType01, Block< T, true, MOVE >>::type () const
 
MAXON_ATTRIBUTE_FORCE_INLINE operator typename std::conditional< STRIDED||CONSTBLOCK, DeleteReturnType02, Block< const T, true, MOVE >>::type () const
 
MAXON_ATTRIBUTE_FORCE_INLINE operator typename std::conditional< CONSTBLOCK, DeleteReturnType03, const Block< const T, STRIDED, MOVE > & >::type () const
 
MAXON_ATTRIBUTE_FORCE_INLINE operator typename std::conditional< STRIDED||!MOVE, DeleteReturnType04, Block< T, true, false >>::type () const
 
MAXON_ATTRIBUTE_FORCE_INLINE operator typename std::conditional< STRIDED||!MOVE||CONSTBLOCK, DeleteReturnType05, Block< const T, true, false >>::type () const
 
MAXON_ATTRIBUTE_FORCE_INLINE operator typename std::conditional<!MOVE||CONSTBLOCK, DeleteReturnType06, const Block< const T, STRIDED, false > & >::type () const
 
MAXON_ATTRIBUTE_FORCE_INLINE operator typename std::conditional<!MOVE, DeleteReturnType07, const Block< T, STRIDED, false > & >::type () const
 
MAXON_ATTRIBUTE_FORCE_INLINE operator typename std::conditional< GENERIC, DeleteReturnType08, const Block< typename InheritConst< Generic, T >::type, STRIDED > & >::type () const
 
MAXON_ATTRIBUTE_FORCE_INLINE operator typename std::conditional< BYTE_OR_CHAR, const Block< typename InheritConst< SwapByteChar, T >::type, STRIDED >, DeleteReturnType09 >::type & () const
 
MAXON_ATTRIBUTE_FORCE_INLINE operator typename std::conditional< BYTE_OR_CHAR &&!CONSTBLOCK, const Block< const SwapByteChar, STRIDED >, const DeleteReturnType09 >::type & () const
 
MAXON_ATTRIBUTE_FORCE_INLINE T * GetFirst () const
 
MAXON_ATTRIBUTE_FORCE_INLINE void SetFirst (T *value)
 
MAXON_ATTRIBUTE_FORCE_INLINE T * GetLast () const
 
MAXON_ATTRIBUTE_FORCE_INLINE T & operator[] (Int index) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Block Slice (Int start) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Block Slice (Int start, Int end) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Bool StartsWith (const Block &prefix) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Bool EndsWith (const Block &suffix) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Iterator Begin () const
 
MAXON_ATTRIBUTE_FORCE_INLINE Iterator End () const
 
MAXON_ATTRIBUTE_FORCE_INLINE 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)
 
MAXON_ATTRIBUTE_FORCE_INLINE Int GetMemorySize () const
 
Int GetBlock (Int index, Block< const T, false > &block) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Int GetBlock (Int index, typename std::conditional< CONSTBLOCK, DeleteReturnType01, Block< T, false > & >::type block) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Int GetBlock (Int index, typename std::conditional< CONSTBLOCK, DeleteReturnType02, StridedBlock< T > & >::type block) const
 
MAXON_ATTRIBUTE_FORCE_INLINE 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
 
MAXON_ATTRIBUTE_FORCE_INLINE T * GetPtr (Int index) const
 
- Public Member Functions inherited from ArrayBase< Block< T, STRIDED, MOVE >, T, BlockBase< T, STRIDED >, DefaultCompare >
constexpr 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>
constexpr MAXON_ATTRIBUTE_FORCE_INLINE ArrayBase0 (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 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, COMPARERESULT >::type Compare (const COLLECTION2 &other, COMPARE &&cmp=COMPARE()) const
 
MAXON_ATTRIBUTE_FORCE_INLINE 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 > CopyValuesFrom (const COLLECTION2 &src, Int srcStart=0, Int start=0, Int count=-1)
 
template<typename COLLECTION2 >
Result< void > SubtractImpl (COLLECTION2 &&other, OverloadRank0)
 
template<typename COLLECTION2 , typename COMPARE >
Bool IsEqualImpl (const COLLECTION2 &other, COMPARE &&cmp, OverloadRank0) const
 
template<typename COLLECTION2 , typename COMPARE >
COMPARERESULT CompareImpl (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 BlockDefaultValueRef ()
 
- 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

◆ 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]

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

◆ Block() [2/9]

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

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]

MAXON_ATTRIBUTE_FORCE_INLINE 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]

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]

MAXON_ATTRIBUTE_FORCE_INLINE Block ( ANY1 *  ptr,
Int  size 
)

Constructs a Byte block of raw bytes using the given values. This constructor can only be used for Byte blocks, and (for safety reasons) only when ANY1 is void or has size 1.

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

◆ Block() [7/9]

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]

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()

MAXON_ATTRIBUTE_FORCE_INLINE 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()

MAXON_ATTRIBUTE_FORCE_INLINE 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 ( )

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

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

MAXON_ATTRIBUTE_FORCE_INLINE 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()

MAXON_ATTRIBUTE_FORCE_INLINE 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()

MAXON_ATTRIBUTE_FORCE_INLINE 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()

MAXON_ATTRIBUTE_FORCE_INLINE 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()

MAXON_ATTRIBUTE_FORCE_INLINE 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()

MAXON_ATTRIBUTE_FORCE_INLINE 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()

MAXON_ATTRIBUTE_FORCE_INLINE 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()

MAXON_ATTRIBUTE_FORCE_INLINE 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 &()

MAXON_ATTRIBUTE_FORCE_INLINE 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 &()

MAXON_ATTRIBUTE_FORCE_INLINE 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()

MAXON_ATTRIBUTE_FORCE_INLINE 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()

MAXON_ATTRIBUTE_FORCE_INLINE void SetFirst ( T *  value)

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

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

◆ GetLast()

MAXON_ATTRIBUTE_FORCE_INLINE 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[]()

MAXON_ATTRIBUTE_FORCE_INLINE 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]

MAXON_ATTRIBUTE_FORCE_INLINE Block Slice ( Int  start) const

Returns a slice 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 block.
Returns
Block starting at start.

◆ Slice() [2/2]

MAXON_ATTRIBUTE_FORCE_INLINE Block Slice ( Int  start,
Int  end 
) const

Returns a slice 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 block.
[in]endEnd index of the block. The end index is exclusive.
Returns
Block with elements from start up to end.

◆ StartsWith()

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

◆ EndsWith()

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

◆ Begin()

Gets an iterator for the first element.

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

◆ End()

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).

◆ DefaultValueRef()

static const Block& DefaultValueRef ( )
static

◆ GetCapacityCount()

MAXON_ATTRIBUTE_FORCE_INLINE Int GetCapacityCount ( ) const

◆ CopyValuesFrom()

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

◆ ConstructValuesFrom()

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

◆ GetMemorySize()

MAXON_ATTRIBUTE_FORCE_INLINE Int GetMemorySize ( ) const

◆ GetBlock() [1/4]

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

◆ GetBlock() [2/4]

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

◆ GetBlock() [3/4]

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

◆ GetBlock() [4/4]

MAXON_ATTRIBUTE_FORCE_INLINE 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.HashAndCombine<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()

MAXON_ATTRIBUTE_FORCE_INLINE 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 ( )
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