C++ Ranges proposal for the Standard Library

via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 17 04:44:28 PDT 2014


On Friday, 17 October 2014 at 10:17:38 UTC, eles wrote:
> double mittelwert_accumulate(const vector<double>& vektor)
> {
> 	return accumulate(vektor.begin(), vektor.end(), 0.0) / 
> vektor.size();
> }


template<typename T>
auto mittelwert_accumulate(const T& vektor){
   return accumulate(cbegin(vektor), cend(vektor), 0.0) / 
distance(cbegin(a), cend(a))
}

(not tested :^)


More information about the Digitalmars-d mailing list