mirror of
https://github.com/nlohmann/json.git
synced 2026-10-10 16:37:14 +00:00
Fix MSVC C4127 in the lookups of editable json documents
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+16
-3
No files matched your search
@@ -217,6 +217,13 @@ struct document_data
|
||||
template<bool Editable>
|
||||
struct navigation
|
||||
{
|
||||
/// whether the walk follows edits (the template argument as a runtime
|
||||
/// condition: `Editable && ...` is a constant condition for MSVC, C4127)
|
||||
static NLOHMANN_VIEW_ALWAYS_INLINE bool editable() noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static NLOHMANN_VIEW_ALWAYS_INLINE const node* first(const document_data& /*d*/, const node* n) noexcept
|
||||
{
|
||||
return n + 1;
|
||||
@@ -236,6 +243,11 @@ struct navigation
|
||||
template<>
|
||||
struct navigation<true>
|
||||
{
|
||||
static NLOHMANN_VIEW_ALWAYS_INLINE bool editable() noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static NLOHMANN_VIEW_ALWAYS_INLINE const node* first(const document_data& d, const node* n) noexcept
|
||||
{
|
||||
return d.first_child_edited(n);
|
||||
|
||||
Reference in new issue
Block a user