I'm trying to decide whether to create a union for convenience. A class I have contains several instances of an object, some of which are in vectors. It looks something like this:
In my code, I'll need to process each Cell in this object. If I don't use a union, I'll need two "for" loops and two individual calls (I think). If I could union them with one array, I could just make one call.
So...is this possible? Is this a good idea? Am I trying to get too fancy?
I'm not doing anything with the vectors other than creating them, and referencing members with the "at" function.
If I understood correctly, you have some functions that you apply to the various vectors. You are then thinking "hey, this feels like rework somehow, can I do this in one shot?". My answer is: Unless you have repeated cells in the vectors, I don't think it is repetitive work. I mean, it sure feels like it, but you have them separated for a reason.
In other words: If the contents of one vector is similar to another vector, then you could gain something by calculating the set union of the two before processing. Otherwise keep as is.