1 .. Metafunctions/Miscellaneous//inherit_linearly |40
14 , typename Root = empty_base
16 struct inherit_linearly
17 : fold<Types,Root,Node>
25 A convenience wrapper for ``fold`` to use in the context of sequence-driven
26 class composition. Returns the result the successive application of binary
27 ``Node`` to the result of the previous ``Node`` invocation (``Root`` if it's
28 the first call) and every type in the |Forward Sequence| ``Types`` in order.
36 #include <boost/mpl/inherit_linearly.hpp>
48 +---------------+-------------------------------+---------------------------------------------------+
49 | Parameter | Requirement | Description |
50 +===============+===============================+===================================================+
51 | ``Types`` | |Forward Sequence| | Types to inherit from. |
52 +---------------+-------------------------------+---------------------------------------------------+
53 | ``Node`` | Binary |Lambda Expression| | A derivation metafunction. |
54 +---------------+-------------------------------+---------------------------------------------------+
55 | ``Root`` | A class type | A type to be placed at the root of the class |
57 +---------------+-------------------------------+---------------------------------------------------+
63 For any |Forward Sequence| ``types``, binary |Lambda Expression| ``node``, and arbitrary
69 typedef inherit_linearly<types,node,root>::type r;
79 typedef fold<types,root,node>::type r;
86 Linear. Exactly ``size<types>::value`` applications of ``node``.
94 template< typename T > struct tuple_field
99 template< typename T >
101 T& field(tuple_field<T>& t)
106 typedef inherit_linearly<
107 vector<int,char const*,bool>
108 , inherit< _1, tuple_field<_2> >
117 field<char const*>(t) = "text";
118 field<bool>(t) = false;
121 << field<int>(t) << '\n'
122 << field<char const*>(t) << '\n'
123 << field<bool>(t) << '\n'
131 |Metafunctions|, |Algorithms|, |inherit|, |empty_base|, |fold|, |reverse_fold|
134 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
135 Distributed under the Boost Software License, Version 1.0. (See accompanying
136 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)