Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2006-03-04 08:24:06


Hello Felipe,

----- Mensaje original -----
De: Felipe Magno de Almeida <felipe.m.almeida_at_[hidden]>
Fecha: Viernes, Marzo 3, 2006 11:22 pm
Asunto: [boost] [multi_index] BOOST_MULTI_INDEX_CONST_MEM_FUN and
membertemplate functions

> Hi,
>
> BOOST_MULTI_INDEX_CONST_MEM_FUN is implemented ths way:
>
> #define BOOST_MULTI_INDEX_CONST_MEM_FUN(Class,Type,MemberFunName) \
> ::boost::multi_index::const_mem_fun<Class,Type,&Class::MemberFunName>
>
> But when I need to do something like this:
>
> typedef boost::tuple<std::string, std::string> tuple;
>
> BOOST_MULTI_INDEX_CONST_MEM_FUN(tuple, std::string const&, get<0>);
>
> It doesnt work because of the two closing brackets that results from
> the macro expansion.
> Couldnt be added a space after &Class::MemberFunName ?
> Here it works ok adding the space.
>

Of course, count on this being committed asap. I've got
a couple of questions, though:

1. Regardless of whether your compiler takes the expanded
macro as containing a '>>' instead of two '>'s, it is my
understanding that a *conformant* preprocessor shouldn't
do this. Is this correct? (I'll add the blank, anyway.)

2. Do you say this particular use of const_mem_fun
(macro problems aside) works for you? Which compiler
and version of Boost (1.33.1,CVS) are you using?
I'm a little surprised because accessing tuple::get
with const_mem_fun is a very tricky issue, as discussed
for instance in the following thread:

http://lists.boost.org/boost-users/2005/12/16087.php

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