JSON for Modern C++ 3.10.4

◆ basic_json() [4/10]

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>>
template<typename BasicJsonType , detail::enable_if_t< detail::is_basic_json< BasicJsonType >::value &&!std::is_same< basic_json, BasicJsonType >::value, int > = 0>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::basic_json ( const BasicJsonType &  val)

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.
[in]valthe basic_json value to be converted.
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.
version 3.2.0

Definition at line 19109 of file json.hpp.