C++ Ranges proposal for the Standard Library

eles via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 17 06:27:35 PDT 2014


On Friday, 17 October 2014 at 11:44:29 UTC, Ola Fosheim Grøstad 
wrote:
> On Friday, 17 October 2014 at 10:17:38 UTC, eles wrote:

> (not tested :^)

template<typename T>
auto mittelwert_accumulate2(const T &vektor) ->typename 
T::value_type
{
   return accumulate(vektor.cbegin(), vektor.cend(), 
static_cast<typename T::value_type>(0)) / 
distance(vektor.cbegin(), vektor.cend());
}

(gcc does not yet support std::cbegin() and std::cend()).

(tested :^)


More information about the Digitalmars-d mailing list