
I have the following program: #include <iostream> #include <boost/accumulators/accumulators.hpp> #include <boost/accumulators/statistics/stats.hpp> #include <boost/accumulators/statistics/density.hpp> using namespace boost; using namespace boost::accumulators; int main() { typedef iterator_range<std::vector<std::pair<double, double> >::iterator > histogram_type; accumulator_set<double, features<tag::density> > acc(tag::density::num_bins = 20, tag::density::cache_size = 10); // push in some data ... acc(0.1); acc(1.2); acc(2.3); acc(3.4); acc(4.5); acc(5.4); acc(5.5); acc(5.5); acc(10); // Display the results ... histogram_type hist = density(acc); for( int i = 0; i < hist.size(); i++ ) std::cout << "Bin lower bound: " << hist[i].first << ", Value: " << hist[i].second << std::endl; return 0; } Bin values and indexes don't seem to be initialized: $ acc_dist Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 ...