File indexing completed on 2025-01-18 09:37:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_FUNCTIONAL_ALWAYS_HPP
0011 #define BOOST_HANA_FUNCTIONAL_ALWAYS_HPP
0012
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/detail/create.hpp>
0015
0016 #include <utility>
0017
0018
0019 namespace boost { namespace hana {
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0037 constexpr auto always = [](auto&& x) {
0038 return [perfect-capture](auto const& ...y) -> decltype(auto) {
0039 return forwarded(x);
0040 };
0041 };
0042 #else
0043 template <typename T>
0044 struct _always {
0045 T val_;
0046
0047 template <typename ...Args>
0048 constexpr T const& operator()(Args const& ...) const&
0049 { return val_; }
0050
0051 template <typename ...Args>
0052 constexpr T& operator()(Args const& ...) &
0053 { return val_; }
0054
0055 template <typename ...Args>
0056 constexpr T operator()(Args const& ...) &&
0057 { return std::move(val_); }
0058 };
0059
0060 BOOST_HANA_INLINE_VARIABLE constexpr detail::create<_always> always{};
0061 #endif
0062 }}
0063
0064 #endif