0
Anyone know how to make a function parameter so that any stl container(vector, list, deque etc) can use it if we need to in cpp?
The function just prints the container
2 Réponses
+ 2
Can you add a brief explanation in the Description about what the function does with the container?
0
Kareem,
I'm not sure whether this answers your query, but if the container supports forward iteration (by the use of std::begin() and std::end()), I guess it is possible by implementing template for the function.
Some containers e.g. std::bitset, std::queue, std::stack apparently are not implemented with forward or random direction iterator, so they might not be an option.
std::deque however, does implement iterators.