boost docs дать это в качестве примера того, как использовать boost::accumulate
:Более элегантное усиление накопления в C++ 11?
// The data for which we wish to calculate statistical properties:
std::vector<double> data(/* stuff */);
// The accumulator set which will calculate the properties for us:
accumulator_set< double, features< tag::tail<left> > > acc(
tag::tail<left>::cache_size = 4);
// Use std::for_each to accumulate the statistical properties:
std::for_each(data.begin(), data.end(), bind<void>(ref(acc), _1));
Есть ли более элегантный способ, чтобы написать этот код с петлями диапазона на основе или лямбды в C++ 11/14?
Что это код должен делать? –
Отслеживайте наименьшие 4 значения. Хвост описан по адресу http://www.boost.org/doc/libs/1_60_0/doc/html/accumulators/user_s_guide.html#accumulators.user_s_guide.the_statistical_accumulators_library.tail. Мой вопрос в основном касается структуры накопителей, а для строки for_each хотя –