Created
August 11, 2009 13:55
-
-
Save bradtgmurray/165836 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
#include <algorithm> | |
#include <functional> | |
#include <vector> | |
class A | |
{ | |
int value; | |
public: | |
void Add(int num) | |
{ | |
value += num; | |
} | |
}; | |
std::vector<A> numbers; | |
// Add 2 to each object in the vector. | |
// Ohhhh yeahhhh | |
// Errr, should this be bind1st or bind2nd? | |
std::for_each(numbers.begin(), numbers.end(), | |
std::bind1st(std::mem_fun_ref(&A::Add), 2)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment