Trouver les limites des points d’insertion des éléments dans un ‘set’ trié

Author:


Download

    #include 
    #include 
    using namespace std;
    int main ()
    {

        set st;

        st.insert(1);
        st.insert(2);
        st.insert(4);
        st.insert(4);
        st.insert(6);

        cout << "lower_bound(2): " << *st.lower_bound(2) << endl;
        cout << "upper_bound(2): " << *st.upper_bound(2) << endl;
        cout << "equal_range(2): " << *st.equal_range(2).first << " "
                                   << *st.equal_range(2).second << endl;
        cout << endl;
        cout << "lower_bound(4): " << *st.lower_bound(4) << endl;
        cout << "upper_bound(4): " << *st.upper_bound(4) << endl;
        cout << "equal_range(4): " << *st.equal_range(4).first << " "
                                 << *st.equal_range(4).second << endl;
		return 0;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *