Trying to make a template specialisation for vectors but getting a compiler error.
template<typename T, typename std::enable_if<std::is_same<double, T>::value>::type* = nullptr>
AttributeValue from(double value) {
...
}
template<typename N, typename T, typename std::enable_if<std::is_same<std::vector<N>, T>::value>::type* = nullptr>
AttributeValue from(std::vector<N> value) {
...
for (N item: value) {
AttributeValue val = from(item);
}
}
When trying to call to convert my vector...
MyClass mclass;
mclass.from<double>(1); // compiles
std::vector<double> vect{1};
mclass.from<std::vector<double>>(vect); // error: no matching function for call to ‘MyClass::from<std::vector<double, std::allocator<double> > >(std::vector<double>&)’
Aucun commentaire:
Enregistrer un commentaire