[ create a new paste ] login | about

Link: http://codepad.org/Js2XNbzF    [ raw code | output | fork ]

pyrtsa_ - C++, pasted on Nov 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <iostream>

struct X {
    int i;
    explicit X(int i) : i(i) {}
    void f() const { std::cout << i << std::endl; }
};

int main() {
    boost::function<void(X const&)> f = boost::bind(&X::f, _1);
    X a(1);
    X b(2);
    f(a);
    f(b);
}


Output:
1
2
1
2


Create a new paste based on this one


Comments: