-
Notifications
You must be signed in to change notification settings - Fork 1
Collection implementations and default implementations
Ábel Hegedüs edited this page Jul 30, 2015
·
2 revisions
-
There are no templates for
element at index
,insert element at index
andreplace element at index
in any CPPSequence default implementation but since vector is a possible choice they should probably contains some. -
At the CPPClassRefAssocCollection we can use both map and set but they need different parameters (see in the table below).
template | SET parameters | MAP parameters |
---|---|---|
add | collection, value, result | collection, key, value, result |
clone | collection, valueType, result | collection, keyType, valueType, result |
contains | collection, value, result | collection, key, result |
count of | collection, value, result | collection, key, result |
remove all | collection, values, valuesType, valueType | collection, values, keyType, valueType |
The old template was too long so we changed it to a shorter variant. There is a little explanation here because it may be difficult to understand the new version. Now we use this template:
bool $result$ = $collection$.insert(::std::make_pair($key$, $value$)).second;
instead of this template:
::std::pair< ::std::_Rb_tree_iterator< ::std::pair< const $keyType$, $valueType$> >, bool> __result__ = $collection$.insert(::std::make_pair($key$, $value$));
bool $result$ = __result__.second;
but they are essentially the same.