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 ThisType >
static ReferenceType nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::get_ref_impl |
( |
ThisType & |
obj | ) |
|
|
inlinestaticprivate |
helper function to implement get_ref()
This function helps to implement get_ref() without code duplication for const and non-const overloads
- Template Parameters
-
- Exceptions
-
type_error.303 | if ReferenceType does not match underlying value type of the current JSON |
Definition at line 20660 of file json.hpp.
20661 {
20662
20663 auto *ptr = obj.template get_ptr<typename std::add_pointer<ReferenceType>::type>();
20664
20665 if (JSON_HEDLEY_LIKELY(ptr != nullptr))
20666 {
20667 return *ptr;
20668 }
20669
20670 JSON_THROW(type_error::create(303, "incompatible ReferenceType for get_ref, actual type is " + std::string(obj.type_name()), obj));
20671 }