Thanks for all your help!
-Mike
On Mon, Oct 18, 2010 at 6:21 PM, Simen kjaeraas simen.kja...@gmail.comwrote:
Mike Chaten mcha...@gmail.com wrote:
I was under the impression that alias this just was shorthand for
Class Foo {
int x;
alias x this;
}
Foo foo = new Foo
foo = 9; // foo.x =
I was under the impression that alias this just was shorthand for
Class Foo {
int x;
alias x this;
}
Foo foo = new Foo
foo = 9; // foo.x = 9
Foo Foo = 9 // null.x =9;
Also, for opCast, doesnt that only work for going from Foo to int and not
the other way around?
-Mike
On Oct 18, 2010 3:55 PM,
On Mon, 18 Oct 2010 23:47:40 +0400, Mike Chaten mcha...@gmail.com wrote:
In C++ it is possible to declare a class as follows
class Foo {
Foo(int x) { }
}
You can then use that constructor to implicitly convert int to Foo. E.g
Foo x = 0; //equivalent to Foo(0)
Is there a way in D to do an
Mike Chaten:
In C++ it is possible to declare a class as follows
class Foo {
Foo(int x) { }
}
You can then use that constructor to implicitly convert int to Foo. E.g
Foo x = 0; //equivalent to Foo(0)
Is there a way in D to do an implicit or explicit conversion from an
integral type to a
Mike Chaten mcha...@gmail.com wrote:
I was under the impression that alias this just was shorthand for
Class Foo {
int x;
alias x this;
}
Foo foo = new Foo
foo = 9; // foo.x = 9
Foo Foo = 9 // null.x =9;
Not just. this would also work:
int n = foo;
// void bar( int n ) {}
bar( foo );