Boost logo

Boost :

From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2006-02-21 16:57:00


Hello Tal,

tal boost <tal.boost <at> gmail.com> writes:
>
> Hi,
>
> Trying someting like this
> typedef NodePtrSet::index<hndl>::type index_hndl_type;
> //complier complains two few arguments
> Note: hndl is a tag name

I assume from previous posts of yours that you're
using MSVC++ 6.0, right? If so, you cannot use the
syntax your_container_type::index<...>, as explained in:

http://boost.org/libs/multi_index/doc/compiler_specifics.html#msvc_60

Please have a good read at this, since MSVC++ 6.0 has
serious limitations affecting the usage of Boost.MultiIndex.
Making the lib work for this compiler is not for the
faint of heart, although it can be done.

> ////
> so I defined the following:
>
> typedef nth_index<NodePtrSet,0>::type hndl_index_type;
> typedef nth_index<NodePtrSet,1>::type group_index_type;

OK. Note that what makes this compile, as compared
with your previous attempt, is not the use of nth_index
(though this might help), but your choice of global
nth_index instead of

// won't work in MSVC++ 6.0
typedef NodePtrSet::nth_index<0>::type hndl_index_type;
typedef NodePtrSet::nth_index<1>::type group_index_type;

as explained in the aforementioned page.

>
> ...
> When I try to write
> group_index_type& g_type = get<group>(ns); // tag<group>
> complier tells me the I have to increase /Zm which i did.(to /Zm1024)
> but still I receive this annoying message.
>
> z:\boost\mpl\aux_\preprocessed\msvc60\iter_fold_if_impl.hpp(65) :
> fatal error C1076: compiler limit : internal heap limit reached; use
> /Zm to specify a higher limit
>
> If I apply this line instead
>
> hndl_index_type & h_type = get<hndl>(ns);
>
> I get the following errors:
> //error C2667: 'get' : none of 2 overload have a best conversion
> //error C2668: 'get' : ambiguous call to overloaded function
>
> What I care is to get access using my keys and I don't know how to do it
>

Your first problem has been reported in the past and
is somewhat alleviated in the version of Boost.MultiIndex
shipping with Boost 1.34; as for the second problem I don't
really know what's happening, some sample code showing that
behavior would be useful.

Anyway, my suggestion is that you entirely omit
the use of tags (i.e, define the indices without tags)
and use ordinals instead:

hndl_index_type & h_type = get<0>(ns);
group_index_type& g_type = get<1>(ns);

As it happens, omitting tags seem to greatly relieve
stress on the compiler. Furthermore, by using enums
you can have some of the convenience of tags:

enum{hndl=0,group=1};

...

hndl_index_type & h_type = get<hndl>(ns);
group_index_type& g_type = get<group>(ns);

Please try this approach and report your results back.
Thank you!

> I am able to run on the first one with no problem
> e.g doing the following
> NodePtrSet::iterator it = ns.find(theHandle); //works
> 1. How to i rewrite the latter line to explictly tell it to find theHandle?

I don't get you. This is exactly what the line above does.

> 2. How to I get access to the non_unique_index

Hopefully my prior suggestion on using ordinals rather
than tags will help here.

>
> This is too good to give up on

I'm glad you like the lib, despite the effort it takes
to make it work under MSVC++ 6.0. Modern compilers
don't choke that much, in case you can consider
upgrading.

Good luck with your project.

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