HELP PLS Troubles with iterators C++

Revision en1, by Dgeka24, 2020-04-01 01:40:11

Why is here it==it1?

    set<ll> st;
    st.insert(1);
    auto it = st.begin(); auto it1=st.begin();
    it1--;
    if(it==it1){
        cout << "HERE\n";
    }

But if increase size of set, it!=it1

    set<ll> st;
    st.insert(1); st.insert(2); st.insert(3);
    auto it = st.begin(); auto it1=st.begin();
    it1--;
    if(it==it1){
        cout << "HERE\n";
    }

And this code just crushes the program?

    set<ll> st;
    auto it = st.begin(); auto it1=st.begin();
    it1--;
    if(it==it1){
        cout << "HERE\n";
    }

Thanks in advance

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru1 Russian Dgeka24 2020-04-01 01:42:23 666 Первая редакция перевода на Русский
en1 English Dgeka24 2020-04-01 01:40:11 669 Initial revision (published)