template<template< typename U, typename V, typename... Args > class ObjectType = std::map, template< typename U, typename... Args > class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template< typename U > class AllocatorType = std::allocator, template< typename T, typename SFINAE=void > class JSONSerializer = adl_serializer, class BinaryType = std::vector<std::uint8_t>>
constexpr bool nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::is_primitive |
( |
| ) |
const |
|
inlineconstexprnoexcept |
return whether type is primitive
This function returns true if and only if the JSON type is primitive (string, number, boolean, or null).
- Returns
true
if type is primitive (string, number, boolean, or null), false
otherwise.
@complexity Constant.
@exceptionsafety No-throw guarantee: this member function never throws exceptions.
@liveexample{The following code exemplifies is_primitive()
for all JSON types.,is_primitive}
- See also
- see is_structured() – returns whether JSON value is structured
-
see is_null() – returns whether JSON value is
null
-
see is_string() – returns whether JSON value is a string
-
see is_boolean() – returns whether JSON value is a boolean
-
see is_number() – returns whether JSON value is a number
-
see is_binary() – returns whether JSON value is a binary array
- Since
- version 1.0.0
Definition at line 20202 of file json.hpp.
20203 {
20205 }
constexpr bool is_boolean() const noexcept
return whether value is a boolean
constexpr bool is_binary() const noexcept
return whether value is a binary array
constexpr bool is_string() const noexcept
return whether value is a string
constexpr bool is_number() const noexcept
return whether value is a number
constexpr bool is_null() const noexcept
return whether value is null