MCPcopy Create free account
hub / github.com/bitfieldaudio/OTTO / empty

Function empty

external/include/json.hpp:11409–11437  ·  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

11407 @since version 1.0.0
11408 */
11409 bool empty() const noexcept
11410 {
11411 switch (m_type)
11412 {
11413 case value_t::null:
11414 {
11415 // null values are empty
11416 return true;
11417 }
11418
11419 case value_t::array:
11420 {
11421 // delegate call to array_t::empty()
11422 return m_value.array->empty();
11423 }
11424
11425 case value_t::object:
11426 {
11427 // delegate call to object_t::empty()
11428 return m_value.object->empty();
11429 }
11430
11431 default:
11432 {
11433 // all other types are nonempty
11434 return false;
11435 }
11436 }
11437 }
11438
11439 /*!
11440 @brief returns the number of elements

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected