🎨 replace alternative operators (and, not, or)
This commit is contained in:
		
							parent
							
								
									4f04ea1bef
								
							
						
					
					
						commit
						0498202a03
					
				
					 22 changed files with 1300 additions and 1300 deletions
				
			
		| 
						 | 
				
			
			@ -26,7 +26,7 @@ namespace detail
 | 
			
		|||
template<typename BasicJsonType>
 | 
			
		||||
void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
 | 
			
		||||
{
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(not j.is_null()))
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(!j.is_null()))
 | 
			
		||||
    {
 | 
			
		||||
        JSON_THROW(type_error::create(302, "type must be null, but is " + std::string(j.type_name())));
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -34,10 +34,10 @@ void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// overloads for basic_json template parameters
 | 
			
		||||
template<typename BasicJsonType, typename ArithmeticType,
 | 
			
		||||
         enable_if_t<std::is_arithmetic<ArithmeticType>::value and
 | 
			
		||||
                     not std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
 | 
			
		||||
                     int> = 0>
 | 
			
		||||
template < typename BasicJsonType, typename ArithmeticType,
 | 
			
		||||
           enable_if_t < std::is_arithmetic<ArithmeticType>::value&&
 | 
			
		||||
                         !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
 | 
			
		||||
                         int > = 0 >
 | 
			
		||||
void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
 | 
			
		||||
{
 | 
			
		||||
    switch (static_cast<value_t>(j))
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +66,7 @@ void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
 | 
			
		|||
template<typename BasicJsonType>
 | 
			
		||||
void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b)
 | 
			
		||||
{
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(not j.is_boolean()))
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(!j.is_boolean()))
 | 
			
		||||
    {
 | 
			
		||||
        JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(j.type_name())));
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -76,7 +76,7 @@ void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b)
 | 
			
		|||
template<typename BasicJsonType>
 | 
			
		||||
void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s)
 | 
			
		||||
{
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(not j.is_string()))
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(!j.is_string()))
 | 
			
		||||
    {
 | 
			
		||||
        JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name())));
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -86,13 +86,13 @@ void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s)
 | 
			
		|||
template <
 | 
			
		||||
    typename BasicJsonType, typename ConstructibleStringType,
 | 
			
		||||
    enable_if_t <
 | 
			
		||||
        is_constructible_string_type<BasicJsonType, ConstructibleStringType>::value and
 | 
			
		||||
        not std::is_same<typename BasicJsonType::string_t,
 | 
			
		||||
                         ConstructibleStringType>::value,
 | 
			
		||||
        is_constructible_string_type<BasicJsonType, ConstructibleStringType>::value&&
 | 
			
		||||
        !std::is_same<typename BasicJsonType::string_t,
 | 
			
		||||
                      ConstructibleStringType>::value,
 | 
			
		||||
        int > = 0 >
 | 
			
		||||
void from_json(const BasicJsonType& j, ConstructibleStringType& s)
 | 
			
		||||
{
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(not j.is_string()))
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(!j.is_string()))
 | 
			
		||||
    {
 | 
			
		||||
        JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name())));
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -132,7 +132,7 @@ template<typename BasicJsonType, typename T, typename Allocator,
 | 
			
		|||
         enable_if_t<std::is_convertible<BasicJsonType, T>::value, int> = 0>
 | 
			
		||||
void from_json(const BasicJsonType& j, std::forward_list<T, Allocator>& l)
 | 
			
		||||
{
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))
 | 
			
		||||
    {
 | 
			
		||||
        JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -149,7 +149,7 @@ template<typename BasicJsonType, typename T,
 | 
			
		|||
         enable_if_t<std::is_convertible<BasicJsonType, T>::value, int> = 0>
 | 
			
		||||
void from_json(const BasicJsonType& j, std::valarray<T>& l)
 | 
			
		||||
{
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))
 | 
			
		||||
    {
 | 
			
		||||
        JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -157,7 +157,7 @@ void from_json(const BasicJsonType& j, std::valarray<T>& l)
 | 
			
		|||
    std::copy(j.begin(), j.end(), std::begin(l));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename BasicJsonType, typename T, std::size_t N>
 | 
			
		||||
template<typename BasicJsonType, typename T, std::size_t N>
 | 
			
		||||
auto from_json(const BasicJsonType& j, T (&arr)[N])
 | 
			
		||||
-> decltype(j.template get<T>(), void())
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -173,7 +173,7 @@ void from_json_array_impl(const BasicJsonType& j, typename BasicJsonType::array_
 | 
			
		|||
    arr = *j.template get_ptr<const typename BasicJsonType::array_t*>();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename BasicJsonType, typename T, std::size_t N>
 | 
			
		||||
template<typename BasicJsonType, typename T, std::size_t N>
 | 
			
		||||
auto from_json_array_impl(const BasicJsonType& j, std::array<T, N>& arr,
 | 
			
		||||
                          priority_tag<2> /*unused*/)
 | 
			
		||||
-> decltype(j.template get<T>(), void())
 | 
			
		||||
| 
						 | 
				
			
			@ -205,7 +205,7 @@ auto from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr, p
 | 
			
		|||
    arr = std::move(ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename BasicJsonType, typename ConstructibleArrayType>
 | 
			
		||||
template<typename BasicJsonType, typename ConstructibleArrayType>
 | 
			
		||||
void from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr,
 | 
			
		||||
                          priority_tag<0> /*unused*/)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -223,20 +223,20 @@ void from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr,
 | 
			
		|||
    arr = std::move(ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename BasicJsonType, typename ConstructibleArrayType,
 | 
			
		||||
          enable_if_t <
 | 
			
		||||
              is_constructible_array_type<BasicJsonType, ConstructibleArrayType>::value and
 | 
			
		||||
              not is_constructible_object_type<BasicJsonType, ConstructibleArrayType>::value and
 | 
			
		||||
              not is_constructible_string_type<BasicJsonType, ConstructibleArrayType>::value and
 | 
			
		||||
              not std::is_same<ConstructibleArrayType, typename BasicJsonType::binary_t>::value and
 | 
			
		||||
              not is_basic_json<ConstructibleArrayType>::value,
 | 
			
		||||
              int > = 0 >
 | 
			
		||||
template < typename BasicJsonType, typename ConstructibleArrayType,
 | 
			
		||||
           enable_if_t <
 | 
			
		||||
               is_constructible_array_type<BasicJsonType, ConstructibleArrayType>::value&&
 | 
			
		||||
               !is_constructible_object_type<BasicJsonType, ConstructibleArrayType>::value&&
 | 
			
		||||
               !is_constructible_string_type<BasicJsonType, ConstructibleArrayType>::value&&
 | 
			
		||||
               !std::is_same<ConstructibleArrayType, typename BasicJsonType::binary_t>::value&&
 | 
			
		||||
               !is_basic_json<ConstructibleArrayType>::value,
 | 
			
		||||
               int > = 0 >
 | 
			
		||||
auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr)
 | 
			
		||||
-> decltype(from_json_array_impl(j, arr, priority_tag<3> {}),
 | 
			
		||||
j.template get<typename ConstructibleArrayType::value_type>(),
 | 
			
		||||
void())
 | 
			
		||||
{
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))
 | 
			
		||||
    {
 | 
			
		||||
        JSON_THROW(type_error::create(302, "type must be array, but is " +
 | 
			
		||||
                                      std::string(j.type_name())));
 | 
			
		||||
| 
						 | 
				
			
			@ -245,10 +245,10 @@ void())
 | 
			
		|||
    from_json_array_impl(j, arr, priority_tag<3> {});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename BasicJsonType>
 | 
			
		||||
template<typename BasicJsonType>
 | 
			
		||||
void from_json(const BasicJsonType& j, typename BasicJsonType::binary_t& bin)
 | 
			
		||||
{
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(not j.is_binary()))
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(!j.is_binary()))
 | 
			
		||||
    {
 | 
			
		||||
        JSON_THROW(type_error::create(302, "type must be binary, but is " + std::string(j.type_name())));
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -260,7 +260,7 @@ template<typename BasicJsonType, typename ConstructibleObjectType,
 | 
			
		|||
         enable_if_t<is_constructible_object_type<BasicJsonType, ConstructibleObjectType>::value, int> = 0>
 | 
			
		||||
void from_json(const BasicJsonType& j, ConstructibleObjectType& obj)
 | 
			
		||||
{
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(not j.is_object()))
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(!j.is_object()))
 | 
			
		||||
    {
 | 
			
		||||
        JSON_THROW(type_error::create(302, "type must be object, but is " + std::string(j.type_name())));
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -282,14 +282,14 @@ void from_json(const BasicJsonType& j, ConstructibleObjectType& obj)
 | 
			
		|||
// (BooleanType, etc..); note: Is it really necessary to provide explicit
 | 
			
		||||
// overloads for boolean_t etc. in case of a custom BooleanType which is not
 | 
			
		||||
// an arithmetic type?
 | 
			
		||||
template<typename BasicJsonType, typename ArithmeticType,
 | 
			
		||||
         enable_if_t <
 | 
			
		||||
             std::is_arithmetic<ArithmeticType>::value and
 | 
			
		||||
             not std::is_same<ArithmeticType, typename BasicJsonType::number_unsigned_t>::value and
 | 
			
		||||
             not std::is_same<ArithmeticType, typename BasicJsonType::number_integer_t>::value and
 | 
			
		||||
             not std::is_same<ArithmeticType, typename BasicJsonType::number_float_t>::value and
 | 
			
		||||
             not std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
 | 
			
		||||
             int> = 0>
 | 
			
		||||
template < typename BasicJsonType, typename ArithmeticType,
 | 
			
		||||
           enable_if_t <
 | 
			
		||||
               std::is_arithmetic<ArithmeticType>::value&&
 | 
			
		||||
               !std::is_same<ArithmeticType, typename BasicJsonType::number_unsigned_t>::value&&
 | 
			
		||||
               !std::is_same<ArithmeticType, typename BasicJsonType::number_integer_t>::value&&
 | 
			
		||||
               !std::is_same<ArithmeticType, typename BasicJsonType::number_float_t>::value&&
 | 
			
		||||
               !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
 | 
			
		||||
               int > = 0 >
 | 
			
		||||
void from_json(const BasicJsonType& j, ArithmeticType& val)
 | 
			
		||||
{
 | 
			
		||||
    switch (static_cast<value_t>(j))
 | 
			
		||||
| 
						 | 
				
			
			@ -338,19 +338,19 @@ void from_json(const BasicJsonType& j, std::tuple<Args...>& t)
 | 
			
		|||
    from_json_tuple_impl(j, t, index_sequence_for<Args...> {});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename BasicJsonType, typename Key, typename Value, typename Compare, typename Allocator,
 | 
			
		||||
          typename = enable_if_t<not std::is_constructible<
 | 
			
		||||
                                     typename BasicJsonType::string_t, Key>::value>>
 | 
			
		||||
template < typename BasicJsonType, typename Key, typename Value, typename Compare, typename Allocator,
 | 
			
		||||
           typename = enable_if_t < !std::is_constructible <
 | 
			
		||||
                                        typename BasicJsonType::string_t, Key >::value >>
 | 
			
		||||
void from_json(const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>& m)
 | 
			
		||||
{
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))
 | 
			
		||||
    {
 | 
			
		||||
        JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
 | 
			
		||||
    }
 | 
			
		||||
    m.clear();
 | 
			
		||||
    for (const auto& p : j)
 | 
			
		||||
    {
 | 
			
		||||
        if (JSON_HEDLEY_UNLIKELY(not p.is_array()))
 | 
			
		||||
        if (JSON_HEDLEY_UNLIKELY(!p.is_array()))
 | 
			
		||||
        {
 | 
			
		||||
            JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name())));
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -358,19 +358,19 @@ void from_json(const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>&
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename BasicJsonType, typename Key, typename Value, typename Hash, typename KeyEqual, typename Allocator,
 | 
			
		||||
          typename = enable_if_t<not std::is_constructible<
 | 
			
		||||
                                     typename BasicJsonType::string_t, Key>::value>>
 | 
			
		||||
template < typename BasicJsonType, typename Key, typename Value, typename Hash, typename KeyEqual, typename Allocator,
 | 
			
		||||
           typename = enable_if_t < !std::is_constructible <
 | 
			
		||||
                                        typename BasicJsonType::string_t, Key >::value >>
 | 
			
		||||
void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>& m)
 | 
			
		||||
{
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
 | 
			
		||||
    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))
 | 
			
		||||
    {
 | 
			
		||||
        JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
 | 
			
		||||
    }
 | 
			
		||||
    m.clear();
 | 
			
		||||
    for (const auto& p : j)
 | 
			
		||||
    {
 | 
			
		||||
        if (JSON_HEDLEY_UNLIKELY(not p.is_array()))
 | 
			
		||||
        if (JSON_HEDLEY_UNLIKELY(!p.is_array()))
 | 
			
		||||
        {
 | 
			
		||||
            JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name())));
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ For a detailed description of the algorithm see:
 | 
			
		|||
namespace dtoa_impl
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
template <typename Target, typename Source>
 | 
			
		||||
template<typename Target, typename Source>
 | 
			
		||||
Target reinterpret_bits(const Source source)
 | 
			
		||||
{
 | 
			
		||||
    static_assert(sizeof(Target) == sizeof(Source), "size mismatch");
 | 
			
		||||
| 
						 | 
				
			
			@ -179,7 +179,7 @@ boundaries.
 | 
			
		|||
 | 
			
		||||
@pre value must be finite and positive
 | 
			
		||||
*/
 | 
			
		||||
template <typename FloatType>
 | 
			
		||||
template<typename FloatType>
 | 
			
		||||
boundaries compute_boundaries(FloatType value)
 | 
			
		||||
{
 | 
			
		||||
    assert(std::isfinite(value));
 | 
			
		||||
| 
						 | 
				
			
			@ -232,7 +232,7 @@ boundaries compute_boundaries(FloatType value)
 | 
			
		|||
    //      -----------------+------+------+-------------+-------------+---  (B)
 | 
			
		||||
    //                       v-     m-     v             m+            v+
 | 
			
		||||
 | 
			
		||||
    const bool lower_boundary_is_closer = F == 0 and E > 1;
 | 
			
		||||
    const bool lower_boundary_is_closer = F == 0 && E > 1;
 | 
			
		||||
    const diyfp m_plus = diyfp(2 * v.f + 1, v.e - 1);
 | 
			
		||||
    const diyfp m_minus = lower_boundary_is_closer
 | 
			
		||||
                          ? diyfp(4 * v.f - 1, v.e - 2)  // (B)
 | 
			
		||||
| 
						 | 
				
			
			@ -567,8 +567,8 @@ inline void grisu2_round(char* buf, int len, std::uint64_t dist, std::uint64_t d
 | 
			
		|||
    // integer arithmetic.
 | 
			
		||||
 | 
			
		||||
    while (rest < dist
 | 
			
		||||
            and delta - rest >= ten_k
 | 
			
		||||
            and (rest + ten_k < dist or dist - rest > rest + ten_k - dist))
 | 
			
		||||
            && delta - rest >= ten_k
 | 
			
		||||
            && (rest + ten_k < dist || dist - rest > rest + ten_k - dist))
 | 
			
		||||
    {
 | 
			
		||||
        assert(buf[len - 1] != '0');
 | 
			
		||||
        buf[len - 1]--;
 | 
			
		||||
| 
						 | 
				
			
			@ -879,7 +879,7 @@ v = buf * 10^decimal_exponent
 | 
			
		|||
len is the length of the buffer (number of decimal digits)
 | 
			
		||||
The buffer must be large enough, i.e. >= max_digits10.
 | 
			
		||||
*/
 | 
			
		||||
template <typename FloatType>
 | 
			
		||||
template<typename FloatType>
 | 
			
		||||
JSON_HEDLEY_NON_NULL(1)
 | 
			
		||||
void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -986,7 +986,7 @@ inline char* format_buffer(char* buf, int len, int decimal_exponent,
 | 
			
		|||
    // k is the length of the buffer (number of decimal digits)
 | 
			
		||||
    // n is the position of the decimal point relative to the start of the buffer.
 | 
			
		||||
 | 
			
		||||
    if (k <= n and n <= max_exp)
 | 
			
		||||
    if (k <= n && n <= max_exp)
 | 
			
		||||
    {
 | 
			
		||||
        // digits[000]
 | 
			
		||||
        // len <= max_exp + 2
 | 
			
		||||
| 
						 | 
				
			
			@ -998,7 +998,7 @@ inline char* format_buffer(char* buf, int len, int decimal_exponent,
 | 
			
		|||
        return buf + (static_cast<size_t>(n) + 2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (0 < n and n <= max_exp)
 | 
			
		||||
    if (0 < n && n <= max_exp)
 | 
			
		||||
    {
 | 
			
		||||
        // dig.its
 | 
			
		||||
        // len <= max_digits10 + 1
 | 
			
		||||
| 
						 | 
				
			
			@ -1010,7 +1010,7 @@ inline char* format_buffer(char* buf, int len, int decimal_exponent,
 | 
			
		|||
        return buf + (static_cast<size_t>(k) + 1U);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (min_exp < n and n <= 0)
 | 
			
		||||
    if (min_exp < n && n <= 0)
 | 
			
		||||
    {
 | 
			
		||||
        // 0.[000]digits
 | 
			
		||||
        // len <= 2 + (-min_exp - 1) + max_digits10
 | 
			
		||||
| 
						 | 
				
			
			@ -1055,7 +1055,7 @@ format. Returns an iterator pointing past-the-end of the decimal representation.
 | 
			
		|||
@note The buffer must be large enough.
 | 
			
		||||
@note The result is NOT null-terminated.
 | 
			
		||||
*/
 | 
			
		||||
template <typename FloatType>
 | 
			
		||||
template<typename FloatType>
 | 
			
		||||
JSON_HEDLEY_NON_NULL(1, 2)
 | 
			
		||||
JSON_HEDLEY_RETURNS_NON_NULL
 | 
			
		||||
char* to_chars(char* first, const char* last, FloatType value)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,9 +56,9 @@ struct external_constructor<value_t::string>
 | 
			
		|||
        j.assert_invariant();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template<typename BasicJsonType, typename CompatibleStringType,
 | 
			
		||||
             enable_if_t<not std::is_same<CompatibleStringType, typename BasicJsonType::string_t>::value,
 | 
			
		||||
                         int> = 0>
 | 
			
		||||
    template < typename BasicJsonType, typename CompatibleStringType,
 | 
			
		||||
               enable_if_t < !std::is_same<CompatibleStringType, typename BasicJsonType::string_t>::value,
 | 
			
		||||
                             int > = 0 >
 | 
			
		||||
    static void construct(BasicJsonType& j, const CompatibleStringType& str)
 | 
			
		||||
    {
 | 
			
		||||
        j.m_type = value_t::string;
 | 
			
		||||
| 
						 | 
				
			
			@ -144,9 +144,9 @@ struct external_constructor<value_t::array>
 | 
			
		|||
        j.assert_invariant();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template<typename BasicJsonType, typename CompatibleArrayType,
 | 
			
		||||
             enable_if_t<not std::is_same<CompatibleArrayType, typename BasicJsonType::array_t>::value,
 | 
			
		||||
                         int> = 0>
 | 
			
		||||
    template < typename BasicJsonType, typename CompatibleArrayType,
 | 
			
		||||
               enable_if_t < !std::is_same<CompatibleArrayType, typename BasicJsonType::array_t>::value,
 | 
			
		||||
                             int > = 0 >
 | 
			
		||||
    static void construct(BasicJsonType& j, const CompatibleArrayType& arr)
 | 
			
		||||
    {
 | 
			
		||||
        using std::begin;
 | 
			
		||||
| 
						 | 
				
			
			@ -203,8 +203,8 @@ struct external_constructor<value_t::object>
 | 
			
		|||
        j.assert_invariant();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template<typename BasicJsonType, typename CompatibleObjectType,
 | 
			
		||||
             enable_if_t<not std::is_same<CompatibleObjectType, typename BasicJsonType::object_t>::value, int> = 0>
 | 
			
		||||
    template < typename BasicJsonType, typename CompatibleObjectType,
 | 
			
		||||
               enable_if_t < !std::is_same<CompatibleObjectType, typename BasicJsonType::object_t>::value, int > = 0 >
 | 
			
		||||
    static void construct(BasicJsonType& j, const CompatibleObjectType& obj)
 | 
			
		||||
    {
 | 
			
		||||
        using std::begin;
 | 
			
		||||
| 
						 | 
				
			
			@ -275,20 +275,20 @@ void to_json(BasicJsonType& j, const std::vector<bool>& e)
 | 
			
		|||
    external_constructor<value_t::array>::construct(j, e);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename BasicJsonType, typename CompatibleArrayType,
 | 
			
		||||
          enable_if_t<is_compatible_array_type<BasicJsonType,
 | 
			
		||||
                      CompatibleArrayType>::value and
 | 
			
		||||
                      not is_compatible_object_type<BasicJsonType, CompatibleArrayType>::value and
 | 
			
		||||
                      not is_compatible_string_type<BasicJsonType, CompatibleArrayType>::value and
 | 
			
		||||
                      not std::is_same<typename BasicJsonType::binary_t, CompatibleArrayType>::value and
 | 
			
		||||
                      not is_basic_json<CompatibleArrayType>::value,
 | 
			
		||||
                      int> = 0>
 | 
			
		||||
template < typename BasicJsonType, typename CompatibleArrayType,
 | 
			
		||||
           enable_if_t < is_compatible_array_type<BasicJsonType,
 | 
			
		||||
                         CompatibleArrayType>::value&&
 | 
			
		||||
                         !is_compatible_object_type<BasicJsonType, CompatibleArrayType>::value&&
 | 
			
		||||
                         !is_compatible_string_type<BasicJsonType, CompatibleArrayType>::value&&
 | 
			
		||||
                         !std::is_same<typename BasicJsonType::binary_t, CompatibleArrayType>::value&&
 | 
			
		||||
                         !is_basic_json<CompatibleArrayType>::value,
 | 
			
		||||
                         int > = 0 >
 | 
			
		||||
void to_json(BasicJsonType& j, const CompatibleArrayType& arr)
 | 
			
		||||
{
 | 
			
		||||
    external_constructor<value_t::array>::construct(j, arr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename BasicJsonType>
 | 
			
		||||
template<typename BasicJsonType>
 | 
			
		||||
void to_json(BasicJsonType& j, const typename BasicJsonType::binary_t& bin)
 | 
			
		||||
{
 | 
			
		||||
    external_constructor<value_t::binary>::construct(j, bin);
 | 
			
		||||
| 
						 | 
				
			
			@ -307,8 +307,8 @@ void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr)
 | 
			
		|||
    external_constructor<value_t::array>::construct(j, std::move(arr));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<typename BasicJsonType, typename CompatibleObjectType,
 | 
			
		||||
         enable_if_t<is_compatible_object_type<BasicJsonType, CompatibleObjectType>::value and not is_basic_json<CompatibleObjectType>::value, int> = 0>
 | 
			
		||||
template < typename BasicJsonType, typename CompatibleObjectType,
 | 
			
		||||
           enable_if_t < is_compatible_object_type<BasicJsonType, CompatibleObjectType>::value&& !is_basic_json<CompatibleObjectType>::value, int > = 0 >
 | 
			
		||||
void to_json(BasicJsonType& j, const CompatibleObjectType& obj)
 | 
			
		||||
{
 | 
			
		||||
    external_constructor<value_t::object>::construct(j, obj);
 | 
			
		||||
| 
						 | 
				
			
			@ -322,9 +322,9 @@ void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj)
 | 
			
		|||
 | 
			
		||||
template <
 | 
			
		||||
    typename BasicJsonType, typename T, std::size_t N,
 | 
			
		||||
    enable_if_t<not std::is_constructible<typename BasicJsonType::string_t,
 | 
			
		||||
                const T(&)[N]>::value,
 | 
			
		||||
                int> = 0 >
 | 
			
		||||
    enable_if_t < !std::is_constructible<typename BasicJsonType::string_t,
 | 
			
		||||
                  const T(&)[N]>::value,
 | 
			
		||||
                  int > = 0 >
 | 
			
		||||
void to_json(BasicJsonType& j, const T(&arr)[N])
 | 
			
		||||
{
 | 
			
		||||
    external_constructor<value_t::array>::construct(j, arr);
 | 
			
		||||
| 
						 | 
				
			
			@ -337,8 +337,8 @@ void to_json(BasicJsonType& j, const std::pair<T1, T2>& p)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// for https://github.com/nlohmann/json/pull/1134
 | 
			
		||||
template < typename BasicJsonType, typename T,
 | 
			
		||||
           enable_if_t<std::is_same<T, iteration_proxy_value<typename BasicJsonType::iterator>>::value, int> = 0>
 | 
			
		||||
template<typename BasicJsonType, typename T,
 | 
			
		||||
         enable_if_t<std::is_same<T, iteration_proxy_value<typename BasicJsonType::iterator>>::value, int> = 0>
 | 
			
		||||
void to_json(BasicJsonType& j, const T& b)
 | 
			
		||||
{
 | 
			
		||||
    j = { {b.key(), b.value()} };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue