Skip to content

Commit

Permalink
Lock json_compatible_type behind ifdef for now
Browse files Browse the repository at this point in the history
  • Loading branch information
fsandhei committed Feb 29, 2024
1 parent 0c9adb1 commit a2f3b70
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/nlohmann/detail/meta/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,11 +684,16 @@ inline constexpr bool value_in_range_of(T val)
template<bool Value>
using bool_constant = std::integral_constant<bool, Value>;

// Locking the definition of json_compatible_type behind
// JSON_HAS_THREE_WAY_COMPARISON because it seems difficult to
// make use of this type trait well with friend functions. Fails on SFINAE.
#if JSON_HAS_THREE_WAY_COMPARISON
template <typename T, typename BasicJsonType, typename U = uncvref_t<T>>
struct json_compatible_type
{
static constexpr auto value = !is_basic_json<U>::value && is_compatible_type<BasicJsonType, U>::value;

Check notice on line 694 in include/nlohmann/detail/meta/type_traits.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

include/nlohmann/detail/meta/type_traits.hpp#L694

struct member 'json_compatible_type::value' is never used.
};
#endif

///////////////////////////////////////////////////////////////////////////////
// is_c_string
Expand Down
5 changes: 5 additions & 0 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4091,11 +4091,16 @@ inline constexpr bool value_in_range_of(T val)
template<bool Value>
using bool_constant = std::integral_constant<bool, Value>;

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

///////////////////////////////////////////////////////////////////////////////
// is_c_string
Expand Down

0 comments on commit a2f3b70

Please sign in to comment.