On Saturday, 30 May 2015 at 08:51:31 UTC, Vladimir Panteleev
wrote:
On Saturday, 30 May 2015 at 08:50:21 UTC, Vladimir Panteleev
wrote:
http://localhost/post/asvcbsvfcxznwypttojk@192.168.0.1
Sorry, working link:
http://forum.dlang.org/post/asvcbsvfcxznwypttojk@192.168.0.1
We may say that AA!(K, V)* should be recognized as V[K] by
compiler. However in this case we will found another problem:
opIndexAssign will unable to allocate memory for the new AA
instance, because it can't modify `this` pointer.
Otherwise, implicit casting _from_ another type is a unsolvable
task now.
Please, remind, why we don't want to add possibility of implicit
casting from another type (not as default constructor behaviour,
of course)?
Something like
struct Foo
{
int a;
static Foo opImplicitConstructFrom(T)(T val) if(is(T : int))
{
return Foo(val);
}
}