From 6121dbbe0282b73e72e78c2572c6efb8cc82da32 Mon Sep 17 00:00:00 2001 From: DarkZeros Date: Sun, 3 Apr 2022 17:33:33 +0100 Subject: [PATCH] Avoid clash with Arduino defines (#3338) * Avoid clash with Arduino defines * Arduino defines B0/B1 in "binary.h" #define B0 0 #define B1 1 This clashes with names of the template variables in conjuction * Renaming them to "B" rather than "B1" Now it can be used as-is in Arduino projects * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: Daniel Ansorregui Co-authored-by: Niels Lohmann --- include/nlohmann/detail/meta/type_traits.hpp | 8 ++++---- single_include/nlohmann/json.hpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/nlohmann/detail/meta/type_traits.hpp b/include/nlohmann/detail/meta/type_traits.hpp index 984ca1931..0a320e6e2 100644 --- a/include/nlohmann/detail/meta/type_traits.hpp +++ b/include/nlohmann/detail/meta/type_traits.hpp @@ -152,10 +152,10 @@ struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> // https://en.cppreference.com/w/cpp/types/conjunction template struct conjunction : std::true_type { }; -template struct conjunction : B1 { }; -template -struct conjunction -: std::conditional, B1>::type {}; +template struct conjunction : B { }; +template +struct conjunction +: std::conditional, B>::type {}; // https://en.cppreference.com/w/cpp/types/negation template struct negation : std::integral_constant < bool, !B::value > { }; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 71f6814ad..ba272a126 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3510,10 +3510,10 @@ struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> // https://en.cppreference.com/w/cpp/types/conjunction template struct conjunction : std::true_type { }; -template struct conjunction : B1 { }; -template -struct conjunction -: std::conditional, B1>::type {}; +template struct conjunction : B { }; +template +struct conjunction +: std::conditional, B>::type {}; // https://en.cppreference.com/w/cpp/types/negation template struct negation : std::integral_constant < bool, !B::value > { };