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_PLACEHOLDERS_HPP_INCLUDED
12 #define BOOST_TYPE_ERASURE_PLACEHOLDERS_HPP_INCLUDED
15 namespace type_erasure {
18 * Placeholders are used heavily throughout the library.
19 * Every placeholder must derive from @ref placeholder.
20 * The library provides a number of placeholders,
21 * out of the box, but you are welcome to define your own,
22 * if you want more descriptive names. The placeholder
23 * @ref _self is special in that it is used as the default
26 * What exactly is a placeholder? Placeholders act as
27 * a substitute for template parameters in concepts.
28 * The library automatically replaces all the placeholders
29 * used in a concept with the actual types involved when
30 * it stores an object in an @ref any.
32 * For example, in the following,
35 * any<copy_constructible<_a>, _a> x(1);
38 * The library sees that we're constructing an @ref any
39 * that uses the @ref _a placeholder with an @c int.
40 * Thus it binds @ref _a to int and instantiates
41 * @ref copy_constructible "copy_constructible<int>".
43 * When there are multiple placeholders involved, you
44 * will have to use @ref tuple, or pass the bindings
45 * explicitly, but the substitution still works the
48 struct placeholder {};
50 struct _a : placeholder {};
51 struct _b : placeholder {};
52 struct _c : placeholder {};
53 struct _d : placeholder {};
54 struct _e : placeholder {};
55 struct _f : placeholder {};
56 struct _g : placeholder {};
59 * \brief The default placeholder
61 * @ref _self is the default @ref placeholder used
62 * by @ref any. It should be used as a default
63 * by most concepts, so using concepts with no
64 * explicit arguments will "just work" as much as
67 struct _self : placeholder {};