Boost C++ Libraries: Ticket #3225: boost::fusion sequence throws compiler error when used with boost::mpl::is_sequence https://svn.boost.org/trac10/ticket/3225 <p> The boost::fusion documentation states in the Introduction section </p> <blockquote> <p> "Fusion sequences are fully conforming MPL sequences ..." </p> </blockquote> <p> It seems incorrect, then, that the following code does not compile (boost version 1.39 with MSVC 9): </p> <pre class="wiki"> #include &lt;boost/fusion/container/vector.hpp&gt; #include &lt;boost/mpl/assert.hpp&gt; #include &lt;boost/mpl/is_sequence.hpp&gt; int main(int argc, char* argv[]) { typedef boost::fusion::vector1&lt; int &gt; vector_type; static const bool b = boost::mpl::is_sequence&lt; vector_type &gt;::value; return 0; } </pre><p> Would someone please explain what the deal is? </p> <p> The compiler output is attached. </p> <p> I have found both boost::fusion and boost::mpl (otherwise) extremely useful! </p> <p> Thanks! </p> <ul><li>Jeff </li></ul> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3225 Trac 1.4.3 Jeffrey Hellrung <jhellrung@…> Fri, 26 Jun 2009 21:04:53 GMT attachment set https://svn.boost.org/trac10/ticket/3225 https://svn.boost.org/trac10/ticket/3225 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">compiler_output.txt</span> </li> </ul> <p> compiler output </p> Ticket Jeffrey Hellrung <jhellrung@…> Fri, 26 Jun 2009 21:34:32 GMT <link>https://svn.boost.org/trac10/ticket/3225#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3225#comment:1</guid> <description> <p> I'm also not having any luck using boost::fusion::vector with boost::mpl::fold and boost::mpl::find_if, so as a workaround for the moment I'll write an explicit conversion metafunction to boost::mpl::vector... </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Sat, 27 Jun 2009 00:49:38 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3225#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3225#comment:2</guid> <description> <p> You should probably ask the MPL authors. The thing is: boost::mpl::is_sequence is not a requirement to be a valid MPL sequence: </p> <blockquote> <p> <a href="http://www.boost.org/doc/libs/1_39_0/libs/mpl/doc/refmanual/forward-sequence.html">http://www.boost.org/doc/libs/1_39_0/libs/mpl/doc/refmanual/forward-sequence.html</a> </p> </blockquote> <p> as for fold and find_if, you need to provide a test case, add another trac ticket for those. </p> <p> I would suggest though to work initially with mpl sequences and only convert to a fusion sequence (e.g using fusion::as_vector) only when necessary. Fusion sequences have more overhead compared with mpl sequences because of its runtime aspects. </p> </description> <category>Ticket</category> </item> <item> <author>Jeffrey Hellrung <jhellrung@…></author> <pubDate>Sat, 27 Jun 2009 03:40:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3225#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3225#comment:3</guid> <description> <p> Thanks for the quick reply! </p> <p> My intent was to provide a compile-time check that the types within the boost::fusion sequence satisfied certain properties. Any boost::mpl-compatible code could thus be used for such checks, but some of the code I've written using boost::mpl has asserts that the sequences satisfy boost::mpl::is_sequence. Otherwise, I would indeed construct the type sequence through boost::mpl and at the end convert it to a boost::fusion sequence, as suggested in the documentation. </p> <p> It's not just that a boost::fusion sequence fails to satisfy boost::mpl::is_sequence, but that attempting to apply a boost::fusion sequence to boost::mpl::is_sequence results in a compiler error, which is not the case for other non-boost::mpl-sequence types (I think). The compiler error looks somewhat similar to what happens when trying to apply boost::mpl::fold to a fusion sequence, so I'll post a trac ticket for that code example and see what you think before forwarding these problems onto boost::mpl. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Sat, 27 Jun 2009 03:49:57 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3225#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3225#comment:4</guid> <description> <p> If there is code that relies on boost::mpl::is_sequence within MPL or outside, then, I'd say it is a bug. The requirements for a fully conforming MPL sequence is clearly stated in the reference (<a class="ext-link" href="http://tinyurl.com/qy376b"><span class="icon">​</span>http://tinyurl.com/qy376b</a>), and mpl::is_sequence is not one of the requirements. </p> <p> I think this needs to be discussed in the Boost list. I'd love to be corrected, if I'm wrong. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Tue, 11 Nov 2014 23:40:09 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3225#comment:5 https://svn.boost.org/trac10/ticket/3225#comment:5 <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">fixed</span> </li> </ul> Ticket