]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <!DOCTYPE header PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" | |
3 | "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd"> | |
4 | <!-- | |
5 | Copyright Douglas Gregor 2001-2004 | |
6 | ||
7 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
8 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
9 | --> | |
10 | <header name="boost/visit_each.hpp" last-revision="$Date: 2007-03-06 16:51:55 -0500 (Tue, 06 Mar 2007) $"> | |
11 | <namespace name="boost"> | |
12 | <function name="visit_each"> | |
13 | <template> | |
14 | <template-type-parameter name="Visitor"/> | |
15 | <template-type-parameter name="T"/> | |
16 | </template> | |
17 | <type>void</type> | |
18 | <parameter name="visitor"> | |
19 | <paramtype>const Visitor&</paramtype> | |
20 | </parameter> | |
21 | <parameter name="t"> | |
22 | <paramtype>const T&</paramtype> | |
23 | </parameter> | |
24 | <parameter> | |
25 | <paramtype>int</paramtype> | |
26 | </parameter> | |
27 | ||
28 | <purpose>Allow limited exploration of class members.</purpose> | |
29 | ||
30 | <description> | |
31 | <para>The <functionname>visit_each</functionname> mechanism | |
32 | allows a visitor to be applied to every subobject in a given | |
33 | object. It was used by the Signals library to discover (now deprecated) | |
34 | <classname>signals::trackable</classname> objects within a | |
35 | function object, but other uses may surface if used | |
36 | universally (e.g., conservative garbage collection). To fit | |
37 | within the <functionname>visit_each</functionname> framework, | |
38 | a <functionname>visit_each</functionname> overload must be | |
39 | supplied for each object type. </para> | |
40 | </description> | |
41 | ||
42 | <effects><para><code>visitor(t)</code>, and for | |
43 | every subobject <code>x</code> of | |
44 | <code>t</code>: | |
45 | <itemizedlist> | |
46 | <listitem><para>If <code>x</code> is a reference, <code>visit_each(visitor, <functionname>ref</functionname>(x), 0)</code></para></listitem> | |
47 | <listitem><para>Otherwise, <code>visit_each(visitor, x, 0)</code></para></listitem> | |
48 | </itemizedlist> | |
49 | </para></effects> | |
50 | ||
51 | <notes><para>The third parameter is | |
52 | <code>long</code> for the fallback version | |
53 | of <functionname>visit_each</functionname> and the argument | |
54 | supplied to this third paramter must always be 0. The third | |
55 | parameter is an artifact of the widespread lack of proper | |
56 | function template ordering, and will be removed in the future.</para> | |
57 | ||
58 | <para>Library authors will be expected to add additional | |
59 | overloads that specialize the T argument for their classes, so | |
60 | that subobjects can be visited.</para> | |
61 | ||
62 | <para>Calls to visit_each are required to be unqualified, to | |
63 | enable argument-dependent lookup.</para></notes> | |
64 | </function> | |
65 | </namespace> | |
66 | </header> |