Relative Content

Tag Archive for c++classc++17template-specialization

specialization of public type template without specializing class template

#include “vector” template <unsigned int order> struct ReturnType; template <> struct ReturnType<0> { using type = double; // Return type for value }; template <> struct ReturnType<1> { using type = std::vector<double>; // Return type for deriv }; template <unsigned int dim> class Function { void value(typename ReturnType<0>::type &value) {}; void deriv(typename ReturnType<1>::type &deriv) {}; […]