1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-28 12:02:00 +03:00

💄 added assertion message

This commit is contained in:
Niels Lohmann
2017-02-18 11:01:03 +01:00
parent 513eb3ab5f
commit d1479e47bb
2 changed files with 6 additions and 4 deletions

View File

@ -8251,7 +8251,8 @@ class basic_json
return; return;
} }
static_assert(std::numeric_limits<NumberType>::digits10 <= s_capacity, ""); static_assert(std::numeric_limits<NumberType>::digits10 <= s_capacity,
"unexpected NumberType");
const bool is_neg = x < 0; const bool is_neg = x < 0;
size_t i = 0; size_t i = 0;
@ -8283,7 +8284,8 @@ class basic_json
} }
static constexpr auto d = std::numeric_limits<NumberType>::digits10; static constexpr auto d = std::numeric_limits<NumberType>::digits10;
static_assert(d == 6 or d == 15 or d == 16 or d == 17, ""); static_assert(d == 6 or d == 15 or d == 16 or d == 17,
"unexpected NumberType");
static constexpr auto fmt = d == 6 ? "%.7g" static constexpr auto fmt = d == 6 ? "%.7g"
: d == 15 ? "%.16g" : d == 15 ? "%.16g"

View File

@ -8252,7 +8252,7 @@ class basic_json
} }
static_assert(std::numeric_limits<NumberType>::digits10 <= s_capacity, static_assert(std::numeric_limits<NumberType>::digits10 <= s_capacity,
"unexpected NumberType"); "unexpected NumberType");
const bool is_neg = x < 0; const bool is_neg = x < 0;
size_t i = 0; size_t i = 0;
@ -8285,7 +8285,7 @@ class basic_json
static constexpr auto d = std::numeric_limits<NumberType>::digits10; static constexpr auto d = std::numeric_limits<NumberType>::digits10;
static_assert(d == 6 or d == 15 or d == 16 or d == 17, static_assert(d == 6 or d == 15 or d == 16 or d == 17,
"unexpected NumberType"); "unexpected NumberType");
static constexpr auto fmt = d == 6 ? "%.7g" static constexpr auto fmt = d == 6 ? "%.7g"
: d == 15 ? "%.16g" : d == 15 ? "%.16g"