JSON for Modern C++  3.7.0

◆ basic_json() [4/9]

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>
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 15696 of file json.hpp.