Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2003-12-22 15:47:08


"Jason House" <jhouse_at_[hidden]> wrote

[indexed_set discussion]

> There is another criteria that I think should be important: Enabling the
> user to alter the "one powerful data structure" after the "simple
> algorithms" have been written. My concern is that when indexed_set
> replaces one index with another (ie. in terms of underlying data
> structure), the manipulating functions will change. I would hope that a
> diversity of index types could be made that all shared the same
> interface. For that very reason, I've been thinking that it might be
> nice to see a few diverse index types implemented for the review of
> indexed_set.
>
If I understand you correctly, this is here. Indexes have the same interface
and differ only in type.

E.g. switching from index#0 to #1 means replacing:

employee_set::nth_index_type<0>::type& name_index=es.get<0>();

with:

employee_set::nth_index_type<1>::type& name_index=es.get<1>();

and the rest of code remains the same.

> Another interesting thought that I had (after reading what you wrote) is
> that it would be nice if the data structure could be accessed by views,
> independent of if those views exist to begin with. I'm thinking along
> the lines of SQL databases where certain columns are indexed and others
> are not. What I'm thinking is that it would be nice if the fact that
> something is indexed or not would not change how the accessing code is
> written (like in SQL). This would really allow massive changes in the
> underlying data structure without rewriting of code (something that I
> really like to avoid doing).
> To clarify this, I'm thinking of a templated get-like function where
> the template parameter is the sorting functor (possibly even a few other
> policy-like parameters to help selection of the best index or iterator).
> Does that sound off the wall? Or is that a good idea?
>
This sounds as 'indexing on demand' feature. I'll think over it. It may be
possible
to have this feature already with current implementation but we didn't try
yet.

Thanks for your opinion.
/Pavel


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