Boost logo

Boost Users :

Subject: Re: [Boost-users] [tuples, multi-index] tuples::get as key extractor
From: joaquin_at_[hidden]
Date: 2010-08-09 01:54:48


Igor R escribió:
> Hello,
>
> Consider the following types:
>
> typedef tuple<std::string, int> Item;
> typedef multi_index_container<
> Item,
> indexed_by<
> ordered_non_unique<global_fun<const Item &, int, &tuples::get<1> > >
> >
>
>> Items;
>>
>
> The above types don't compile (MSVC10) because of &tuples::get<1>:
> C2440: 'specialization' : cannot convert from 'overloaded-function' to
> 'int (__cdecl *)(boost::tuples::tuple<T0,T1> &)'
> It seems there're several overloaded function templates "tuples::get"...
>
> So, what's the correct type of the appropriate function? Or -- is
> there a more "robust" way to extract the key (without defining
> explicit function-object)?
>

There can be a number of problems in trying to reference Boost.Tuple
extractors
directly. Have a look at

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

for a discussion and a proposed solution (search for
tuple_member_extractor at the
bottom of the post).

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