MCPcopy Create free account
hub / github.com/AllentDan/LibtorchTutorials / size

Function size

lesson6-Segmentation/json.hpp:21494–21522  ·  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

21492 @since version 1.0.0
21493 */
21494 size_type size() const noexcept
21495 {
21496 switch (m_type)
21497 {
21498 case value_t::null:
21499 {
21500 // null values are empty
21501 return 0;
21502 }
21503
21504 case value_t::array:
21505 {
21506 // delegate call to array_t::size()
21507 return m_value.array->size();
21508 }
21509
21510 case value_t::object:
21511 {
21512 // delegate call to object_t::size()
21513 return m_value.object->size();
21514 }
21515
21516 default:
21517 {
21518 // all other types have size 1
21519 return 1;
21520 }
21521 }
21522 }
21523
21524 /*!
21525 @brief returns the maximum possible number of elements

Callers 2

eraseFunction · 0.85
max_sizeFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected