Boost logo

Boost Users :

Subject: Re: [Boost-users] [Multi-Index] Chained Ptr misunderstanding
From: joaquin_at_[hidden]
Date: 2009-04-14 01:52:17


Dominique Devienne escribió:
> Hi. I'm trying to use a shared_ptr as the value_type of a
> multi_index_container, but I'm not having any success with the key
> extractors (VS2005, 1.38).
>
> [...]
> ordered_unique<
> BOOST_MULTI_INDEX_CONST_MEM_FUN(
> shared_ptr<Foo>, const Uid&, uid
> )
> >
>

Replace the declaration above with

  ordered_unique<
    BOOST_MULTI_INDEX_CONST_MEM_FUN(
      Foo, const Uid&, uid
    )
>

That is, you must specifiy keys as if there weren't any intervening pointers
--dereferencing is taken care of automatically by Boost.MultiIndex
predefined extractors.

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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net