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 ReferenceType , typename std::enable_if< std::is_reference< ReferenceType >
::value &&std::is_const< typename std::remove_reference< ReferenceType >
::type >
::value, int >
::type = 0>
ReferenceType nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::get_ref |
( |
| ) |
const |
|
inline |
get a reference value (implicit)
get a reference value (implicit)
Implicit reference access to the internally stored JSON value. No copies are made.
- Warning
- Writing data to the referee of the result yields an undefined state.
- Template Parameters
-
- Returns
- reference to the internally stored JSON value if the requested reference type ReferenceType fits to the JSON value; throws type_error.303 otherwise
- Exceptions
-
type_error.303 | in case passed type ReferenceType is incompatible with the stored JSON value; see example below |
@complexity Constant.
@liveexample{The example shows several calls to get_ref()
.,get_ref}
- Since
- version 1.1.0
Definition at line 21065 of file json.hpp.
21066 {
21067
21068 return get_ref_impl<ReferenceType>(*this);
21069 }