JSON for Modern C++  3.7.3

◆ basic_json() [4/9]

template<typename BasicJsonType , detail::enable_if_t< detail::is_basic_json< BasicJsonType >::value and not std::is_same< basic_json, BasicJsonType >::value, int > = 0>
nlohmann::basic_json::basic_json ( const BasicJsonType &  val)
inline

This is a constructor for existing basic_json types. It does not hijack copy/move constructors, since the parameter has different template arguments than the current ones.

The constructor tries to convert the internal m_value of the parameter.

Template Parameters
BasicJsonTypea type such that:
  • BasicJsonType is a basic_json type.
  • BasicJsonType has different template arguments than basic_json_t.
Parameters
[in]valthe basic_json value to be converted.
Complexity
Usually linear in the size of the passed val, also depending on the implementation of the called to_json() method.
Exception safety
Depends on the called constructor. For types directly supported by the library (i.e., all types for which no to_json() function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any JSON value.
Since
version 3.2.0

Definition at line 15880 of file json.hpp.