shared Variant[string]

zhmt via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 28 02:20:41 PST 2015


On Wednesday, 28 January 2015 at 10:16:02 UTC, Fyodor Ustinov 
wrote:
> Hi!
>
> Simple program:
> import std.variant;
>
> shared Variant[string] t;
>
> void main() {
>     t["t"] = "bebebe";
> }
>
> Without "shared" this program compiles and works.
>
> With shared I get:
>
> aa.d(6): Error: template 
> std.variant.VariantN!32LU.VariantN.opAssign cannot deduce 
> function from argument types !()(string) shared, candidates are:
> /usr/include/dmd/phobos/std/variant.d(577):        
> std.variant.VariantN!32LU.VariantN.opAssign(T)(T rhs)
> aa.d(6): Error: cannot implicitly convert expression 
> (VariantN(& handler, cast(ubyte)0u, ).this("bebebe")) of type 
> VariantN!32LU to shared(VariantN!32LU)
>
> Help me, please.

try __gshared


More information about the Digitalmars-d-learn mailing list