Created
January 23, 2011 19:45
-
-
Save berkeley-db/792367 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(dbl_vec_t::iterator itr = v1.begin(); itr != v1.end(); ++itr) | |
*itr *= 2; | |
for (int i = 0; i < v1.size(); i++) | |
v1[i] += 3; | |
v1.swap(v2); // Swap the vector's contents. | |
v2 = v1; // Assign one vector to another. | |
assert(v1 == v2); | |
std::reverse(v1.begin(), v1.end()); | |
// More standard features follow ... | |
for(dbl_vec_t::reverse_iterator ritr = v1.begin(); ritr != v1.rend(); ++ritr) | |
*ritr /= 2; | |
v1.pop_back(); | |
v1.insert(v1.begin(), 34); | |
assert(v1.front() == 34); | |
v2.assign(v1.begin(), v1.end()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment