Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2004-04-24 20:35:31


----- Mensaje original -----
De: Jeremy Maitin-Shepard <jbms_at_[hidden]>
Fecha: Sábado, Abril 24, 2004 11:13 pm
Asunto: Re: [boost] [multi_index] composite keys: request for advice

> Joaquin M Lopez Munoz <joaquin_at_[hidden]> writes:
>
> > [snip: composite key system]
>
> > composite_key</* as before*> ck;
> > ck(record(1,2,3))<=make_tuple(1,2); // yields true
>
> This is not lexicographical order. According to lexicographical
> ordering:
>
> (1, 2) < (1, 2, 3)
>

I did not claim that composite_key results and
tuples are ordered lexicographically. What I said
is that, given that a composite_key induces a
lexicographical order on the elements of the
multi_index_container it is used in, this can be
taken advantage of to perform searches where
only the first keys are given. For this to
work, (1, 2) must be equivalent to (1,2,3) (meaning
that !((1, 2)<(1,2,3)) and !((1,2,3)<(1,2)). I
don't think there's any flaw with this approach,
my doubt is about whether the fact that

ck(record(1,2,3))<=make_tuple(1,2) and
make_tuple(1,2)<=ck(record(1,2,3))

is reason enough to also make

ck(record(1,2,3))==make_tuple(1,2)

hold true.

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