alias this and constructor
MrSmith
mrsmith33 at yandex.ru
Sat Apr 12 05:47:00 PDT 2014
On Saturday, 12 April 2014 at 11:48:36 UTC, Jack Applegame wrote:
> Why this code doesn't want to compile?
>
> import std.algorithm;
> import std.array;
>
> struct Foo {
> int a;
> this(int v) {}
> alias a this;
> }
>
> void main() {
> immutable(Foo)[] foo;
> auto arr = array(foo.filter!(o => true));
> }
>
> http://dpaste.dzfl.pl/25572b0f6d0b
Maybe, because compiler cannot distinguish between default
constructor which takes int and your one, which also takes int.
More information about the Digitalmars-d-learn
mailing list