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