Boost logo

Boost :

From: Dirk Gerrits (dirk_at_[hidden])
Date: 2002-09-16 13:35:52

Aleksey Gurtovoy wrote:
> Dirk Gerrits wrote:
>>I believe the example at
>>is broken. Intel's C++ Compiler 6.0 complains that iter
>>doesn't have a position member. (The real error message is
>>more cryptic of course. ;)
> Fixed in sources. Here's the corrected version:
> typedef vector<char,int,unsigned,long,unsigned long> types;
> typedef find<types,unsigned>::type iter;
> BOOST_STATIC_ASSERT(iter::pos::value == 2);
>>If this is true then I think the example should make use of
>>distance instead:
>>typedef mpl::vector<char,int,unsigned,long,unsigned long> types;
>>typedef mpl::find<types,unsigned>::type iter;
>>std::size_t const position =
>> mpl::distance<mpl::begin<types>::type, iter>::type::value;
>>BOOST_STATIC_ASSERT(position == 2);
> It could be written this way too; may be it's even _should_ be re-written as
> you suggest, to keep a reader away from a conclusion that "iter::pos" is a
> general-supported iterator notation as opposite to a 'vector'-specific one.

Ah I see. Well perhaps the iter::pos example could be incorporated into
the vector example and the find example could be changed to use distance?

>>Additionally, when I change the "== 2" to "== 3" then code
>>still compiles! All I get is a:
>>main.cpp(18): warning #70: incomplete type is not allowed
>> BOOST_STATIC_ASSERT(position == 3);
>>But no errors.
>>Is this a fault on my part? Or is BOOST_STATIC_ASSERT broken
>>for Intel's compiler?
> Yes, it's "broken" in the sense that you get a warning instead of an error
> (as promised in the docs). Fixed in the CVS.
> Aleksey

OK, thanks for the info. I guess I'll go snoop around the CVS a bit.


Boost list run by bdawes at, gregod at, cpdaniel at, john at