visit_each.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. 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/visit_each.hpp" last-revision="$Date: 2007-03-06 16:51:55 -0500 (Tue, 06 Mar 2007) $">
  10. <namespace name="boost">
  11. <function name="visit_each">
  12. <template>
  13. <template-type-parameter name="Visitor"/>
  14. <template-type-parameter name="T"/>
  15. </template>
  16. <type>void</type>
  17. <parameter name="visitor">
  18. <paramtype>const Visitor&amp;</paramtype>
  19. </parameter>
  20. <parameter name="t">
  21. <paramtype>const T&amp;</paramtype>
  22. </parameter>
  23. <parameter>
  24. <paramtype>int</paramtype>
  25. </parameter>
  26. <purpose>Allow limited exploration of class members.</purpose>
  27. <description>
  28. <para>The <functionname>visit_each</functionname> mechanism
  29. allows a visitor to be applied to every subobject in a given
  30. object. It was used by the Signals library to discover (now deprecated)
  31. <classname>signals::trackable</classname> objects within a
  32. function object, but other uses may surface if used
  33. universally (e.g., conservative garbage collection). To fit
  34. within the <functionname>visit_each</functionname> framework,
  35. a <functionname>visit_each</functionname> overload must be
  36. supplied for each object type. </para>
  37. </description>
  38. <effects><para><code>visitor(t)</code>, and for
  39. every subobject <code>x</code> of
  40. <code>t</code>:
  41. <itemizedlist>
  42. <listitem><para>If <code>x</code> is a reference, <code>visit_each(visitor, <functionname>ref</functionname>(x), 0)</code></para></listitem>
  43. <listitem><para>Otherwise, <code>visit_each(visitor, x, 0)</code></para></listitem>
  44. </itemizedlist>
  45. </para></effects>
  46. <notes><para>The third parameter is
  47. <code>long</code> for the fallback version
  48. of <functionname>visit_each</functionname> and the argument
  49. supplied to this third paramter must always be 0. The third
  50. parameter is an artifact of the widespread lack of proper
  51. function template ordering, and will be removed in the future.</para>
  52. <para>Library authors will be expected to add additional
  53. overloads that specialize the T argument for their classes, so
  54. that subobjects can be visited.</para>
  55. <para>Calls to visit_each are required to be unqualified, to
  56. enable argument-dependent lookup.</para></notes>
  57. </function>
  58. </namespace>
  59. </header>