1 /*=============================================================================
2     Copyright (c) 2012 Paul Fultz II
3     join.h
4     Distributed under the Boost Software License, Version 1.0. (See accompanying
5     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 
8 #ifndef BOOST_HOF_GUARD_FUNCTION_DETAIL_JOIN_H
9 #define BOOST_HOF_GUARD_FUNCTION_DETAIL_JOIN_H
10 
11 #include <boost/hof/detail/holder.hpp>
12 
13 namespace boost { namespace hof { namespace detail {
14 
15 template<class... Ts>
16 struct join_args
17 {};
18 
19 template<template <class...> class T, class Args, class=void>
20 struct join_impl
21 {};
22 
23 template<template <class...> class T, class... Args>
24 struct join_impl<T, join_args<Args...>, typename holder<
25     T<Args...>
26 >::type>
27 { typedef T<Args...> type; };
28 
29 template<template <class...> class T, class... Args>
30 struct join
31 : join_impl<T, join_args<Args...>>
32 {};
33 
34 }}} // namespace boost::hof
35 
36 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
37 #define BOOST_HOF_JOIN(c, ...) typename boost::hof::detail::join<c, __VA_ARGS__>::type
38 #else
39 #define BOOST_HOF_JOIN(c, ...) c<__VA_ARGS__>
40 
41 #endif
42 
43 #endif
44