visitor_ptr.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. Distributed under the Boost Software License, Version 1.0. (See accompanying
  7. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  8. -->
  9. <header name="boost/variant/visitor_ptr.hpp">
  10. <namespace name="boost">
  11. <class name="visitor_ptr_t">
  12. <template>
  13. <template-type-parameter name="T"/>
  14. <template-type-parameter name="R"/>
  15. </template>
  16. <purpose>Adapts a function pointer for use as a static visitor.</purpose>
  17. <description>
  18. <simpara>Adapts the function given at construction for use as a
  19. <link linkend="variant.concepts.static-visitor">static visitor</link>
  20. of type <code>T</code> with result type <code>R</code>.</simpara>
  21. </description>
  22. <inherit access="public"><classname>static_visitor</classname>&lt;R&gt;</inherit>
  23. <constructor specifiers="explicit">
  24. <parameter>
  25. <paramtype>R (*)(T)</paramtype>
  26. </parameter>
  27. <effects>
  28. <simpara>Constructs the visitor with the given function.</simpara>
  29. </effects>
  30. </constructor>
  31. <method-group name="static visitor interfaces">
  32. <overloaded-method name="operator()">
  33. <signature>
  34. <type>R</type>
  35. <parameter name="operand">
  36. <paramtype><emphasis>unspecified-forwarding-type</emphasis></paramtype>
  37. </parameter>
  38. </signature>
  39. <signature>
  40. <template>
  41. <template-type-parameter name="U"/>
  42. </template>
  43. <type>void</type>
  44. <parameter>
  45. <paramtype>const U&amp;</paramtype>
  46. </parameter>
  47. </signature>
  48. <effects>
  49. <simpara>If passed a value or reference of type
  50. <code>T</code>, it invokes the function given at
  51. construction, appropriately forwarding
  52. <code>operand</code>.</simpara>
  53. </effects>
  54. <returns>Returns the result of the function invocation.</returns>
  55. <throws id="visitor_ptr_t.visit.throws">
  56. <simpara>The overload taking a value or reference of type
  57. <code>T</code> throws if the invoked function throws.
  58. The overload taking all other values <emphasis>always</emphasis>
  59. throws <code><classname>bad_visit</classname></code>.</simpara>
  60. </throws>
  61. </overloaded-method>
  62. </method-group>
  63. </class>
  64. <function name="visitor_ptr">
  65. <purpose>
  66. <simpara>Returns a visitor object that adapts function pointers for
  67. use as a static visitor.</simpara>
  68. </purpose>
  69. <description>
  70. <simpara>Constructs and returns a
  71. <code><classname>visitor_ptr_t</classname></code> adaptor over the
  72. given function.</simpara>
  73. </description>
  74. <template>
  75. <template-type-parameter name="R"/>
  76. <template-type-parameter name="T"/>
  77. </template>
  78. <type><classname>visitor_ptr_t</classname>&lt;T,R&gt;</type>
  79. <parameter>
  80. <paramtype>R (*)(T)</paramtype>
  81. </parameter>
  82. <returns>
  83. <simpara>Returns a <code><classname>visitor_ptr_t</classname></code>
  84. visitor object that, when applied, invokes the given
  85. function.</simpara>
  86. </returns>
  87. <throws>
  88. <simpara>Will not throw. (Note, however, that the returned
  89. <classname alt="boost::visitor_ptr_t">visitor object</classname> may
  90. throw when applied.)</simpara>
  91. </throws>
  92. </function>
  93. </namespace>
  94. </header>