Exceptions
Team LiB
Previous Section Next Section

Exceptions

If you know you're adding a range, even at the end of a container, prefer to use a range insertion function (see Item 81).

Exponential growth is generous with memory allocation. To fine-tune growth, call reserve explicitlypush_back, resize , and the like never trigger reallocation if they have enough space. To "right-size" a vector, use the shrink-to-fit idiom (see Item 82).

    Team LiB
    Previous Section Next Section