|
Boost : |
From: Peder Holt (peder.holt_at_[hidden])
Date: 2007-05-24 08:35:22
2007/5/24, Minmin Gong <gongminmin_at_[hidden]>:
> Hi all.
> Does Boost.Typeof work with MinGW in a little complex situation? I test
> it with this:
>
> #include <boost/typeof/typeof.hpp>
> #include <vector>
>
> using namespace std;
>
> int main()
> {
> std::vector<int> v;
> BOOST_TYPEOF(v)::value_type i;
> }
>
> It failed. But if the line 9 is changed from
> BOOST_TYPEOF(v)::value_type i;
> to
> typedef BOOST_TYPEOF(v) v_type;
> v_type::value_type i;
> It works.
>
> My question is why BOOST_TYPEOF(v)::value_type is not supported?
> I'm using MinGW with gcc 4.1.2. (3.4.2 fails too. But vc8 is OK.)
> Thanks.
On GCC we use the native typeof mechanism, so your code is actually
translated into this:
int main() {
std::vector<int> v;
typedef typeof(boost::type_of::ensure_obj(v))::type type;
}
The simpler:
typedef typeof(v)::type type;
fails to compile as well, so this is a shortcomming in the compiler.
Unfortunately there is little we can do to fix this in Boost.Typeof.
Regards,
Peder
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk