Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | |
| 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 Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 9 | #ifndef NDNBOOST_FT_DETAIL_TO_SEQUENCE_HPP_INCLUDED |
| 10 | #define NDNBOOST_FT_DETAIL_TO_SEQUENCE_HPP_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 11 | |
| 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 | |
| 20 | namespace ndnboost { namespace function_types { namespace detail { |
| 21 | |
| 22 | // wrap first arguments in components, if callable builtin type |
| 23 | template<typename T> |
| 24 | struct 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 Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 35 | #ifndef NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 36 | // reduce template instantiations, if possible |
| 37 | template<typename T, typename U> |
| 38 | struct 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 | |