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

Function empty

lesson6-Segmentation/json.hpp:21421–21449  ·  view source on GitHub ↗

! @brief checks whether the container is empty. Checks if a JSON value has no elements (i.e. whether its @ref size is `0`). @return The return value depends on the different types and is defined as follows: Value type | return value ----------- | ------------- null | `true` boolean | `false` string

Source from the content-addressed store, hash-verified

21419 @since version 1.0.0
21420 */
21421 bool empty() const noexcept
21422 {
21423 switch (m_type)
21424 {
21425 case value_t::null:
21426 {
21427 // null values are empty
21428 return true;
21429 }
21430
21431 case value_t::array:
21432 {
21433 // delegate call to array_t::empty()
21434 return m_value.array->empty();
21435 }
21436
21437 case value_t::object:
21438 {
21439 // delegate call to object_t::empty()
21440 return m_value.object->empty();
21441 }
21442
21443 default:
21444 {
21445 // all other types are nonempty
21446 return false;
21447 }
21448 }
21449 }
21450
21451 /*!
21452 @brief returns the number of elements

Callers 4

parent_pointerMethod · 0.85
pop_backMethod · 0.85
json_pointerClass · 0.85
json_pointer topFunction · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected