Boost logo

Boost Users :

From: JOAQUIN M. LOPEZ MUÑOZ (joaquin_at_[hidden])
Date: 2008-07-23 13:58:17


________________________________________
De: boost-users-bounces_at_[hidden] [boost-users-bounces_at_[hidden]] En nombre de Igor R [boost.lists_at_[hidden]]
Enviado el: miércoles, 23 de julio de 2008 19:53
Para: boost-users_at_[hidden]
Asunto: [Boost-users] [boost-users][multi-index] passing modifier byreference/pointer?
>
> Hello,
>
> Is there a simple way to pass a modifier by reference/pointer in the
> following expression:
>
> my_multi_index_container.modify(somePos, modifier);
>
> "modifier" is a functor that has some internal state, so I wouldn't
> like it to be copied.
> Is it possible to do this without an explicit creation of a binder
> that binds operator() and &modifier (or so)?

The following should do:

  modifier_type modifier(...);
  ...
  my_multi_index_container.modify<modifier_type&>(somePos, modifier);

HTH,

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