Is there to templatize the "ints" in the lambda function below in the case that there was a standard container of doubles or floats, etc.? I have searched the world over for help with this. I even asked for the help of my professor who says it is possible but is to cryptic about the answer.
template <typename T>
float mean(T &container)
{
auto sum = std::accumulate(container.begin(), container.end(), 0/*initial value*/,
[](int total, int cur)
{
return total+cur;
}//end of lambda
);//end of accumulate
return static_cast<float>(sum) / container.size(); //to find the mean
}//end of mean
Thanks in advance.