Skip to content

Instantly share code, notes, and snippets.

@skhaz
Last active December 16, 2015 07:28
Embed
What would you like to do?
#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