! @return The size of the BSON-encoded array @a value */
| 16020 | @return The size of the BSON-encoded array @a value |
| 16021 | */ |
| 16022 | static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t& value) |
| 16023 | { |
| 16024 | std::size_t array_index = 0ul; |
| 16025 | |
| 16026 | const std::size_t embedded_document_size = std::accumulate(std::begin(value), std::end(value), static_cast<std::size_t>(0), [&array_index](std::size_t result, const typename BasicJsonType::array_t::value_type & el) |
| 16027 | { |
| 16028 | return result + calc_bson_element_size(std::to_string(array_index++), el); |
| 16029 | }); |
| 16030 | |
| 16031 | return sizeof(std::int32_t) + embedded_document_size + 1ul; |
| 16032 | } |
| 16033 | |
| 16034 | /*! |
| 16035 | @return The size of the BSON-encoded binary array @a value |