up now, have guessed
double mean(constiterator startit, constiterator endit); is decent signature function computing mean of collection of values stored in std collection.
but c++11, have both lamdas , for val : col.
what best practice signature such function?
until ranges, nothing change in terms of functions taking collections of values.
however, unless function specific types, sort of thing implemented generically:
template<typename iterator, typename sentinel> auto mean(iterator begin, sentinel end) { // c++14 deduced return type // ... }
Comments
Post a Comment