![]() 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::eval`. @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_EVAL_HPP #define BOOST_HANA_FWD_EVAL_HPP #include <boost/hana/config.hpp> #include <boost/hana/core/when.hpp> BOOST_HANA_NAMESPACE_BEGIN //! Evaluate a lazy value and return it. //! @relates hana::lazy //! //! Given a lazy expression `expr`, `eval` evaluates `expr` and returns //! the result as a normal value. However, for convenience, `eval` can //! also be used with nullary and unary function objects. Specifically, //! if `expr` is not a `hana::lazy`, it is called with no arguments at //! all and the result of that call (`expr()`) is returned. Otherwise, //! if `expr()` is ill-formed, then `expr(hana::id)` is returned instead. //! If that expression is ill-formed, then a compile-time error is //! triggered. //! //! The reason for allowing nullary callables in `eval` is because this //! allows using nullary lambdas as lazy branches to `eval_if`, which //! is convenient. The reason for allowing unary callables and calling //! them with `hana::id` is because this allows deferring the //! compile-time evaluation of selected expressions inside the callable. //! How this can be achieved is documented by `hana::eval_if`. //! //! //! Example //! ------- //! @include example/eval.cpp #ifdef BOOST_HANA_DOXYGEN_INVOKED constexpr auto eval = [](auto&& see_documentation) -> decltype(auto) { return tag-dispatched; }; #else template <typename T, typename = void> struct eval_impl : eval_impl<T, when<true>> { }; struct eval_t { template <typename Expr> constexpr decltype(auto) operator()(Expr&& expr) const; }; constexpr eval_t eval{}; #endif BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_FWD_EVAL_HPP