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 | |
| 9 | #ifndef BOOST_FT_RESULT_TYPE_HPP_INCLUDED |
| 10 | #define BOOST_FT_RESULT_TYPE_HPP_INCLUDED |
| 11 | |
| 12 | #include <ndnboost/blank.hpp> |
| 13 | #include <ndnboost/mpl/if.hpp> |
| 14 | |
| 15 | #include <ndnboost/mpl/aux_/lambda_support.hpp> |
| 16 | #include <ndnboost/type_traits/detail/template_arity_spec.hpp> |
| 17 | |
| 18 | #include <ndnboost/mpl/at.hpp> |
| 19 | |
| 20 | #include <ndnboost/function_types/is_callable_builtin.hpp> |
| 21 | #include <ndnboost/function_types/components.hpp> |
| 22 | |
| 23 | namespace ndnboost |
| 24 | { |
| 25 | namespace function_types |
| 26 | { |
| 27 | template< typename T > struct result_type; |
| 28 | |
| 29 | namespace detail |
| 30 | { |
| 31 | template<typename T> struct result_type_impl |
| 32 | : mpl::at_c |
| 33 | < typename function_types::components<T>::types, 0 > |
| 34 | { }; |
| 35 | } |
| 36 | |
| 37 | template<typename T> struct result_type |
| 38 | : mpl::if_ |
| 39 | < function_types::is_callable_builtin<T> |
| 40 | , detail::result_type_impl<T>, ndnboost::blank |
| 41 | >::type |
| 42 | { |
| 43 | BOOST_MPL_AUX_LAMBDA_SUPPORT(1,result_type,(T)) |
| 44 | }; |
| 45 | } |
| 46 | BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,function_types::result_type) |
| 47 | } |
| 48 | |
| 49 | #endif |
| 50 | |