![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/include/boost/hana/fwd/ |
Upload File : |
/*! @file Forward declares `boost::hana::ap`. @copyright Louis Dionne 2013-2017 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_HANA_FWD_AP_HPP #define BOOST_HANA_FWD_AP_HPP #include <boost/hana/config.hpp> #include <boost/hana/core/when.hpp> BOOST_HANA_NAMESPACE_BEGIN //! Lifted application. //! @ingroup group-Applicative //! //! Specifically, `ap` applies a structure containing functions to a //! structure containing values, and returns a new structure containing //! values. The exact way in which the functions are applied to the values //! depends on the `Applicative`. //! //! `ap` can be called with two arguments or more; the functions in the `f` //! structure are curried and then applied to the values in each `x...` //! structure using the binary form of `ap`. Note that this requires the //! number of `x...` must match the arity of the functions in the `f` //! structure. In other words, `ap(f, x1, ..., xN)` is equivalent to //! @code //! ((curry(f) ap x1) ap x2) ... ap xN //! @endcode //! where `x ap y` is just `ap(x, y)` written in infix notation to //! emphasize the left associativity. //! //! //! Signature //! --------- //! Given an Applicative `A`, the signature is //! @f$ \mathtt{ap} : A(T_1 \times \cdots \times T_n \to U) //! \times A(T_1) \times \cdots \times A(T_n) //! \to A(U) @f$. //! //! @param f //! A structure containing function(s). //! //! @param x... //! Structure(s) containing value(s) and on which `f` is applied. The //! number of structures must match the arity of the functions in the //! `f` structure. //! //! //! Example //! ------- //! @include example/ap.cpp //! //! @todo //! Consider giving access to all the arguments to the tag-dispatched //! implementation for performance purposes. #ifdef BOOST_HANA_DOXYGEN_INVOKED constexpr auto ap = [](auto&& f, auto&& ...x) -> decltype(auto) { return tag-dispatched; }; #else template <typename A, typename = void> struct ap_impl : ap_impl<A, when<true>> { }; struct ap_t { template <typename F, typename X> constexpr decltype(auto) operator()(F&& f, X&& x) const; template <typename F, typename ...Xs> constexpr decltype(auto) operator()(F&& f, Xs&& ...xs) const; }; constexpr ap_t ap{}; #endif BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_FWD_AP_HPP