0
  B   ˆl–Ãa¾”êh¥2 ¸&®6â˜´o�þHÑnRÉÜcüÿÅƒd-=Ä_‹I|¥�+ýÿ¹ä³ÄÃ L    /*=============================================================================
    Copyright (c) 2014 Paul Fultz II
    arg.h
    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/

#ifndef BOOST_HOF_GUARD_FUNCTION_ARGS_H
#define BOOST_HOF_GUARD_FUNCTION_ARGS_H

#include <boost/hof/detail/seq.hpp>
#include <boost/hof/returns.hpp>
#include <boost/hof/detail/static_const_var.hpp>
#include <utility>

/// arg
/// ===
/// 
/// Description
/// -----------
/// 
/// The `arg` function returns a function object that returns the Nth argument
/// passed to it. It actually starts at 1, so it is not the zero-based index
/// of the argument.
/// 
/// Synopsis
/// --------
/// 
///     template<class IntegralConstant>
///     constexpr auto arg(IntegralConstant);
/// 
///     template<std::size_t N, class... Ts>
///     constexpr auto arg_c(Ts&&...);
/// 
/// 
/// Example
/// -------
/// 
///     #include <boost/hof.hpp>
///     #include <cassert>
///     using namespace boost::hof;
/// 
///     int main() {
///         assert(arg(std::integral_constant<int, 3>())(1,2,3,4,5) == 3);
///     }
/// 

namespace boost { namespace hof {

namespace detail {

template<class T>
struct perfect_ref
{
    typedef T type;
    typedef typename std::remove_reference<T>::type value_type;
    T&& value;
    constexpr perfect_ref(value_type& x) noexcept
    : value(BOOST_HOF_FORWARD(T)(x))
    {}
};

template<std::size_t N>
struct ignore
{
    template<class T>
    constexpr ignore(T&&...) noexcept
    {}
};

template<std::size_t... N>
struct args_at
{
    template<class T, class... Ts>
    constexpr auto operator()(ignore<N>..., T x, Ts...) const 
    BOOST_HOF_RETURNS(BOOST_HOF_FORWARD(typename T::type)(x.value));
};

template<std::size_t... N>
constexpr args_at<N...> make_args_at(seq<N...>) noexcept
{
    return {};
}

template<std::size_t N, class... Ts>
constexpr auto get_args(Ts&&... xs) BOOST_HOF_RETURNS
(
    boost::hof::detail::make_args_at(typename gens<N>::type())(nullptr, BOOST_HOF_RETURNS_CONSTRUCT(perfect_ref<Ts>)(xs)...)
);

template<class T, T N>
struct make_args_f
{
    template<class... Ts, class=typename std::enable_if<(N <= sizeof...(Ts))>::type>
    constexpr auto operator()(Ts&&... xs) const BOOST_HOF_RETURNS
    (
        boost::hof::detail::get_args<N>(BOOST_HOF_FORWARD(Ts)(xs)...)
    );
};

struct arg_f
{
    template<class IntegralConstant>
    constexpr make_args_f<std::size_t, IntegralConstant::value> operator()(IntegralConstant) const noexcept
    {
        return make_args_f<std::size_t, IntegralConstant::value>();
    }
};

}
#if BOOST_HOF_HAS_VARIABLE_TEMPLATES
template<std::size_t N>
BOOST_HOF_STATIC_CONSTEXPR detail::make_args_f<std::size_t, N> arg_c = {};
#else
template<std::size_t N, class... Ts>
constexpr auto arg_c(Ts&&... xs) BOOST_HOF_RETURNS
(
    boost::hof::detail::get_args<N>(BOOST_HOF_FORWARD(Ts)(xs)...)
);
#endif

BOOST_HOF_DECLARE_STATIC_VAR(arg, detail::arg_f);

}} // namespace boost::hof

#endif
  /   	ˆ{‹„„-i[D<†ªoZƒ›Ù«Ç475_‘I|¥‰ÓMdœv ©ƒ†ü+=ÇÆ Û    	‹      µ“]o›0†ïû+Î|±»pòµµÆS‘-M¢”j›¦]lÀ`d»M³_?DM§DÛ¤MBâ �Ïû¾Ç˜¾WAôe=ƒÑÍÖwïó È ñÓ$@£°û0õ†#ÄÙ’ É�«/·Û­·�xÚdm0we1EëŒJœ'œ ì‚¶ïØÐ\rÑÜ�:å
Éæ•�� S@}ï¬r|(PèÒ¢••HU!=!KíåÖK´®¡;°¶8ÐS,TŒ™ÑiŠY­ª�ª(v�(öª4Öb×šý_á¦ÿ>"�÷úmiu9<ðBe•Oœ®	£ªÌÀšÄ'¨]YŒ^}÷2•à…óÉ×y°úÖpèòv5£r#SŸ¼üåÕÊ	[òRRä§™›†¹&lÁ­ƒR•*)ÎÂ·|«~œovL(mbTí”®žPl"GMtakÞd}Õ$ÈÍ1Õ!âwÓàÉ³a¬¯7³eÎ7ÝHDÛâÉÝ?ÜFÂÖÜÈÊA¨ŒLœ6»>e'ù²Šm}ux„>ƒQYîÀIò/‚;ùèŽƒGŸ£“‘í}l½º ¬/Ž]þbk<OÃæz£áåä-À9ÿ£×ÏûÿÃíÅþÇ§¸?o»ÃÿT¤Þï_       ˆÀ¿È625¾ÇÆ q    ‹      ½•[SÚ@†ïýÛ½è]ò%!`Ñ�Ž&8P0AVítœÍ�d%'vW}Á‘vDËLëÕ~IÞïð¼ÙÙ5>Ù®5¾´Qg|ÞGƒÉi¿k!,|¯Y öØ®>è²¢´Œp,Dq°X,äEMÎYã!Ä"Mtà‚Q_È�°y`¬Þ™ÈˆC”+2Ihv³ |DùA~/8Bí9x^žHš’ DZ€Oü8Ây(8ð‚åþl=”#É
¸Mªºe'Ø´2¼<X®&PÿC·²è†xë¦«�™†ˆÑIh”µ°Èl4�g~õóŒƒ—�l&GtŠIDÿèZîÏR"^e›A1§-üÕj9ÇnËÆ¦CÒÐ ò