concept_of.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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_CONCEPT_OF_HPP_INCLUDED
  11. #define BOOST_TYPE_ERASURE_CONCEPT_OF_HPP_INCLUDED
  12. #include <boost/config.hpp>
  13. namespace boost {
  14. namespace type_erasure {
  15. #ifndef BOOST_TYPE_ERASURE_DOXYGEN
  16. template<class Concept, class T>
  17. class any;
  18. template<class Concept, class T>
  19. class param;
  20. #endif
  21. /**
  22. * A metafunction returning the concept corresponding
  23. * to an @ref any. It will also work for all bases
  24. * of @ref any, so it can be applied to the @c Base
  25. * parameter of @ref concept_interface.
  26. */
  27. template<class T>
  28. struct concept_of
  29. {
  30. #ifdef BOOST_TYPE_ERASURE_DOXYGEN
  31. typedef detail::unspecified type;
  32. #else
  33. typedef typename ::boost::type_erasure::concept_of<
  34. typename T::_boost_type_erasure_derived_type
  35. >::type type;
  36. #endif
  37. };
  38. /** INTERNAL ONLY */
  39. template<class Concept, class T>
  40. struct concept_of< ::boost::type_erasure::any<Concept, T> >
  41. {
  42. typedef Concept type;
  43. };
  44. /** INTERNAL ONLY */
  45. template<class Concept, class T>
  46. struct concept_of< ::boost::type_erasure::param<Concept, T> >
  47. {
  48. typedef Concept type;
  49. };
  50. #ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES
  51. template<class T>
  52. using concept_of_t = typename ::boost::type_erasure::concept_of<T>::type;
  53. #endif
  54. }
  55. }
  56. #endif