fix doc example typo
[boost.git] / libs / utility / CopyConstructible.html
blob6a7ce6557fce34d9e476f99745495ba32fb890c9
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3 <html>
4 <head>
5 <meta http-equiv="Content-Language" content="en-us">
6 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
8 <title>Copy Constructible</title>
9 </head>
11 <body bgcolor="#FFFFFF" link="#0000EE" text="#000000" vlink="#551A8B" alink=
12 "#FF0000">
13 <img src="../../boost.png" alt="C++ Boost" width="277" height=
14 "86"><br clear="none">
16 <h1>Copy Constructible</h1>
18 <h3>Description</h3>
20 <p>A type is Copy Constructible if it is possible to copy objects of that
21 type.</p>
23 <h3>Notation</h3>
25 <table summary="">
26 <tr>
27 <td valign="top"><tt>T</tt></td>
29 <td valign="top">is type that is a model of Copy Constructible</td>
30 </tr>
32 <tr>
33 <td valign="top"><tt>t</tt></td>
35 <td valign="top">is an object of type <tt>T</tt></td>
36 </tr>
38 <tr>
39 <td valign="top"><tt>u</tt></td>
41 <td valign="top">is an object of type <tt>const T</tt></td>
42 </tr>
43 </table>
45 <h3>Definitions</h3>
47 <h3>Valid expressions</h3>
49 <table border summary="">
50 <tr>
51 <th>Name</th>
53 <th>Expression</th>
55 <th>Return type</th>
57 <th>Semantics</th>
58 </tr>
60 <tr>
61 <td valign="top">Copy constructor</td>
63 <td valign="top"><tt>T(t)</tt></td>
65 <td valign="top"><tt>T</tt></td>
67 <td valign="top"><tt>t</tt> is equivalent to <tt>T(t)</tt></td>
68 </tr>
70 <tr>
71 <td valign="top">Copy constructor</td>
73 <td valign="top">
74 <pre>
75 T(u)
76 </pre>
77 </td>
79 <td valign="top"><tt>T</tt></td>
81 <td valign="top"><tt>u</tt> is equivalent to <tt>T(u)</tt></td>
82 </tr>
84 <tr>
85 <td valign="top">Destructor</td>
87 <td valign="top">
88 <pre>
89 t.~T()
90 </pre>
91 </td>
93 <td valign="top"><tt>T</tt></td>
95 <td valign="top">&nbsp;</td>
96 </tr>
98 <tr>
99 <td valign="top">Address Operator</td>
101 <td valign="top">
102 <pre>
103 &amp;t
104 </pre>
105 </td>
107 <td valign="top"><tt>T*</tt></td>
109 <td valign="top">denotes the address of <tt>t</tt></td>
110 </tr>
112 <tr>
113 <td valign="top">Address Operator</td>
115 <td valign="top">
116 <pre>
117 &amp;u
118 </pre>
119 </td>
121 <td valign="top"><tt>T*</tt></td>
123 <td valign="top">denotes the address of <tt>u</tt></td>
124 </tr>
125 </table>
127 <h3>Models</h3>
129 <ul>
130 <li><tt>int</tt></li>
132 <li><tt>std::pair</tt></li>
133 </ul>
135 <h3>Concept Checking Class</h3>
136 <pre>
137 template &lt;class T&gt;
138 struct CopyConstructibleConcept
140 void constraints() {
141 T a(b); // require copy constructor
142 T* ptr = &amp;a; // require address of operator
143 const_constraints(a);
144 ignore_unused_variable_warning(ptr);
146 void const_constraints(const T&amp; a) {
147 T c(a); // require const copy constructor
148 const T* ptr = &amp;a; // require const address of operator
149 ignore_unused_variable_warning(c);
150 ignore_unused_variable_warning(ptr);
152 T b;
154 </pre>
156 <h3>See also</h3>
158 <p><a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">Default
159 Constructible</a> and <a href="./Assignable.html">Assignable</a><br></p>
160 <hr>
162 <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
163 "../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
164 height="31" width="88"></a></p>
166 <p>Revised
167 <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05
168 December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p>
170 <table summary="">
171 <tr valign="top">
172 <td nowrap><i>Copyright &copy; 2000</i></td>
174 <td><i><a href="http://www.lsc.nd.edu/~jsiek">Jeremy Siek</a>, Univ.of
175 Notre Dame (<a href=
176 "mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</a>)</i></td>
177 </tr>
178 </table>
180 <p><i>Distributed under the Boost Software License, Version 1.0. (See
181 accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
182 copy at <a href=
183 "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
184 </body>
185 </html>