Boost C++ Libraries: Ticket #7304: size of a fusion sequences is signed, should be unsigned https://svn.boost.org/trac10/ticket/7304 <p> fusion::result_of::size&lt; fusion::vector&lt;int, int&gt; &gt;::type::value is signed, even though it should be size_t. </p> <p> It appears the problem is two-fold: </p> <ul><li>fusion::result_of::size&lt;T&gt;::value is not the same type as fusion::result_of::size&lt;T&gt;::type::value_type </li><li>size of fusion::vector is defined to be a mpl::int_ (it also seems it is the case for all fusion sequences types!) </li></ul><p> The fact that this is wrongly signed causes all sorts of warnings. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7304 Trac 1.4.3 Joel de Guzman Thu, 06 Sep 2012 13:50:18 GMT <link>https://svn.boost.org/trac10/ticket/7304#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7304#comment:1</guid> <description> <p> Pedantic. fusion follows MPL's implementation which also uses int (signed). See the implementation of mpl::list for example. And see : <a href="http://www.boost.org/doc/libs/1_51_0/libs/mpl/doc/refmanual/forward-sequence.html">http://www.boost.org/doc/libs/1_51_0/libs/mpl/doc/refmanual/forward-sequence.html</a> which specifies size as an Integral Constant with no requirement that it be unsigned. E.g. (mpl::vector): </p> <blockquote> <p> template&lt;&gt; struct size_impl&lt; aux::vector_tag&lt;1&gt; &gt; { </p> <blockquote> <p> template&lt; typename Vector &gt; struct apply </p> <blockquote> <p> : long_&lt;1&gt; </p> </blockquote> <p> { }; </p> </blockquote> <p> }; </p> </blockquote> <p> Anyway, if you have a patch (it's library wide), I'd welcome it, but i wonder how it would jive with MPL. E.g. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Mathias Gaunard</dc:creator> <pubDate>Thu, 06 Sep 2012 14:16:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7304#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7304#comment:2</guid> <description> <p> Fusion is different than MPL in that some standard containers, such as std::array, are also fusion sequences. Standard containers use unsigned sizes, and fusion should follow this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Thu, 06 Sep 2012 14:59:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7304#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7304#comment:3</guid> <description> <p> Good point. I'll work on it over the weekend; but I'll very much welcome a patch if you already have one. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Mon, 10 Sep 2012 02:00:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7304#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7304#comment:4</guid> <description> <p> It turns out that this is not as simple as it seems. Fusion interacts with MPL more than with std::containers. Changing the size to unsigned has vast implications (e.g. we'll have to change at_c and at too. If we do this, in the end, we'll have more warnings with MPL. </p> <p> If you really want to do this, go ask MPL first. For now, I'm inclined to make this a "wontfix" status. </p> </description> <category>Ticket</category> </item> </channel> </rss>