Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-10-30 01:54:56


Joaqu?n M? L?pez Mu?oz wrote:

> For those interested, prelerease 7 of indexed_set is available at:
>
> http://groups.yahoo.com/group/boost/files/indexed_set.zip

[...]

> A quote from the introduction for those unfamiliar with the
> library:
>
> "The Boost.IndexedSet library provides a template class named
> indexed_set which enables the construction of set-like containers
> maintaining one or more indices according to given comparison
> predicates.

Hi Joaqu?n,

some time ago I wrote a class called numbered_set. It was like a set (i.e
efficiently checked for duplicates) but had additional integer index, so
that all elements could be obtained by the index in constant time.

Will it be possible to mimic this functionality using your library? I've
quickly browsed the docs and did not find if it's possible.

One more small comment. The 'tagged indices' might not be the right
solution: they mean that I need to introduce more-or-less global type
'name' just because I want to store employee in an indexed_set. Is it
workable to use 'member' function to specify index. E.g. instead of

    typedef employee_set::index_type<name>::type employee_set_by_name;

to write

    typedef employee_set::index_type<
         member<employee, std::string, &employee::name> >::type
         employee_set_by_name;

I also think that

    member<employee, std::string, &employee::name>

is too verbose, though I'm not all all sure it can be made shorter.

And the final note: what if employee::name is a method, not member variable?
This does not seem to be supported. It it by design, technical problems or
lack of time?

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk