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