]>
Commit | Line | Data |
---|---|---|
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 2003, Eric Friedman, Itay Maman. | |
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/variant/visitor_ptr.hpp"> | |
11 | <namespace name="boost"> | |
12 | ||
13 | <class name="visitor_ptr_t"> | |
14 | <template> | |
15 | <template-type-parameter name="T"/> | |
16 | <template-type-parameter name="R"/> | |
17 | </template> | |
18 | ||
19 | <purpose>Adapts a function pointer for use as a static visitor.</purpose> | |
20 | <description> | |
21 | <simpara>Adapts the function given at construction for use as a | |
22 | <link linkend="variant.concepts.static-visitor">static visitor</link> | |
23 | of type <code>T</code> with result type <code>R</code>.</simpara> | |
24 | </description> | |
25 | ||
26 | <inherit access="public"><classname>static_visitor</classname><R></inherit> | |
27 | ||
28 | <constructor specifiers="explicit"> | |
29 | <parameter> | |
30 | <paramtype>R (*)(T)</paramtype> | |
31 | </parameter> | |
32 | ||
33 | <effects> | |
34 | <simpara>Constructs the visitor with the given function.</simpara> | |
35 | </effects> | |
36 | </constructor> | |
37 | ||
38 | <method-group name="static visitor interfaces"> | |
39 | <overloaded-method name="operator()"> | |
40 | <signature> | |
41 | <type>R</type> | |
42 | ||
43 | <parameter name="operand"> | |
44 | <paramtype><emphasis>unspecified-forwarding-type</emphasis></paramtype> | |
45 | </parameter> | |
46 | </signature> | |
47 | ||
48 | <signature> | |
49 | <template> | |
50 | <template-type-parameter name="U"/> | |
51 | </template> | |
52 | ||
53 | <type>void</type> | |
54 | ||
55 | <parameter> | |
56 | <paramtype>const U&</paramtype> | |
57 | </parameter> | |
58 | </signature> | |
59 | ||
60 | <effects> | |
61 | <simpara>If passed a value or reference of type | |
62 | <code>T</code>, it invokes the function given at | |
63 | construction, appropriately forwarding | |
64 | <code>operand</code>.</simpara> | |
65 | </effects> | |
66 | <returns>Returns the result of the function invocation.</returns> | |
67 | ||
68 | <throws id="visitor_ptr_t.visit.throws"> | |
69 | <simpara>The overload taking a value or reference of type | |
70 | <code>T</code> throws if the invoked function throws. | |
71 | The overload taking all other values <emphasis>always</emphasis> | |
72 | throws <code><classname>bad_visit</classname></code>.</simpara> | |
73 | </throws> | |
74 | </overloaded-method> | |
75 | </method-group> | |
76 | </class> | |
77 | ||
78 | <function name="visitor_ptr"> | |
79 | <purpose> | |
80 | <simpara>Returns a visitor object that adapts function pointers for | |
81 | use as a static visitor.</simpara> | |
82 | </purpose> | |
83 | <description> | |
84 | <simpara>Constructs and returns a | |
85 | <code><classname>visitor_ptr_t</classname></code> adaptor over the | |
86 | given function.</simpara> | |
87 | </description> | |
88 | ||
89 | <template> | |
90 | <template-type-parameter name="R"/> | |
91 | <template-type-parameter name="T"/> | |
92 | </template> | |
93 | ||
94 | <type><classname>visitor_ptr_t</classname><T,R></type> | |
95 | ||
96 | <parameter> | |
97 | <paramtype>R (*)(T)</paramtype> | |
98 | </parameter> | |
99 | ||
100 | <returns> | |
101 | <simpara>Returns a <code><classname>visitor_ptr_t</classname></code> | |
102 | visitor object that, when applied, invokes the given | |
103 | function.</simpara> | |
104 | </returns> | |
105 | ||
106 | <throws> | |
107 | <simpara>Will not throw. (Note, however, that the returned | |
108 | <classname alt="boost::visitor_ptr_t">visitor object</classname> may | |
109 | throw when applied.)</simpara> | |
110 | </throws> | |
111 | </function> | |
112 | ||
113 | </namespace> | |
114 | </header> |