boostorg / accumulators

An awesome library from Boost
http://boost.org/libs/accumulators
22 stars 54 forks source link

[Regression] boost::accumulators::tag::rolling_mean requires comparison operators < and > as of boost 1.71. #36

Open thebrandre opened 4 years ago

thebrandre commented 4 years ago

Code that uses boost::accumulators::accumulator_set with<X, Stats> where Stats contains boost::accumulators::tag::rolling_mean and X does not implement the operators < and > no longer compiles since Fix #11437: correct immediate_rolling_mean.

We were using this for coordinates in 3d, let's say struct Vec3d { float x; float y; float z}; . This type doesn't have a natural order. (Note that lexicographic ordering does not respect rotation symmetries, etc.) So it doesn't make sense to define comparison operators for them. Averaging, by contrast, is basically a linear combination, which is a perfectly valid operation for elements of vector spaces.

Code sample on godbolt. This code breaks when upgrading from boost-1.70 to boost -1.71.