Copy a struct and its context

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 13 14:24:05 PDT 2016


On 9/13/16 5:01 PM, Yuxuan Shui wrote:
>
> For example, a common use case might be I want to capture everything by
> value. In stead of adding all the fields by hand and passing them to the
> constructor, I want the compiler to do it for me.
>
> i.e. I wish I could (borrowing C++ syntax):
>
> struct A[=] {
>    ...
> }
>
> Then the context will be captured by value instead of reference.

This is a valid enhancement. Why not try and ask for it?

I don't know if the specific syntax would work for D, but the feature 
seems useful in some respects.

-Steve


More information about the Digitalmars-d-learn mailing list