parenthesized_type.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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. #ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP
  6. #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP
  7. namespace boost { namespace parameter { namespace aux {
  8. // A metafunction that transforms void(*)(T) -> T
  9. template <typename UnaryFunctionPointer>
  10. struct unaryfunptr_arg_type;
  11. template <typename Arg>
  12. struct unaryfunptr_arg_type<void(*)(Arg)>
  13. {
  14. typedef Arg type;
  15. };
  16. template <>
  17. struct unaryfunptr_arg_type<void(*)(void)>
  18. {
  19. typedef void type;
  20. };
  21. }}} // namespace boost::parameter::aux
  22. // A macro that takes a parenthesized C++ type name (T) and transforms it
  23. // into an un-parenthesized type expression equivalent to T.
  24. #define BOOST_PARAMETER_PARENTHESIZED_TYPE(x) \
  25. ::boost::parameter::aux::unaryfunptr_arg_type< void(*)x >::type
  26. #endif // include guard