1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>BOOST_FUSION_DEFINE_STRUCT_INLINE</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="Chapter 1. Fusion 2.2"> 8<link rel="up" href="../adapted.html" title="Adapted"> 9<link rel="prev" href="define_tpl_struct.html" title="BOOST_FUSION_DEFINE_TPL_STRUCT"> 10<link rel="next" href="define_tpl_struct_inline.html" title="BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE"> 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="define_tpl_struct.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../adapted.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="define_tpl_struct_inline.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="fusion.adapted.define_struct_inline"></a><a class="link" href="define_struct_inline.html" title="BOOST_FUSION_DEFINE_STRUCT_INLINE">BOOST_FUSION_DEFINE_STRUCT_INLINE</a> 28</h3></div></div></div> 29<h5> 30<a name="fusion.adapted.define_struct_inline.h0"></a> 31 <span class="phrase"><a name="fusion.adapted.define_struct_inline.description"></a></span><a class="link" href="define_struct_inline.html#fusion.adapted.define_struct_inline.description">Description</a> 32 </h5> 33<p> 34 BOOST_FUSION_DEFINE_STRUCT_INLINE is a macro that can be used to generate 35 all the necessary boilerplate to define and adapt an arbitrary struct as 36 a model of <a class="link" href="../sequence/concepts/random_access_sequence.html" title="Random Access Sequence">Random 37 Access Sequence</a>. Unlike BOOST_FUSION_DEFINE_STRUCT, it can be used 38 at class or namespace scope. 39 </p> 40<h5> 41<a name="fusion.adapted.define_struct_inline.h1"></a> 42 <span class="phrase"><a name="fusion.adapted.define_struct_inline.synopsis"></a></span><a class="link" href="define_struct_inline.html#fusion.adapted.define_struct_inline.synopsis">Synopsis</a> 43 </h5> 44<pre class="programlisting"><span class="identifier">BOOST_FUSION_DEFINE_STRUCT_INLINE</span><span class="special">(</span> 45 <span class="identifier">struct_name</span><span class="special">,</span> 46 <span class="special">(</span><span class="identifier">member_type0</span><span class="special">,</span> <span class="identifier">member_name0</span><span class="special">)</span> 47 <span class="special">(</span><span class="identifier">member_type1</span><span class="special">,</span> <span class="identifier">member_name1</span><span class="special">)</span> 48 <span class="special">...</span> 49 <span class="special">)</span> 50</pre> 51<h5> 52<a name="fusion.adapted.define_struct_inline.h2"></a> 53 <span class="phrase"><a name="fusion.adapted.define_struct_inline.expression_semantics"></a></span><a class="link" href="define_struct_inline.html#fusion.adapted.define_struct_inline.expression_semantics">Expression 54 Semantics</a> 55 </h5> 56<p> 57 The semantics of BOOST_FUSION_DEFINE_STRUCT_INLINE are identical to those 58 of BOOST_FUSION_DEFINE_STRUCT, with two differences: 59 </p> 60<div class="orderedlist"><ol class="orderedlist" type="1"> 61<li class="listitem"> 62 BOOST_FUSION_DEFINE_STRUCT_INLINE can be used at class or namespace scope, 63 and thus does not take a namespace list parameter. 64 </li> 65<li class="listitem"> 66 The structure generated by BOOST_FUSION_DEFINE_STRUCT_INLINE has a base 67 class, and is thus not POD in C++03. 68 </li> 69</ol></div> 70<h5> 71<a name="fusion.adapted.define_struct_inline.h3"></a> 72 <span class="phrase"><a name="fusion.adapted.define_struct_inline.header"></a></span><a class="link" href="define_struct_inline.html#fusion.adapted.define_struct_inline.header">Header</a> 73 </h5> 74<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">adapted</span><span class="special">/</span><span class="keyword">struct</span><span class="special">/</span><span class="identifier">define_struct_inline</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 75<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">define_struct_inline</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 76</pre> 77<h5> 78<a name="fusion.adapted.define_struct_inline.h4"></a> 79 <span class="phrase"><a name="fusion.adapted.define_struct_inline.example"></a></span><a class="link" href="define_struct_inline.html#fusion.adapted.define_struct_inline.example">Example</a> 80 </h5> 81<pre class="programlisting"><span class="comment">// enclosing::employee is a Fusion sequence</span> 82<span class="keyword">class</span> <span class="identifier">enclosing</span> 83<span class="special">{</span> 84 <span class="identifier">BOOST_FUSION_DEFINE_STRUCT_INLINE</span><span class="special">(</span> 85 <span class="identifier">employee</span><span class="special">,</span> 86 <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">name</span><span class="special">)</span> 87 <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">age</span><span class="special">))</span> 88<span class="special">};</span> 89</pre> 90</div> 91<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 92<td align="left"></td> 93<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman, 94 Dan Marsden, Tobias Schwinger<p> 95 Distributed under the Boost Software License, Version 1.0. (See accompanying 96 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>) 97 </p> 98</div></td> 99</tr></table> 100<hr> 101<div class="spirit-nav"> 102<a accesskey="p" href="define_tpl_struct.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../adapted.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="define_tpl_struct_inline.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 103</div> 104</body> 105</html> 106