yo/containers/set/insert.cc
raw| 1 | #include <iostream> |
| 2 | #include <set> |
| 3 | #include <utility> |
| 4 | using namespace std; |
| 5 | |
| 6 | int main() |
| 7 | { |
| 8 | set<int> |
| 9 | object; |
| 10 | |
| 11 | pair<set<int>::iterator, bool> |
| 12 | result = object.insert(set<int>::value_type(4)); |
| 13 | |
| 14 | cout << "Element " << *result.first << " was " << |
| 15 | (result.second ? "" : "not ") << "inserted\n"; |
| 16 | |
| 17 | result = object.insert(set<int>::value_type(4)); |
| 18 | |
| 19 | cout << "Element " << *result.first << " was " << |
| 20 | (result.second ? "" : "not ") << "inserted\n"; |
| 21 | } |