1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  Copyright 2012 Eric Niebler
4
5  Distributed under the Boost
6  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/proto/literal.hpp">
10  <para>
11    The
12    <computeroutput><classname alt="boost::proto::literal">proto::literal&lt;&gt;</classname></computeroutput>
13    terminal wrapper, and the
14    <computeroutput><functionname alt="boost::proto::lit">proto::lit()</functionname></computeroutput>
15    function for creating
16    <computeroutput><classname alt="boost::proto::literal">proto::literal&lt;&gt;</classname></computeroutput>
17    wrappers.
18  </para>
19  <namespace name="boost">
20    <namespace name="proto">
21      <struct name="literal">
22        <template>
23          <template-type-parameter name="T"/>
24          <template-type-parameter name="Domain">
25            <default><classname>proto::default_domain</classname></default>
26          </template-type-parameter>
27        </template>
28        <inherit>
29          <type>
30  <classname>proto::extends</classname>&lt;<classname>proto::basic_expr</classname>&lt;<classname>proto::tag::terminal</classname>, <classname>proto::term</classname>&lt; T &gt; &gt;, proto::literal&lt;T, Domain&gt;, Domain&gt;</type>
31        </inherit>
32        <purpose>A simple wrapper for a terminal, provided for ease of use.</purpose>
33        <description>
34          <para>
35            A simple wrapper for a terminal, provided for ease of use. In all cases,
36            <computeroutput>proto::literal&lt;X&gt; l(x);</computeroutput> is equivalent to
37            <computeroutput><classname>proto::terminal</classname>&lt;X&gt;::type l = {x};</computeroutput>.
38          </para>
39          <para>
40            The <computeroutput>Domain</computeroutput> template parameter defaults to
41            <computeroutput><classname>proto::default_domain</classname></computeroutput>.
42          </para>
43        </description>
44        <typedef name="X">
45          <purpose>For exposition only</purpose>
46          <type><classname>proto::basic_expr</classname>&lt;<classname>proto::tag::terminal</classname>, <classname>proto::term</classname>&lt; T &gt; &gt;</type>
47        </typedef>
48        <typedef name="value_type">
49          <type>typename <classname>proto::result_of::value</classname>&lt;X&gt;::type</type>
50        </typedef>
51        <typedef name="reference">
52          <type>typename <classname>proto::result_of::value</classname>&lt;X &amp;&gt;::type</type>
53        </typedef>
54        <typedef name="const_reference">
55          <type>typename <classname>proto::result_of::value</classname>&lt;X const &amp;&gt;::type</type>
56        </typedef>
57        <method-group name="public member functions">
58          <method name="get">
59            <type>reference</type>
60            <returns>
61              <computeroutput><functionname>proto::value</functionname>(*this)</computeroutput>
62            </returns>
63          </method>
64          <method name="get" cv="const">
65            <type>const_reference</type>
66            <returns>
67              <computeroutput><functionname>proto::value</functionname>(*this)</computeroutput>
68            </returns>
69          </method>
70        </method-group>
71        <constructor/>
72        <constructor>
73          <template>
74            <template-type-parameter name="U"/>
75          </template>
76          <parameter name="u">
77            <paramtype>U &amp;</paramtype>
78          </parameter>
79        </constructor>
80        <constructor>
81          <template>
82            <template-type-parameter name="U"/>
83          </template>
84          <parameter name="u">
85            <paramtype>U const &amp;</paramtype>
86          </parameter>
87        </constructor>
88        <constructor>
89          <template>
90            <template-type-parameter name="U"/>
91          </template>
92          <parameter name="u">
93            <paramtype><classname>proto::literal</classname>&lt; U, Domain &gt; const &amp;</paramtype>
94          </parameter>
95        </constructor>
96      </struct>
97
98      <!-- proto::lit() -->
99      <overloaded-function name="lit">
100        <signature>
101          <type><classname>proto::literal</classname>&lt; T &amp; &gt; const</type>
102          <template>
103            <template-type-parameter name="T"/>
104          </template>
105          <parameter name="t">
106            <paramtype>T &amp;</paramtype>
107            <description>
108              <para>The object to wrap.</para>
109            </description>
110          </parameter>
111        </signature>
112        <signature>
113          <type><classname>proto::literal</classname>&lt; T const &amp; &gt; const</type>
114          <template>
115            <template-type-parameter name="T"/>
116          </template>
117          <parameter name="t">
118            <paramtype>T const &amp;</paramtype>
119          </parameter>
120        </signature>
121        <purpose>A helper function for creating a <computeroutput>
122          <classname alt="proto::literal">proto::literal&lt;&gt;</classname></computeroutput> wrapper.
123        </purpose>
124        <returns>
125          <para>
126            <computeroutput><classname>proto::literal</classname>&lt;T &amp;&gt;(t)</computeroutput>
127          </para>
128        </returns>
129        <throws>
130          <simpara>Will not throw.</simpara>
131        </throws>
132        <notes>
133          <para>The returned value holds the argument by reference. </para>
134        </notes>
135      </overloaded-function>
136    </namespace>
137  </namespace>
138</header>
139