-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Fix warning C4127: conditional expression is constant #1272
Conversation
I was thinking of something like this (to not add runtime overhead): template <std::size_t N>
void fill_buffer() {
fill_buffer_utf32();
}
template <>
void fill_buffer<2>() {
fill_buffer_utf16();
} Also, do not forget to edit files in |
98580fe
to
20edbf6
Compare
20edbf6
to
ad3c216
Compare
@theodelrieu I just edited the include files and generated the header 👍 About the implementation, I can change it if you want to use templates, but I am not sure how much overhead I am introducing with my implementation. I would say none actually 🤔 |
Well, you are performing a runtime check (with the Unfortunately the templates way is the pre-C++17 way of doing |
Yes, please use templates. The change right now makes little sense. |
@theodelrieu @nlohmann The warning is silenced with the current implementation, but I will use templates if you prefer. |
Commit 9ba3f79 fixes the following error in LGTM:
|
Commit 7c385a4 fixes the following error in LGTM:
|
This pull request fixes 1 alert when merging 7c385a4 into 9f18e17 - view on LGTM.com fixed alerts:
Comment posted by LGTM.com |
This pull request fixes 1 alert when merging b6fdad9 into 9f18e17 - view on LGTM.com fixed alerts:
Comment posted by LGTM.com |
@theodelrieu PR ready to merge 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Thanks! |
#1268
Pull request checklist
Read the Contribution Guidelines for detailed information.
include/nlohmann
directory, runmake amalgamate
to create the single-header filesingle_include/nlohmann/json.hpp
. The whole process is described here.Please don't
#ifdef
s or other means.