BaseCollection< COLLECTION, SUPER > Class Template Reference

#include <collection.h>

Inheritance diagram for BaseCollection< COLLECTION, SUPER >:

Detailed Description

template<typename COLLECTION, typename SUPER>
class maxon::BaseCollection< COLLECTION, SUPER >

BaseCollection is a helper template to be used as base class for collections which have Begin()/End() functions returning iterators, and a GetCount() function. It will then add iterator-based utility functions such as ToString.

Template Parameters
COLLECTIONThe actual collection class, this has to have BaseCollection as (direct or indirect) base class.
SUPERThe class to be used as base class for BaseCollection.
See also
$ref collections

Public Types

using IsCollection = std::true_type
 
using IsBaseArray = std::false_type
 

Public Member Functions

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
 

Member Typedef Documentation

◆ IsCollection

using IsCollection = std::true_type

◆ IsBaseArray

using IsBaseArray = std::false_type

Constructor & Destructor Documentation

◆ BaseCollection()

MAXON_ATTRIBUTE_FORCE_INLINE BaseCollection ( ARGS &&...  args)
explicit

Member Function Documentation

◆ operator==()

MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if<maxon::IsCollection<COLLECTION2>::value, Bool>::type operator== ( const COLLECTION2 &  other) const

◆ operator!=()

MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if<maxon::IsCollection<COLLECTION2>::value, Bool>::type operator!= ( const COLLECTION2 &  other) const

◆ IsEqual()

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

◆ AppendAll()

Appends all elements from another collection other to this collection. If this doesn't succeed for all entries, the collection will be left in a valid, but intermediate state with only some entries from other added.

Parameters
[in]otherAnother collection, may be any iterable object.
[in]resizeFlagsIf ON_GROW_FIT_TO_SIZE is set, the collection will use only as much memory as needed to hold the data.
Returns
OK on success.

◆ CopyFrom()

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

Makes this collection a copy of other. If copying doesn't succeed for all entries, the collection will be left in a valid, but intermediate state with only some entries from other added.

Parameters
[in]otherAnother collection, may be any iterable object.
[in]resizeFlagsIf ON_GROW_FIT_TO_SIZE is set, the collection will use only as much memory as needed to hold the data.
Returns
OK on success.

◆ Subtract()

MAXON_ATTRIBUTE_FORCE_INLINE Result<void> Subtract ( COLLECTION2 &&  other)

Removes all elements of another collection other from this collection. Elements of this collection which are not part of other are kept. For a map, only the keys are considered, i.e., an entry is removed from this map if its key is contained in other, regardless of the corresponding values.

Parameters
[in]otherAnother collection, may be any iterable object.
Returns
OK on success.

◆ Intersect()

MAXON_ATTRIBUTE_FORCE_INLINE Result<void> Intersect ( const COLLECTION2 &  other)

Intersects this collection with the other collection. I.e., elements which are not contained in other are removed. For a map, only the keys are considered, i.e., an entry is kept in this map if its key is contained in other, regardless of the corresponding values.

Parameters
[in]otherAnother collection, may be any predicate object.
Returns
OK on success.

◆ Intersects()

Bool Intersects ( const COLLECTION2 &  other) const

◆ CopyFromImpl()

MAXON_ATTRIBUTE_FORCE_INLINE Result<void> CopyFromImpl ( COLLECTION2 &&  other,
COLLECTION_RESIZE_FLAGS  resizeFlags,
OverloadRank0   
)

◆ AppendAllImpl()

Result<void> AppendAllImpl ( COLLECTION2 &&  other,
COLLECTION_RESIZE_FLAGS  resizeFlags,
Bool  overwrite,
OverloadRank0   
)

◆ IntersectImpl()

Result<void> IntersectImpl ( COLLECTION2 &&  other,
OverloadRank0   
)

◆ IsEmpty()

Checks if the collection is empty. This is the same as GetCount() == 0

Returns
True if the collection does not contain any elements.

◆ IsPopulated()

MAXON_ATTRIBUTE_FORCE_INLINE Bool IsPopulated ( ) const

Checks if the collection is populated. This is the same as GetCount() != 0

Returns
True if the collection contains any elements.

◆ ContainsAll()

MAXON_ATTRIBUTE_FORCE_INLINE Bool ContainsAll ( COLLECTION2 &&  other) const

Returns true if this collection contains all elements from another collection.

Parameters
[in]otherAnother collection, may be any iterable object.
Returns
True if this collection contains all elements from other, false otherwise.

◆ ContainsAllImpl()

Bool ContainsAllImpl ( COLLECTION2 &&  other,
OverloadRank0   
) const