Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nlohmann_json_cmake_fetchcontent
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
刘 冠章
nlohmann_json_cmake_fetchcontent
Commits
0ad2ba44
Commit
0ad2ba44
authored
3 years ago
by
GitHub Actions
Browse files
Options
Downloads
Patches
Plain Diff
Upstream release v3.10.1
parent
e293c9ac
No related branches found
Branches containing commit
Tags
v3.10.1
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
include/nlohmann/json.hpp
+40
-5
40 additions, 5 deletions
include/nlohmann/json.hpp
with
41 additions
and
6 deletions
README.md
+
1
−
1
View file @
0ad2ba44
...
...
@@ -12,7 +12,7 @@ include(FetchContent)
FetchContent_Declare
(
json
GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent
GIT_TAG v3.10.
0
)
GIT_TAG v3.10.
1
)
FetchContent_GetProperties
(
json
)
if
(
NOT json_POPULATED
)
...
...
This diff is collapsed.
Click to expand it.
include/nlohmann/json.hpp
+
40
−
5
View file @
0ad2ba44
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++
| | |__ | | | | | | version 3.10.
0
| | |__ | | | | | | version 3.10.
1
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
...
...
@@ -32,7 +32,7 @@ SOFTWARE.
#define NLOHMANN_JSON_VERSION_MAJOR 3
#define NLOHMANN_JSON_VERSION_MINOR 10
#define NLOHMANN_JSON_VERSION_PATCH
0
#define NLOHMANN_JSON_VERSION_PATCH
1
#include <algorithm> // all_of, find, for_each
#include <cstddef> // nullptr_t, ptrdiff_t, size_t
...
...
@@ -3845,6 +3845,24 @@ struct is_constructible_tuple : std::false_type {};
template<typename T1, typename... Args>
struct is_constructible_tuple<T1, std::tuple<Args...>> : conjunction<is_constructible<T1, Args>...> {};
// a naive helper to check if a type is an ordered_map (exploits the fact that
// ordered_map inherits capacity() from std::vector)
template <typename T>
struct is_ordered_map
{
using one = char;
struct two
{
char x[2]; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
};
template <typename C> static one test( decltype(&C::capacity) ) ;
template <typename C> static two test(...);
enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
};
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324)
template < typename T, typename U, enable_if_t < !std::is_same<T, U>::value, int > = 0 >
T conditional_static_cast(U value)
...
...
@@ -4602,7 +4620,7 @@ struct external_constructor<value_t::binary>
{
j.m_value.destroy(j.m_type);
j.m_type = value_t::binary;
j.m_value = typename BasicJsonType::binary_t(std::move(b));
;
j.m_value = typename BasicJsonType::binary_t(std::move(b));
j.assert_invariant();
}
};
...
...
@@ -5169,6 +5187,8 @@ class byte_container_with_subtype : public BinaryType
// #include <nlohmann/detail/macro_scope.hpp>
// #include <nlohmann/detail/value_t.hpp>
namespace nlohmann
{
...
...
@@ -13615,7 +13635,7 @@ class binary_writer
case value_t::discarded:
default:
{
JSON_THROW(type_error::create(317, "to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name()), j));
;
JSON_THROW(type_error::create(317, "to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name()), j));
}
}
}
...
...
@@ -18446,7 +18466,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
object = nullptr; // silence warning, see #821
if (JSON_HEDLEY_UNLIKELY(t == value_t::null))
{
JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.10.
0
", basic_json())); // LCOV_EXCL_LINE
JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.10.
1
", basic_json())); // LCOV_EXCL_LINE
}
break;
}
...
...
@@ -18717,6 +18737,21 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}
}
// ordered_json uses a vector internally, so pointers could have
// been invalidated; see https://github.com/nlohmann/json/issues/2962
#ifdef JSON_HEDLEY_MSVC_VERSION
#pragma warning(push )
#pragma warning(disable : 4127) // ignore warning to replace if with if constexpr
#endif
if (detail::is_ordered_map<object_t>::value)
{
set_parents();
return j;
}
#ifdef JSON_HEDLEY_MSVC_VERSION
#pragma warning( pop )
#endif
j.m_parent = this;
#else
static_cast<void>(j);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment