diff --git a/include/boost/random/detail/polynomial.hpp b/include/boost/random/detail/polynomial.hpp index a8c4b269f..89f779a14 100644 --- a/include/boost/random/detail/polynomial.hpp +++ b/include/boost/random/detail/polynomial.hpp @@ -284,7 +284,12 @@ class polynomial public: reference(digit_t &value, int idx) : _value(value), _idx(idx) {} - operator bool() const { return (_value & (digit_t(1) << _idx)) != 0; } + reference(const reference& other) = default; + reference(reference&& other) = default; + reference &operator=(const reference &other) + { + return *this = static_cast(other); + } reference& operator=(bool b) { if(b) { @@ -294,16 +299,14 @@ class polynomial } return *this; } + operator bool() const { return (_value & (digit_t(1) << _idx)) != 0; } + + reference &operator^=(bool b) { _value ^= (digit_t(b) << _idx); return *this; } - - reference &operator=(const reference &other) - { - return *this = static_cast(other); - } private: digit_t &_value; int _idx; @@ -339,7 +342,7 @@ class polynomial friend polynomial operator*(const polynomial &lhs, const polynomial &rhs); friend polynomial mod_pow_x(boost::uintmax_t exponent, polynomial mod); private: - std::vector _storage; + std::vector _storage; std::size_t _size; void ensure_bit(std::size_t i) {