Skip to content

Commit a2f3b70

Browse files
committed
Lock json_compatible_type behind ifdef for now
1 parent 0c9adb1 commit a2f3b70

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

include/nlohmann/detail/meta/type_traits.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,11 +684,16 @@ inline constexpr bool value_in_range_of(T val)
684684
template<bool Value>
685685
using bool_constant = std::integral_constant<bool, Value>;
686686

687+
// Locking the definition of json_compatible_type behind
688+
// JSON_HAS_THREE_WAY_COMPARISON because it seems difficult to
689+
// make use of this type trait well with friend functions. Fails on SFINAE.
690+
#if JSON_HAS_THREE_WAY_COMPARISON
687691
template <typename T, typename BasicJsonType, typename U = uncvref_t<T>>
688692
struct json_compatible_type
689693
{
690694
static constexpr auto value = !is_basic_json<U>::value && is_compatible_type<BasicJsonType, U>::value;
691695
};
696+
#endif
692697

693698
///////////////////////////////////////////////////////////////////////////////
694699
// is_c_string

single_include/nlohmann/json.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4091,11 +4091,16 @@ inline constexpr bool value_in_range_of(T val)
40914091
template<bool Value>
40924092
using bool_constant = std::integral_constant<bool, Value>;
40934093

4094+
// Locking the definition of json_compatible_type behind
4095+
// JSON_HAS_THREE_WAY_COMPARISON because it seems difficult to
4096+
// make use of this type trait well with friend functions. Fails on SFINAE.
4097+
#if JSON_HAS_THREE_WAY_COMPARISON
40944098
template <typename T, typename BasicJsonType, typename U = uncvref_t<T>>
40954099
struct json_compatible_type
40964100
{
40974101
static constexpr auto value = !is_basic_json<U>::value && is_compatible_type<BasicJsonType, U>::value;
40984102
};
4103+
#endif
40994104

41004105
///////////////////////////////////////////////////////////////////////////////
41014106
// is_c_string

0 commit comments

Comments
 (0)