placeholder_of.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Boost.TypeErasure library
  2. //
  3. // Copyright 2011 Steven Watanabe
  4. //
  5. // Distributed under the Boost Software License Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // $Id$
  10. #ifndef BOOST_TYPE_ERASURE_PLACEHOLDER_OF_HPP_INCLUDED
  11. #define BOOST_TYPE_ERASURE_PLACEHOLDER_OF_HPP_INCLUDED
  12. namespace boost {
  13. namespace type_erasure {
  14. #ifndef BOOST_TYPE_ERASURE_DOXYGEN
  15. template<class Concept, class T>
  16. class any;
  17. template<class Concept, class T>
  18. class param;
  19. #endif
  20. /**
  21. * A metafunction returning the (const/reference qualified) placeholder
  22. * corresponding to an @ref any. It will also work for all bases
  23. * of @ref any, so it can be applied to the @c Base
  24. * parameter of @ref concept_interface.
  25. */
  26. template<class T>
  27. struct placeholder_of
  28. {
  29. #ifdef BOOST_TYPE_ERASURE_DOXYGEN
  30. typedef detail::unspecified type;
  31. #else
  32. typedef typename ::boost::type_erasure::placeholder_of<
  33. typename T::_boost_type_erasure_derived_type
  34. >::type type;
  35. #endif
  36. };
  37. /** INTERNAL ONLY */
  38. template<class Concept, class T>
  39. struct placeholder_of< ::boost::type_erasure::any<Concept, T> >
  40. {
  41. typedef T type;
  42. };
  43. /** INTERNAL ONLY */
  44. template<class Concept, class T>
  45. struct placeholder_of< ::boost::type_erasure::param<Concept, T> >
  46. {
  47. typedef T type;
  48. };
  49. #ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES
  50. template<class T>
  51. using placeholder_of_t = typename ::boost::type_erasure::placeholder_of<T>::type;
  52. #endif
  53. }
  54. }
  55. #endif