#ifndef METAL_LAMBDA_ARG_HPP #define METAL_LAMBDA_ARG_HPP #include "../config.hpp" #include namespace metal { /// \cond namespace detail { template struct _arg; } /// \endcond /// \ingroup lambda /// /// ### Description /// A parametric \lambda that selects the n-th argument it is invoked with. /// /// ### Usage /// For any nonzero positive integral value `n` /// \code /// using result = metal::arg; /// \endcode /// /// \returns: \lambda /// \semantics: /// Equivalent to /// \code /// using result = metal::lambda; /// \endcode /// where `expr` is an \expression such that /// `expr` yields `val_n-1`. /// /// ### Example /// \snippet lambda.cpp arg /// /// ### See Also /// \see lambda, invoke, bind, always template using arg = typename detail::_arg::type; } #include "../lambda/lambda.hpp" #include "../list/at.hpp" #include "../list/list.hpp" #include "../number/number.hpp" namespace metal { /// \cond namespace detail { template struct _arg { template using impl = at, number>; using type = lambda; }; template <> struct _arg<0U> { }; } /// \endcond /// \ingroup lambda /// /// ### Description /// Predefined placeholder. /// \{ using _1 = metal::arg<1U>; using _2 = metal::arg<2U>; using _3 = metal::arg<3U>; using _4 = metal::arg<4U>; using _5 = metal::arg<5U>; using _6 = metal::arg<6U>; using _7 = metal::arg<7U>; using _8 = metal::arg<8U>; using _9 = metal::arg<9U>; /// \} } #endif