Skip to content

Commit

Permalink
Runs make amalgamate on the project.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xav83 committed Sep 19, 2019
1 parent 2be2630 commit 1667541
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5678,7 +5678,7 @@ class binary_reader
const int exp = (half >> 10u) & 0x1Fu;
const unsigned int mant = half & 0x3FFu;
assert(0 <= exp and exp <= 32);
assert(0 <= mant and mant <= 1024);
assert(mant <= 1024);
switch (exp)
{
case 0:
Expand Down Expand Up @@ -12044,13 +12044,10 @@ class binary_writer
*/
static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t& value)
{
std::size_t embedded_document_size = 0ul;
std::size_t array_index = 0ul;

for (const auto& el : value)
const std::size_t embedded_document_size = std::accumulate(std::begin(value), std::end(value), [array_index = 0ul](std::size_t result, const auto & el)
{
embedded_document_size += calc_bson_element_size(std::to_string(array_index++), el);
}
return result + calc_bson_element_size(std::to_string(array_index++), el);
});

return sizeof(std::int32_t) + embedded_document_size + 1ul;
}
Expand Down

0 comments on commit 1667541

Please sign in to comment.