diff options
author | Matt Cotter <matt.cotter@mongodb.com> | 2016-09-08 17:24:07 -0400 |
---|---|---|
committer | Matt Cotter <matt.cotter@mongodb.com> | 2016-09-09 13:22:25 -0400 |
commit | 2bd286acef2fdb035f1d45253f6e6e4c24a2dc04 (patch) | |
tree | 13943305b07a3e368ca48d5b1520cfee02ce0b3f /src/mongo/util/represent_as.h | |
parent | ae280145c3c3dc770884a68885e80a282e8d50fd (diff) | |
download | mongo-2bd286acef2fdb035f1d45253f6e6e4c24a2dc04.tar.gz |
SERVER-22973 use mongo macros for static assert
Diffstat (limited to 'src/mongo/util/represent_as.h')
-rw-r--r-- | src/mongo/util/represent_as.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/util/represent_as.h b/src/mongo/util/represent_as.h index 2bdb12ce06e..f85805adbee 100644 --- a/src/mongo/util/represent_as.h +++ b/src/mongo/util/represent_as.h @@ -34,6 +34,7 @@ #include <boost/optional.hpp> +#include "mongo/base/static_assert.h" #include "mongo/stdx/type_traits.h" namespace mongo { @@ -48,7 +49,7 @@ namespace detail { // Floating point numbers -> double template <typename T> typename stdx::enable_if_t<std::is_floating_point<T>::value, double> upconvert(T t) { - static_assert(sizeof(double) >= sizeof(T), "sizeof(double) >= sizeof(T)"); + MONGO_STATIC_ASSERT(sizeof(double) >= sizeof(T)); return static_cast<double>(t); } @@ -56,7 +57,7 @@ typename stdx::enable_if_t<std::is_floating_point<T>::value, double> upconvert(T template <typename T> typename stdx::enable_if_t<std::is_integral<T>::value && std::is_signed<T>::value, int64_t> upconvert(T t) { - static_assert(sizeof(int64_t) >= sizeof(T), "sizeof(int64_t) >= sizeof(T)"); + MONGO_STATIC_ASSERT(sizeof(int64_t) >= sizeof(T)); return static_cast<int64_t>(t); } @@ -64,7 +65,7 @@ upconvert(T t) { template <typename T> typename stdx::enable_if_t<std::is_integral<T>::value && !std::is_signed<T>::value, uint64_t> upconvert(T t) { - static_assert(sizeof(uint64_t) >= sizeof(T), "sizeof(uint64_t) >= sizeof(T)"); + MONGO_STATIC_ASSERT(sizeof(uint64_t) >= sizeof(T)); return static_cast<uint64_t>(t); } |