On Monday, 16 December 2019 at 18:01:06 UTC, Steven Schveighoffer
wrote:
I'd compare the typeid directly:
auto tid = typeid(object);
return(tid is typeid(X) || tid is typeid(Y) || tid is typeid(Z)
|| ...)
If you are doing a cast(const(X))object, what you are doing is
each time traversing
On 12/16/19 9:38 AM, Per Nordlöw wrote:
What is the fastest way to check whether a class reference is an
instance of a
bottom equal to any in a set of classes? My current try is something like
class C {}
class X : C {}
class Y : C {}
class Z : C {}
bool pred(scope const Object object)
{
On Mon, Dec 16, 2019 at 02:38:59PM +, Per Nordlöw via Digitalmars-d-learn
wrote:
> What is the fastest way to check whether a class reference is an instance of
> a
> bottom equal to any in a set of classes? My current try is something like
>
> class C {}
>
> class X : C {}
> class Y : C {}
What is the fastest way to check whether a class reference is an
instance of a
bottom equal to any in a set of classes? My current try is
something like
class C {}
class X : C {}
class Y : C {}
class Z : C {}
...
bool pred(scope const Object object)
{
return (cast(const(X))object ||