-
Notifications
You must be signed in to change notification settings - Fork 74
Labels
Description
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.