mirror of
https://github.com/boostorg/compat.git
synced 2026-01-19 04:02:16 +00:00
Extract nontype_t to its own header; add nontype
This commit is contained in:
@@ -5,31 +5,19 @@
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/compat/nontype.hpp>
|
||||
#include <boost/compat/invoke.hpp>
|
||||
#include <boost/compat/type_traits.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#if defined(__cpp_nontype_template_parameter_auto) && __cpp_nontype_template_parameter_auto >= 201606L
|
||||
#define BOOST_COMPAT_HAS_AUTO_NTTP
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace compat {
|
||||
|
||||
template <class... S>
|
||||
struct function_ref;
|
||||
|
||||
#if defined(BOOST_COMPAT_HAS_AUTO_NTTP)
|
||||
|
||||
template <auto V>
|
||||
struct nontype_t {
|
||||
explicit nontype_t() = default;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <bool NoEx>
|
||||
|
||||
37
include/boost/compat/nontype.hpp
Normal file
37
include/boost/compat/nontype.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef BOOST_COMPAT_NONTYPE_HPP_INCLUDED
|
||||
#define BOOST_COMPAT_NONTYPE_HPP_INCLUDED
|
||||
|
||||
// Copyright 2024 Christian Mazakas
|
||||
// Copyright 2025 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(__cpp_nontype_template_parameter_auto) && __cpp_nontype_template_parameter_auto >= 201606L
|
||||
#define BOOST_COMPAT_HAS_AUTO_NTTP
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace compat {
|
||||
|
||||
#if defined(BOOST_COMPAT_HAS_AUTO_NTTP)
|
||||
|
||||
template <auto V>
|
||||
struct nontype_t {
|
||||
explicit nontype_t() = default;
|
||||
};
|
||||
|
||||
# if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304L
|
||||
|
||||
template<auto V>
|
||||
BOOST_INLINE_CONSTEXPR nontype_t<V> nontype {};
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace compat
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_COMPAT_NONTYPE_HPP_INCLUDED
|
||||
Reference in New Issue
Block a user