mirror of
https://github.com/nlohmann/json.git
synced 2025-07-28 12:02:00 +03:00
added assertion for contiguous memory
This commit is contained in:
@ -8902,7 +8902,13 @@ basic_json_parser_63:
|
|||||||
: callback(cb),
|
: callback(cb),
|
||||||
m_lexer(reinterpret_cast<const typename lexer::lexer_char_t*>(&(*first)),
|
m_lexer(reinterpret_cast<const typename lexer::lexer_char_t*>(&(*first)),
|
||||||
static_cast<size_t>(std::distance(first, last)))
|
static_cast<size_t>(std::distance(first, last)))
|
||||||
{}
|
{
|
||||||
|
int i = 0;
|
||||||
|
assert(std::accumulate(first, last, true, [&i, &first](bool res, decltype(*first) val)
|
||||||
|
{
|
||||||
|
return res and (val == *(std::next(std::addressof(*first), i++)));
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
/// public parser interface
|
/// public parser interface
|
||||||
basic_json parse()
|
basic_json parse()
|
||||||
|
@ -8199,7 +8199,13 @@ class basic_json
|
|||||||
: callback(cb),
|
: callback(cb),
|
||||||
m_lexer(reinterpret_cast<const typename lexer::lexer_char_t*>(&(*first)),
|
m_lexer(reinterpret_cast<const typename lexer::lexer_char_t*>(&(*first)),
|
||||||
static_cast<size_t>(std::distance(first, last)))
|
static_cast<size_t>(std::distance(first, last)))
|
||||||
{}
|
{
|
||||||
|
int i = 0;
|
||||||
|
assert(std::accumulate(first, last, true, [&i, &first](bool res, decltype(*first) val)
|
||||||
|
{
|
||||||
|
return res and (val == *(std::next(std::addressof(*first), i++)));
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
/// public parser interface
|
/// public parser interface
|
||||||
basic_json parse()
|
basic_json parse()
|
||||||
|
Reference in New Issue
Block a user