Q:

Why do you think the algorithms don’t change the size of containers

0

Why do you think the algorithms don’t change the size of containers?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

We pass only iterators to algorithms, not containers, so the algorithms have no direct access to the container members. If we want change the size of a container, we must do it by calling the cotainer members. Thus the algorithms cannot change the size of containers.

Insert iterator, however, has access to container members when we pass the container to it. Thus it can change the size of containers.

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now