Skip to content

Commit

Permalink
optional: use #if instead of #ifndef, fixes #3859
Browse files Browse the repository at this point in the history
  • Loading branch information
Théo Delrieu committed Dec 2, 2024
1 parent a006a7a commit ff7ed18
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/nlohmann/detail/conversions/from_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ inline void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
}

#ifdef JSON_HAS_CPP_17
#ifndef JSON_USE_IMPLICIT_CONVERSIONS
#if !JSON_USE_IMPLICIT_CONVERSIONS
template<typename BasicJsonType, typename T>
void from_json(const BasicJsonType& j, std::optional<T>& opt)
{
Expand Down
2 changes: 1 addition & 1 deletion single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4721,7 +4721,7 @@ inline void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
}

#ifdef JSON_HAS_CPP_17
#ifndef JSON_USE_IMPLICIT_CONVERSIONS
#if !JSON_USE_IMPLICIT_CONVERSIONS
template<typename BasicJsonType, typename T>
void from_json(const BasicJsonType& j, std::optional<T>& opt)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/src/unit-conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ TEST_CASE("JSON to enum mapping")


#ifdef JSON_HAS_CPP_17
#ifndef JSON_USE_IMPLICIT_CONVERSIONS
#if !JSON_USE_IMPLICIT_CONVERSIONS
TEST_CASE("std::optional")
{
SECTION("null")
Expand Down

0 comments on commit ff7ed18

Please sign in to comment.