Re: Variant and immutable struct

2016-08-21 Thread Øivind via Digitalmars-d-learn
On Sunday, 10 January 2016 at 17:50:44 UTC, Vlad Leberstein wrote: As I'm not very good at D, I would like to get some feedback about this solutions' viability. AFAIU memcpy-ing struct here is safe because all target arguments ever passed to tryPutting are internal to implementation(and

Re: Variant and immutable struct

2016-01-10 Thread Vlad Leberstein via Digitalmars-d-learn
v2.069.2): import std.variant : Variant; immutable struct Test { int member; } int main() { Test v; Variant test = v; return 0; } Qualifier applied to definition of aggregate type just marks all it's members with the qualifier and doesn't change the type itself

Variant and immutable struct

2016-01-05 Thread Vlad Leberstein via Digitalmars-d-learn
Hi! I've stumbled into some strange problem. I'm trying to put an immutable struct into std.variant.Variant but get some compilation error(but only when struct has at least one member). Stripped down example(tested on Linux dmd64 v2.069.2): import std.variant : Variant; immutable struct