Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8318025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:48:44+00:00 2026-06-08T21:48:44+00:00

Yes, I’ve looked at the C++ standards that I could find (or the drafts),

  • 0

Yes, I’ve looked at the C++ standards that I could find (or the drafts), but I’m not finding any comprehensive of the exception guarantees given by STL containers. All I can find are occasional sections with incomplete descriptions on some of the functions for some of the types. Or perhaps it’s there but I’m just not finding it, I don’t know.

Note: I’m not asking for a list of all the guarantees people can think of, which is basically in this question.
I’m looking for the authoritative source of this information itself — or preferably, a free version of the source (e.g. a draft of the standard) where I can more or less treat as official.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:48:47+00:00Added an answer on June 8, 2026 at 9:48 pm

    Reading the standard can be scary (let’s come back to the standard), but Bjarne Stroustrup has written a really nice appendix on this subject in his book ‘The C++ Programming Language’. He posted this appendix at

    http://www.stroustrup.com/3rd_safe0.html , at
    http://www.stroustrup.com/3rd_safe.pdf

    It’s pretty long and detailed (and well written). You may for example find section E.4 interesting, quote:

    E.4 Standard Container Guarantees

    If a library operation itself throws an exception, it can – and does –
    make sure that the objects on which it operates are left in a
    well-defined state. For example, at() throwing out_of_range for a
    vector (§16.3.3) is not a problem with exception safety for the vector
    . The writer of at() has no problem making sure that a vector is in a
    well-defined state before throwing.

    In addition, section E.4.1 states

    In addition to the basic guarantee, the standard library offers the
    strong guarantee for a few operations that insert or remove elements.

    have a look at page 956. It contains a table of guarantees for various operations for vector, deque, list and map.
    In summary, all operations on those containers are either nothrow or strong, except for N – element insert into map which offers the basic guarantees.

    Note: the above text is old and does not address C++11, but should still be correct enough for most aims and purposes.

    When it comes to C++11…

    the standard first states, about the containers
    array, deque, forward_list, list, vector, map, set, unordered_map, unordered_set, queue,stack:
    at

    23.2.1/10:

    Unless otherwise specified (see 23.2.4.1, 23.2.5.1, 23.3.3.4, and
    23.3.6.5) all container types defined in this Clause meet the following additional requirements:

    — if an exception is thrown by an insert() or emplace() function while
    inserting a single element, that function has no effects.
    — if an exception is thrown by a push_back() or push_front() function,
    that function has no effects.
    — no erase(), clear(), pop_back() or pop_front() function throws an
    exception.
    — no copy constructor or assignment operator of a returned iterator
    throws an exception.
    — no swap() function throws an exception.
    — no swap() function invalidates any references, pointers, or
    iterators referring to the elements of the containers being swapped.

    The quirks pointed out in the respective sections referred to above (each called Exception safety guarantees) are mostly about special against-the-wall cases like when dealing with exceptions from the contained types’ hashing, comparison operations as well as throwing swap and throwing move operations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Yes I know Ruby doesn't have pointers, but that's the closest I could get
Yes, I know that my problem is not the unique, but I have analysed
Yes, I know this question has been asked before, but I can't find an
Yes, I'm aware that this question has already been post, but ... I'm looking
yes this question is asked some times. but I can't find an answer for
Yes, I have seen this question, but I am still finding myself confused: How
Yes, getting the class name by using an exception is a plausible solution, but
yes but i have a problem i have created a controller that inherits from
Yes another question that is a little Unique because I cant find the same
Yes, I know you could use regular objects as associative arrays in JavaScript, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.