www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Associative Ranges implementation questions

reply "Freddy" <Hexagonalstar64 gmail.com> writes:
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)?
Aug 08 2014
parent "Freddy" <Hexagonalstar64 gmail.com> writes:
On Saturday, 9 August 2014 at 01:34:38 UTC, Freddy wrote:
 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)?
Opps i forgot to post a link to my phobos fork: https://github.com/Superstar64/phobos/tree/associative_ranges
Aug 08 2014