On 2012-09-24 22:45, Nick Sabalausky wrote:

Because 'b' is neither being assigned to an (int) nor passed into a
template/func parameter that's expecting an (int).

Either I'm just stupid or I've failed completely to understand "implicit convertible to".

Another example:

struct Foo
{
    int[] arr;
    alias arr this;
}

void main ()
{
    auto foo = Foo([3, 4]);
    auto i = foo[0];
}

Have a look at the last line. In that line "foo" is implicitly converted to "int[]" with the help of the "alias this" in Foo, because the context requires something "indexable". Since you cannot index a struct the implicit conversion kicks in. What's the difference?

--
/Jacob Carlborg

Reply via email to