Is it possible to detect if a type exists?

Q

Qi

Assume we can use any standard technical (macro, template, etc),
is it possible to know that if type SomeType exists at compile time?

SomeType is,
either not defined, i.e, the symbol SomeType doesn't exist at all,
or was defined as a class, so I can fetch any pre-defined information
from it.

I highly doubt its feasibility. Because as long as the type doesn't
exist, the compile will complain "SomeType" can't be found.

Any magic (while be standard)?
 
C

Cholo Lennon

Assume we can use any standard technical (macro, template, etc),
is it possible to know that if type SomeType exists at compile time?

SomeType is,
either not defined, i.e, the symbol SomeType doesn't exist at all,
or was defined as a class, so I can fetch any pre-defined information
from it.

I highly doubt its feasibility. Because as long as the type doesn't
exist, the compile will complain "SomeType" can't be found.

Any magic (while be standard)?
AFAIK, you can't. The closest approach is Boost.TypeTraits or some
compiler intrinsic type traits.

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top