Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
186c747a
Unverified
Commit
186c747a
authored
6 years ago
by
Niels Lohmann
Committed by
GitHub
6 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1230 from mandreyel/lambda-unevaluated-context-fix
Move lambda out of unevaluated context
parents
ebb3c032
6b5334c1
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
include/nlohmann/detail/input/input_adapters.hpp
include/nlohmann/detail/input/input_adapters.hpp
+7
-4
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+7
-4
No files found.
include/nlohmann/detail/input/input_adapters.hpp
View file @
186c747a
...
...
@@ -320,15 +320,18 @@ class input_adapter
int
>::
type
=
0
>
input_adapter
(
IteratorType
first
,
IteratorType
last
)
{
#ifndef NDEBUG
// assertion to check that the iterator range is indeed contiguous,
// see http://stackoverflow.com/a/35008842/266378 for more discussion
assert
(
std
::
accumulate
(
first
,
last
,
std
::
pair
<
bool
,
int
>
(
true
,
0
),
[
&
first
](
std
::
pair
<
bool
,
int
>
res
,
decltype
(
*
first
)
val
)
const
auto
is_contiguous
=
std
::
accumulate
(
first
,
last
,
std
::
pair
<
bool
,
int
>
(
true
,
0
),
[
&
first
](
std
::
pair
<
bool
,
int
>
res
,
decltype
(
*
first
)
val
)
{
res
.
first
&=
(
val
==
*
(
std
::
next
(
std
::
addressof
(
*
first
),
res
.
second
++
)));
return
res
;
}).
first
);
}).
first
;
assert
(
is_contiguous
);
#endif
// assertion to check that each element is 1 byte long
static_assert
(
...
...
This diff is collapsed.
Click to expand it.
single_include/nlohmann/json.hpp
View file @
186c747a
...
...
@@ -2184,15 +2184,18 @@ class input_adapter
int>::type = 0>
input_adapter(IteratorType first, IteratorType last)
{
#ifndef NDEBUG
// assertion to check that the iterator range is indeed contiguous,
// see http://stackoverflow.com/a/35008842/266378 for more discussion
assert(
std::accumulate(
first, last, std::pair<bool, int>(true, 0),
[&first](std::pair<bool, int> res, decltype(*first) val)
const auto is_contiguous =
std::accumulate(
first, last, std::pair<bool, int>(true, 0),
[&first](std::pair<bool, int> res, decltype(*first) val)
{
res.first &= (val == *(std::next(std::addressof(*first), res.second++)));
return res;
}).first);
}).first;
assert(is_contiguous);
#endif
// assertion to check that each element is 1 byte long
static_assert(
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment