Functional Programming
bind 사용법 예제
hellobird
2019. 3. 23. 12:45
출처 :https://github.com/jwvg0425/ProjectArthas/wiki/%ED%95%A8%EC%88%98-%ED%8F%AC%EC%9D%B8%ED%84%B0-%EA%B0%9C%EB%85%90%EB%B6%80%ED%84%B0-std::function%EA%B9%8C%EC%A7%80
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include <QCoreApplication> #include <iostream> #include <functional> using namespace std; template <typename T> auto co_T(T t_) -> decltype (t_){ cout << typeid (t_).name() << " : " << t_ << endl; return t_; } void show_text(const string& t) { cout << "TEXT: " << t << endl; } int main(int argc, char *argv[]) { function <void ()> f = std::bind(show_text, "Bound function"); f(); return 0; } | cs |