Boost C++ Libraries: Ticket #3226: boost::fusion sequence fails to work in boost::mpl::fold https://svn.boost.org/trac10/ticket/3226 <p> The following results in a compiler error (boost 1.39, MSVC 9) at the line where boost::mpl::fold is applied to fusion_vector_type. Commenting this line out makes the code compile. </p> <pre class="wiki"> #include &lt;boost/fusion/container/vector.hpp&gt; #include &lt;boost/mpl/assert.hpp&gt; #include &lt;boost/mpl/fold.hpp&gt; #include &lt;boost/mpl/placeholders.hpp&gt; #include &lt;boost/mpl/vector.hpp&gt; #include &lt;boost/type_traits/is_void.hpp&gt; int main(int argc, char* argv[]) { typedef boost::fusion::vector&lt; int &gt; fusion_vector_type; typedef boost::mpl::vector&lt; int &gt; mpl_vector_type; typedef boost::mpl::fold&lt; fusion_vector_type, void, boost::mpl::_1 &gt;::type void1_type; typedef boost::mpl::fold&lt; mpl_vector_type, void, boost::mpl::_1 &gt;::type void2_type; BOOST_MPL_ASSERT((boost::is_void&lt; void2_type &gt;)); return 0; } </pre><p> Is this a problem with boost::fusion::vector failing some requirement of being a boost::mpl sequence, or of boost::mpl::fold using something outside the stated requirements of boost::mpl sequences? </p> <p> I've attached the compiler output. </p> <ul><li>Jeff </li></ul> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3226 Trac 1.4.3 Jeffrey Hellrung <jhellrung@…> Sat, 27 Jun 2009 03:50:35 GMT attachment set https://svn.boost.org/trac10/ticket/3226 https://svn.boost.org/trac10/ticket/3226 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">compiler_output.txt</span> </li> </ul> Ticket Jeffrey Hellrung <jhellrung@…> Sat, 27 Jun 2009 04:48:55 GMT <link>https://svn.boost.org/trac10/ticket/3226#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3226#comment:1</guid> <description> <p> Here's a similar example using a somewhat simpler boost::mpl metafunction: </p> <pre class="wiki"> #include &lt;boost/fusion/container/vector.hpp&gt; #include &lt;boost/mpl/assert.hpp&gt; #include &lt;boost/mpl/front.hpp&gt; #include &lt;boost/mpl/vector.hpp&gt; #include &lt;boost/type_traits/is_void.hpp&gt; int main(int argc, char* argv[]) { typedef boost::fusion::vector&lt; void &gt; fusion_vector_type; typedef boost::mpl::vector&lt; void &gt; mpl_vector_type; //typedef boost::mpl::front&lt; fusion_vector_type &gt;::type void1_type; typedef boost::mpl::front&lt; mpl_vector_type &gt;::type void2_type; BOOST_MPL_ASSERT((boost::is_void&lt; void2_type &gt;)); return 0; } </pre><p> FWIW, boost::mpl::find_if appears to work fine on boost::fusion sequences... </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Sat, 27 Jun 2009 15:51:43 GMT</pubDate> <title>status, component changed; resolution set https://svn.boost.org/trac10/ticket/3226#comment:2 https://svn.boost.org/trac10/ticket/3226#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">fusion</span> </li> </ul> <p> You're missing a header. </p> <pre class="wiki">#include &lt;boost/fusion/include/mpl.hpp&gt; </pre> Ticket Jeffrey Hellrung <jhellrung@…> Sat, 27 Jun 2009 16:07:20 GMT <link>https://svn.boost.org/trac10/ticket/3226#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3226#comment:3</guid> <description> <p> Ah, I see; great! Is that the most finely-grained header to include to enable the use of fusion sequences as MPL sequences? </p> <p> The only MPL-related headers I had remembered reading about in the docs were for adapting MPL sequences to be used as fusion sequences, and a spot check right now didn't find anything else. I might be blind. Is this use (enabling fusion sequences to be used in MPL algorithms) mentioned somewhere in the documentation? </p> <p> Thanks. </p> </description> <category>Ticket</category> </item> </channel> </rss>