Created
October 23, 2016 21:33
-
-
Save illescasDaniel/ffbfcc380012e0d3db2d28ac99d3745f to your computer and use it in GitHub Desktop.
Change parameter order in functions [C++]
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 <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