blob: 7b57ed47b3f4b2914483d67a105cc169924537f9 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001
2// (C) Copyright Tobias Schwinger
3//
4// Use modification and distribution are subject to the boost Software License,
5// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
6
7//------------------------------------------------------------------------------
8
Jeff Thompson3d613fd2013-10-15 15:39:04 -07009#ifndef NDNBOOST_FT_DETAIL_TO_SEQUENCE_HPP_INCLUDED
10#define NDNBOOST_FT_DETAIL_TO_SEQUENCE_HPP_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -070011
12#include <ndnboost/mpl/eval_if.hpp>
13#include <ndnboost/mpl/identity.hpp>
14#include <ndnboost/mpl/is_sequence.hpp>
15#include <ndnboost/mpl/placeholders.hpp>
16#include <ndnboost/type_traits/add_reference.hpp>
17
18#include <ndnboost/function_types/is_callable_builtin.hpp>
19
20namespace ndnboost { namespace function_types { namespace detail {
21
22// wrap first arguments in components, if callable builtin type
23template<typename T>
24struct to_sequence
25{
26 typedef typename
27 mpl::eval_if
28 < is_callable_builtin<T>
29 , to_sequence< components<T> >
30 , mpl::identity< T >
31 >::type
32 type;
33};
34
Jeff Thompson3d613fd2013-10-15 15:39:04 -070035#ifndef NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Jeff Thompsona28eed82013-08-22 16:21:10 -070036// reduce template instantiations, if possible
37template<typename T, typename U>
38struct to_sequence< components<T,U> >
39{
40 typedef typename components<T,U>::types type;
41};
42#endif
43
44} } } // namespace ::ndnboost::function_types::detail
45
46#endif
47