Boost logo

Boost :

From: Piccolboni, Antonio (Antonio_Piccolboni_at_[hidden])
Date: 2004-07-19 16:57:24


Hi,
 I have n arrays of float and I need to take median of all the
values. I have a nifty templatized implementation median(start
stop) and I don't have the space to make a copy of all the
arrays. Well I do most of the times but I like zero-copy
implementations. So I was thinking that I could use an
itarator that spans multiple ranges. Something like

Vector<float a,b>;
[fill them]

Multiple_range_iterator<vector<float::iterator>
start(a.end(),b.begin()), stop(start);
start = a.begin();
stop = b.end();
cout << median(start, stop);

Of course this needs to be extended to n ranges. The intended
meaning is that incrementing start would apply the increment
operator of the argument type until it reaches a.end(), where
it would jump straight to b.begin(). You can imagine how
random jumps and comparisons are defined. I guess < would
bring trouble. Well, the question is: has anyone seen anything
like this? Does it make sense? Should I start from
iterator_adaptor? Any suggestions (no, "go get another job" is
not admissible)? Thanks

Antonio


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