Functions that return type

sarn via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 16 14:28:28 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;
> }

A type itself isn't a runtime value.  I think the closest thing 
is a TypeInfo object:

https://dlang.org/library/object/type_info.html
https://dlang.org/spec/expression.html#TypeidExpression


More information about the Digitalmars-d-learn mailing list