Or login with:
| Expression | Description |
|---|---|
| *i | Provides read access to the actual element |
| i->m | Provides read access to a member of the actual element |
| ++i | Steps forward and returns new position (when not null) |
| i++ | Steps forward and returns old position (when not null) |
| i1==i2 | Returns if i1 is equal to i2 |
| i1!=i2 | Returns if i1 is not equal to i2 |
| TYPE() | Creates iterator (default constructor) |
| TYPE(i) | Copies iterator (copy constructor) |
| i1=i2 | Assigns an iterator |
#define _DEFINE_DEPRECATED_HASH_CLASSES 0 #include <iostream> #include <hash_set> using namespace std; using namespace stdext; int main { hash_set <int> hs1; hash_set <int>::iterator hs1_Iter; hash_set <int>::const_iterator hs1_cIter; hs1.insert( 1 ); hs1.insert( 2 ); hs1.insert( 3 ); hs1_Iter = hs1.begin( ); cout <<"The first element of hs1 is "<<*hs1_Iter<<endl; hs1_Iter = hs1.begin( ); hs1.erase( hs1_Iter ); // The following 2 lines would err because the iterator is const // hs1_cIter = hs1.begin( ); // hs1.erase( hs1_cIter ); hs1_cIter = hs1.begin( ); cout <<"The first element of hs1 is now "<<*hs1_cIter<<endl; return 0; }
You must login to leave a messge