/usr/include/boost/hana/functional
NameSizeModeActions
always.hpp17900644editdlrm
apply.hpp29400644editdlrm
arg.hpp51160644editdlrm
capture.hpp34980644editdlrm
compose.hpp33930644editdlrm
curry.hpp57160644editdlrm
demux.hpp95500644editdlrm
fix.hpp27580644editdlrm
flip.hpp20710644editdlrm
id.hpp9050644editdlrm
infix.hpp64620644editdlrm
iterate.hpp62540644editdlrm
lockstep.hpp36100644editdlrm
on.hpp22910644editdlrm
overload.hpp26810644editdlrm
overload_linearly.hpp37070644editdlrm
partial.hpp32370644editdlrm
placeholder.hpp129850644editdlrm
reverse_partial.hpp32690644editdlrm
Edit: /usr/include/boost/hana/functional/apply.hpp (2940B)
/*! @file Defines `boost::hana::apply`. @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_FUNCTIONAL_APPLY_HPP #define BOOST_HANA_FUNCTIONAL_APPLY_HPP #include BOOST_HANA_NAMESPACE_BEGIN //! @ingroup group-functional //! Invokes a Callable with the given arguments. //! //! This is equivalent to [std::invoke][1] that will be added in C++17. //! However, `apply` is a function object instead of a function, which //! makes it possible to pass it to higher-order algorithms. //! //! //! @param f //! A [Callable][2] to be invoked with the given arguments. //! //! @param x... //! The arguments to call `f` with. The number of `x...` must match the //! arity of `f`. //! //! //! Example //! ------- //! @include example/functional/apply.cpp //! //! [1]: http://en.cppreference.com/w/cpp/utility/functional/invoke //! [2]: http://en.cppreference.com/w/cpp/named_req/Callable #ifdef BOOST_HANA_DOXYGEN_INVOKED constexpr auto apply = [](auto&& f, auto&& ...x) -> decltype(auto) { return forwarded(f)(forwarded(x)...); }; #else struct apply_t { template constexpr auto operator()(F&& f, Args&&... args) const -> decltype(static_cast(f)(static_cast(args)...)) { return static_cast(f)(static_cast(args)...); } template constexpr auto operator()(T Base::*pmd, Derived&& ref) const -> decltype(static_cast(ref).*pmd) { return static_cast(ref).*pmd; } template constexpr auto operator()(PMD pmd, Pointer&& ptr) const -> decltype((*static_cast(ptr)).*pmd) { return (*static_cast(ptr)).*pmd; } template constexpr auto operator()(T Base::*pmf, Derived&& ref, Args&&... args) const -> decltype((static_cast(ref).*pmf)(static_cast(args)...)) { return (static_cast(ref).*pmf)(static_cast(args)...); } template constexpr auto operator()(PMF pmf, Pointer&& ptr, Args&& ...args) const -> decltype(((*static_cast(ptr)).*pmf)(static_cast(args)...)) { return ((*static_cast(ptr)).*pmf)(static_cast(args)...); } }; constexpr apply_t apply{}; #endif BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_FUNCTIONAL_APPLY_HPP