2007-11-06 12:13:52 +00:00
< html >
< head >
2009-12-11 21:01:22 +00:00
< meta http-equiv = "Content-Type" content = "text/html; charset=US-ASCII" >
2007-11-06 12:13:52 +00:00
< title > Notes< / title >
2007-11-07 03:46:23 +00:00
< link rel = "stylesheet" href = "../../../../../doc/html/boostbook.css" type = "text/css" >
2010-06-18 17:23:20 +00:00
< meta name = "generator" content = "DocBook XSL Stylesheets V1.75.1" >
2009-12-11 21:01:22 +00:00
< link rel = "home" href = "../index.html" title = "Chapter 1. Fusion 2.0" >
< link rel = "up" href = "../index.html" title = "Chapter 1. Fusion 2.0" >
2009-09-25 00:21:53 +00:00
< link rel = "prev" href = "functional/generation/metafunctions/mk_unfused.html" title = "make_unfused" >
2007-11-06 12:13:52 +00:00
< link rel = "next" href = "change_log.html" title = "Change log" >
< / head >
< body bgcolor = "white" text = "black" link = "#0000FF" vlink = "#840084" alink = "#0000FF" >
< table cellpadding = "2" width = "100%" > < tr >
< td valign = "top" > < img alt = "Boost C++ Libraries" width = "277" height = "86" src = "../../../../../boost.png" > < / td >
2008-07-17 23:59:22 +00:00
< td align = "center" > < a href = "../../../../../index.html" > Home< / a > < / td >
2007-11-06 12:13:52 +00:00
< td align = "center" > < a href = "../../../../libraries.htm" > Libraries< / a > < / td >
2008-07-17 23:59:22 +00:00
< td align = "center" > < a href = "http://www.boost.org/users/people.html" > People< / a > < / td >
< td align = "center" > < a href = "http://www.boost.org/users/faq.html" > FAQ< / a > < / td >
2007-11-06 12:13:52 +00:00
< td align = "center" > < a href = "../../../../../more/index.htm" > More< / a > < / td >
< / tr > < / table >
< hr >
< div class = "spirit-nav" >
2009-02-22 06:27:12 +00:00
< a accesskey = "p" href = "functional/generation/metafunctions/mk_unfused.html" > < img src = "../../../../../doc/html/images/prev.png" alt = "Prev" > < / a > < a accesskey = "u" href = "../index.html" > < img src = "../../../../../doc/html/images/up.png" alt = "Up" > < / a > < a accesskey = "h" href = "../index.html" > < img src = "../../../../../doc/html/images/home.png" alt = "Home" > < / a > < a accesskey = "n" href = "change_log.html" > < img src = "../../../../../doc/html/images/next.png" alt = "Next" > < / a >
2007-11-06 12:13:52 +00:00
< / div >
2010-06-03 08:29:23 +00:00
< div class = "section" >
2009-09-25 00:21:53 +00:00
< div class = "titlepage" > < div > < div > < h2 class = "title" style = "clear: both" >
< a name = "fusion.notes" > < / a > < a class = "link" href = "notes.html" title = "Notes" > Notes< / a >
< / h2 > < / div > < / div > < / div >
< a name = "fusion.notes.recursive_inlined_functions" > < / a > < h4 >
2010-06-18 17:23:20 +00:00
< a name = "id1110622" > < / a >
2009-09-25 00:21:53 +00:00
< a class = "link" href = "notes.html#fusion.notes.recursive_inlined_functions" > Recursive Inlined
2007-11-06 12:13:52 +00:00
Functions< / a >
2009-09-25 00:21:53 +00:00
< / h4 >
2007-11-06 12:13:52 +00:00
< p >
2009-09-25 00:21:53 +00:00
An interesting peculiarity of functions like < a class = "link" href = "sequence/intrinsic/functions/at.html" title = "at" > < code class = "computeroutput" > < span class = "identifier" > at< / span > < / code > < / a > when applied to a < a class = "link" href = "sequence/concepts/forward_sequence.html" title = "Forward Sequence" > Forward
Sequence< / a > like < a class = "link" href = "container/list.html" title = "list" > < code class = "computeroutput" > < span class = "identifier" > list< / span > < / code > < / a >
2007-11-06 12:13:52 +00:00
is that what could have been linear runtime complexity effectively becomes
constant O(1) due to compiler optimization of C++ inlined functions, however
deeply recursive (up to a certain compiler limit of course). Compile time complexity
remains linear.
< / p >
2009-09-25 00:21:53 +00:00
< a name = "fusion.notes.overloaded_functions" > < / a > < h4 >
2010-06-18 17:23:20 +00:00
< a name = "id1110663" > < / a >
2009-09-25 00:21:53 +00:00
< a class = "link" href = "notes.html#fusion.notes.overloaded_functions" > Overloaded Functions< / a >
< / h4 >
2007-11-06 12:13:52 +00:00
< p >
Associative sequences use function overloading to implement membership testing
and type associated key lookup. This amounts to constant runtime and amortized
2009-09-25 00:21:53 +00:00
constant compile time complexities. There is an overloaded function, < code class = "computeroutput" > < span class = "identifier" > f< / span > < span class = "special" > (< / span > < span class = "identifier" > k< / span > < span class = "special" > )< / span > < / code > , for each key < span class = "emphasis" > < em > type< / em > < / span > < code class = "computeroutput" > < span class = "identifier" > k< / span > < / code > . The compiler chooses the appropriate function
given a key, < code class = "computeroutput" > < span class = "identifier" > k< / span > < / code > .
2007-11-06 12:13:52 +00:00
< / p >
2009-09-25 00:21:53 +00:00
< a name = "fusion.notes.tag_dispatching" > < / a > < h4 >
2010-06-18 17:23:20 +00:00
< a name = "id1110716" > < / a >
2009-09-25 00:21:53 +00:00
< a class = "link" href = "notes.html#fusion.notes.tag_dispatching" > Tag Dispatching< / a >
< / h4 >
2007-11-06 12:13:52 +00:00
< p >
Tag dispatching is a generic programming technique for selecting template specializations.
There are typically 3 components involved in the tag dispatching mechanism:
< / p >
2009-09-25 00:21:53 +00:00
< div class = "orderedlist" > < ol class = "orderedlist" type = "1" >
< li class = "listitem" >
2010-06-13 01:45:12 +00:00
A type for which an appropriate template specialization is required
< / li >
2009-09-25 00:21:53 +00:00
< li class = "listitem" >
2010-06-13 01:45:12 +00:00
A metafunction that associates the type with a tag type
< / li >
2009-09-25 00:21:53 +00:00
< li class = "listitem" >
2010-06-13 01:45:12 +00:00
A template that is specialized for the tag type
< / li >
2007-11-06 12:13:52 +00:00
< / ol > < / div >
< p >
2009-09-25 00:21:53 +00:00
For example, the fusion < code class = "computeroutput" > < span class = "identifier" > result_of< / span > < span class = "special" > ::< / span > < span class = "identifier" > begin< / span > < / code > metafunction
2007-11-06 12:13:52 +00:00
is implemented as follows:
< / p >
2009-02-22 06:27:12 +00:00
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > typename< / span > < span class = "identifier" > Sequence< / span > < span class = "special" > > < / span >
2007-11-06 12:13:52 +00:00
< span class = "keyword" > struct< / span > < span class = "identifier" > begin< / span >
< span class = "special" > {< / span >
< span class = "keyword" > typedef< / span > < span class = "keyword" > typename< / span >
< span class = "identifier" > result_of< / span > < span class = "special" > ::< / span > < span class = "identifier" > begin_impl< / span > < span class = "special" > < < / span > < span class = "keyword" > typename< / span > < span class = "identifier" > traits< / span > < span class = "special" > ::< / span > < span class = "identifier" > tag_of< / span > < span class = "special" > < < / span > < span class = "identifier" > Sequence< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span > < span class = "special" > > ::< / span >
< span class = "keyword" > template< / span > < span class = "identifier" > apply< / span > < span class = "special" > < < / span > < span class = "identifier" > Sequence< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span >
< span class = "identifier" > type< / span > < span class = "special" > ;< / span >
< span class = "special" > };< / span >
< / pre >
< p >
In the case:
< / p >
2009-09-25 00:21:53 +00:00
< div class = "orderedlist" > < ol class = "orderedlist" type = "1" >
< li class = "listitem" >
2010-06-13 01:45:12 +00:00
< code class = "computeroutput" > < span class = "identifier" > Sequence< / span > < / code > is the type for
which a suitable implementation of < code class = "computeroutput" > < span class = "identifier" > result_of< / span > < span class = "special" > ::< / span > < span class = "identifier" > begin_impl< / span > < / code >
is required
< / li >
2009-09-25 00:21:53 +00:00
< li class = "listitem" >
2010-06-13 01:45:12 +00:00
< code class = "computeroutput" > < span class = "identifier" > traits< / span > < span class = "special" > ::< / span > < span class = "identifier" > tag_of< / span > < / code > is the metafunction that associates
< code class = "computeroutput" > < span class = "identifier" > Sequence< / span > < / code > with an appropriate
tag
< / li >
2009-09-25 00:21:53 +00:00
< li class = "listitem" >
2010-06-13 01:45:12 +00:00
< code class = "computeroutput" > < span class = "identifier" > result_of< / span > < span class = "special" > ::< / span > < span class = "identifier" > begin_impl< / span > < / code > is the template which is specialized
to provide an implementation for each tag type
< / li >
2007-11-06 12:13:52 +00:00
< / ol > < / div >
2009-09-25 00:21:53 +00:00
< a name = "fusion.notes.extensibility" > < / a > < h4 >
2010-06-18 17:23:20 +00:00
< a name = "id1111004" > < / a >
2009-09-25 00:21:53 +00:00
< a class = "link" href = "notes.html#fusion.notes.extensibility" > Extensibility< / a >
< / h4 >
2007-11-06 12:13:52 +00:00
< p >
Unlike < a href = "http://www.boost.org/libs/mpl/index.html" target = "_top" > MPL< / a > , there
is no extensibe sequence concept in fusion. This does not mean that Fusion
sequences are not extensible. In fact, all Fusion sequences are inherently
extensible. It is just that the manner of sequence extension in Fusion is diferent
from both < a href = "http://en.wikipedia.org/wiki/Standard_Template_Library" target = "_top" > STL< / a >
and < a href = "http://www.boost.org/libs/mpl/index.html" target = "_top" > MPL< / a > on account
2009-09-25 00:21:53 +00:00
of the lazy nature of fusion < a class = "link" href = "algorithm.html" title = "Algorithm" > Algorithms< / a > .
2007-11-06 12:13:52 +00:00
< a href = "http://en.wikipedia.org/wiki/Standard_Template_Library" target = "_top" > STL< / a >
2009-09-25 00:21:53 +00:00
containers extend themselves in place though member functions such as < a class = "link" href = "algorithm/transformation/functions/push_back.html" title = "push_back" > < code class = "computeroutput" > < span class = "identifier" > push_back< / span > < / code > < / a > and < a class = "link" href = "algorithm/transformation/functions/insert.html" title = "insert" > < code class = "computeroutput" > < span class = "identifier" > insert< / span > < / code > < / a > . < a href = "http://www.boost.org/libs/mpl/index.html" target = "_top" > MPL< / a >
2007-11-06 12:13:52 +00:00
sequences, on the other hand, are extended through "intrinsic" functions
that actually return whole sequences. < a href = "http://www.boost.org/libs/mpl/index.html" target = "_top" > MPL< / a >
is purely functional and can not have side effects. For example, < a href = "http://www.boost.org/libs/mpl/index.html" target = "_top" > MPL< / a > 's
2009-09-25 00:21:53 +00:00
< code class = "computeroutput" > < span class = "identifier" > push_back< / span > < / code > does not actually
mutate an < code class = "computeroutput" > < span class = "identifier" > mpl< / span > < span class = "special" > ::< / span > < span class = "identifier" > vector< / span > < / code > . It can't do that. Instead, it returns
an extended < code class = "computeroutput" > < span class = "identifier" > mpl< / span > < span class = "special" > ::< / span > < span class = "identifier" > vector< / span > < / code > .
2007-11-06 12:13:52 +00:00
< / p >
< p >
Like < a href = "http://www.boost.org/libs/mpl/index.html" target = "_top" > MPL< / a > , Fusion
too is purely functional and can not have side effects. With runtime efficiency
in mind, Fusion sequences are extended through generic functions that return
2009-09-25 00:21:53 +00:00
< a class = "link" href = "view.html" title = "View" > Views< / a > . < a class = "link" href = "view.html" title = "View" > Views< / a >
2007-11-06 12:13:52 +00:00
are sequences that do not actually contain data, but instead impart an alternative
2009-09-25 00:21:53 +00:00
presentation over the data from one or more underlying sequences. < a class = "link" href = "view.html" title = "View" > Views< / a >
2007-11-06 12:13:52 +00:00
are proxies. They provide an efficient yet purely functional way to work on
2009-09-25 00:21:53 +00:00
potentially expensive sequence operations. For example, given a < a class = "link" href = "container/vector.html" title = "vector" > < code class = "computeroutput" > < span class = "identifier" > vector< / span > < / code > < / a > , Fusion's < a class = "link" href = "algorithm/transformation/functions/push_back.html" title = "push_back" > < code class = "computeroutput" > < span class = "identifier" > push_back< / span > < / code > < / a > returns a < a class = "link" href = "view/joint_view.html" title = "joint_view" > < code class = "computeroutput" > < span class = "identifier" > joint_view< / span > < / code > < / a > , instead of an actual extended
< a class = "link" href = "container/vector.html" title = "vector" > < code class = "computeroutput" > < span class = "identifier" > vector< / span > < / code > < / a > .
A < a class = "link" href = "view/joint_view.html" title = "joint_view" > < code class = "computeroutput" > < span class = "identifier" > joint_view< / span > < / code > < / a >
2007-11-06 12:13:52 +00:00
holds a reference to the original sequence plus the appended data --making
it very cheap to pass around.
< / p >
2009-09-25 00:21:53 +00:00
< a name = "fusion.notes.element_conversion" > < / a > < h4 >
2010-06-18 17:23:20 +00:00
< a name = "id1111186" > < / a >
2009-09-25 00:21:53 +00:00
< a class = "link" href = "notes.html#fusion.notes.element_conversion" > Element Conversion< / a >
< / h4 >
2007-11-06 12:13:52 +00:00
< p >
2009-09-25 00:21:53 +00:00
Functions that take in elemental values to form sequences (e.g. < a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > ) convert their arguments
2007-11-06 12:13:52 +00:00
to something suitable to be stored as a sequence element. In general, the element
types are stored as plain values. Example:
< / p >
2009-09-25 00:21:53 +00:00
< pre class = "programlisting" > < a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > < span class = "special" > (< / span > < span class = "number" > 1< / span > < span class = "special" > ,< / span > < span class = "char" > 'x'< / span > < span class = "special" > )< / span >
2007-11-06 12:13:52 +00:00
< / pre >
< p >
2009-09-25 00:21:53 +00:00
returns a < a class = "link" href = "container/list.html" title = "list" > < code class = "computeroutput" > < span class = "identifier" > list< / span > < / code > < / a > < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span >
< span class = "keyword" > char< / span > < span class = "special" > > < / span > < / code > .
2007-11-06 12:13:52 +00:00
< / p >
< p >
There are a few exceptions, however.
< / p >
< p >
2009-09-25 00:21:53 +00:00
< span class = "bold" > < strong > Arrays:< / strong > < / span >
2007-11-06 12:13:52 +00:00
< / p >
< p >
2010-06-18 17:23:20 +00:00
Array arguments are deduced to reference to const types. For example < sup > [< a name = "id1111290" href = "#ftn.id1111290" class = "footnote" > 10< / a > ]< / sup > :
2007-11-06 12:13:52 +00:00
< / p >
2009-09-25 00:21:53 +00:00
< pre class = "programlisting" > < a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > < span class = "special" > (< / span > < span class = "string" > "Donald"< / span > < span class = "special" > ,< / span > < span class = "string" > "Daisy"< / span > < span class = "special" > )< / span >
2007-11-06 12:13:52 +00:00
< / pre >
< p >
2009-09-25 00:21:53 +00:00
creates a < a class = "link" href = "container/list.html" title = "list" > < code class = "computeroutput" > < span class = "identifier" > list< / span > < / code > < / a >
2007-11-06 12:13:52 +00:00
of type
< / p >
2009-09-25 00:21:53 +00:00
< pre class = "programlisting" > < a class = "link" href = "container/list.html" title = "list" > < code class = "computeroutput" > < span class = "identifier" > list< / span > < / code > < / a > < span class = "special" > < < / span > < span class = "keyword" > const< / span > < span class = "keyword" > char< / span > < span class = "special" > (& )[< / span > < span class = "number" > 7< / span > < span class = "special" > ],< / span > < span class = "keyword" > const< / span > < span class = "keyword" > char< / span > < span class = "special" > (& )[< / span > < span class = "number" > 6< / span > < span class = "special" > ]> < / span >
2007-11-06 12:13:52 +00:00
< / pre >
< p >
2009-09-25 00:21:53 +00:00
< span class = "bold" > < strong > Function pointers:< / strong > < / span >
2007-11-06 12:13:52 +00:00
< / p >
< p >
Function pointers are deduced to the plain non-reference type (i.e. to plain
function pointer). Example:
< / p >
2009-02-22 06:27:12 +00:00
< pre class = "programlisting" > < span class = "keyword" > void< / span > < span class = "identifier" > f< / span > < span class = "special" > (< / span > < span class = "keyword" > int< / span > < span class = "identifier" > i< / span > < span class = "special" > );< / span >
2007-11-06 12:13:52 +00:00
< span class = "special" > ...< / span >
2009-09-25 00:21:53 +00:00
< a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > < span class = "special" > (& < / span > < span class = "identifier" > f< / span > < span class = "special" > );< / span >
2007-11-06 12:13:52 +00:00
< / pre >
< p >
2009-09-25 00:21:53 +00:00
creates a < a class = "link" href = "container/list.html" title = "list" > < code class = "computeroutput" > < span class = "identifier" > list< / span > < / code > < / a >
2007-11-06 12:13:52 +00:00
of type
< / p >
2009-09-25 00:21:53 +00:00
< pre class = "programlisting" > < a class = "link" href = "container/list.html" title = "list" > < code class = "computeroutput" > < span class = "identifier" > list< / span > < / code > < / a > < span class = "special" > < < / span > < span class = "keyword" > void< / span > < span class = "special" > (*)(< / span > < span class = "keyword" > int< / span > < span class = "special" > )> < / span >
2007-11-06 12:13:52 +00:00
< / pre >
2009-09-25 00:21:53 +00:00
< a name = "fusion.notes.boost__ref" > < / a > < h4 >
2010-06-18 17:23:20 +00:00
< a name = "id1111592" > < / a >
2009-09-25 00:21:53 +00:00
< a class = "link" href = "notes.html#fusion.notes.boost__ref" > boost::ref< / a >
< / h4 >
2007-11-06 12:13:52 +00:00
< p >
2009-09-25 00:21:53 +00:00
Fusion's generation functions (e.g. < a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > ) by default stores the element
2007-11-06 12:13:52 +00:00
types as plain non-reference types. Example:
< / p >
2009-02-22 06:27:12 +00:00
< pre class = "programlisting" > < span class = "keyword" > void< / span > < span class = "identifier" > foo< / span > < span class = "special" > (< / span > < span class = "keyword" > const< / span > < span class = "identifier" > A< / span > < span class = "special" > & < / span > < span class = "identifier" > a< / span > < span class = "special" > ,< / span > < span class = "identifier" > B< / span > < span class = "special" > & < / span > < span class = "identifier" > b< / span > < span class = "special" > )< / span > < span class = "special" > {< / span >
2007-11-06 12:13:52 +00:00
< span class = "special" > ...< / span >
2009-09-25 00:21:53 +00:00
< a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > < span class = "special" > (< / span > < span class = "identifier" > a< / span > < span class = "special" > ,< / span > < span class = "identifier" > b< / span > < span class = "special" > )< / span >
2007-11-06 12:13:52 +00:00
< / pre >
< p >
2009-09-25 00:21:53 +00:00
creates a < a class = "link" href = "container/list.html" title = "list" > < code class = "computeroutput" > < span class = "identifier" > list< / span > < / code > < / a >
2007-11-06 12:13:52 +00:00
of type
< / p >
2009-09-25 00:21:53 +00:00
< pre class = "programlisting" > < a class = "link" href = "container/list.html" title = "list" > < code class = "computeroutput" > < span class = "identifier" > list< / span > < / code > < / a > < span class = "special" > < < / span > < span class = "identifier" > A< / span > < span class = "special" > ,< / span > < span class = "identifier" > B< / span > < span class = "special" > > < / span >
2007-11-06 12:13:52 +00:00
< / pre >
< p >
2009-09-25 00:21:53 +00:00
Sometimes the plain non-reference type is not desired. You can use < code class = "computeroutput" > < span class = "identifier" > boost< / span > < span class = "special" > ::< / span > < span class = "identifier" > ref< / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > boost< / span > < span class = "special" > ::< / span > < span class = "identifier" > cref< / span > < / code > to store references or const references
2007-11-06 12:13:52 +00:00
(respectively) instead. The mechanism does not compromise const correctness
since a const object wrapped with ref results in a tuple element with const
reference type (see the fifth code line below). Examples:
< / p >
< p >
For example:
< / p >
2009-02-22 06:27:12 +00:00
< pre class = "programlisting" > < span class = "identifier" > A< / span > < span class = "identifier" > a< / span > < span class = "special" > ;< / span > < span class = "identifier" > B< / span > < span class = "identifier" > b< / span > < span class = "special" > ;< / span > < span class = "keyword" > const< / span > < span class = "identifier" > A< / span > < span class = "identifier" > ca< / span > < span class = "special" > =< / span > < span class = "identifier" > a< / span > < span class = "special" > ;< / span >
2009-09-25 00:21:53 +00:00
< a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > < span class = "special" > (< / span > < span class = "identifier" > cref< / span > < span class = "special" > (< / span > < span class = "identifier" > a< / span > < span class = "special" > ),< / span > < span class = "identifier" > b< / span > < span class = "special" > );< / span > < span class = "comment" > // creates list< const A& , B>
< / span > < a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > < span class = "special" > (< / span > < span class = "identifier" > ref< / span > < span class = "special" > (< / span > < span class = "identifier" > a< / span > < span class = "special" > ),< / span > < span class = "identifier" > b< / span > < span class = "special" > );< / span > < span class = "comment" > // creates list< A& , B>
< / span > < a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > < span class = "special" > (< / span > < span class = "identifier" > ref< / span > < span class = "special" > (< / span > < span class = "identifier" > a< / span > < span class = "special" > ),< / span > < span class = "identifier" > cref< / span > < span class = "special" > (< / span > < span class = "identifier" > b< / span > < span class = "special" > ));< / span > < span class = "comment" > // creates list< A& , const B& >
< / span > < a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > < span class = "special" > (< / span > < span class = "identifier" > cref< / span > < span class = "special" > (< / span > < span class = "identifier" > ca< / span > < span class = "special" > ));< / span > < span class = "comment" > // creates list< const A& >
< / span > < a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > < span class = "special" > (< / span > < span class = "identifier" > ref< / span > < span class = "special" > (< / span > < span class = "identifier" > ca< / span > < span class = "special" > ));< / span > < span class = "comment" > // creates list< const A& >
2007-11-06 12:13:52 +00:00
< / span > < / pre >
< p >
See < a href = "http://www.boost.org/doc/html/ref.html" target = "_top" > Boost.Ref< / a > for
details.
< / p >
< div class = "footnotes" >
< br > < hr width = "100" align = "left" >
2010-06-18 17:23:20 +00:00
< div class = "footnote" > < p > < sup > [< a name = "ftn.id1111290" href = "#id1111290" class = "para" > 10< / a > ] < / sup >
2010-06-13 01:45:12 +00:00
Note that the type of a string literal is an array of const characters, not
< code class = "computeroutput" > < span class = "keyword" > const< / span > < span class = "keyword" > char< / span > < span class = "special" > *< / span > < / code > . To get < a class = "link" href = "container/generation/functions/make_list.html" title = "make_list" > < code class = "computeroutput" > < span class = "identifier" > make_list< / span > < / code > < / a > to create a < a class = "link" href = "container/list.html" title = "list" > < code class = "computeroutput" > < span class = "identifier" > list< / span > < / code > < / a > with an element of a non-const
array type one must use the < code class = "computeroutput" > < span class = "identifier" > ref< / span > < / code >
wrapper (see < a class = "link" href = "notes.html#fusion.notes.boost__ref" > < code class = "computeroutput" > < span class = "identifier" > boost< / span > < span class = "special" > ::< / span > < span class = "identifier" > ref< / span > < / code > < / a > ).
< / p > < / div >
2007-11-06 12:13:52 +00:00
< / div >
< / div >
< table xmlns:rev = "http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width = "100%" > < tr >
< td align = "left" > < / td >
2009-12-11 21:01:22 +00:00
< td align = "right" > < div class = "copyright-footer" > Copyright © 2001-2007 Joel de Guzman, Dan Marsden, Tobias
2007-11-07 02:12:28 +00:00
Schwinger< p >
Distributed under the Boost Software License, Version 1.0. (See accompanying
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 > )
2007-11-14 10:17:09 +00:00
< / p >
< / div > < / td >
2007-11-06 12:13:52 +00:00
< / tr > < / table >
< hr >
< div class = "spirit-nav" >
2009-02-22 06:27:12 +00:00
< a accesskey = "p" href = "functional/generation/metafunctions/mk_unfused.html" > < img src = "../../../../../doc/html/images/prev.png" alt = "Prev" > < / a > < a accesskey = "u" href = "../index.html" > < img src = "../../../../../doc/html/images/up.png" alt = "Up" > < / a > < a accesskey = "h" href = "../index.html" > < img src = "../../../../../doc/html/images/home.png" alt = "Home" > < / a > < a accesskey = "n" href = "change_log.html" > < img src = "../../../../../doc/html/images/next.png" alt = "Next" > < / a >
2007-11-06 12:13:52 +00:00
< / div >
< / body >
< / html >