I have a rather plain/obvious iterator solution going, but thought I'd tap SO to see if someone comes up with one of the occasional amazing recipes that crop up in answers around here :)
The situation is the following:
- Multiple vectors of int of known and available size, currently stashed in a
vector<vector<int>>, can't work around this due to a mix of API reqs and number of vects being only known at run-time - There can be any number of these, but realistically speaking it's always between a handful and a dozen or so (Vectors)
- Order is unimportant, so sorting and sequencing tricks and optimizations are fair game (not that at this stage I've found any need for it, but given the bonus question below they might crop up)
- The vectors at that point are disposable, so move tricks are also fair game
- Size is usually small, but in rare yet not illegal edge cases there could be upwards of a few million ints ins some or even all of these
- Memory not much of an issue, there will usually be several GBs of contiguous memory available at any given time and this is not a critical system
- Performance isn't critical, it's a pre-flight check, but since it's still user facing it can't look like the app is hanging. A small handful of seconds for the edge cases kind of scenario.
As I'm currently bound between two APIs with strict binary requirements this is GCC 4.1.x limited, so an absolute and maddening lack of any C++0x, Boost 1.44 available though.
At present time these vects all contain unique indices, but in the future producing a single filtered array with duplicates removed (future uses might involve feeds with overlapping indices) might also become a requirement, so bonus points if that's handled.
C++11 solutions or anything related still welcome. I'm not looking for someone to do my homework, I have a clunky but working piece out anyway, I'm more after enlightenment and cookbook inspiration than anything.
Thanks in advance