Hi,
Sometimes it is difficult to make boost::units quantities with other
libraries. For example to have boost::accumulators mean work with
units, one has to specialize division by integer for quantities.
In this example the accumulators and units compiles out of the box but
gives an incorrect answer.
#include
#include // or other stat
features
#include // or other stat
features
#include
#include
using namespace boost::accumulators;
using namespace boost::units;
int main(){
accumulator_setsi::time, features > a;
a(2.1*si::second);
a(2.0*si::second);
a(4.1*si::second);
std::cout
<< extract::min(a)<< " "
<< extract::max(a)<< std::endl
;
return 0;
}
It prints: 0 s 4.1 s
instead of: 2.1 s 4.1 s
So, it seems that the min extractor fails for quantities. I would like
to know if there is a way to correctly specialize "min" for
quantities. (By the way, std::min for quantities works fine).
However the behavior is unfortunate in the first place. Regardless of
the solution I would label this as a bug of one of the two libraries.
Thank you,
Alfredo