Boost logo

Boost :

From: Minmin Gong (gongminmin_at_[hidden])
Date: 2007-05-14 21:36:22


Eric Niebler wrote:
> Arkadiy Vertleyb wrote:
>> "Minmin Gong" <gongminmin_at_[hidden]> wrote
>>> It seems that BOOSTTYPEOF in 1.34 doesn't work in VC8. I try to copy
>>> boost\typeof\msvc\typeof_impl.hpp and boost\typeof\typeof.hpp from CVS
>>> HEAD to 1.34 and it works. Did I do something wrong or there is a bug?
>> I suspect you might be trying to use the MSVC "native" mode, which is
>> available in head but not in 1.34.0. Look for the "using typeof
>> emulation/native typeof" compiler message. Which one is it?
>>
>> In 1.34.0 you have to use emulation mode with vc8.0. It is supposed to be
>> used by default. Did you by any chance define BOOST_TYPEOF_NATIVE?
>
> Or perhaps you didn't register your types, which is required in 1.34,
> but not in the version currently in CVS. We can't know unless you supply
> code that reproduces your error.
>

Thanks for your reply. This is my test code:

#include <iostream>
#include <vector>

#include <boost/typeof/typeof.hpp>
#include <boost/foreach.hpp>

using namespace std;

int main()
{
        std::vector<int> v;
        v.push_back(1);
        v.push_back(2);
        v.push_back(3);
        v.push_back(4);

        BOOST_FOREACH(BOOST_TYPEOF(v)::reference i, v)
        {
                cout << i << endl;
        }
}

The compile output is:
using typeof emulation
d:\boost\boost\typeof\encode_decode.hpp(47) : error C2504:
'`anonymous-namespace'::boost_typeof::encode_type_impl<V,Type_Not_Registered_With_Typeof_System>'
: base class undefined
         with
         [
             V=boost::type_of::vector0<>,
             Type_Not_Registered_With_Typeof_System=std::vector<int>
         ]
         d:\test\testtypeof\testtypeof.cpp(17) : see reference to class
template instantiation 'boost::type_of::encode_type<V,T>' being compiled
         with
         [
             V=boost::type_of::vector0<>,
             T=std::vector<int>
         ]

...

Do I need to register types such as std::vector, boost::array, etc. myself?


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