Skip to content

Instantly share code, notes, and snippets.

@skhaz
Last active December 16, 2015 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skhaz/5398392 to your computer and use it in GitHub Desktop.
Save skhaz/5398392 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <functional>
int main(int argc, char **argv)
{
using namespace std;
using namespace std::placeholders;
vector<string> words = { "foo", "bar", "skhaz" };
for_each(words.begin(), words.end(),
bind(&reverse<string::iterator>,
bind((string::iterator(string::*)()) &string::begin, _1),
bind((string::iterator(string::*)()) &string::end, _1)));
copy(words.begin(), words.end(), ostream_iterator<string>(cout, "\n"));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment