On Saturday, 25 February 2012 at 16:26:05 UTC, Ashish Myles wrote:

2. Secondly, TDPL on page 381 says that foreach iterates over C[], if
  C defines the opSlice() function without any arguments.
  However the code above doesn't seem to work and requires me to
  explicitly invoke the slice operator myself like
    foreach(p; C[]) { ... }
when my data structure clearly defines the following functions.
    Point3[] opSlice() { return _cpts[]; }
    const (Point3)[] opSlice() const { return _cpts[]; }
Is this a misunderstanding on my part or an unimplemented feature?

Is not implemented, not seeing a bug report
http://d.puremagic.com/issues/

3. A more general question: Is there any by any chance a way to avoid the redundancy above of defining two opSlice() functions (or two opAssign() functions if I went that route -- one for const and another for ref)?
  I suspect that the answer is no, but I just wanted to verify.

Not sure look into information on 'auto ref' and 'inout' these
were built for removing duplications of const and ref functions.
These have had some work done to make them functional, but could
still have holes.

Reply via email to