Code using boost::binomial_distribution fails to compile if the template argument is an unsigned integer type, due to an ambiguous call to abs in the implementation of generate().
https://godbolt.org/z/MKKGz3b4r
#include <boost/random.hpp>
#include <random>
#include <cstddef>
std::mt19937_64 prng(0);
boost::random::binomial_distribution<uint64_t> dist;
uint64_t test(uint64_t num) {
return dist(prng);
}
The ambiguous call is here:
|
RealType km = abs(k - m); |
Is this the intended behaviour? I haven't seen anything in the docs that would mention that the template argument must be signed, and std::binomial_distribution supports unsigned integer types.
Code using
boost::binomial_distributionfails to compile if the template argument is an unsigned integer type, due to an ambiguous call toabsin the implementation ofgenerate().https://godbolt.org/z/MKKGz3b4r
The ambiguous call is here:
random/include/boost/random/binomial_distribution.hpp
Line 324 in be37499
Is this the intended behaviour? I haven't seen anything in the docs that would mention that the template argument must be signed, and
std::binomial_distributionsupports unsigned integer types.