On Tuesday, 11 December 2012 at 09:40:08 UTC, Ali Çehreli wrote:
On 12/11/2012 01:05 AM, Ali Çehreli wrote:
> /* Fundamental types must be made differently; probably due
to syntax
> * issues. I would have expected for the following to work:
> *
> * return Type!index(args); // <-- compilation error
> */
My mind must have been in C++ mode there. :) The following is
not legal in D:
int foo()
{
return int(42); // not D syntax!
}
But of course the simpler code below works:
/* A generic function that can make an object of any type. */
Type!index make(size_t index, T...)(T args)
{
// ...
} else {
return args[0]; // simply return "the" argument
}
}
Ali
Thank you for you example,I understand.
But how do you think does it make sense to open enhancement
allow alias this with types?
Or it is completely useless?