Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Change name from RTTypeid to __typeid
Browse files Browse the repository at this point in the history
  • Loading branch information
andralex committed Jul 28, 2020
1 parent 1a76c5b commit fc0de5b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/object.d
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ class TypeInfo
/*
Run-time type information for scalar types (int for now).
*/
template RTTypeid(T)
template __typeid(T)
if (is(T == int))
{
class Impl : TypeInfo
Expand All @@ -450,11 +450,11 @@ if (is(T == int))
return 1;
}

override string toString() const pure nothrow @safe { return T.stringof; }
override string toString() { return T.stringof; }

override size_t getHash(scope const void* p) @nogc @trusted
{
return *cast(const T *)p;
return *cast(const T *) p;
}

override bool equals(in void* p1, in void* p2) @nogc @trusted
Expand Down Expand Up @@ -490,12 +490,12 @@ if (is(T == int))
}

// On-demand singleton object in static storage
immutable RTTypeid = new Impl;
immutable __typeid = new Impl;
}

unittest
{
alias id = RTTypeid!int;
alias id = __typeid!int;
static assert(id == id && id <= id && id >= id);
static assert(id.toString == "int");
int a = 42, b = 42, c = 43;
Expand Down

0 comments on commit fc0de5b

Please sign in to comment.