Horizon
Loading...
Searching...
No Matches
adl_serializer.hpp
1#pragma once
2
3#include <type_traits>
4#include <utility>
5
6#include <nlohmann/detail/conversions/from_json.hpp>
7#include <nlohmann/detail/conversions/to_json.hpp>
8#include <nlohmann/detail/meta/identity_tag.hpp>
9#include <nlohmann/detail/meta/type_traits.hpp>
10
11namespace nlohmann
12{
13
14template<typename ValueType, typename>
16{
28 template<typename BasicJsonType, typename TargetType = ValueType>
29 static auto from_json(BasicJsonType && j, TargetType& val) noexcept(
30 noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
31 -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
32 {
33 ::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
34 }
35
48 template<typename BasicJsonType, typename TargetType = ValueType>
49 static auto from_json(BasicJsonType && j) noexcept(
50 noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {})))
51 -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
52 {
53 return ::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {});
54 }
55
65 template<typename BasicJsonType, typename TargetType = ValueType>
66 static auto to_json(BasicJsonType& j, TargetType && val) noexcept(
67 noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val))))
68 -> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void())
69 {
70 ::nlohmann::to_json(j, std::forward<TargetType>(val));
71 }
72};
73} // namespace nlohmann
namespace for Niels Lohmann
Definition adl_serializer.hpp:12
default JSONSerializer template argument
Definition adl_serializer.hpp:16
static auto from_json(BasicJsonType &&j, TargetType &val) noexcept(noexcept(::nlohmann::from_json(std::forward< BasicJsonType >(j), val))) -> decltype(::nlohmann::from_json(std::forward< BasicJsonType >(j), val), void())
convert a JSON value to any value type
Definition adl_serializer.hpp:29
static auto from_json(BasicJsonType &&j) noexcept(noexcept(::nlohmann::from_json(std::forward< BasicJsonType >(j), detail::identity_tag< TargetType > {}))) -> decltype(::nlohmann::from_json(std::forward< BasicJsonType >(j), detail::identity_tag< TargetType > {}))
convert a JSON value to any value type
Definition adl_serializer.hpp:49
static auto to_json(BasicJsonType &j, TargetType &&val) noexcept(noexcept(::nlohmann::to_json(j, std::forward< TargetType >(val)))) -> decltype(::nlohmann::to_json(j, std::forward< TargetType >(val)), void())
convert any value type to a JSON value
Definition adl_serializer.hpp:66
Definition identity_tag.hpp:8