Boost C++ Libraries: Ticket #3874: [map0 / insert] inserting into map0 does not work without including map10.hpp https://svn.boost.org/trac10/ticket/3874 <p> The following does not compile on MSVC9: </p> <pre class="wiki">#include &lt;boost/mpl/insert.hpp&gt; #include &lt;boost/mpl/map/map0.hpp&gt; #include &lt;boost/mpl/pair.hpp&gt; typedef boost::mpl::insert&lt; boost::mpl::map0&lt;&gt;, boost::mpl::pair&lt; void, void &gt; &gt;::type map1_type; typedef boost::mpl::insert&lt; map1_type, boost::mpl::pair&lt; int, int &gt; &gt;::type map2_type; int main() { } </pre><p> The compiler output is </p> <pre class="wiki">1&gt;------ Build started: Project: test, Configuration: Debug Win32 ------ 1&gt;Compiling... 1&gt;main.cpp 1&gt;d:\boost_1_41_0\boost\mpl\insert.hpp(32) : error C2903: 'apply' : symbol is neither a class template nor a function template 1&gt; d:\test\main.cpp(13) : see reference to class template instantiation 'boost::mpl::insert&lt;Sequence,Pos_or_T&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; Sequence=map1_type, 1&gt; Pos_or_T=boost::mpl::pair&lt;int,int&gt; 1&gt; ] 1&gt;d:\boost_1_41_0\boost\mpl\insert.hpp(32) : error C2039: 'apply' : is not a member of 'boost::mpl::insert_impl&lt;boost::mpl::non_sequence_tag&gt;' 1&gt; d:\boost_1_41_0\boost\mpl\aux_\insert_impl.hpp(64) : see declaration of 'boost::mpl::insert_impl&lt;boost::mpl::non_sequence_tag&gt;' 1&gt;d:\boost_1_41_0\boost\mpl\insert.hpp(32) : error C2955: 'boost::mpl::apply' : use of class template requires template argument list 1&gt; d:\boost_1_41_0\boost\mpl\aux_\preprocessed\plain\apply.hpp(134) : see declaration of 'boost::mpl::apply' 1&gt;d:\boost_1_41_0\boost\mpl\insert.hpp(32) : error C2143: syntax error : missing ',' before '&lt;' 1&gt;d:\test\main.cpp(13) : error C2039: 'type' : is not a member of 'boost::mpl::insert&lt;Sequence,Pos_or_T&gt;' 1&gt; with 1&gt; [ 1&gt; Sequence=map1_type, 1&gt; Pos_or_T=boost::mpl::pair&lt;int,int&gt; 1&gt; ] 1&gt;d:\test\main.cpp(13) : error C2146: syntax error : missing ';' before identifier 'map2_type' 1&gt;d:\test\main.cpp(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1&gt;d:\test\main.cpp(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1&gt;Build log was saved at "file://d:\test\Debug\BuildLog.htm" 1&gt;test - 8 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== </pre><p> A fix (which took me a while to figure out, since the above error message didn't give me any clues) is to include &lt;boost/mpl/map/map10.hpp&gt;. I think either a note should be made in the documentation for insert, the error message should be more helpful (maybe a comment in mpl/insert.hpp line 32???), or the above code should "just work". </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3874 Trac 1.4.3 Steven Watanabe Sat, 05 Jun 2010 20:51:46 GMT <link>https://svn.boost.org/trac10/ticket/3874#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3874#comment:1</guid> <description> <p> In C++0x, the code will just work, since the typeof based implementation of mpl::map has no fixed limits. Unfortunately, with the non-typeof implementation, there is no good way to make it just work. </p> </description> <category>Ticket</category> </item> </channel> </rss>