json/include/nlohmann/detail/json_custom_base_class.hpp
Raphael Grimm 143f868f9c Allow to add a custom base class as an extension point to json nodes
* by default an empty class is used and the library behaves as it already did
* if a user explicitly adds a base class (last template parameter) each node inherits it
* this can be used to add custom extensions (e.g. add metadata / visitor methods)
* add test for this feature
2022-08-18 23:12:49 +02:00

21 lines
315 B
C++

#pragma once
#include <type_traits>
namespace nlohmann
{
namespace detail
{
struct json_default_base {};
template<class T>
using json_base_class = typename std::conditional<
std::is_same<T, void>::value,
json_default_base,
T
>::type;
} // namespace detail
} // namespace nlohmann