I need to add each item from my function into a list, array or a vector container. But i'm unsure which one or how to do so.. i need to then later access that list and cycle through one by one.
Here is the code i'm using, any help is appreciated!
So, the first thing to do is to fix your return type. For simplicity sake, I suggest returning an std::vector as a copy. Yes it's expensive but it's also easy. Another easy alternative is to accept a pointer to an std::vector as an argument. That would be computationally cheaper while still being simple to use and easy to read. Why are we using a template for iterators? Pretty much all of the standard existing containers have those built in already.