I make a class - let it be Container- it just contains std::vectorsome special logic that decides how vector values are chosen. I want to add a method to add multiple values to my class with one call. This is my method that adds one element:
void LoopGenerator::add(RandomStripe &stripe)
{
stripes.push_back(new SingleStripe(stripe));
}
I need a similar method that will be called like this:
LoopGenerator gen = LoopGenerator();
gen.add(RandomStripe(), RandomStripe(), RandomStripe() ... and as much as you want ... );
and add all the parameters to the internal one std::vector.
Can this be done only with standard libraries, or is it best without them?
source
share