-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change operator==
overload that constrains to is_scalar_v
to constrain to compatible types.
#4181
base: develop
Are you sure you want to change the base?
Change operator==
overload that constrains to is_scalar_v
to constrain to compatible types.
#4181
Conversation
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @fsandhei |
1 similar comment
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @fsandhei |
Can you please try to amalgamate with an older version of astyle, like astyle 3.2? There was a breaking change in astyle which makes the output differ unfortunately. |
Sure, I'll do it some time later today after work. |
There seems to be some issues or inconsistencies with the astyle version 3.2.1 from the AUR versus 3.2.1-build from apt: * --squeeze-lines is not defined in the one from Arch, so I had to comment that one out in order to make the amalgamate step run. * A bunch of files are affected by the amalgamate, which does not seem right.
First, sorry, @nlohmann, for the trouble I'm causing here. So, I tried amalgamating again. There seems to be some issues or inconsistencies with the astyle version 3.2.1 from the AUR versus 3.2.1-build from apt:
Would you want me to perhaps unstage all the other unrelated files that got affected by this? |
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @fsandhei |
This reverts commit ca40711.
This is what I am using locally (patched Makefile): # call the Artistic Style pretty printer on all source files
pretty:
/Users/niels/Downloads/astyle/build/astyle \
--style=allman \
--indent=spaces=4 \
--indent-modifiers \
--indent-switches \
--indent-preproc-block \
--indent-preproc-define \
--indent-col1-comments \
--pad-oper \
--pad-header \
--align-pointer=type \
--align-reference=type \
--add-braces \
--convert-tabs \
--close-templates \
--lineend=linux \
--preserve-date \
--suffix=none \
--formatted \
$(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) docs/examples/*.cpp with Astyle 3.1. |
Thank you for so quick response. The amalgamation seems happy now. |
Thanks for your effort! |
Opting out of using concept and rather defining a structure while still being able to not use SFINAE and instead `requires` expression. Compiling with C++23 on GCC 13.2.1 fails on overload resolution on calling operator== for `std::nullptr_t`. The solution for this was to simply add another overload for nullptr, on par with the equivalent `nullptr_t` constructor.
I see that the GCC 10 CI run failed. It seems to be not able to parse the concept, which is odd as it should be supported in GCC 10. For the sake of getting this in and have the least amount of hassle I don't use However I was pondering on the idea of having a #ifdef JSON_HAS_CPP_20
#include <concepts>
template <typename T, typename BasicJsonType, typename U = uncvref_t<T>>
concept CompatibleType = requires(const U& type, BasicJsonType& j) {
{ to_json(j, type) } -> std::convertible_to<void>;
};
#endif The use of this would be quite simple, as we'd then can constrict constructors / operators with this concept:
EDIT: I realize I goofed myself. It is supported but |
a2f3b70
to
b20332d
Compare
I'm not really sure what is Codacy is actually complaining about. The struct member is being used in the type trait. It might be a bug in Codacy. Do you have any suggestions @nlohmann? |
Indeed looks like a false positive. I set it to "ignore". |
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @fsandhei |
#4165 shows an issue with the overload resolution when attempting to compare a
std::string
withjson
from left to right. This can be fixed by changing the constraint to instead of focusing on scalar types, we constrain the comparison operator to "compatible types", in par with the catch-call constructor.Pull request checklist
Read the Contribution Guidelines for detailed information.
include/nlohmann
directory, runmake amalgamate
to create the single-header filessingle_include/nlohmann/json.hpp
andsingle_include/nlohmann/json_fwd.hpp
. The whole process is described here.Please don't
#ifdef
s or other means.