Explicitly disallow floats from object settings API

This is to incentivize the transfer from `float` to `double` throughout
the codebase.
This commit is contained in:
Vasily
2020-01-30 10:36:21 +01:00
committed by username223
parent eed01ed5a8
commit 7b9f7e6ff3
2 changed files with 8 additions and 0 deletions
@@ -59,9 +59,13 @@ private:
const auto isBool = is_same<bool, Value>::value;
const auto isInt = is_same<int, Value>::value;
const auto isDouble = is_same<double, Value>::value;
const auto isFloat = is_same<float, Value>::value;
const auto isString = is_same<std::string, Value>::value
|| is_same<const char*, Value>::value;
static_assert( !isFloat,
"'float' is not supported. Use 'double' instead." );
static_assert( isBool || isInt || isDouble || isString,
"Type is not supported for the settings object." );
+4
View File
@@ -65,8 +65,12 @@ std::list<Value> loadListFromDisk( const std::string structName,
const auto isBool = is_same<bool, Value>::value;
const auto isInt = is_same<int, Value>::value;
const auto isDouble = is_same<double, Value>::value;
const auto isFloat = is_same<float, Value>::value;
const auto isString = is_same<std::string, Value>::value;
static_assert( !isFloat,
"'float' is not supported. Use 'double' instead." );
static_assert( isBool || isInt || isDouble || isString,
"Type is not supported for the settings object." );