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>>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::basic_json |
( |
const value_t |
v | ) |
|
|
inline |
create an empty value with a given type
Create an empty JSON value with a given type. The value will be default initialized with an empty value which depends on the type:
Value type | initial value |
null | null |
boolean | false |
string | "" |
number | 0 |
object | {} |
array | [] |
binary | empty array |
- Parameters
-
[in] | v | the type of the value to create |
@complexity Constant.
@exceptionsafety Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
@liveexample{The following code shows the constructor for different value_t values,basic_json__value_t}
- See also
- see clear() – restores the postcondition of this constructor
- Since
- version 1.0.0
Definition at line 19164 of file json.hpp.
19166 {
19168 }
void assert_invariant(bool check_parents=true) const noexcept
checks the class invariants
json_value m_value
the value of the current element