Skip to content

Commit

Permalink
allows narrow implicit cast of failings
Browse files Browse the repository at this point in the history
  • Loading branch information
TinyTinni committed Mar 9, 2024
1 parent 8b47ab4 commit cf3a2b2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/chaos/RandomSequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ class RandomSequence : public Sequence
public:
class Fail
{
float probability;
double probability;
std::vector<std::function<void()>> exceptions;
std::vector<double> weights;
friend Probas;

public:
Fail() : probability{0.f} {}
Fail(float probability) : probability{probability} {}
Fail(int proba) : probability{static_cast<double>(proba)} {}
Fail(double proba) : probability{proba}
{
assert(proba >= 0 && proba <= 0);
}

template <std::default_initializable ExceptionT>
Fail &with(double weight = 1.0)
Expand Down

0 comments on commit cf3a2b2

Please sign in to comment.