#include <iostream> #include <set> using namespace std; int main () { set<int> 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; } |
----------------------------------------------------------------------------