! @brief checks whether the container is empty Checks if a JSON value has no elements. @return The return value depends on the different types and is defined as follows: Value type | return value ----------- | ------------- null | `true` boolean | `false` string | `false` number
| 4624 | @since version 1.0.0 |
| 4625 | */ |
| 4626 | bool empty() const noexcept |
| 4627 | { |
| 4628 | switch (m_type) |
| 4629 | { |
| 4630 | case value_t::null: |
| 4631 | { |
| 4632 | // null values are empty |
| 4633 | return true; |
| 4634 | } |
| 4635 | |
| 4636 | case value_t::array: |
| 4637 | { |
| 4638 | // delegate call to array_t::empty() |
| 4639 | return m_value.array->empty(); |
| 4640 | } |
| 4641 | |
| 4642 | case value_t::object: |
| 4643 | { |
| 4644 | // delegate call to object_t::empty() |
| 4645 | return m_value.object->empty(); |
| 4646 | } |
| 4647 | |
| 4648 | default: |
| 4649 | { |
| 4650 | // all other types are nonempty |
| 4651 | return false; |
| 4652 | } |
| 4653 | } |
| 4654 | } |
| 4655 | |
| 4656 | /*! |
| 4657 | @brief returns the number of elements |
no outgoing calls
no test coverage detected