Skip to content

Commit

Permalink
Move lambda expression outside of assert to prevent "unevaluated" error
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuck Atkins committed Aug 22, 2017
1 parent cd53790 commit 7da0450
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,13 +1495,15 @@ class input_adapter
{
// assertion to check that the iterator range is indeed contiguous,
// see http://stackoverflow.com/a/35008842/266378 for more discussion
auto lf_is_contiguous =
[&first](std::pair<bool, int> res, decltype(*first) val)
{
res.first &= (val == *(std::next(std::addressof(*first), res.second++)));
return res;
};
assert(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);
lf_is_contiguous).first);

// assertion to check that each element is 1 byte long
static_assert(
Expand Down

0 comments on commit 7da0450

Please sign in to comment.