Associative Ranges implementation questions

Freddy via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 8 18:34:37 PDT 2014


As of now Associative Ranges are defined as:
----
static assert(isInputRange!R);
R r=void;
auto v=r.front;//r is an input range
static assert(isInputRange!(typeof(r.byKey)));
auto k=r.byKey.front;//byKey is an input range
static assert(is(typeof(v) ==typeof(r[k]) ));//opIndex of k
static assert(is(typeof(v) ==typeof(*(k in r))
));//opBinearyRight!"in" of k
----
Should associative ranges be a forward range instead of input
range?
Should associative ranges provide an opApply for keys and
elements(note: this conflicts with range's default foreach(size_t
counter,E element) so we will have to redesign the interface)?
Which functions from std.range, std.algorithm, etc; should have
special cases for associatve ranges(map, chain,etc)?


More information about the Digitalmars-d mailing list