|
◆ is_number_integer()
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>
This function returns true iff the JSON value is an integer or unsigned integer number. This excludes floating-point values.
- Returns
true if type is an integer or unsigned integer number, false otherwise.
- Complexity\n Constant.
- Exception safety\n No-throw guarantee: this member function never throws
- exceptions.
- Example\n The following code exemplifies
is_number_integer() for all - JSON types.
18 std::cout << std::boolalpha;
static basic_json array(std::initializer_list< basic_json > init=std::initializer_list< basic_json >()) explicitly create an array from an initializer list
constexpr bool is_number_integer() const noexcept return whether value is an integer number
a class to store JSON values
basic_json<> json default JSON class
Output (play with this example online):
false
false
true
true
false
false
false
false
The example code above can be translated with g++ -std=c++11 -Isrc doc/examples/is_number_integer.cpp -o is_number_integer
- See also
- is_number() – check if value is a number
-
is_number_unsigned() – check if value is an unsigned integer number
-
is_number_float() – check if value is a floating-point number
- Since
- version 1.0.0
Definition at line 2841 of file json.hpp.
|