From 7da045060b19c470084e2c2fcc388d8b28de2c0b Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Tue, 22 Aug 2017 10:47:09 -0400 Subject: [PATCH] Move lambda expression outside of assert to prevent "unevaluated" error Fixes #705 --- src/json.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 3c338eb8d..411033145 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -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 res, decltype(*first) val) + { + res.first &= (val == *(std::next(std::addressof(*first), res.second++))); + return res; + }; assert(std::accumulate( first, last, std::pair(true, 0), - [&first](std::pair 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(