Is it possible to define patterns for accepting parameters that are int, float, etc.?
It's fine. But in order to pass an array, you must have an array.
std::array<float,4> hoor2 = {3.0f, 3.0f, 1.0f, 1.0f};
In the appropriate template, you should use size_t , not int
template <typename T, size_t N> void ExpectedValueDataSet(const std::array<T, N>& data) {}
How to set up a template for receiving two inputs?
Just add an extra parameter. To pass a pointer and length, you create a template that receives a pointer and length
template <typename T> void ExpectedValueDataSet( T const * data, int N){}
There is also a special syntax for arrays of c styles that allow you to pass them without specifying the length, since this argument will be inferred from this type.
template <typename T, size_t N > void ExpectedValueDataSet( const T (&data)[N]) { }
Together we have
class Probability { public: template <typename T, size_t N> void ExpectedValueDataSet(const std::array<T, N>& data) {} template <typename T> void ExpectedValueDataSet( T const * data, int N){} template <typename T, size_t N> void ExpectedValueDataSet(const T (&data)[N]){}; };
See a live working exam here