concept_interface.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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_INTERFACE_HPP_INCLUDED
  11. #define BOOST_TYPE_ERASURE_CONCEPT_INTERFACE_HPP_INCLUDED
  12. namespace boost {
  13. namespace type_erasure {
  14. /**
  15. * The @ref concept_interface class can be specialized to
  16. * add behavior to an @ref any. An @ref any inherits from
  17. * all the relevant specializations of @ref concept_interface.
  18. *
  19. * @ref concept_interface can be specialized for either
  20. * primitive or composite concepts. If a concept @c C1
  21. * contains another concept @c C2, then the library guarantees
  22. * that the specialization of @ref concept_interface for
  23. * @c C2 is a base class of the specialization for @c C1.
  24. * This means that @c C1 can safely override members of @c C2.
  25. *
  26. * @ref concept_interface may only be specialized for user-defined
  27. * concepts. The library owns the specializations of its own
  28. * built in concepts.
  29. *
  30. * \tparam Concept The concept that we're specializing
  31. * @ref concept_interface for. One of its
  32. * placeholders should be @c ID.
  33. * \tparam Base The base of this class. Specializations of @ref
  34. * concept_interface must inherit publicly from this type.
  35. * \tparam ID The placeholder representing this type.
  36. * \tparam Enable A dummy parameter that can be used for SFINAE.
  37. *
  38. * The metafunctions @ref derived, @ref rebind_any, and @ref as_param
  39. * (which can be applied to @c Base) are useful for determining the
  40. * argument and return types of functions defined in @ref concept_interface.
  41. *
  42. * For dispatching the function use \call.
  43. */
  44. template<class Concept, class Base, class ID, class Enable = void>
  45. struct concept_interface : Base {};
  46. }
  47. }
  48. #endif