We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
namespace meta_detail { template<typename Ts, int = 0> struct lambda_rec_; template<typename ...Ts> struct lambda_rec_<list<Ts...>> { template<typename...Us> using apply = apply<let<var<_self, lambda_rec_>, lambda<Ts...>>, Us...>; }; } //////////////////////////////////////////////////////////////////////////////////// // lambda_rec /// For defining a self-recursive lambda. In the body of a lambda, the placeholder /// `_self` refers to the nearest enclosing `lambda_rec` /// /// \code /// // Define a factorial template in terms of a recursive lambda /// using factorial_ = lambda_rec<_a, /// lazy::if_<lazy::greater<_a, meta::size_t<0>>, /// lazy::multiplies<_a, lazy::apply<_self, lazy::dec<_a>>>, /// meta::size_t<1>>>; /// template<std::size_t N> /// using factorial = apply<factorial_, meta::size_t<N>>; /// /// static_assert(factorial<0>::value == 1, ""); /// static_assert(factorial<1>::value == 1, ""); /// static_assert(factorial<2>::value == 2, ""); /// static_assert(factorial<3>::value == 6, ""); /// static_assert(factorial<4>::value == 24, ""); /// \endcode template<typename ...Ts> using lambda_rec = meta_detail::lambda_rec_<list<Ts...>>;
The text was updated successfully, but these errors were encountered:
Is this in range-v3 master already?
Sorry, something went wrong.
Use the source, Luke.
No branches or pull requests
The text was updated successfully, but these errors were encountered: