Q:

We said that algorithms do not change the size of the containers over which they operate. Why doesn’t the use of back_inserter invalidate this claim

0

We said that algorithms do not change the size of the containers over which they operate. Why doesn’t the use of back_inserter invalidate this claim?

All Answers

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

Because all the changes of the container size are made by the insert iterator, not the algorithm.

The algorithms may

- read elements,

- wirte elements (change the elements in the container),

- reorder elements (change the sequence of the elements in the container),

and the algorithms never

- add/remove elements (change the size of the container).

 

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