Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2005-01-23 16:45:30


Joaquín Mª López Muñoz writes:
> The following simple snippet ICEs in MSVC 6.5:
>
> #include <boost/mpl/vector_c.hpp>
> #include <boost/mpl/assert.hpp>
>
> template<int N>
> struct foo:boost::mpl::vector_c<int,N>
> {
> };
>
> Yet, this version (where assert.hpp is included
> first) compiles fine:
>
> #include <boost/mpl/assert.hpp>
> #include <boost/mpl/vector_c.hpp>
>
> template<int N>
> struct foo:boost::mpl::vector_c<int,N>
> {
> };
>
> The situation is the same if I change vector_c for
> list_c. With plain vectors and lists, however, everytihng's
> fine. ?????

This has little to do with MPL; non-type integer template
parameters are generally "unsafe" on MSVC 6.x:

    namespace std {
    template< typename Char > struct string;
    }

    void foo(std::string<char>);

    template< int C > struct arg; // ICE here

MPL avoids the problem internally by using the following
workaround:

    #include <boost/mpl/aux_/nttp_decl.hpp>

    ...

    template< BOOST_MPL_AUX_NTTP_DECL(int, C) > struct arg; // OK

HTH,

--
Aleksey Gurtovoy
MetaCommunications Engineering

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