Я пытаюсь сделать общую функцию кросс-произведения:
template<class ContainerType1, class ContainerType2, typename ReturnType>
std::vector<ReturnType> cross_product(const ContainerType1& a, const ContainerType2& b)
{
assert((a.size()==3)&&(b.size==3));
return {a[1]*b[2]-a[2]-b[1], a[2]*b[0]-a[0]*b[2], a[0]*b[1]-a[1]*b[0]};
}
строка
std::vector<double> A = cross_product(p_r2,p_r1);
выдает мне ошибку:
error : couldn't deduce template parameter ‘ReturnType’
Есть лиспособ сохранить универсальность и избежать объявления ReturnType как, например, double?