Updated nlohmann::basicjson::is_boolean (markdown)
1 parent
a04d5ad21b
commit
6a83a79340
1 file changed
+35
@@ -22,6 +22,41 @@ Constant.
|
|||||||
|
|
||||||
None. The function's noexcept-specification is `noexcept`.
|
None. The function's noexcept-specification is `noexcept`.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include <iostream>
|
||||||
|
#include <json.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
nlohmann::json j_null;
|
||||||
|
nlohmann::json j_boolean = true;
|
||||||
|
nlohmann::json j_number = 17;
|
||||||
|
nlohmann::json j_object = {{"one", 1}, {"two", 2}};
|
||||||
|
nlohmann::json j_array = {1, 2, 4, 8, 16};
|
||||||
|
nlohmann::json j_string = "Hello, world";
|
||||||
|
|
||||||
|
std::cout << std::boolalpha << j_null.is_null() << '\n';
|
||||||
|
std::cout << std::boolalpha << j_boolean.is_boolean() << '\n';
|
||||||
|
std::cout << std::boolalpha << j_number.is_number() << '\n';
|
||||||
|
std::cout << std::boolalpha << j_object.is_object() << '\n';
|
||||||
|
std::cout << std::boolalpha << j_array.is_array() << '\n';
|
||||||
|
std::cout << std::boolalpha << j_string.is_string() << '\n';
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Output
|
||||||
|
|
||||||
|
```
|
||||||
|
true
|
||||||
|
true
|
||||||
|
true
|
||||||
|
true
|
||||||
|
true
|
||||||
|
true
|
||||||
|
```
|
||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [**is_null**](https://github.com/nlohmann/json/wiki/nlohmann::basicjson::is_null)<br>
|
- [**is_null**](https://github.com/nlohmann/json/wiki/nlohmann::basicjson::is_null)<br>
|
||||||
|
|||||||
Reference in new issue
Block a user