| 1 | // Copyright David Abrahams 2006. |
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // (See accompanying file LICENSE_1_0.txt or copy at |
| 4 | // http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | #ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP |
| 7 | #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP |
| 8 | |
| 9 | namespace boost { namespace parameter { namespace aux { |
| 10 | |
| 11 | // A metafunction that transforms void(*)(T) -> T |
| 12 | template <typename UnaryFunctionPointer> |
| 13 | struct unaryfunptr_arg_type; |
| 14 | |
| 15 | template <typename Arg> |
| 16 | struct unaryfunptr_arg_type<void(*)(Arg)> |
| 17 | { |
| 18 | typedef Arg type; |
| 19 | }; |
| 20 | |
| 21 | template <> |
| 22 | struct unaryfunptr_arg_type<void(*)(void)> |
| 23 | { |
| 24 | typedef void type; |
| 25 | }; |
| 26 | }}} // namespace boost::parameter::aux |
| 27 | |
| 28 | // A macro that takes a parenthesized C++ type name (T) and transforms it |
| 29 | // into an un-parenthesized type expression equivalent to T. |
| 30 | #define BOOST_PARAMETER_PARENTHESIZED_TYPE(x) \ |
| 31 | ::boost::parameter::aux::unaryfunptr_arg_type< void(*)x >::type |
| 32 | |
| 33 | #endif // include guard |
| 34 | |
| 35 | |