System::Collections::Generic::BaseDictionary class

BaseDictionary class

Implements common code for various dictionary-alike data structures (e. g. Dictionary, SortedDictionary). Shouldn’t be used directly, except for inheritance when defining containers. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

template<typename Map>class BaseDictionary : public System::Collections::Generic::IDictionary<Map::key_type, Map::mapped_type>
ParameterDescription
MapUnderlying map type.

Methods

MethodDescription
_add_range(std::initializer_list<typename Map::value_type>)C++ specific.
Add(const key_t&, const mapped_t&) overrideAdds key-value pair into dictionary.
BaseDictionary()Creates empty data structure.
BaseDictionary(int, const Args&…)Forwarding constructor to push arguments into underlying map constructor.
BaseDictionary(BaseType *, const Args&…)Copying constructor.
BaseDictionary(BaseType *)Copying constructor.
begin() constReturns an iterator to the KVPair-wrapper for key-value-element of the container. Implemented in C# style - iterator should be return the KVPair-object with get_Key() and get_Value() interface. If the container is empty, the returned iterator will be equal to end().
cbegin() constReturns an iterator to the first element of the container. Implemented in STL-style. If the container is empty, the returned iterator will be equal to end().
cend() constReturns an iterator to the element following the last element of the container. Implemented in STL-style. This element acts as a placeholder; attempting to access it results in undefined behavior.
Clear() overrideDeletes all elements.
ContainsKey(const key_t&) const overrideChecks if key is present in dictionary.
ContainsValue(const mapped_t&)Checks if value is present in dictionary. Uses operator == to compare values.
data()Underlying data storage accessor.
data() constUnderlying data storage accessor.
end() constReturns an iterator to the KVPair-wrapper for key-value-element following the last element of the container. Implemented in C# style - iterator should be return the KVPair-object with get_Key() and get_Value() interface. This element acts as a placeholder; attempting to access it results in undefined behavior.
get_Count() const overrideGets elements count.
virtual GetEnumerator()Creates enumerator instance, should be implemented by subclass.
GetValueOrDefault(const key_t&) const overrideReturns value if found; or Value() otherwise.
GetValueOrDefault(const key_t&, const mapped_t&) const overrideReturns value if found; or defaultValue otherwise.
GetValueOrNull(const key_t&) const overrideReturns value if found; or null otherwise. Make sense only for reference types.
idx_get(const key_t&) const overrideKeyed getter function.
idx_set(const key_t&, mapped_t) overrideKeyed setter function. Alters or creates element.
virtual operator[](const key_t&)Accessor function.
Remove(const key_t&) overrideRemoves specific key from dictionary.
SetTemplateWeakPtr(unsigned int) override
TryGetValue(const key_t&, mapped_t&) const overrideLooks for keyed value and retreives it if found.
virtualizeBeginConstIterator() const overrideGets the implementation of begin const iterator for the current container.
virtualizeBeginIterator() overrideGets the implementation of begin iterator for the current container.
virtualizeEndConstIterator() const overrideGets the implementation of end const iterator for the current container.
virtualizeEndIterator() overrideGets the implementation of end iterator for the current container.

Typedefs

TypedefDescription
BaseTypeImplemented interface.
const_iteratorConst iterator type.
iteratorIterator type.
KeyCollectionMake sure we use correct allocator with underlying storage type.
KVPairKey-value pair type.
map_tInternal map type.
ValueCollectionCollection of values.

See Also