MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / size

Function size

Source/external/json.hpp:22114–22149  ·  view source on GitHub ↗

@brief returns the number of elements @sa https://json.nlohmann.me/api/basic_json/size/

Source from the content-addressed store, hash-verified

22112 /// @brief returns the number of elements
22113 /// @sa https://json.nlohmann.me/api/basic_json/size/
22114 size_type size() const noexcept
22115 {
22116 switch (m_type)
22117 {
22118 case value_t::null:
22119 {
22120 // null values are empty
22121 return 0;
22122 }
22123
22124 case value_t::array:
22125 {
22126 // delegate call to array_t::size()
22127 return m_value.array->size();
22128 }
22129
22130 case value_t::object:
22131 {
22132 // delegate call to object_t::size()
22133 return m_value.object->size();
22134 }
22135
22136 case value_t::string:
22137 case value_t::boolean:
22138 case value_t::number_integer:
22139 case value_t::number_unsigned:
22140 case value_t::number_float:
22141 case value_t::binary:
22142 case value_t::discarded:
22143 default:
22144 {
22145 // all other types have size 1
22146 return 1;
22147 }
22148 }
22149 }
22150
22151 /// @brief returns the maximum possible number of elements
22152 /// @sa https://json.nlohmann.me/api/basic_json/max_size/

Callers 2

eraseFunction · 0.85
max_sizeFunction · 0.85

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected