On Sunday, 22 August 2021 at 00:18:18 UTC, Ali Çehreli wrote:
I did not read the linked thread but a "this template
parameter" seems to work in this case:
class Whoami {
string name(this This)() const {
return __traits(identifier, This);
}
}
class AnotherOne : Whoami { }
unittest {
On 8/21/21 2:48 PM, jfondren wrote:
On Saturday, 21 August 2021 at 21:13:58 UTC, Jeremy T. Gibson wrote:
On Saturday, 21 August 2021 at 18:27:34 UTC, Ali Çehreli wrote:
return __traits(identifier, typeof(this));
That works perfectly! Thanks. =)
This is exactly the solution you linked
On Saturday, 21 August 2021 at 21:13:58 UTC, Jeremy T. Gibson
wrote:
On Saturday, 21 August 2021 at 18:27:34 UTC, Ali Çehreli wrote:
return __traits(identifier, typeof(this));
That works perfectly! Thanks. =)
This is exactly the solution you linked to in your first post,
and found
On Saturday, 21 August 2021 at 18:45:07 UTC, jfondren wrote:
On Saturday, 21 August 2021 at 17:33:51 UTC, Jeremy T. Gibson
wrote:
is there a simple way to get the unqualified name of a class
at runtime without having to pass it through std.format?
`typeid(class).name` always yields the full
On Saturday, 21 August 2021 at 18:27:34 UTC, Ali Çehreli wrote:
return __traits(identifier, typeof(this));
That works perfectly! Thanks. =)
On Saturday, 21 August 2021 at 17:33:51 UTC, Jeremy T. Gibson
wrote:
is there a simple way to get the unqualified name of a class at
runtime without having to pass it through std.format?
`typeid(class).name` always yields the full classname,
including its module information (i.e.,
On 8/21/21 10:33 AM, Jeremy T. Gibson wrote:
`typeid(class).name` always yields the full classname, including its
module information (i.e., "modulename.classname"), where I only want
"classname" on its own.
I've been reminded of __traits(identifier) on this forum just yesterday:
import
I saw this thread --
https://forum.dlang.org/post/hdkvezicxfvehbtvj...@forum.dlang.org
-- which works at compile time (although templating seems like
overkill for my purpose), but is there a simple way to get the
unqualified name of a class at runtime without having to pass it
through