MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / size

Function size

3rd/nlohmann_json/include/nlohmann/json.hpp:5215–5250  ·  view source on GitHub ↗

! @brief returns the number of elements Returns the number of elements in a JSON value. @return The return value depends on the different types and is defined as follows: Value type | return value ----------- | ------------- null | `0` boolean | `1` string | `1` number | `1`

Source from the content-addressed store, hash-verified

5213 @since version 1.0.0
5214 */
5215 size_type size() const noexcept
5216 {
5217 switch (m_type)
5218 {
5219 case value_t::null:
5220 {
5221 // null values are empty
5222 return 0;
5223 }
5224
5225 case value_t::array:
5226 {
5227 // delegate call to array_t::size()
5228 return m_value.array->size();
5229 }
5230
5231 case value_t::object:
5232 {
5233 // delegate call to object_t::size()
5234 return m_value.object->size();
5235 }
5236
5237 case value_t::string:
5238 case value_t::boolean:
5239 case value_t::number_integer:
5240 case value_t::number_unsigned:
5241 case value_t::number_float:
5242 case value_t::binary:
5243 case value_t::discarded:
5244 default:
5245 {
5246 // all other types have size 1
5247 return 1;
5248 }
5249 }
5250 }
5251
5252 /*!
5253 @brief returns the maximum possible number of elements

Callers 2

eraseFunction · 0.70
max_sizeFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected