I am trying to write a deduction guide, that only detects one of many typename's from given constructor argument and requires user to enter int
size
manually
template <int size, typename T>
struct Board
{
array<array<T, size>, size> values;
explicit Board(const vector<T>& raw_values){
}
};
template <int size, typename T> Board(const vector<T>&) -> Board<int size, T>;
The idea above is that user should still be forced to enter "int size
" argument of template, but "typename T
" should be deduced from the argument of constructor, is this possible?
After correct specification, this is how method should be called
auto b = Board<3>(initialStateVector);
Currently, it requires to me to enter like this;
auto b = Board<3, int>(initialStateVector);
So basically, I want "int
" above to be deduced from given initialStateVector
, which has type
const vector<int>& raw_values