! @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
| 16686 | @since version 1.0.0 |
| 16687 | */ |
| 16688 | bool empty() const noexcept |
| 16689 | { |
| 16690 | switch (m_type) |
| 16691 | { |
| 16692 | case value_t::null: |
| 16693 | { |
| 16694 | // null values are empty |
| 16695 | return true; |
| 16696 | } |
| 16697 | |
| 16698 | case value_t::array: |
| 16699 | { |
| 16700 | // delegate call to array_t::empty() |
| 16701 | return m_value.array->empty(); |
| 16702 | } |
| 16703 | |
| 16704 | case value_t::object: |
| 16705 | { |
| 16706 | // delegate call to object_t::empty() |
| 16707 | return m_value.object->empty(); |
| 16708 | } |
| 16709 | |
| 16710 | default: |
| 16711 | { |
| 16712 | // all other types are nonempty |
| 16713 | return false; |
| 16714 | } |
| 16715 | } |
| 16716 | } |
| 16717 | |
| 16718 | /*! |
| 16719 | @brief returns the number of elements |
nothing calls this directly
no outgoing calls
no test coverage detected