|
Boost : |
From: Roland (roland_at_[hidden])
Date: 2002-01-18 08:41:57
> > > I never understood what the benefits of doing it differently might be, so I
> > > had nothing to say. If it is just an implementation detail, and it avoids
[...]
> Agreed, that's crucially important! Why will the code be faster?
Performance was just one reason for me trying an alternative tuple implementation;
the main reason, however, was my interest in tuples of containers, and
tuples of iterators.
What I'm thinking of is to write something like the following:
vector<int> a; vector<double> b; vector<string> c;
tuple< vector<int>, vector<double>, vector<string> > t( a,b,c );
// Is it the same as vector< tuple<int, double, string> >?
// Close to? Or completely different?
t[0] = tuple<int, double, string>( 42, 3.14, "foo" );
tuple< vector<int>, vector<double>, vector<string> >::iterator it;
// Is the same as tuple< vector<int>::iterator,
// vector<double>::iterator, vector<string>::iterator >
for( it = t.begin(); it != t.end(); ++it ) // requires begin(), end(), ++
etc.
Of course there are still a couple of unsolved issues, for instance,
how to deal with different container types / sizes etc.
And perhaps it's a bad idea to stuff all this functionality
into one tuple class.
Another way would be to use zip_view of the View Template Library,
but I'd like to tie together more than two containers.
- Roland
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk