If you don't mind, could you see if your solutions work on the following code:

http://dpaste.dzfl.pl/64025e0a


What you're doing here is a bit different (AFAICT). _A is a template, not a 'real' class. So, it has no classinfo. The only real type here is the template instantiation you call A.

Honestly, I have trouble reading your code, even though mine look much like yours. I really do not get what you're trying to do. Maybe I'm too tired.


This is possibly because I want to design the code to work with a variable number of arguments(hence my asking for the number of arguments of a templated class in the other post).

e.g., I want

class A(..., bool _NestLevel = true) { }

then

A(...) a; to create an object. (note the _NestLevel is "hidden")

If A has only one template argument, _NestLevel, then I want this to reduce to

A a;

Thanks.

You should try to use templated factory functions:

auto makeA(..., bool _NestLevel = true)
{
    return new A!(..., _NestLevel)();