template <class T>
bool safe_increment(T& t) {
- if (t < std::numeric_limits<T>::max()) {
+ if (t < (std::numeric_limits<T>::max)()) {
++t;
return true;
}
bool safe_radd(T& t, const U& u) {
static_assert(is_unsigned_integral<T>::value, "T must be unsigned integral type");
static_assert(is_unsigned_integral<U>::value, "T must be unsigned integral type");
- if (static_cast<T>(std::numeric_limits<T>::max() - t) >= u) {
+ if (static_cast<T>((std::numeric_limits<T>::max)() - t) >= u) {
t += static_cast<T>(u); // static_cast to suppress conversion warning
return true;
}
// in decimal system it would look like this:
// 8 + 8 = 6 = 8 - (9 - 8) - 1
// 9 + 1 = 0 = 9 - (9 - 1) - 1
- auto tmp = std::numeric_limits<std::uint64_t>::max();
+ auto tmp = (std::numeric_limits<std::uint64_t>::max)();
tmp -= o;
--d -= tmp;
}
+ template <class Archive>
+ void serialize(Archive& ar, unsigned /* version */) {
+ ar& make_nvp("data", data);
+ }
+
std::vector<std::uint64_t, Allocator> data;
};