| Thread overview | |||||
|---|---|---|---|---|---|
|
November 13, 2014 Get full class name at compile time - Not yet implemented | ||||
|---|---|---|---|---|
| ||||
Hi,
I currently have some issues to get the full class name at compile time by the variable which might point to null.
With .stringof I get the class name without the module. It seems typeid(typeof())
is the solution, but DMD throws the error:
source\app.d(10): Error: &typeid(app.A).name is not yet implemented at compile t
ime
Do I have any other possibilities?
Kind regards
André
module app;
class A {};
void main()
{
A a;
pragma(msg, typeof(a).stringof); // A
pragma(msg, typeid(typeof(a)).name); // Should print app.A
}
| ||||
November 13, 2014 Re: Get full class name at compile time - Not yet implemented | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andre | On 13/11/2014 6:22 p.m., Andre wrote: > Hi, > > I currently have some issues to get the full class name at compile time > by the variable which might point to null. > With .stringof I get the class name without the module. It seems > typeid(typeof()) > is the solution, but DMD throws the error: > > source\app.d(10): Error: &typeid(app.A).name is not yet implemented at > compile t > ime > > Do I have any other possibilities? > > Kind regards > André > > module app; > > class A {}; > > void main() > { > A a; > > pragma(msg, typeof(a).stringof); // A > pragma(msg, typeid(typeof(a)).name); // Should print app.A > } http://dlang.org/phobos/std_traits.html#fullyQualifiedName | |||
November 13, 2014 Re: Get full class name at compile time - Not yet implemented | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Rikki Cattermole | perfekt, thanks a lot.
Kind regards
André
On Thursday, 13 November 2014 at 05:37:26 UTC, Rikki Cattermole wrote:
> On 13/11/2014 6:22 p.m., Andre wrote:
>
> http://dlang.org/phobos/std_traits.html#fullyQualifiedName
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply