Boost logo

Boost :

From: Jaap Suter (J.Suter_at_[hidden])
Date: 2002-07-28 14:45:26


Hello,

I'm sorry if this actually belongs in the Boost user group instead of here,
but I think the MPL is currently only being discussed in here.

Anyway, I'm having a few problems using the MPL. Here's what I have done.

1. Downloaded the Boost 1.28 distribution from
http://boost.sourceforge.net/release/boost_1_28_0.zip

2. Downloaded the MPL 23-jul-02 distrubution from
http://www.mywikinet.com/mpl/mpl_23_jul_02_full.zip,
and copied it over the boost 1.28 distrubution.

3. Included the following headers:

#include <boost/mpl/list.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/mpl/distance.hpp>
#include <boost/mpl/advance.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/size.hpp>

I could have included less, which I had at first, but some of the errors
made me think that I wasn't including some neccesary parts to compile the
following code. Anyway, even with only the neccesary includes (according to
the documentation) I keep getting the same errors.

4. Then I wrote the following code:

typedef boost::mpl::vector< float, double > vars;
typedef boost::mpl::push_back< vars, unsigned char >::type ext_vars;
typedef boost::mpl::at_c< 2, ext_vars >::type third_var;
BOOST_STATIC_ASSERT( (boost::is_same< double, third_var >::value) );

5. I compiled everything with Microsoft Visual Studio 7 (.NET) , and got the
following errors:

c:\Development\Library\boost_1_28_0\boost\mpl\push_back.hpp(36) :

error C2504: 'boost::mpl::push_back_traits<Tag>::algorithm<Sequence,T>' :

base class undefined

with

[
      Tag=boost::mpl::vector2<float,double>::tag
]
and
[
     Sequence=vars,
     T=unsigned char
]

c:\Development\Projects\godel\src\application\go_main.cpp(27) :
see reference to class template instantiation
'boost::mpl::push_back<Sequence,T>' being compiled

with

[
    Sequence=vars,
    T=unsigned char
]
c:\Development\Projects\godel\src\application\go_main.cpp(27) : error C2039:
'type' : is not a member of 'boost::mpl::push_back<Sequence,T>'
with
[
    Sequence=vars,
    T=unsigned char
]

c:\Development\Projects\godel\src\application\go_main.cpp(27) : error C2146:
syntax error : missing ';' before identifier 'ext_vars'
c:\Development\Projects\godel\src\application\go_main.cpp(27) : error C2065:
'ext_vars' : undeclared identifier
c:\Development\Projects\godel\src\application\go_main.cpp(28) : error C2955:
'boost::mpl::at_c' : use of class template requires template argument list
c:\Development\Library\boost_1_28_0\boost\mpl\at.hpp(49) : see declaration
of 'boost::mpl::at_c'
c:\Development\Projects\godel\src\application\go_main.cpp(28) : error C2955:
'boost::mpl::at_c' : use of class template requires template argument list
c:\Development\Library\boost_1_28_0\boost\mpl\at.hpp(49) : see declaration
of 'boost::mpl::at_c'

If anybody knows what I'm doing wrong, that would be great. AFAIK the MPL
compile-matrix shows that VC-7 should compile my code.

Sincerely,

Jaap "hoping he didn't overlook a really obvious mistake" Suter


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk