Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2005-02-28 13:04:30


Hi Vokkerm thanks for trying Boost.MultiIndex!

Volker Vieth ha escrito:

> Hi,
>
> using multi_index_container I've got strange errors. Simple source code
> leaned on official examples doesn't compile. Hardly modified code that seems
> to be equivalent does compile however. I've reduced it to two examples.
>
> I'm using Visual C++ .NET 7.09466 (i.e. cl.exe 13.00.9466) with boost 1.32.0
> under Win XP.
>

[...]

> 40 //version A: does NOT compile
> 41 //causes basic.cpp(42) : error C2976: 'boost::multi_index::index' : too
> few template arguments
> 42 typedef employee_set::index<id>::type employee_set_by_id;

Yes, this is a limitation with MSVC++ 6.0/7.0, see
http://boost.org/libs/multi_index/doc/compiler_specifics.html#msvc_70

>
> 43
> 44 //version B: DOES compile
> 45 typedef index<employee_set,id >::type employee_set_by_id;
> 46 typedef index<employee_set,age>::type employee_set_by_age;

OK, fine.

>
> 47
> 48 //remove the name index (lines 31, 32) for following versions
> 49
> 50 //version C: DOES compile
> 51 typedef index<employee_set,id >::type employee_set_by_id;;

OK, too.

>
> 52
> 53 //version D: does NOT compile
> 54 //causes
> ...\include\boost-1_32\boost\mpl\vector\aux_\preprocessed\no_ctps\vector10.hpp(398)
> :
> 55 // error C2039: 'item3' : is not a member of
> 'boost::mpl::vector2<T0,T1>'
> 56 typedef index<employee_set,age>::type employee_set_by_age;
>

!! Here I'm missing somethig... Isn't version D exactly the same
as version B, which does work?

>
> My second example consists of 2 tiny programs. The former compile fine.
> Using the qualified name should do the same, but outputs
> ...\include\boost-1_32\boost\multi_index_container.hpp(60) : error C2039:
> 'multi_index_node_type' : is not a member of 'boost::detail'
> Where's the difference?
>
> 60 #include <boost/multi_index_container.hpp>
> 61 #include <boost/multi_index/ordered_index.hpp>
> 62
> 63 using boost::multi_index_container;
> 64
> 65 int main( int argc, char* argv[] )
> 66 {
> 67 multi_index_container< int > mic;
> 68 return 0;
> 69 }
>
> 70 #include <boost/multi_index_container.hpp>
> 71 #include <boost/multi_index/ordered_index.hpp>
> 72
> 73 int main( int argc, char* argv[] )
> 74 {
> 75 boost::multi_index_container< int > mic;
> 76 return 0;
> 77 }

Yes, MSVC++ 6.0/7.0 has problems locating a class template imported into
a namespace with using. You can use the following instead:

boost::multi_index::multi_index_container< int > mic;

Anyway, I should comment on this in the compiler specifics section.

HTH,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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