|
|
|||
File indexing completed on 2025-12-16 10:10:14
0001 // Boost.TypeErasure library 0002 // 0003 // Copyright 2011 Steven Watanabe 0004 // 0005 // Distributed under the Boost Software License Version 1.0. (See 0006 // accompanying file LICENSE_1_0.txt or copy at 0007 // http://www.boost.org/LICENSE_1_0.txt) 0008 // 0009 // $Id$ 0010 0011 #ifndef BOOST_TYPE_ERASURE_PLACEHOLDERS_HPP_INCLUDED 0012 #define BOOST_TYPE_ERASURE_PLACEHOLDERS_HPP_INCLUDED 0013 0014 namespace boost { 0015 namespace type_erasure { 0016 0017 /** 0018 * Placeholders are used heavily throughout the library. 0019 * Every placeholder must derive from @ref placeholder. 0020 * The library provides a number of placeholders, 0021 * out of the box, but you are welcome to define your own, 0022 * if you want more descriptive names. The placeholder 0023 * @ref _self is special in that it is used as the default 0024 * wherever possible. 0025 * 0026 * What exactly is a placeholder? Placeholders act as 0027 * a substitute for template parameters in concepts. 0028 * The library automatically replaces all the placeholders 0029 * used in a concept with the actual types involved when 0030 * it stores an object in an @ref any. 0031 * 0032 * For example, in the following, 0033 * 0034 * @code 0035 * any<copy_constructible<_a>, _a> x(1); 0036 * @endcode 0037 * 0038 * The library sees that we're constructing an @ref any 0039 * that uses the @ref _a placeholder with an @c int. 0040 * Thus it binds @ref _a to int and instantiates 0041 * @ref copy_constructible "copy_constructible<int>". 0042 * 0043 * When there are multiple placeholders involved, you 0044 * will have to use @ref tuple, or pass the bindings 0045 * explicitly, but the substitution still works the 0046 * same way. 0047 */ 0048 struct placeholder { 0049 /// INTERNAL ONLY 0050 typedef void _boost_type_erasure_is_placeholder; 0051 }; 0052 0053 struct _a : placeholder {}; 0054 struct _b : placeholder {}; 0055 struct _c : placeholder {}; 0056 struct _d : placeholder {}; 0057 struct _e : placeholder {}; 0058 struct _f : placeholder {}; 0059 struct _g : placeholder {}; 0060 0061 /** 0062 * \brief The default placeholder 0063 * 0064 * @ref _self is the default @ref placeholder used 0065 * by @ref any. It should be used as a default 0066 * by most concepts, so using concepts with no 0067 * explicit arguments will "just work" as much as 0068 * possible. 0069 */ 0070 struct _self : placeholder {}; 0071 0072 } 0073 } 0074 0075 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|