json/include/nlohmann/detail/json_custom_base_class.hpp

31 lines
829 B
C++
Raw Normal View History

#pragma once
#include <type_traits> // conditional, is_same
namespace nlohmann
{
namespace detail
{
2021-11-01 17:59:56 +03:00
/*!
@brief Default base class of the @ref basic_json class.
So that the correct implementation of the copy / move ctors / assign operators
of @ref basic_json does not require complex case distinctions
(no base class / custom base class used as customization point),
@ref basic_json always has a base class.
By default, this class is used because it is empty and thus has no effect
on the behavior of @ref basic_json.
*/
struct json_default_base {};
template<class T>
2021-10-31 15:30:58 +03:00
using json_base_class = typename std::conditional <
std::is_same<T, void>::value,
json_default_base,
T
>::type;
} // namespace detail
} // namespace nlohmann