Getting expression list of all keys
Getting expression list of all values
Number of entries in the map
Filters entries with function or template F, leaving entry only if F returning true.
Filters entries with function or template F passing only a key from an entry, leaving entry only if F returning true.
Getting values by keys. If Keys is a one key, then returns unwrapped value, else a ExpressionExpressionList of values.
Returns true if map has a Key
Applies F template for each pair (key-value).
Setting values to specific keys (or adding new key-values)
alias map = KeyValueList!("a", 42, "b", 23); static assert(map.get!"a" == 42); static assert(map.get!("a", "b") == ExpressionList!(42, 23)); static assert(map.get!"c".length == 0); alias map2 = KeyValueList!(int, float, float, double, double, 42); static assert(is(map2.get!int == float)); static assert(is(map2.get!float == double)); static assert(map2.get!double == 42); static assert(map.has!"a"); static assert(map2.has!int); static assert(!map2.has!void); static assert(!map.has!"c"); alias map3 = map.set!("c", 4); static assert(map3.get!"c" == 4); alias map4 = map.set!("c", 4, "d", 8); static assert(map4.get!("c", "d") == ExpressionList!(4, 8)); alias map5 = map.set!("a", 4); static assert(map5.get!"a" == 4); template inc(string key, int val) { alias inc = ExpressionList!(key, val+1); } alias map6 = map.map!inc; static assert(map6.get!"a" == 43); static assert(map6.get!("a", "b") == ExpressionList!(43, 24)); static assert(map.keys == ExpressionList!("a", "b")); static assert(map.values == ExpressionList!(42, 23));
Static associative map.
Pairs is a list of pairs key-value.