NonConstArray< TYPE > Class Template Reference

#include <array.h>

Inheritance diagram for NonConstArray< TYPE >:

Detailed Description

template<typename TYPE>
class maxon::NonConstArray< TYPE >

Helper class for the WritableArrayInterface macro. A WritableArrayInterface& parameter is actually a const NonConstArray& parameter, so temporary objects resulting from a conversion of some array to the NonConstArray interface may be bound to such a parameter (this wouldn't be possible if the parameter was non-const). To be able to invoke modifying functions on such a parameter, those functions are implemented as const functions in this class.

Public Types

using Super = ArrayInterface< TYPE >
 
using ConstIterator = typename Super::Iterator
 
- Public Types inherited from ArrayInterface< TYPE >
using ValueType = TYPE
 
using Super = StaticArrayInterface< TYPE >
 
using Iterator = typename Super::template IteratorTemplate< ArrayInterface >
 
using ConstIterator = typename Super::template IteratorTemplate< const ArrayInterface >
 
- 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

const NonConstArrayToArray () const
 
NonConstArrayToArray ()
 
 operator const NonConstArray< typename std::conditional< STD_IS_REPLACEMENT (same, TYPE, Generic)
 
TYPE & operator[] (Int index) const
 
Int GetBlock (Int index, Block< TYPE, false > &block) const
 
Int GetBlock (Int index, Block< TYPE, true > &block) const
 
ResultMem Resize (Int count, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::DEFAULT) const
 
ResultMem SetCapacityHint (Int requestedCapacity, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) const
 
ResultRef< TYPE > Insert (Int index) const
 
ResultMem Insert (Int index, const Block< const TYPE > &values) const
 
ResultMem Insert (Int index, const MoveBlock< TYPE > &values) const
 
ResultRef< TYPE > Append () const
 
ResultRef< TYPE > Append (const TYPE &value) const
 
ResultRef< TYPE > Append (TYPE &&value) const
 
template<typename T >
ResultRef< TYPE > Append (T &&value) const
 
ResultMem Erase (Int index, Int count=1) const
 
ResultMem SwapErase (Int index, Int count=1) const
 
void Reset () const
 
void Flush () const
 
Result< void > CopyFrom (const Super &other) const
 
ConstIterator Begin () const
 
ConstIterator End () const
 
template<typename COLLECTION2 >
Result< void > AppendAll (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) const
 
template<typename COLLECTION2 >
Result< void > CopyFrom (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::FIT_TO_SIZE) const
 
- Public Member Functions inherited from ArrayInterface< TYPE >
 MAXON_ADD_TO_COPY_ON_WRITE_REFERENCE_CLASS (public:using ValueType=TYPE;)
 
TYPE & operator[] (Int index)
 
MAXON_METHOD Int GetBlock (Int index, Block< const TYPE > &block) const
 
Int GetBlock (Int index, Block< typename Super::NonConstValueType > &block)
 
MAXON_METHOD Result< void > PrivateInsert (Int index, const StridedBlock< const TYPE > &values, Bool move, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY)
 
MAXON_METHOD ResultMem Resize (Int count, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::DEFAULT)
 
MAXON_METHOD ResultMem SetCapacityHint (Int requestedCapacity, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY)
 
MAXON_METHOD ResultRef< TYPE > Insert (Int index)
 
MAXON_FUNCTION ResultRef< TYPE > Insert (Int index, const TYPE &value)
 
MAXON_FUNCTION ResultRef< TYPE > Insert (Int index, TYPE &&value)
 
MAXON_METHOD ResultMem Insert (Int index, const Block< const TYPE > &values)
 
MAXON_METHOD ResultMem Insert (Int index, const MoveBlock< TYPE > &values)
 
MAXON_FUNCTION ResultMem InsertBlock (Int index, const Block< const TYPE > &values)
 
MAXON_FUNCTION ResultMem InsertBlock (Int index, const MoveBlock< TYPE > &values)
 
MAXON_METHOD ResultRef< TYPE > Append ()
 
MAXON_FUNCTION ResultRef< TYPE > Append (const TYPE &value)
 
MAXON_FUNCTION ResultRef< TYPE > Append (TYPE &&value)
 
template<typename A >
MAXON_FUNCTION ResultRef< TYPE > Append (A &&value)
 
MAXON_FUNCTION Bool Pop ()
 
MAXON_FUNCTION Bool Pop (TYPE *dst)
 
MAXON_METHOD ResultMem Erase (Int index, Int count=1)
 
template<typename C >
ArrayInterface::template IteratorTemplate< C > Erase (const typename ArrayInterface::template IteratorTemplate< C > &it)
 
MAXON_METHOD ResultMem SwapErase (Int index, Int count=1)
 
MAXON_METHOD void Reset ()
 
MAXON_METHOD void Flush ()
 
MAXON_METHOD Result< void > CopyFrom (const ArrayInterface &other)
 
MAXON_METHOD void SetPersistentIdGenerator (const PersistentIdGenerator &generator)
 
MAXON_METHOD Int GetMemorySize () const
 
template<typename DT >
MAXON_FUNCTION Bool HasType () const
 
template<typename DT >
MAXON_FUNCTION void AssertType () const
 
template<typename T2 >
ArrayInterface< T2 > & AssertCast ()
 
template<typename T2 >
const ArrayInterface< T2 > & AssertCast () const
 
 operator const ArrayInterface< const TYPE > & () const
 
 operator const ArrayInterface< typename std::conditional< STD_IS_REPLACEMENT (same, const TYPE, const Generic)
 
 operator ArrayInterface< typename std::conditional< STD_IS_REPLACEMENT (same, TYPE, Generic)
 
Generic ::typeoperator const NonConstArray< TYPE > & ()
 
 operator const NonConstArray< typename std::conditional< STD_IS_REPLACEMENT (same, TYPE, Generic)
 
 MAXON_ADD_TO_CONST_REFERENCE_CLASS (using Iterator=typename ArrayInterface::ConstIterator;using ConstIterator=typename ArrayInterface::ConstIterator;)
 
MAXON_FUNCTION ArrayInterface< TYPE >::ConstIterator Begin () const
 
Iterator Begin ()
 
MAXON_FUNCTION ArrayInterface< TYPE >::ConstIterator End () const
 
Iterator End ()
 
MAXON_METHOD Int GetBlock (Int index, SimdBlock< const TYPE > &block) const
 
Int GetBlock (Int index, StridedBlock< const TYPE > &block) const
 
Int GetBlock (Int index, Block< const TYPE, false > &block) const
 
MAXON_METHOD Result< IntGetBlock (Int index, SimdBlock< NonConstValueType > &block)
 
Int GetBlock (Int index, StridedBlock< NonConstValueType > &block)
 
- Public Member Functions inherited from ArrayBase0< ArrayInterface< TYPE >, TYPE, StaticArrayInterface< TYPE >, DefaultCompare >
MAXON_ATTRIBUTE_FORCE_INLINE ArrayBase0 (ARGS &&... args)
 
Bool IsValidIndex (Int index) const
 
Result< void > CheckValidIndex (Int index) const
 
Int FindIndex (typename ByValueParam< TYPE >::type v, Int start) const
 
Int FindLastIndex (typename ByValueParam< TYPE >::type v) const
 
Int FindLastIndex (typename ByValueParam< TYPE >::type v, Int start) const
 
Bool EraseFirst (typename ByValueParam< TYPE >::type v)
 
Int EraseAll (typename ByValueParam< TYPE >::type v)
 
Result< void > AppendAllImpl (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags, Bool overwrite, OverloadRank0)
 
Result< void > InsertAll (Int index, COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY)
 
Result< void > Add (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY)
 
Result< void > SubtractImpl (COLLECTION2 &&other, OverloadRank0)
 
Bool IsEqualImpl (const COLLECTION2 &other, COMPARE &&cmp, OverloadRank0) const
 
HashInt GetHashCode () const
 
UniqueHash GetUniqueHashCode () const
 
MAXON_ATTRIBUTE_FORCE_INLINE AutoIterator< ArrayInterface< TYPE > > Slice (Int start)
 
MAXON_ATTRIBUTE_FORCE_INLINE AutoIterator< const ArrayInterface< TYPE > > Slice (Int start) const
 
MAXON_ATTRIBUTE_FORCE_INLINE AutoIterator< ArrayInterface< TYPE > > Slice (Int start, Int end)
 
MAXON_ATTRIBUTE_FORCE_INLINE AutoIterator< const ArrayInterface< TYPE > > Slice (Int start, Int end) const
 
BlockIterator< ArrayInterface< TYPE >, TYPE, false, false > GetBlocks ()
 
BlockIterator< ArrayInterface< TYPE >, TYPE, true, false > GetBlocks () const
 
BlockIterator< ArrayInterface< TYPE >, TYPE, false, true > GetStridedBlocks ()
 
BlockIterator< ArrayInterface< TYPE >, TYPE, 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
 

Public Attributes

 DeleteReturnType01
 
Generic ::typeconst
 
- Public Attributes inherited from ArrayInterface< TYPE >
 DeleteReturnType01
 
const Generic ::typeconst
 
 DeleteReturnType02
 
- Public Attributes inherited from Collection< COLLECTION, VALUETYPE, SUPER >
 VALUETYPE
 

Protected Member Functions

 NonConstArray (const typename Super::MTable &vtable)
 
 ~NonConstArray ()
 

Private Member Functions

 MAXON_DISALLOW_COPY_AND_ASSIGN (NonConstArray)
 

Additional Inherited Members

- Static Public Member Functions inherited from Collection< COLLECTION, VALUETYPE, SUPER >
static const VALUETYPEGetMapKey (const VALUETYPE &key)
 
- Static Public Attributes inherited from ArrayBase0< ArrayInterface< TYPE >, TYPE, StaticArrayInterface< TYPE >, DefaultCompare >
static const COLLECTION_KIND KIND
 

Member Typedef Documentation

◆ Super

using Super = ArrayInterface<TYPE>

◆ ConstIterator

using ConstIterator = typename Super::Iterator

Constructor & Destructor Documentation

◆ NonConstArray()

NonConstArray ( const typename Super::MTable &  vtable)
explicitprotected

◆ ~NonConstArray()

~NonConstArray ( )
protected

Member Function Documentation

◆ ToArray() [1/2]

const NonConstArray& ToArray ( ) const

◆ ToArray() [2/2]

NonConstArray& ToArray ( )

◆ operator const NonConstArray< typename std::conditional< STD_IS_REPLACEMENT()

operator const NonConstArray< typename std::conditional< STD_IS_REPLACEMENT ( same  ,
TYPE  ,
Generic   
)

◆ operator[]()

TYPE& operator[] ( Int  index) const

◆ GetBlock() [1/2]

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

◆ GetBlock() [2/2]

Int GetBlock ( Int  index,
Block< TYPE, true > &  block 
) const

◆ Resize()

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

◆ SetCapacityHint()

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

◆ Insert() [1/3]

ResultRef<TYPE> Insert ( Int  index) const

◆ Insert() [2/3]

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

◆ Insert() [3/3]

ResultMem Insert ( Int  index,
const MoveBlock< TYPE > &  values 
) const

◆ Append() [1/4]

ResultRef<TYPE> Append ( ) const

◆ Append() [2/4]

ResultRef<TYPE> Append ( const TYPE &  value) const

◆ Append() [3/4]

ResultRef<TYPE> Append ( TYPE &&  value) const

◆ Append() [4/4]

ResultRef<TYPE> Append ( T &&  value) const

◆ Erase()

ResultMem Erase ( Int  index,
Int  count = 1 
) const

◆ SwapErase()

ResultMem SwapErase ( Int  index,
Int  count = 1 
) const

◆ Reset()

void Reset ( void  ) const

◆ Flush()

void Flush ( void  ) const

◆ CopyFrom() [1/2]

Result<void> CopyFrom ( const Super other) const

◆ Begin()

ConstIterator Begin ( ) const

◆ End()

ConstIterator End ( ) const

◆ AppendAll()

Result<void> AppendAll ( COLLECTION2 &&  other,
COLLECTION_RESIZE_FLAGS  resizeFlags = COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY 
) const

◆ CopyFrom() [2/2]

Result<void> CopyFrom ( COLLECTION2 &&  other,
COLLECTION_RESIZE_FLAGS  resizeFlags = COLLECTION_RESIZE_FLAGS::FIT_TO_SIZE 
) const

◆ MAXON_DISALLOW_COPY_AND_ASSIGN()

MAXON_DISALLOW_COPY_AND_ASSIGN ( NonConstArray< TYPE >  )
private

Member Data Documentation

◆ DeleteReturnType01

DeleteReturnType01

◆ const

Generic ::type& const