MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / size

Function size

include/behaviortree_cpp/contrib/json.hpp:22247–22282  ·  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

22245 /// @brief returns the number of elements
22246 /// @sa https://json.nlohmann.me/api/basic_json/size/
22247 size_type size() const noexcept
22248 {
22249 switch (m_data.m_type)
22250 {
22251 case value_t::null:
22252 {
22253 // null values are empty
22254 return 0;
22255 }
22256
22257 case value_t::array:
22258 {
22259 // delegate call to array_t::size()
22260 return m_data.m_value.array->size();
22261 }
22262
22263 case value_t::object:
22264 {
22265 // delegate call to object_t::size()
22266 return m_data.m_value.object->size();
22267 }
22268
22269 case value_t::string:
22270 case value_t::boolean:
22271 case value_t::number_integer:
22272 case value_t::number_unsigned:
22273 case value_t::number_float:
22274 case value_t::binary:
22275 case value_t::discarded:
22276 default:
22277 {
22278 // all other types have size 1
22279 return 1;
22280 }
22281 }
22282 }
22283
22284 /// @brief returns the maximum possible number of elements
22285 /// @sa https://json.nlohmann.me/api/basic_json/max_size/

Callers 11

eraseFunction · 0.70
max_sizeFunction · 0.70
magic_enum.hppFile · 0.70
static_strClass · 0.70
toStdStringMethod · 0.50
toStdStringViewMethod · 0.50
operator==Method · 0.50
operator!=Method · 0.50
operator<Method · 0.50
operator>Method · 0.50
sizeMethod · 0.50

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected