[Boost-bugs] [Boost C++ Libraries] #3874: [map0 / insert] inserting into map0 does not work without including map10.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #3874: [map0 / insert] inserting into map0 does not work without including map10.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-01-29 01:02:01


#3874: [map0 / insert] inserting into map0 does not work without including
map10.hpp
---------------------------------------------------+------------------------
 Reporter: Jeffrey Hellrung <jhellrung@…> | Owner: agurtovoy
     Type: Bugs | Status: new
Milestone: Boost 1.42.0 | Component: mpl
  Version: Boost 1.41.0 | Severity: Problem
 Keywords: mpl map0 insert |
---------------------------------------------------+------------------------
 The following does not compile on MSVC9:

 {{{
 #include <boost/mpl/insert.hpp>
 #include <boost/mpl/map/map0.hpp>
 #include <boost/mpl/pair.hpp>

 typedef boost::mpl::insert<
     boost::mpl::map0<>,
     boost::mpl::pair< void, void >
>::type map1_type;

 typedef boost::mpl::insert<
     map1_type,
     boost::mpl::pair< int, int >
>::type map2_type;

 int main() { }
 }}}

 The compiler output is

 {{{
 1>------ Build started: Project: test, Configuration: Debug Win32 ------
 1>Compiling...
 1>main.cpp
 1>d:\boost_1_41_0\boost\mpl\insert.hpp(32) : error C2903: 'apply' : symbol
 is neither a class template nor a function template
 1> d:\test\main.cpp(13) : see reference to class template
 instantiation 'boost::mpl::insert<Sequence,Pos_or_T>' being compiled
 1> with
 1> [
 1> Sequence=map1_type,
 1> Pos_or_T=boost::mpl::pair<int,int>
 1> ]
 1>d:\boost_1_41_0\boost\mpl\insert.hpp(32) : error C2039: 'apply' : is not
 a member of 'boost::mpl::insert_impl<boost::mpl::non_sequence_tag>'
 1> d:\boost_1_41_0\boost\mpl\aux_\insert_impl.hpp(64) : see
 declaration of 'boost::mpl::insert_impl<boost::mpl::non_sequence_tag>'
 1>d:\boost_1_41_0\boost\mpl\insert.hpp(32) : error C2955:
 'boost::mpl::apply' : use of class template requires template argument
 list
 1> d:\boost_1_41_0\boost\mpl\aux_\preprocessed\plain\apply.hpp(134)
 : see declaration of 'boost::mpl::apply'
 1>d:\boost_1_41_0\boost\mpl\insert.hpp(32) : error C2143: syntax error :
 missing ',' before '<'
 1>d:\test\main.cpp(13) : error C2039: 'type' : is not a member of
 'boost::mpl::insert<Sequence,Pos_or_T>'
 1> with
 1> [
 1> Sequence=map1_type,
 1> Pos_or_T=boost::mpl::pair<int,int>
 1> ]
 1>d:\test\main.cpp(13) : error C2146: syntax error : missing ';' before
 identifier 'map2_type'
 1>d:\test\main.cpp(13) : error C4430: missing type specifier - int
 assumed. Note: C++ does not support default-int
 1>d:\test\main.cpp(13) : error C4430: missing type specifier - int
 assumed. Note: C++ does not support default-int
 1>Build log was saved at "file://d:\test\Debug\BuildLog.htm"
 1>test - 8 error(s), 0 warning(s)
 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
 ==========
 }}}

 A fix (which took me a while to figure out, since the above error message
 didn't give me any clues) is to include <boost/mpl/map/map10.hpp>. 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".

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3874>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC