Skip to content

Instantly share code, notes, and snippets.

@illescasDaniel
Created October 23, 2016 21:33
Show Gist options
  • Save illescasDaniel/ffbfcc380012e0d3db2d28ac99d3745f to your computer and use it in GitHub Desktop.
Save illescasDaniel/ffbfcc380012e0d3db2d28ac99d3745f to your computer and use it in GitHub Desktop.
Change parameter order in functions [C++]
#include <functional>
#include <iostream>
using namespace std;
using namespace std::placeholders;
void show(const string& a, const string& b, const string& c) {
cout << a << "; " << b << "; " << c << endl;
}
int main() {
auto x = bind(show, _1, _2, _3);
auto y = bind(show, _3, _1, _2);
auto z = bind(show, "hi", _2, _1);
x("one", "two", "three");
y("one", "two", "three");
z("one", "two");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment