json_custom_base_class.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // __ _____ _____ _____
  2. // __| | __| | | | JSON for Modern C++
  3. // | | |__ | | | | | | version 3.11.3
  4. // |_____|_____|_____|_|___| https://github.com/nlohmann/json
  5. //
  6. // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
  7. // SPDX-License-Identifier: MIT
  8. #pragma once
  9. #include <type_traits> // conditional, is_same
  10. #include <nlohmann/detail/abi_macros.hpp>
  11. NLOHMANN_JSON_NAMESPACE_BEGIN
  12. namespace detail
  13. {
  14. /*!
  15. @brief Default base class of the @ref basic_json class.
  16. So that the correct implementations of the copy / move ctors / assign operators
  17. of @ref basic_json do not require complex case distinctions
  18. (no base class / custom base class used as customization point),
  19. @ref basic_json always has a base class.
  20. By default, this class is used because it is empty and thus has no effect
  21. on the behavior of @ref basic_json.
  22. */
  23. struct json_default_base {};
  24. template<class T>
  25. using json_base_class = typename std::conditional <
  26. std::is_same<T, void>::value,
  27. json_default_base,
  28. T
  29. >::type;
  30. } // namespace detail
  31. NLOHMANN_JSON_NAMESPACE_END