File: visitor_ptr.xml

package info (click to toggle)
boost1.88 1.88.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 576,932 kB
  • sloc: cpp: 4,149,234; xml: 136,789; ansic: 35,092; python: 33,910; asm: 5,698; sh: 4,604; ada: 1,681; makefile: 1,633; pascal: 1,139; perl: 1,124; sql: 640; yacc: 478; ruby: 271; java: 77; lisp: 24; csh: 6
file content (114 lines) | stat: -rw-r--r-- 3,792 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE header PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
  "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<!--
    Copyright 2003, Eric Friedman, Itay Maman.

    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-->
<header name="boost/variant/visitor_ptr.hpp">
  <namespace name="boost">

    <class name="visitor_ptr_t">
      <template>
        <template-type-parameter name="T"/>
        <template-type-parameter name="R"/>
      </template>

      <purpose>Adapts a function pointer for use as a static visitor.</purpose>
      <description>
        <simpara>Adapts the function given at construction for use as a
        <link linkend="variant.concepts.static-visitor">static visitor</link>
        of type <code>T</code> with result type <code>R</code>.</simpara>
      </description>

      <inherit access="public"><classname>static_visitor</classname>&lt;R&gt;</inherit>

      <constructor specifiers="explicit">
        <parameter>
          <paramtype>R (*)(T)</paramtype>
        </parameter>

        <effects>
          <simpara>Constructs the visitor with the given function.</simpara>
        </effects>
      </constructor>

      <method-group name="static visitor interfaces">
        <overloaded-method name="operator()">
          <signature>
            <type>R</type>

            <parameter name="operand">
              <paramtype><emphasis>unspecified-forwarding-type</emphasis></paramtype>
            </parameter>
          </signature>

          <signature>
            <template>
              <template-type-parameter name="U"/>
            </template>
            
            <type>void</type>

            <parameter>
              <paramtype>const U&amp;</paramtype>
            </parameter>
          </signature>

          <effects>
            <simpara>If passed a value or reference of type
              <code>T</code>, it invokes the function given at
              construction, appropriately forwarding
              <code>operand</code>.</simpara>
          </effects>
          <returns>Returns the result of the function invocation.</returns>

          <throws id="visitor_ptr_t.visit.throws">
            <simpara>The overload taking a value or reference of type
              <code>T</code> throws if the invoked function throws.
              The overload taking all other values <emphasis>always</emphasis>
              throws <code><classname>bad_visit</classname></code>.</simpara>
          </throws>
        </overloaded-method>
      </method-group>
    </class>

    <function name="visitor_ptr">
      <purpose>
        <simpara>Returns a visitor object that adapts function pointers for
        use as a static visitor.</simpara>
      </purpose>
      <description>
        <simpara>Constructs and returns a
        <code><classname>visitor_ptr_t</classname></code> adaptor over the
        given function.</simpara>
      </description>

      <template>
        <template-type-parameter name="R"/>
        <template-type-parameter name="T"/>
      </template>

      <type><classname>visitor_ptr_t</classname>&lt;T,R&gt;</type>

      <parameter>
        <paramtype>R (*)(T)</paramtype>
      </parameter>

      <returns>
        <simpara>Returns a <code><classname>visitor_ptr_t</classname></code>
          visitor object that, when applied, invokes the given
          function.</simpara>
      </returns>

      <throws>
        <simpara>Will not throw. (Note, however, that the returned
        <classname alt="boost::visitor_ptr_t">visitor object</classname> may
        throw when applied.)</simpara>
      </throws>
    </function>

  </namespace>
</header>