mirror of
https://github.com/nlohmann/json.git
synced 2025-07-13 20:21:48 +03:00
remove explicit keyword on udt-constructor
This commit is contained in:
committed by
Théo DELRIEU
parent
c0c72b5b62
commit
1eafac7220
90
src/json.hpp
90
src/json.hpp
@ -257,30 +257,6 @@ struct is_compatible_integer_type_impl<true, RealIntegerType, CompatibleNumberIn
|
||||
RealLimits::is_signed == CompatibleLimits::is_signed;
|
||||
};
|
||||
|
||||
// quickfix, just trying to make things compile before refactoring
|
||||
template <bool B, typename RealIntegerType, typename CompatibleEnumType>
|
||||
struct is_compatible_enum_type_impl : std::false_type{};
|
||||
|
||||
template <typename RealIntegerType, typename CompatibleEnumType>
|
||||
struct is_compatible_enum_type_impl<true, RealIntegerType, CompatibleEnumType>
|
||||
{
|
||||
using RealLimits = std::numeric_limits<RealIntegerType>;
|
||||
using CompatibleLimits = std::numeric_limits<typename std::underlying_type<CompatibleEnumType>::type>;
|
||||
|
||||
static constexpr auto value =
|
||||
CompatibleLimits::is_integer and
|
||||
RealLimits::is_signed == CompatibleLimits::is_signed;
|
||||
};
|
||||
|
||||
template <typename RealIntegerType, typename CompatibleEnumType>
|
||||
struct is_compatible_enum_type
|
||||
{
|
||||
static constexpr auto value = is_compatible_enum_type_impl<
|
||||
// quickfix for all enums
|
||||
std::is_enum<CompatibleEnumType>::value, RealIntegerType,
|
||||
CompatibleEnumType>::value;
|
||||
};
|
||||
|
||||
template <typename RealIntegerType, typename CompatibleNumberIntegerType>
|
||||
struct is_compatible_integer_type
|
||||
{
|
||||
@ -289,6 +265,27 @@ struct is_compatible_integer_type
|
||||
CompatibleNumberIntegerType>::value;
|
||||
};
|
||||
|
||||
// quickfix, just trying to make things compile before refactoring
|
||||
template <bool B, typename RealIntegerType, typename CompatibleEnumType>
|
||||
struct is_compatible_enum_type_impl : std::false_type {};
|
||||
|
||||
template <typename RealIntegerType, typename CompatibleEnumType>
|
||||
struct is_compatible_enum_type_impl<true, RealIntegerType, CompatibleEnumType>
|
||||
{
|
||||
using Underlying = typename std::underlying_type<CompatibleEnumType>::type;
|
||||
static constexpr auto value =
|
||||
is_compatible_integer_type<RealIntegerType, Underlying>::value;
|
||||
};
|
||||
|
||||
template <typename RealIntegerType, typename CompatibleEnumType>
|
||||
struct is_compatible_enum_type
|
||||
{
|
||||
static constexpr auto value =
|
||||
is_compatible_enum_type_impl<std::is_enum<CompatibleEnumType>::value,
|
||||
RealIntegerType,
|
||||
CompatibleEnumType>::value;
|
||||
};
|
||||
|
||||
template <typename RealFloat, typename CompatibleFloat>
|
||||
struct is_compatible_float_type
|
||||
{
|
||||
@ -306,6 +303,7 @@ struct is_compatible_basic_json_type
|
||||
std::is_same<typename BasicJson::boolean_t, T>::value or
|
||||
is_compatible_array_type<BasicJson, T>::value or
|
||||
is_compatible_enum_type<T, typename BasicJson::number_integer_t>::value or
|
||||
is_compatible_enum_type<T, typename BasicJson::number_unsigned_t>::value or
|
||||
is_compatible_object_type<typename BasicJson::object_t, T>::value or
|
||||
is_compatible_float_type<typename BasicJson::number_float_t, T>::value or
|
||||
is_compatible_integer_type<typename BasicJson::number_integer_t,
|
||||
@ -1627,8 +1625,8 @@ class basic_json
|
||||
uncvref_t<T>, basic_json_t>::value and
|
||||
not detail::is_basic_json_nested_class<uncvref_t<T>, basic_json_t, primitive_iterator_t>::value and
|
||||
not std::is_same<uncvref_t<T>, typename basic_json_t::array_t::iterator>::value and
|
||||
// quickfix
|
||||
not std::is_enum<uncvref_t<T>>::value and
|
||||
not detail::is_compatible_enum_type<number_integer_t, uncvref_t<T>>::value and
|
||||
not detail::is_compatible_enum_type<number_unsigned_t, uncvref_t<T>>::value and
|
||||
not std::is_same<uncvref_t<T>, typename basic_json_t::object_t::iterator>::value and
|
||||
detail::has_to_json<JSONSerializer, basic_json,
|
||||
uncvref_t<T>>::value,
|
||||
@ -1831,17 +1829,17 @@ not std::is_enum<uncvref_t<T>>::value and
|
||||
|
||||
@since version 1.0.0
|
||||
*/
|
||||
template <
|
||||
typename CompatibleNumberIntegerType,
|
||||
enable_if_t<detail::is_compatible_integer_type<
|
||||
number_integer_t, CompatibleNumberIntegerType>::value or
|
||||
detail::is_compatible_enum_type<number_integer_t, CompatibleNumberIntegerType>::value,
|
||||
int> = 0>
|
||||
template <typename CompatibleNumberIntegerType,
|
||||
enable_if_t<
|
||||
detail::is_compatible_integer_type<
|
||||
number_integer_t, CompatibleNumberIntegerType>::value or
|
||||
detail::is_compatible_enum_type<
|
||||
number_integer_t, CompatibleNumberIntegerType>::value,
|
||||
int> = 0>
|
||||
basic_json(const CompatibleNumberIntegerType val) noexcept
|
||||
: m_type(value_t::number_integer),
|
||||
m_value(static_cast<number_integer_t>(val))
|
||||
{
|
||||
assert_invariant();
|
||||
m_value(static_cast<number_integer_t>(val)) {
|
||||
assert_invariant();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1892,14 +1890,16 @@ detail::is_compatible_enum_type<number_integer_t, CompatibleNumberIntegerType>::
|
||||
*/
|
||||
template <
|
||||
typename CompatibleNumberUnsignedType,
|
||||
enable_if_t<detail::is_compatible_integer_type<
|
||||
number_unsigned_t, CompatibleNumberUnsignedType>::value,
|
||||
int> = 0>
|
||||
enable_if_t<
|
||||
detail::is_compatible_integer_type<
|
||||
number_unsigned_t, CompatibleNumberUnsignedType>::value or
|
||||
detail::is_compatible_enum_type<
|
||||
number_integer_t, CompatibleNumberUnsignedType>::value,
|
||||
int> = 0>
|
||||
basic_json(const CompatibleNumberUnsignedType val) noexcept
|
||||
: m_type(value_t::number_unsigned),
|
||||
m_value(static_cast<number_unsigned_t>(val))
|
||||
{
|
||||
assert_invariant();
|
||||
m_value(static_cast<number_unsigned_t>(val)) {
|
||||
assert_invariant();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -8603,12 +8603,14 @@ detail::is_compatible_enum_type<number_integer_t, CompatibleNumberIntegerType>::
|
||||
return lhs.m_it >= rhs.m_it;
|
||||
}
|
||||
|
||||
friend constexpr bool operator+(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
|
||||
primitive_iterator_t operator+(difference_type i)
|
||||
{
|
||||
return lhs.m_it + rhs.m_it;
|
||||
auto result = *this;
|
||||
result += i;
|
||||
return result;
|
||||
}
|
||||
|
||||
friend constexpr bool operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
|
||||
friend constexpr difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
|
||||
{
|
||||
return lhs.m_it - rhs.m_it;
|
||||
}
|
||||
|
Reference in New Issue
Block a user