I'm trying to use class template argument deduction while having non-deducible argument, kinda expected that it would work automatically/implicitly, but it doesn't, seems so simple but i just can't make it to work, deduction guides are new to me.
template<typename T>
class Basic {
public:
T& _obj;
Basic(T& obj) : _obj(obj){}
};
template<size_t nond, typename T>
class Example {
public:
static const size_t _nond = nond;
T& _obj;
Example(T& obj) : _obj(obj){}
};
int var = 1;
auto basic = Basic(var); // works
auto example = Example<1>(var); // do not work, Error: "Too few template arguments for class template"
Tried deduction guide something like:
template<size_t nond, typename T>
Example(T) -> Example<nond, T>;
But don't even see how that should help, tried few variations without luck. Error: "Deduction guide template contains a template parameter that cannot be deduced" - does that mean i cannot use non-deducible arguments together with deduction ?