mirror of
https://github.com/nlohmann/json.git
synced 2026-10-27 00:08:55 +00:00
Add See also links in both directions between the concept pages (features, home, integration) and the API pages, write API links in code font, give every entry a comment after a dash, and show the callback event figure on the parser callbacks page. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
1.0 KiB
1.0 KiB
nlohmann::basic_json::is_boolean
constexpr bool is_boolean() const noexcept;
This function returns #!cpp true if and only if the JSON value is #!json true or #!json false.
Return value
#!cpp true if type is boolean, #!cpp false otherwise.
Exception safety
No-throw guarantee: this member function never throws exceptions.
Complexity
Constant.
Examples
??? example
The following code exemplifies `is_boolean()` for all JSON types.
```cpp
--8<-- "examples/is_boolean.cpp"
```
Output:
```json
--8<-- "examples/is_boolean.output"
```
See also
boolean_t- the type used to store JSON booleansis_primitive- checks whether the JSON value is primitivebasic_json_view::is_boolean- the same check on a zero-copy view- Types - the JSON value types and how they are stored
Version history
- Added in version 1.0.0.