All pastes #916738 Raw Edit

Untitled

public text v1 · immutable
#916738 ·published 2008-02-24 21:50 UTC
rendered paste body
#include <iostream>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/noncopyable.hpp>
#include <tr1/functional>
#include <boost/ref.hpp>


struct S
{
	int value;
};


void func(std::tr1::function < void(int const, S const &) > f, S const &s)
{
	f(3, s);
}


class X
{
public:
	void member(int const a, S const &s)
	{
		std::cout << "member " << a << " " << s.value << std::endl;
	}
};


int main()
{
	X x;
	S s;
	s.value = 1;
	using std::tr1::placeholders::_1;
	using std::tr1::placeholders::_2;
	func(std::tr1::bind(&X::member, &x, _1, _2), s);

	return 0;
}