Functions that return type
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jan 16 14:13:05 PST 2016
On Saturday, 16 January 2016 at 21:22:15 UTC, data pulverizer
wrote:
> Is it possible to create a function that returns Type like
> typeof() does? Something such as:
>
> Type returnInt(){
> return int;
> }
No. A function cannot return a type. A template can evaluate to a
type, though:
----
template returnInt(){
alias returnInt = int;
}
----
> More to the point what is the Type of a type such as int?
Types don't have types. You can check if something is a type with
an IsExpression: `is(T)` is true if T is a type.
More information about the Digitalmars-d-learn
mailing list