Boost logo

Boost :

From: Phil Bouchard (philippe_at_[hidden])
Date: 2008-08-19 01:26:43


"David Abrahams" <dave_at_[hidden]> wrote in message
news:877iae4oeq.fsf_at_mcbain.luannocracy.com...

[...]

>> Let's put it this way. All new "unordered" and multiset containers could
>> easily be implemented as:
>> 1) superc1st<double, list, vector> s1;
>> 2) superc2nd<string, double, map, vector> s2;
>> 3) superc2nd<string, double, map, map> s3;
>
> Sounds reminiscent of boost::graph::adjacency_list.

It's a n-th dimensional container as opposed to adjacent_list. All in all
we will benefit from:
- "unordered" when list is part of the container. Ex.:
    superc<char, _map<char>, _list> s;

- multisets or unordered multisets. Ex.:
    superc<employee, _map<string>, _map<string>, _map<double>, _map<double>,
list> s;

- the vector O(1) access when fragmentation is minimal

- accessing sorted nodes (using map) but still adjacent in memory (vector).
Ex.:
    superc<char, _map<char>, _vector> s = (_node<_map<char>, _vector> [])
{'T', 'h', 'i', 's', ' ', 'i', 's', ' ', 'a', ' ', 't', 'e', 's', 't', '.'};

- interchanging vector iterators to map iterators. Ex.:
    superc<char, _map<char>, _vector> s;
    superc<char, _map<char>, _vector>::iterator i = s[10]; // if new
_vector<>::operator [] returns: _node<> &
    s.find(i, s.end()); // O(log n) find from within a range of iterators
only

- STL code reuse
- easy implementation
- easy to use

-Phil


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