1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Transform an Attribute to a Different Type (Qi and Karma)</title> 5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../../index.html" title="Spirit 2.5.8"> 8<link rel="up" href="../customize.html" title="Customization of Spirit's Attribute Handling"> 9<link rel="prev" href="handles_container.html" title="Determine Whether a Component Handles Container Attributes (Qi and Karma)"> 10<link rel="next" href="assign_to.html" title="Store a Parsed Attribute Value (Qi)"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="handles_container.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../customize.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="assign_to.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h4 class="title"> 27<a name="spirit.advanced.customize.transform"></a><a class="link" href="transform.html" title="Transform an Attribute to a Different Type (Qi and Karma)">Transform an Attribute 28 to a Different Type (Qi and Karma)</a> 29</h4></div></div></div> 30<h6> 31<a name="spirit.advanced.customize.transform.h0"></a> 32 <span class="phrase"><a name="spirit.advanced.customize.transform.transform_attribute"></a></span><a class="link" href="transform.html#spirit.advanced.customize.transform.transform_attribute">transform_attribute</a> 33 </h6> 34<p> 35 The template <code class="computeroutput"><span class="identifier">transform_attribute</span></code> 36 is a type used as an attribute customization point. It is invoked by <span class="emphasis"><em>Qi</em></span> 37 <code class="computeroutput"><span class="identifier">rule</span></code>, semantic action and 38 <code class="computeroutput"><span class="identifier">attr_cast</span></code>, and <span class="emphasis"><em>Karma</em></span> 39 <code class="computeroutput"><span class="identifier">rule</span></code>, semantic action and 40 <a class="link" href="../../karma/reference/auxiliary/attr_cast.html" title="Attribute Transformation Pseudo Generator (attr_cast)"><code class="computeroutput"><span class="identifier">attr_cast</span></code></a>. It is used to automatically 41 transform the user provided attribute to the attribute type expected by 42 the right hand side component (for <code class="computeroutput"><span class="identifier">rule</span></code>), 43 the semantic action, or the embedded component (for <code class="computeroutput"><span class="identifier">attr_cast</span></code>). 44 </p> 45<div class="note"><table border="0" summary="Note"> 46<tr> 47<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../images/note.png"></td> 48<th align="left">Note</th> 49</tr> 50<tr><td align="left" valign="top"><p> 51 The interface of this customization point has been changed with Boost 52 V1.44. We added the <code class="computeroutput"><span class="identifier">Domain</span></code> 53 template parameter to allow for more fine grained specializations for 54 <span class="emphasis"><em>Spirit.Qi</em></span> and <span class="emphasis"><em>Spirit.Karma</em></span>. 55 </p></td></tr> 56</table></div> 57<h6> 58<a name="spirit.advanced.customize.transform.h1"></a> 59 <span class="phrase"><a name="spirit.advanced.customize.transform.module_headers"></a></span><a class="link" href="transform.html#spirit.advanced.customize.transform.module_headers">Module Headers</a> 60 </h6> 61<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">home</span><span class="special">/</span><span class="identifier">support</span><span class="special">/</span><span class="identifier">attributes</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 62</pre> 63<p> 64 Also, see <a class="link" href="../../structure/include.html" title="Include">Include Structure</a>. 65 </p> 66<div class="note"><table border="0" summary="Note"> 67<tr> 68<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../images/note.png"></td> 69<th align="left">Note</th> 70</tr> 71<tr><td align="left" valign="top"><p> 72 This header file does not need to be included directly by any user program 73 as it is normally included by other Spirit header files relying on its 74 content. 75 </p></td></tr> 76</table></div> 77<h6> 78<a name="spirit.advanced.customize.transform.h2"></a> 79 <span class="phrase"><a name="spirit.advanced.customize.transform.namespace"></a></span><a class="link" href="transform.html#spirit.advanced.customize.transform.namespace">Namespace</a> 80 </h6> 81<div class="informaltable"><table class="table"> 82<colgroup><col></colgroup> 83<thead><tr><th> 84 <p> 85 Name 86 </p> 87 </th></tr></thead> 88<tbody><tr><td> 89 <p> 90 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">traits</span></code> 91 </p> 92 </td></tr></tbody> 93</table></div> 94<h6> 95<a name="spirit.advanced.customize.transform.h3"></a> 96 <span class="phrase"><a name="spirit.advanced.customize.transform.synopsis"></a></span><a class="link" href="transform.html#spirit.advanced.customize.transform.synopsis">Synopsis</a> 97 </h6> 98<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Exposed</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Transformed</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Domain</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Enable</span><span class="special">></span> 99<span class="keyword">struct</span> <span class="identifier">transform_attribute</span> 100<span class="special">{</span> 101 <span class="keyword">typedef</span> <span class="special"><</span><span class="identifier">unspecified</span><span class="special">></span> <span class="identifier">type</span><span class="special">;</span> 102 103 <span class="keyword">static</span> <span class="identifier">type</span> <span class="identifier">pre</span><span class="special">(</span><span class="identifier">Exposed</span><span class="special">&</span> <span class="identifier">val</span><span class="special">);</span> 104 <span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">post</span><span class="special">(</span><span class="identifier">Exposed</span><span class="special">&</span> <span class="identifier">val</span><span class="special">,</span> <span class="identifier">type</span> <span class="identifier">attr</span><span class="special">);</span> <span class="comment">// Qi only</span> 105 <span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">fail</span><span class="special">(</span><span class="identifier">Exposed</span><span class="special">&);</span> <span class="comment">// Qi only</span> 106<span class="special">};</span> 107</pre> 108<h6> 109<a name="spirit.advanced.customize.transform.h4"></a> 110 <span class="phrase"><a name="spirit.advanced.customize.transform.template_parameters"></a></span><a class="link" href="transform.html#spirit.advanced.customize.transform.template_parameters">Template 111 parameters</a> 112 </h6> 113<div class="informaltable"><table class="table"> 114<colgroup> 115<col> 116<col> 117<col> 118</colgroup> 119<thead><tr> 120<th> 121 <p> 122 Parameter 123 </p> 124 </th> 125<th> 126 <p> 127 Description 128 </p> 129 </th> 130<th> 131 <p> 132 Default 133 </p> 134 </th> 135</tr></thead> 136<tbody> 137<tr> 138<td> 139 <p> 140 <code class="computeroutput"><span class="identifier">Exposed</span></code> 141 </p> 142 </td> 143<td> 144 <p> 145 The attribute type supplied to the component which needs to be 146 transformed. 147 </p> 148 </td> 149<td> 150 <p> 151 none 152 </p> 153 </td> 154</tr> 155<tr> 156<td> 157 <p> 158 <code class="computeroutput"><span class="identifier">Transformed</span></code> 159 </p> 160 </td> 161<td> 162 <p> 163 The attribute type expected by the component to be provided as 164 the result of the transformation. 165 </p> 166 </td> 167<td> 168 <p> 169 none 170 </p> 171 </td> 172</tr> 173<tr> 174<td> 175 <p> 176 <code class="computeroutput"><span class="identifier">Domain</span></code> 177 </p> 178 </td> 179<td> 180 <p> 181 The domain of the sub library the template is instantiated in. 182 Typically this is either <code class="computeroutput"><span class="identifier">qi</span><span class="special">::</span><span class="identifier">domain</span></code> 183 or <code class="computeroutput"><span class="identifier">karma</span><span class="special">::</span><span class="identifier">domain</span></code>. 184 </p> 185 </td> 186<td> 187 <p> 188 none 189 </p> 190 </td> 191</tr> 192<tr> 193<td> 194 <p> 195 <code class="computeroutput"><span class="identifier">Enable</span></code> 196 </p> 197 </td> 198<td> 199 <p> 200 Helper template parameter usable to selectively enable or disable 201 certain specializations of <code class="computeroutput"><span class="identifier">transform_attribute</span></code> 202 utilizing SFINAE (i.e. <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">enable_if</span></code> 203 or <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">disable_if</span></code>). 204 </p> 205 </td> 206<td> 207 <p> 208 <code class="computeroutput"><span class="keyword">void</span></code> 209 </p> 210 </td> 211</tr> 212</tbody> 213</table></div> 214<div class="variablelist"> 215<p class="title"><b>Notation</b></p> 216<dl class="variablelist"> 217<dt><span class="term"><code class="computeroutput"><span class="identifier">Exposed</span></code></span></dt> 218<dd><p> 219 The type, <code class="computeroutput"><span class="identifier">Exposed</span></code> 220 is the type of the attribute as passed in by the user. 221 </p></dd> 222<dt><span class="term"><code class="computeroutput"><span class="identifier">Transformed</span></code></span></dt> 223<dd><p> 224 The type, <code class="computeroutput"><span class="identifier">Transformed</span></code> 225 is the type of the attribute as passed along to the right hand side 226 of the <code class="computeroutput"><span class="identifier">rule</span></code> (embedded 227 component of <code class="computeroutput"><span class="identifier">attr_cast</span></code>). 228 </p></dd> 229<dt><span class="term"><code class="computeroutput"><span class="identifier">Domain</span></code></span></dt> 230<dd><p> 231 The domain of the sub library the template is instantiated in. Typically 232 this is either <code class="computeroutput"><span class="identifier">qi</span><span class="special">::</span><span class="identifier">domain</span></code> 233 or <code class="computeroutput"><span class="identifier">karma</span><span class="special">::</span><span class="identifier">domain</span></code>. 234 </p></dd> 235<dt><span class="term"><code class="computeroutput"><span class="identifier">exposed</span></code></span></dt> 236<dd><p> 237 An instance of type <code class="computeroutput"><span class="identifier">Exposed</span></code>. 238 </p></dd> 239<dt><span class="term"><code class="computeroutput"><span class="identifier">transformed</span></code></span></dt> 240<dd><p> 241 An instance of type <code class="computeroutput"><span class="identifier">Transformed</span></code>. 242 </p></dd> 243</dl> 244</div> 245<h6> 246<a name="spirit.advanced.customize.transform.h5"></a> 247 <span class="phrase"><a name="spirit.advanced.customize.transform.expression_semantics"></a></span><a class="link" href="transform.html#spirit.advanced.customize.transform.expression_semantics">Expression 248 Semantics</a> 249 </h6> 250<div class="informaltable"><table class="table"> 251<colgroup> 252<col> 253<col> 254</colgroup> 255<thead><tr> 256<th> 257 <p> 258 Expression 259 </p> 260 </th> 261<th> 262 <p> 263 Semantics 264 </p> 265 </th> 266</tr></thead> 267<tbody> 268<tr> 269<td> 270 <p> 271 <code class="computeroutput"><span class="identifier">transform_attribute</span><span class="special"><</span><span class="identifier">Exposed</span><span class="special">,</span> <span class="identifier">Transformed</span><span class="special">,</span> <span class="identifier">Domain</span><span class="special">>::</span><span class="identifier">type</span></code> 272 </p> 273 </td> 274<td> 275 <p> 276 Evaluates to the type to be used as the result of the transformation 277 (to be passed to the right hand side of the <code class="computeroutput"><span class="identifier">rule</span></code> 278 or to the embedded component of the <code class="computeroutput"><span class="identifier">attr_cast</span></code>. 279 Most of the time this is equal to <code class="computeroutput"><span class="identifier">Transformed</span></code>, 280 but in other cases this might evaluate to <code class="computeroutput"><span class="identifier">Transformed</span><span class="special">&</span></code> instead avoiding superfluous 281 object creation. 282 </p> 283 </td> 284</tr> 285<tr> 286<td> 287 <p> 288</p> 289<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">type</span> <span class="identifier">transform_attribute</span><span class="special"><</span><span class="identifier">Exposed</span><span class="special">,</span> <span class="identifier">Transformed</span><span class="special">,</span> <span class="identifier">Domain</span><span class="special">>::</span><span class="identifier">pre</span><span class="special">(</span><span class="identifier">exposed</span><span class="special">)</span></pre> 290<p> 291 </p> 292 </td> 293<td> 294 <p> 295 Do <code class="computeroutput"><span class="identifier">pre</span></code>-transformation 296 before invoking the right hand side component for <code class="computeroutput"><span class="identifier">rule</span></code> (or the embedded component 297 for <code class="computeroutput"><span class="identifier">attr_cast</span></code>). 298 This takes the attribute supplied as by the user (of type <code class="computeroutput"><span class="identifier">Exposed</span></code>) and returns the attribute 299 to be passed down the component hierarchy (of the type as exposed 300 by the metafunction <code class="computeroutput"><span class="identifier">type</span></code>). 301 This function will be called in <span class="emphasis"><em>Qi</em></span> and for 302 <span class="emphasis"><em>Karma</em></span>. 303 </p> 304 </td> 305</tr> 306<tr> 307<td> 308 <p> 309</p> 310<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">void</span> <span class="identifier">transform_attribute</span><span class="special"><</span><span class="identifier">Exposed</span><span class="special">,</span> <span class="identifier">Transformed</span><span class="special">,</span> <span class="identifier">Domain</span><span class="special">>::</span><span class="identifier">post</span><span class="special">(</span><span class="identifier">exposed</span><span class="special">,</span> <span class="identifier">transformed</span><span class="special">)</span></pre> 311<p> 312 </p> 313 </td> 314<td> 315 <p> 316 Do <code class="computeroutput"><span class="identifier">post</span></code>-transformation 317 after the invocation of the right hand side component for <code class="computeroutput"><span class="identifier">rule</span></code> (or the embedded component 318 for <code class="computeroutput"><span class="identifier">attr_cast</span></code>). 319 This takes the original attribute as supplied by the user and 320 the attribute as returned from the right hand side (embedded) 321 component and is expected to propagate the result back into the 322 supplied attribute instance. This function will be called in 323 <span class="emphasis"><em>Qi</em></span> only. 324 </p> 325 </td> 326</tr> 327<tr> 328<td> 329 <p> 330</p> 331<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">void</span> <span class="identifier">transform_attribute</span><span class="special"><</span><span class="identifier">Exposed</span><span class="special">,</span> <span class="identifier">Transformed</span><span class="special">,</span> <span class="identifier">Domain</span><span class="special">>::</span><span class="identifier">fail</span><span class="special">(</span><span class="identifier">exposed</span><span class="special">)</span></pre> 332<p> 333 </p> 334 </td> 335<td> 336 <p> 337 Handling failing parse operations of the right hand side component 338 for <code class="computeroutput"><span class="identifier">rule</span></code> (or 339 the embedded component for <code class="computeroutput"><span class="identifier">attr_cast</span></code>). 340 This function will be called in <span class="emphasis"><em>Qi</em></span> only. 341 </p> 342 </td> 343</tr> 344</tbody> 345</table></div> 346<h6> 347<a name="spirit.advanced.customize.transform.h6"></a> 348 <span class="phrase"><a name="spirit.advanced.customize.transform.predefined_specializations"></a></span><a class="link" href="transform.html#spirit.advanced.customize.transform.predefined_specializations">Predefined 349 Specializations</a> 350 </h6> 351<div class="informaltable"><table class="table"> 352<colgroup> 353<col> 354<col> 355</colgroup> 356<thead><tr> 357<th> 358 <p> 359 Template parameters 360 </p> 361 </th> 362<th> 363 <p> 364 Semantics 365 </p> 366 </th> 367</tr></thead> 368<tbody> 369<tr> 370<td> 371 <p> 372 <code class="computeroutput"><span class="identifier">Exposed</span></code>, <code class="computeroutput"><span class="identifier">Transformed</span></code> 373 </p> 374 </td> 375<td> 376 <p> 377 <code class="computeroutput"><span class="identifier">type</span></code> evaluates 378 to <code class="computeroutput"><span class="identifier">Transformed</span></code>, 379 <code class="computeroutput"><span class="identifier">pre</span><span class="special">()</span></code> 380 returns a new instance of <code class="computeroutput"><span class="identifier">Transformed</span></code> 381 constructed from the argument of type <code class="computeroutput"><span class="identifier">Exposed</span></code>, 382 <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code> 383 assigns <code class="computeroutput"><span class="identifier">transformed</span></code> 384 to <code class="computeroutput"><span class="identifier">exposed</span></code>. 385 </p> 386 </td> 387</tr> 388<tr> 389<td> 390 <p> 391 <code class="computeroutput"><span class="identifier">optional</span><span class="special"><</span><span class="identifier">Exposed</span><span class="special">></span></code>, 392 <code class="computeroutput"><span class="identifier">Transformed</span></code>, 393 <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">disable_if</span><span class="special"><</span><span class="identifier">is_same</span><span class="special"><</span><span class="identifier">optional</span><span class="special"><</span><span class="identifier">Exposed</span><span class="special">>,</span> <span class="identifier">Transformed</span><span class="special">></span> <span class="special">>::</span><span class="identifier">type</span></code> 394 </p> 395 </td> 396<td> 397 <p> 398 <code class="computeroutput"><span class="identifier">type</span></code> evaluates 399 to <code class="computeroutput"><span class="identifier">Transformed</span><span class="special">&</span></code>, <code class="computeroutput"><span class="identifier">pre</span><span class="special">()</span></code> returns a reference to the 400 instance of <code class="computeroutput"><span class="identifier">Transformed</span></code> 401 stored in the passed optional (the argument of type <code class="computeroutput"><span class="identifier">optional</span><span class="special"><</span><span class="identifier">Exposed</span><span class="special">></span></code>), 402 the optional instance is initialized, if needed. <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code> 403 does nothing, <code class="computeroutput"><span class="identifier">fail</span><span class="special">()</span></code> resets the optional (its parameter) 404 instance to the non-initialized state. 405 </p> 406 </td> 407</tr> 408<tr> 409<td> 410 <p> 411 <code class="computeroutput"><span class="identifier">Exposed</span><span class="special">&</span></code>, 412 <code class="computeroutput"><span class="identifier">Transformed</span></code> 413 </p> 414 </td> 415<td> 416 <p> 417 <code class="computeroutput"><span class="identifier">type</span></code> evaluates 418 to <code class="computeroutput"><span class="identifier">Transformed</span></code>, 419 <code class="computeroutput"><span class="identifier">pre</span><span class="special">()</span></code> 420 returns a new instance of <code class="computeroutput"><span class="identifier">Transformed</span></code> 421 constructed from the argument of type <code class="computeroutput"><span class="identifier">Exposed</span></code>, 422 <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code> 423 assigns <code class="computeroutput"><span class="identifier">transformed</span></code> 424 to <code class="computeroutput"><span class="identifier">exposed</span></code>. 425 </p> 426 </td> 427</tr> 428<tr> 429<td> 430 <p> 431 <code class="computeroutput"><span class="identifier">Attrib</span><span class="special">&</span></code>, 432 <code class="computeroutput"><span class="identifier">Attrib</span></code> 433 </p> 434 </td> 435<td> 436 <p> 437 <code class="computeroutput"><span class="identifier">type</span></code> evaluates 438 to <code class="computeroutput"><span class="identifier">Attrib</span><span class="special">&</span></code>, 439 <code class="computeroutput"><span class="identifier">pre</span><span class="special">()</span></code> 440 returns it's argument, <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code> does nothing. 441 </p> 442 </td> 443</tr> 444<tr> 445<td> 446 <p> 447 <code class="computeroutput"><span class="identifier">Exposed</span> <span class="keyword">const</span></code>, 448 <code class="computeroutput"><span class="identifier">Transformed</span></code> 449 </p> 450 </td> 451<td> 452 <p> 453 (usind in <span class="emphasis"><em>Karma</em></span> only) <code class="computeroutput"><span class="identifier">type</span></code> 454 evaluates to <code class="computeroutput"><span class="identifier">Transformed</span></code>, 455 <code class="computeroutput"><span class="identifier">pre</span><span class="special">()</span></code> 456 returns it's argument, <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code> is not implemented. 457 </p> 458 </td> 459</tr> 460<tr> 461<td> 462 <p> 463 <code class="computeroutput"><span class="identifier">Attrib</span> <span class="keyword">const</span><span class="special">&</span></code>, <code class="computeroutput"><span class="identifier">Attrib</span></code> 464 </p> 465 </td> 466<td> 467 <p> 468 (usind in <span class="emphasis"><em>Karma</em></span> only) <code class="computeroutput"><span class="identifier">type</span></code> 469 evaluates to <code class="computeroutput"><span class="identifier">Attrib</span> 470 <span class="keyword">const</span><span class="special">&</span></code>, 471 <code class="computeroutput"><span class="identifier">pre</span><span class="special">()</span></code> 472 returns it's argument, <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code> is not implemented. 473 </p> 474 </td> 475</tr> 476<tr> 477<td> 478 <p> 479 <code class="computeroutput"><span class="identifier">Attrib</span> <span class="keyword">const</span></code>, 480 <code class="computeroutput"><span class="identifier">Attrib</span></code> 481 </p> 482 </td> 483<td> 484 <p> 485 (usind in <span class="emphasis"><em>Karma</em></span> only) <code class="computeroutput"><span class="identifier">type</span></code> 486 evaluates to <code class="computeroutput"><span class="identifier">Attrib</span> 487 <span class="keyword">const</span><span class="special">&</span></code>, 488 <code class="computeroutput"><span class="identifier">pre</span><span class="special">()</span></code> 489 returns it's argument, <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code> is not implemented. 490 </p> 491 </td> 492</tr> 493<tr> 494<td> 495 <p> 496 <code class="computeroutput"><span class="identifier">unused_type</span></code>, 497 <code class="computeroutput"><span class="identifier">Attrib</span></code> 498 </p> 499 </td> 500<td> 501 <p> 502 <code class="computeroutput"><span class="identifier">type</span></code> evaluates 503 to <code class="computeroutput"><span class="identifier">unused_type</span></code>, 504 <code class="computeroutput"><span class="identifier">pre</span><span class="special">()</span></code> 505 and <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code> 506 do nothing. 507 </p> 508 </td> 509</tr> 510<tr> 511<td> 512 <p> 513 <code class="computeroutput"><span class="identifier">Attrib</span></code>, <code class="computeroutput"><span class="identifier">unused_type</span></code> 514 </p> 515 </td> 516<td> 517 <p> 518 <code class="computeroutput"><span class="identifier">type</span></code> evaluates 519 to <code class="computeroutput"><span class="identifier">unused_type</span></code>, 520 <code class="computeroutput"><span class="identifier">pre</span><span class="special">()</span></code> 521 and <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code> 522 do nothing. 523 </p> 524 </td> 525</tr> 526</tbody> 527</table></div> 528<h6> 529<a name="spirit.advanced.customize.transform.h7"></a> 530 <span class="phrase"><a name="spirit.advanced.customize.transform.when_to_implement"></a></span><a class="link" href="transform.html#spirit.advanced.customize.transform.when_to_implement">When to 531 implement</a> 532 </h6> 533<p> 534 The customization point <code class="computeroutput"><span class="identifier">transform_attribute</span></code> 535 needs to be implemented for a specific pair of types whenever the attribute 536 type supplied to a <code class="computeroutput"><span class="identifier">rule</span></code> 537 or <code class="computeroutput"><span class="identifier">attr_cast</span></code> cannot automatically 538 transformed to the attribute type expected by the right hand side of the 539 <code class="computeroutput"><span class="identifier">rule</span></code> (embedded component 540 of the <code class="computeroutput"><span class="identifier">attr_cast</span></code>) because 541 the default implementation as shown above is not applicable. Examples for 542 this could be that the type <code class="computeroutput"><span class="identifier">Transformed</span></code> 543 is not constructible from the type <code class="computeroutput"><span class="identifier">Exposed</span></code>. 544 </p> 545</div> 546<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 547<td align="left"></td> 548<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p> 549 Distributed under the Boost Software License, Version 1.0. (See accompanying 550 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 551 </p> 552</div></td> 553</tr></table> 554<hr> 555<div class="spirit-nav"> 556<a accesskey="p" href="handles_container.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../customize.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="assign_to.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 557</div> 558</body> 559</html> 560