config.hpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright (C) 2020 T. Zachary Laine
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_STL_INTERFACES_CONFIG_HPP
  7. #define BOOST_STL_INTERFACES_CONFIG_HPP
  8. // Included for BOOST_CLANG_VERSION
  9. #include <boost/config.hpp>
  10. // Included for definition of __cpp_lib_concepts.
  11. #include <iterator>
  12. #if defined(__cpp_lib_concepts) && defined(__cpp_lib_ranges) && \
  13. !defined(BOOST_STL_INTERFACES_DISABLE_CONCEPTS)
  14. #define BOOST_STL_INTERFACES_USE_CONCEPTS 1
  15. #else
  16. #define BOOST_STL_INTERFACES_USE_CONCEPTS 0
  17. #endif
  18. #if ( \
  19. defined(__cpp_explicit_this_parameter) || \
  20. (defined(_MSC_VER) && _MSC_VER >= 1941) || \
  21. (defined(BOOST_CLANG_VERSION) && BOOST_CLANG_VERSION >= 190000)) && \
  22. BOOST_STL_INTERFACES_USE_CONCEPTS && (202002L < __cplusplus) && \
  23. !defined(BOOST_STL_INTERFACES_DISABLE_DEDUCED_THIS)
  24. #define BOOST_STL_INTERFACES_USE_DEDUCED_THIS 1
  25. #else
  26. #define BOOST_STL_INTERFACES_USE_DEDUCED_THIS 0
  27. #endif
  28. // The inline namespaces v1, v2, and v3 represent C++14, C++20, and C++23 and
  29. // later, respectively. v1 is inline for standards before C++20, and v2 is
  30. // inline for C++20 and later. Note that this only applies to code for which
  31. // multiple vI namespace alternatives exist. For example, some instances of
  32. // the v1 namespace may still be inline, if there is no v2 version of its
  33. // contents.
  34. #if !BOOST_STL_INTERFACES_USE_CONCEPTS && !BOOST_STL_INTERFACES_USE_DEDUCED_THIS
  35. # define BOOST_STL_INTERFACES_NAMESPACE_V1 inline namespace v1
  36. # define BOOST_STL_INTERFACES_NAMESPACE_V2 namespace v2
  37. # define BOOST_STL_INTERFACES_NAMESPACE_V3 namespace v3
  38. #elif BOOST_STL_INTERFACES_USE_CONCEPTS && !BOOST_STL_INTERFACES_USE_DEDUCED_THIS
  39. # define BOOST_STL_INTERFACES_NAMESPACE_V1 namespace v1
  40. # define BOOST_STL_INTERFACES_NAMESPACE_V2 inline namespace v2
  41. # define BOOST_STL_INTERFACES_NAMESPACE_V3 namespace v3
  42. #else
  43. # define BOOST_STL_INTERFACES_NAMESPACE_V1 namespace v1
  44. # define BOOST_STL_INTERFACES_NAMESPACE_V2 namespace v2
  45. # define BOOST_STL_INTERFACES_NAMESPACE_V3 inline namespace v3
  46. #endif
  47. #endif