On Friday, 30 May 2014 at 12:57:52 UTC, anonymous wrote:
And why is "const(Foo) getQ" so much different? (e.g: this is
an explicit cast, right? Is there anything that might go
wrong?)
It's not a cast. It's the unambiguous notation for a qualified
type. Often you can omit the parentheses. With methods you
cannot. With methods you need the parentheses to let the
compiler
know that you indeed mean the return type to be const, not the
method itself.
Ouch... I even wonder why I wrote about "is this a cast?"... Noob
mistake! :P
Anyway thank you everyone, I really thought the two way of
writing were equivalent. (it's C++ fault, not mine! I tell you!)