In code (just paste and copy)is there a way to avoid repetition/listing of template args(line marked in code):
#include <iostream>
using namespace std;
template<class T,class... V>
struct nullptr_
{
nullptr_(T& obj,V&... args)
{
nullptr_hlp(obj,args...);
}
template<class A>
static void nullptr_hlp(A& a);
{
a = nullptr;
}
template<class A,class... Vs>
static void nullptr_hlp(A& a,Vs&... args)
{
a = nullptr;
nullptr_hlp(args...);
}
};
class X : nullptr_<int*,double*,char*>//IS THERE A WAY TO HAVE JUST nullptr_?
{
int* a;
double* b;
char* c;
typedef nullptr_<decltype(a),decltype(b),decltype(c)> init_;
public:
X():init_(a,b,c)
{
}
};
int main()
{
X x;
return 0;
}
nullptr_<int*,double*,char*>becomes an injected class name withinX, so you can refer to it without the argument list: