Question about set in cpp

If I remove an element that is not present in a set will it give an exception?

First of all how can you do that ??

if i created a set inserted some elements . erase one element that may be or may not be in set.If element is not present will it throw exception?

Why don’t you simply try doing that ? Or why don’t you Google search ?

Afaik it doesn’t give any exception.


that only how do you remove I asked
I don’t think it is possible

sir,like this:

set st;

First check whether that element is included in set or not, and then erase, like this:

set <long long> st;
if(st.count(8) == 0) {
    cout << "Element not found" << endl;
else {
    cout << "Element found" << endl;