char buffer[20];
if (value < 0) {
result->push_back('-');
- using u = std::make_signed<size_t>::type;
result->append(
- buffer,
- uint64ToBufferUnsafe(
- static_cast<size_t>(-static_cast<u>(value)), buffer));
+ buffer, uint64ToBufferUnsafe(uint64_t(-uint64_t(value)), buffer));
} else {
result->append(buffer, uint64ToBufferUnsafe(uint64_t(value), buffer));
}
namespace detail {
/**
- * Bool to integral/float doesn't need any special checks, and this
+ * Bool to integral doesn't need any special checks, and this
* overload means we aren't trying to see if a bool is less than
* an integer.
*/
template <class Tgt>
typename std::enable_if<
- !std::is_same<Tgt, bool>::value &&
- (std::is_integral<Tgt>::value || std::is_floating_point<Tgt>::value),
+ !std::is_same<Tgt, bool>::value && std::is_integral<Tgt>::value,
Expected<Tgt, ConversionCode>>::type
convertTo(const bool& value) noexcept {
return static_cast<Tgt>(value ? 1 : 0);
Value&& value() && {
return std::move(value_);
}
- // TODO (t17322426): remove when VS2015 support is deprecated
- // VS2015 static analyzer incorrectly flags these as unreachable in certain
- // circumstances. VS2017 does not have this problem on the same code.
- FOLLY_PUSH_WARNING
- FOLLY_MSVC_DISABLE_WARNING(4702) // unreachable code
Error& error() & {
return error_;
}
Error&& error() && {
return std::move(error_);
}
- FOLLY_POP_WARNING
};
template <class Value, class Error>
Value&& value() && {
return std::move(value_);
}
- // TODO (t17322426): remove when VS2015 support is deprecated
- // VS2015 static analyzer incorrectly flags these as unreachable in certain
- // circumstances. VS2017 does not have this problem on the same code.
- FOLLY_PUSH_WARNING
- FOLLY_MSVC_DISABLE_WARNING(4702) // unreachable code
Error& error() & {
return error_;
}
Error&& error() && {
return std::move(error_);
}
- FOLLY_POP_WARNING
};
namespace expected_detail_ExpectedHelper {
struct hasher<bool> {
size_t operator()(bool key) const {
// Make sure that all the output bits depend on the input.
- using u = std::make_signed<size_t>::type;
- return static_cast<size_t>(-static_cast<u>(key));
+ return -static_cast<size_t>(key);
}
};
#undef CAL_GREGORIAN
#endif
+// Defined in winnt.h
+#ifdef DELETE
+#undef DELETE
+#endif
+
// Defined in the GDI interface.
#ifdef ERROR
#undef ERROR