! @return The size of the BSON-encoded array @a value */
| 13773 | @return The size of the BSON-encoded array @a value |
| 13774 | */ |
| 13775 | static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t& value) |
| 13776 | { |
| 13777 | std::size_t array_index = 0ul; |
| 13778 | |
| 13779 | const std::size_t embedded_document_size = std::accumulate(std::begin(value), std::end(value), std::size_t(0), [&array_index](std::size_t result, const typename BasicJsonType::array_t::value_type& el) |
| 13780 | { |
| 13781 | return result + calc_bson_element_size(std::to_string(array_index++), el); |
| 13782 | }); |
| 13783 | |
| 13784 | return sizeof(std::int32_t) + embedded_document_size + 1ul; |
| 13785 | } |
| 13786 | |
| 13787 | /*! |
| 13788 | @return The size of the BSON-encoded binary array @a value |