Get most D type from type
Hussien via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Mar 18 06:30:22 PDT 2017
On Saturday, 18 March 2017 at 13:16:49 UTC, Adam D. Ruppe wrote:
> On Saturday, 18 March 2017 at 13:06:56 UTC, Hussien wrote:
>> So you are telling me there is no way to do this easily?
>
> What are you actually trying to do?
Glad you asked! It is very simple: I am trying to get the
underlying D type from a type that I have.
interface X; => dtype!(X) == "interface"
enum X; => dtype!(X) == "enum"
class X; => dtype!(X) == "class"
struct X; => dtype!(X) == "struct"
union X; => dtype!(X) == "union"
wchar* X; => dtype!(X) == "wchar*"
int X; => dtype!(X) == "int"
void function() X; => dtype!(X) == "function*"
void X(); => dtype!(X) == "function"
etc..
etc..
The very right terms should only be terms that are listed in the
D grammar as types besides the *'s. If a type is a pointer to a
_type_, dtype should return _type_*, etc.
More information about the Digitalmars-d-learn
mailing list