Boston D Meetup: Strawman Structs
Steven Schveighoffer via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Mon Jul 24 08:01:06 PDT 2017
On 7/23/17 9:50 AM, Moritz Maxeiner wrote:
> On Sunday, 23 July 2017 at 02:15:18 UTC, Steven Schveighoffer wrote:
>>
>> struct StrawmanRange(T)
>> {
>> ...
>> void popFront() {}
>> }
>
> How do you deal with ranges where `.popFront` returns the old front
> element (`.front` requires copying the front element if the caller wants
> to store it, `.popFront` can move it)?
As I said in the talk, there's not an actual library for this, it's just
an idea. I would say you could probably return Any here, and infer that
means the return type doesn't matter. Or you could have an attribute.
The idea is to communicate in some way to the "implements" function how
to create the right constraint.
-Steve
More information about the Digitalmars-d-announce
mailing list