1
  /   ˆ{‹„„-i[D<†ªoZƒ›Ù«Ä523_‘I|¥‰ÓMdœv ©ƒ†ü+=ÃÂ     ‹      Õ•ßoÚ0ÇßûWÜü°7¸„2¦RÇSG�†FQ¦iš¦É‰±šÄÈ10ö×Ï!¡°ªl�¶iÝ“Ï—ïýø\›>Ç½Ù‡IÞÌ®‡0y÷z8èi ¾?ï!†³°zÐnz>bD€$Ö.»ˆ›Í¦¹9oj³ÀÙ›¥m,¬Q±m
+;£¥��M$nj•M%äB~=Ô+[(!]Ü¶@!×*–Ei[™a&3m¶õÒö0×Bzû­‹XE•�b•ÕÕÁº�´Ø–õý?^Ë¥Ü�ðhW²4£6�5OÕ"ˆÕKÂ¨ÊP˜8 ¨b�¥<¿m.Ôœ Om@>zãON‡6)£å�9È«^0º!a#žIŠüaÍµÓ\6ä……L5WRœßTâõõtÂ°Ò„²ˆ�ZZ¥óƒâ1j¬ÓbÉëG�˜cU%?›�¿ÆäjÚÍÂÁ´‰(Sºû�7GØ„™[•‘±uÎ«ªñ<�Šåå~uÓF-K@Tþé\§BšcÖS”{.ÂöÖq§÷Zky­NÃ÷þø/»^ài0µ–fÇP[O…a•ßæz“C¸úGŸùÊ¥2:’w4×#°Z>x�nË;‰åÔ·ÿ ëÒÿŠ³’k÷[V­à‘ÇÖÅÝD±º¿"õ)Ve    6   ˆl–Ü4ý( ©¤ýÔâ�rà¸ËjbÑ¿�þB g#}Æd�’»üÿÇƒh¹ÆÄÃ      00000055
  C   	ˆl–Ãa¾”êh¥2 ¸&®6â˜´o�þY	#Y¹H$qŒ@óÈ„�ißÇ_‹I|¥�+ýÿ¹ä³ÆÅ 1Ë    	/*=============================================================================
    Copyright (c) 2014 Paul Fultz II
    pack.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_PACK_H
#define BOOST_HOF_GUARD_FUNCTION_PACK_H

/// pack
/// ====
/// 
/// Description
/// -----------
/// 
/// The `pack` function returns a higher order function object that takes a
/// function that will be passed the initial elements. The function object is
/// a sequence that can be unpacked with `unpack_adaptor` as well. Also,
/// `pack_join` can be used to join multiple packs together.
/// 
/// Synopsis
/// --------
/// 
///     // Decay everything before capturing
///     template<class... Ts>
///     constexpr auto pack(Ts&&... xs);
/// 
///     // Capture lvalues by reference and rvalue reference by reference
///     template<class... Ts>
///     constexpr auto pack_forward(Ts&&... xs);
/// 
///     // Capture lvalues by reference and rvalues by value.
///     template<class... Ts>
///     constexpr auto pack_basic(Ts&&... xs);
/// 
///     // Join multiple packs together
///     template<class... Ts>
///     constexpr auto pack_join(Ts&&... xs);
/// 
/// Semantics
/// ---------
/// 
///     assert(pack(xs...)(f) == f(xs...));
///     assert(unpack(f)(pack(xs...)) == f(xs...));
/// 
///     assert(pack_join(pack(xs...), pack(ys...)) == pack(xs..., ys...));
/// 
/// 
/// Example
/// -------
/// 
///     #include <boost/hof.hpp>
///     #include <cassert>
///     using namespace boost::hof;
/// 
///     struct sum
///     {
///         template<class T, class U>
///         T operator()(T x, U y) const
///         {
///             return x+y;
///         }
///     };
/// 
///     int main() {
///         int r = pack(3, 2)(sum());
///         assert(r == 5);
///     }
/// 
/// See Also
/// --------
/// 
/// * [unpack](unpack)
/// 

#include <boost/hof/detail/seq.hpp>
#include <boost/hof/detail/delegate.hpp>
#include <boost/hof/detail/remove_rvalue_reference.hpp>
#include <boost/hof/detail/unwrap.hpp>
#include <boost/hof/detail/static_const_var.hpp>
#include <boost/hof/unpack_sequence.hpp>
#include <boost/hof/returns.hpp>
#include <boost/hof/alias.hpp>
#include <boost/hof/decay.hpp>

namespace boost { namespace hof { namespace detail {

template<class...>
struct pack_tag
{};

template<class T, class Tag>
struct pack_holder
: detail::alias_empty<T, Tag>
{};

template<class Seq, class... Ts>
struct pack_base;

template<class T>
struct is_copyable
: std::integral_constant<bool, (
    BOOST_HOF_IS_CONSTRUCTIBLE(T, const T&)
)>
{};

template<class T>
struct is_copyable<T&>
: std::true_type
{};

template<class T>
struct is_copyable<T&&>
: std::true_type
{};

template<class T, class Tag, class X, class... Ts, typename std::enable_if<
    is_copyable<T>::value && !std::is_lvalue_reference<T>::value
, int>::type = 0>
constexpr T pack_get(X&& x, Ts&&... xs) noexcept(BOOST_HOF_IS_NOTHROW_COPY_CONSTRUCTIBLE(T))
{
    return static_cast<T>(boost::hof::alias_value<Tag, T>(BOOST_HOF_FORWARD(X)(x), xs...));
}

template<class T, class Tag, class X, class... Ts, typename std::enable_if<
    std::is_