The type of return from std::accumulate depends on the "init" i.e. if it is integer it will return integer and if it is double it will return double.
I have a template function for sum like this:
T mean(std::vector<T> vector)
{
T sum = std::accumulate(vector.begin(), vector.end(), X);
}
What should I put instead of X?
Aucun commentaire:
Enregistrer un commentaire