14905 {
14906 if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
14907 {
14909 write_number<std::int32_t, true>(static_cast<std::int32_t>(j.m_value.number_unsigned));
14910 }
14911
14912 else if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))
14913 {
14915 write_number<std::int64_t, true>(static_cast<std::int64_t>(j.m_value.number_unsigned));
14916 }
14917
14918 else
14919 {
14920 JSON_THROW(out_of_range::create(407, "integer number " + std::to_string(j.m_value.number_unsigned) + " cannot be represented by BSON as it does not fit int64", j));
14921 }
14922 }
void write_bson_entry_header(const string_t &name, const std::uint8_t element_type)
Writes the given element_type and name to the output adapter.