#include <collection.h>
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.
COLLECTION | The actual collection class, this has to have BaseCollection as (direct or indirect) base class. |
SUPER | The class to be used as base class for BaseCollection. |
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 |
using IsCollection = std::true_type |
using IsBaseArray = std::false_type |
|
explicit |
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if<maxon::IsCollection<COLLECTION2>::value, Bool>::type operator== | ( | const COLLECTION2 & | other | ) | const |
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if<maxon::IsCollection<COLLECTION2>::value, Bool>::type operator!= | ( | const COLLECTION2 & | other | ) | const |
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 |
MAXON_ATTRIBUTE_FORCE_INLINE Result<void> AppendAll | ( | COLLECTION2 && | other, |
COLLECTION_RESIZE_FLAGS | resizeFlags = COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY |
||
) |
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.
[in] | other | Another collection, may be any iterable object. |
[in] | resizeFlags | If ON_GROW_FIT_TO_SIZE is set, the collection will use only as much memory as needed to hold the data. |
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.
[in] | other | Another collection, may be any iterable object. |
[in] | resizeFlags | If ON_GROW_FIT_TO_SIZE is set, the collection will use only as much memory as needed to hold the data. |
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.
[in] | other | Another collection, may be any iterable object. |
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.
[in] | other | Another collection, may be any predicate object. |
Bool Intersects | ( | const COLLECTION2 & | other | ) | const |
MAXON_ATTRIBUTE_FORCE_INLINE Result<void> CopyFromImpl | ( | COLLECTION2 && | other, |
COLLECTION_RESIZE_FLAGS | resizeFlags, | ||
OverloadRank0 | |||
) |
Result<void> AppendAllImpl | ( | COLLECTION2 && | other, |
COLLECTION_RESIZE_FLAGS | resizeFlags, | ||
Bool | overwrite, | ||
OverloadRank0 | |||
) |
Result<void> IntersectImpl | ( | COLLECTION2 && | other, |
OverloadRank0 | |||
) |
MAXON_ATTRIBUTE_FORCE_INLINE Bool IsEmpty | ( | ) | const |
Checks if the collection is empty. This is the same as GetCount() == 0
MAXON_ATTRIBUTE_FORCE_INLINE Bool IsPopulated | ( | void | ) | const |
Checks if the collection is populated. This is the same as GetCount() != 0
MAXON_ATTRIBUTE_FORCE_INLINE Bool ContainsAll | ( | COLLECTION2 && | other | ) | const |
Returns true if this collection contains all elements from another collection.
[in] | other | Another collection, may be any iterable object. |
other
, false otherwise. Bool ContainsAllImpl | ( | COLLECTION2 && | other, |
OverloadRank0 | |||
) | const |