diff options
Diffstat (limited to 'boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp')
-rw-r--r-- | boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp b/boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp new file mode 100644 index 0000000000..f3d9ed9a90 --- /dev/null +++ b/boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp @@ -0,0 +1,34 @@ +// Copyright David Abrahams 2006. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP +#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP + +namespace boost { namespace parameter { namespace aux { + + // A metafunction that transforms void(*)(T) -> T + template <typename UnaryFunctionPointer> + struct unaryfunptr_arg_type; + + template <typename Arg> + struct unaryfunptr_arg_type<void(*)(Arg)> + { + typedef Arg type; + }; + + template <> + struct unaryfunptr_arg_type<void(*)(void)> + { + typedef void type; + }; +}}} // namespace boost::parameter::aux + +// A macro that takes a parenthesized C++ type name (T) and transforms it +// into an un-parenthesized type expression equivalent to T. +#define BOOST_PARAMETER_PARENTHESIZED_TYPE(x) \ + ::boost::parameter::aux::unaryfunptr_arg_type< void(*)x >::type + +#endif // include guard + |