Commit 137297a
committed
fix: explicitly cast rmp::AnnealingStrategy::random_'s seed to 32-bit
`rmp::AnnealingStrategy::random_` is `std::mt19937` which is 32-bit: https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine.html
This in turn causes the constructor for `AnnealingStrategy` to be ill-formed according to the C++17 standard:
> List-initialization of an object or reference of type T is defined as follows:
> ...
> (3.7) Otherwise, if T is a class type, constructors are considered. The applicable constructors are enumerated and the best one is chosen through overload resolution (16.3, 16.3.1.7). If a narrowing conversion (see below) is required to convert any of the arguments, the program is ill-formed.
As the seed is `uint64_t` and `mt19937` uses `uint32_t`, this is a narrowing conversion that fails to compile on at least Darwin. This is the solution that probably causes the least amount of surprises.
Signed-off-by: Mohamed Gaber <me@donn.website>1 parent fce81f1 commit 137297a
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
0 commit comments