Boost logo

Boost :

From: tal boost (tal.boost_at_[hidden])
Date: 2006-02-21 13:00:50


Hi,

Trying someting like this
typedef NodePtrSet::index<hndl>::type index_hndl_type;
//complier complains two few arguments
Note: hndl is a tag name
////
so I defined the following:

typedef nth_index<NodePtrSet,0>::type hndl_index_type;
typedef nth_index<NodePtrSet,1>::type group_index_type;

...
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

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?
2. How to I get access to the non_unique_index

This is too good to give up on
Can someone help me?

Regards,
t.a
On 2/20/06, Joaquín Mª López Muñoz <joaquin_at_[hidden]> wrote:
>
> tal boost ha escrito:
>
> > Hello,
> >
> > I having difficulties getting multi_index working with shared_ptr
> >
> > Example code:
> >
> > typedef multi_index_container<
> >
> > NodePtr,
> >
> > indexed_by<
> >
> > ordered_unique<
> >
> > BOOST_MULTI_INDEX_CONST_MEM_FUN(NodePtr, handle,
> > getHandle)
> >
> > >
> >
> > >
> >
> > > node_set;
> >
> > NodePtr is a typedef to boost::shared_ptr<NodeBase>
> >
> > NodeBase is an interface for other NodeTypes objects the use it.
> >
> > NodeBase ::getHandle() : handle (handle==size_t)
> >
> > Using MSVC++ 6.0 compilers complains that getHandle is not a member of
> > NodePtr
> >
> > If I replace NodePtr with NodeBase class it compiles, with a price of giving
> > away shared_ptr abilty.
> >
> > Does anyone have any idea how to get both libs work?
> >
>
> OK. You should define your NodePtr_set as follows
>
> typedef multi_index_container<
> NodePtr,
> indexed_by<
> ordered_unique<
> BOOST_MULTI_INDEX_CONST_MEM_FUN(NodeBase,handle,getHandle)
> >
> >
> > NodePtr_set;
>
> Note that elements are NodePtrs, but the index is based on NodeBase.
>
> This is explained at
>
> http://boost.org/libs/multi_index/doc/advanced_topics.html#advanced_key_extractors
>
> It is possible that you missed that part.
>
> > Regards
> > Tal Agmon
>
> Best regards,
>
> Joaquín M López Muñoz
> Telefónica, Investigación y Desarrollo
>
> _______________________________________________
> 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