123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #ifndef BOOST_HOF_GUARD_FUNCTION_FUNCTION_H
- #define BOOST_HOF_GUARD_FUNCTION_FUNCTION_H
- #include <boost/hof/reveal.hpp>
- #if !BOOST_HOF_HAS_INLINE_VARIABLES
- #include <boost/hof/detail/static_const_var.hpp>
- #include <boost/hof/detail/constexpr_deduce.hpp>
- #endif
- namespace boost { namespace hof {
- namespace detail {
- struct reveal_static_const_factory
- {
- constexpr reveal_static_const_factory()
- {}
- template<class F>
- constexpr reveal_adaptor<F> operator=(const F& f) const
- {
- #if BOOST_HOF_HAS_INLINE_VARIABLES
- #else
- static_assert(BOOST_HOF_IS_DEFAULT_CONSTRUCTIBLE(F), "Static functions must be default constructible");
- #endif
- return reveal_adaptor<F>(f);
- }
- };
- }}}
- #if BOOST_HOF_HAS_INLINE_VARIABLES
- #define BOOST_HOF_STATIC_FUNCTION(name) inline const constexpr auto name = boost::hof::detail::reveal_static_const_factory()
- #else
- #define BOOST_HOF_STATIC_FUNCTION(name) BOOST_HOF_STATIC_CONST_VAR(name) = BOOST_HOF_DETAIL_MSVC_CONSTEXPR_DEDUCE boost::hof::detail::reveal_static_const_factory()
- #endif
- #endif
|