1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #ifndef BOOST_HANA_FUNCTIONAL_FIX_HPP
- #define BOOST_HANA_FUNCTIONAL_FIX_HPP
- #include <boost/hana/config.hpp>
- #include <boost/hana/detail/create.hpp>
- #include <utility>
- BOOST_HANA_NAMESPACE_BEGIN
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #ifdef BOOST_HANA_DOXYGEN_INVOKED
- constexpr auto fix = [](auto&& f) {
- return [perfect-capture](auto&& ...x) -> decltype(auto) {
- return forwarded(f)(fix(f), forwarded(x)...);
- };
- };
- #else
- template <typename F>
- struct fix_t;
- constexpr detail::create<fix_t> fix{};
- template <typename F>
- struct fix_t {
- F f;
- template <typename ...X>
- constexpr decltype(auto) operator()(X&& ...x) const&
- { return f(fix(f), static_cast<X&&>(x)...); }
- template <typename ...X>
- constexpr decltype(auto) operator()(X&& ...x) &
- { return f(fix(f), static_cast<X&&>(x)...); }
- template <typename ...X>
- constexpr decltype(auto) operator()(X&& ...x) &&
- { return std::move(f)(fix(f), static_cast<X&&>(x)...); }
- };
- #endif
- BOOST_HANA_NAMESPACE_END
- #endif
|