I'm making a class - let's call it Container
- that is basically just containing a std::vector
and some special logic that decides how are the vector values picked. I want to add a method for adding multiple values to my class with one call. This is my method that adds one item:
void LoopGenerator::add(RandomStripe &stripe)
{
stripes.push_back(new SingleStripe(stripe));
}
I'd like a similar method that would be called like this:
LoopGenerator gen = LoopGenerator();
gen.add(RandomStripe(), RandomStripe(), RandomStripe() ... and as much as you want ... );
and would add all parameters to the inner std::vector
.
Is this possible to do just with standard libraries, or best without them?