Boost C++ Libraries: Ticket #6961: problem with list_c et.all https://svn.boost.org/trac10/ticket/6961 <p> The documentation for list_c states that it is a model of Front Extensible Sequence. </p> <p> But some simple testing suggests otherwise. Here is my test program: </p> <pre class="wiki">#include "../include/multi_precision.hpp" //#include &lt;boost/mpl/shift_right.hpp&gt; //#include &lt;boost/mpl/integral_c.hpp&gt; //#include &lt;boost/cstdint.hpp&gt; #include &lt;boost/mpl/list.hpp&gt; #include &lt;boost/mpl/list_c.hpp&gt; #include &lt;boost/mpl/push_front.hpp&gt; #include &lt;boost/mpl/front.hpp&gt; #include &lt;boost/mpl/int.hpp&gt; #include &lt;boost/mpl/integral_c.hpp&gt; #include &lt;boost/mpl/print.hpp&gt; namespace boost { namespace mpl { print&lt; list_c&lt;int, 22, 64 &gt; &gt; x8; print&lt; front&lt; list_c&lt;int, 22, 64 &gt; &gt;::type &gt; x7; print&lt; push_front&lt; list_c&lt;int, 22, 64 &gt;, integral_c&lt;int, 33&gt; &gt;::type &gt; x6; </pre><p> which produces the following output on my VC 9.0 compiler </p> <pre class="wiki">1&gt;------ Build started: Project: test_interval, Configuration: Debug Win32 ------ 1&gt;Compiling... 1&gt;test_multi_precision.cpp 1&gt;c:\boostrelease\boost\mpl\print.hpp(51) : warning C4308: negative integral constant converted to unsigned type 1&gt; c:\projects\boost projects\mpl\tests\test_multi_precision.cpp(24) : see reference to class template instantiation 'boost::mpl::print&lt;T&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; T=boost::mpl::list_c&lt;int,22,64&gt; 1&gt; ] 1&gt;c:\boostrelease\boost\mpl\print.hpp(51) : warning C4308: negative integral constant converted to unsigned type 1&gt; c:\projects\boost projects\mpl\tests\test_multi_precision.cpp(33) : see reference to class template instantiation 'boost::mpl::print&lt;T&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; T=boost::mpl::integral_c&lt;int,22&gt; 1&gt; ] 1&gt;c:\boostrelease\boost\mpl\print.hpp(51) : warning C4308: negative integral constant converted to unsigned type 1&gt; c:\projects\boost projects\mpl\tests\test_multi_precision.cpp(44) : see reference to class template instantiation 'boost::mpl::print&lt;T&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; T=boost::mpl::l_item&lt;boost::mpl::long_&lt;3&gt;,boost::mpl::integral_c&lt;int,33&gt;,boost::mpl::list2_c&lt;int,22,64&gt;&gt; 1&gt; ] </pre><p> What I hope to see for the third test is: </p> <pre class="wiki">T=boost::mpl::list_c&lt;int,33, 22,64&gt; </pre><p> If I use </p> <pre class="wiki">print&lt; push_front&lt; list_c&lt;int, 22, 64 &gt;, 33 &gt;::type &gt; x5; </pre><p> But this fails to compile at all. </p> <p> To me, the list_c implementation is misconceived. Maybe the following should result </p> <pre class="wiki">print&lt; list_c&lt;int, 22, 64 &gt;::type // note the ::type to make it a metafunction &gt; x8; </pre><p> to return </p> <pre class="wiki">T=boost::mpl::list&lt;boost::mpl::integral_c&lt;int, 22&gt;,boost::mpl::integral_c&lt;int, 64&gt; &gt; </pre><p> Of course the same observations would apply to vector_c, etc. </p> <p> Robert Ramey </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6961 Trac 1.4.3 Robert Ramey Sun, 03 Jun 2012 20:48:06 GMT <link>https://svn.boost.org/trac10/ticket/6961#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6961#comment:1</guid> <description> <p> FYI - the following works as expected from the docs. </p> <pre class="wiki">typedef vector_c&lt;int,1,2,3,5,8,13,21&gt; v; print&lt; v::type &gt; x7; print&lt; push_front&lt;v ,integral_c&lt;int,1&gt; &gt;::type &gt; x6; </pre><p> showing: </p> <pre class="wiki">test_multi_precision.cpp 1&gt;c:\boostrelease\boost\mpl\print.hpp(51) : warning C4308: negative integral constant converted to unsigned type 1&gt; c:\projects\boost projects\mpl\tests\test_multi_precision.cpp(18) : see reference to class template instantiation 'boost::mpl::print&lt;T&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; T=boost::mpl::vector7_c&lt;int,1,2,3,5,8,13,21&gt; 1&gt; ] 1&gt;c:\boostrelease\boost\mpl\print.hpp(51) : warning C4308: negative integral constant converted to unsigned type 1&gt; c:\projects\boost projects\mpl\tests\test_multi_precision.cpp(22) : see reference to class template instantiation 'boost::mpl::print&lt;T&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; T=boost::mpl::vector8&lt;boost::mpl::integral_c&lt;int,1&gt;,boost::mpl::integral_c&lt;int,1&gt;,boost::mpl::integral_c&lt;int,2&gt;,boost::mpl::integral_c&lt;int,3&gt;,boost::mpl::integral_c&lt;int,5&gt;,boost::mpl::integral_c&lt;int,8&gt;,boost::mpl::integral_c&lt;int,13&gt;,boost::mpl::integral_c&lt;int,21&gt;&gt; 1&gt; ] </pre> </description> <category>Ticket</category> </item> </channel> </rss>