#include <iostream>
#include <functional>

using namespace std;

class Notify
{
	using HandlerType = std::function<void ( Notify& )>;
	
	unsigned int Value_;
	HandlerType  Handler_;
	
public:
	Notify() : Value_( 0 )
	{
	}
	
	unsigned int value() const
	{
		return Value_;
	}
	
	void set_value( unsigned int Val )
	{
		if( Val != value() )
		{
			Value_ = Val;
			if( Handler_ )
			{
				Handler_( *this );
			}
		}
	}
	
	void set_handler( HandlerType Handler )
	{
		Handler_ = Handler;
	}
};

Notify n;

class Sink
{
public:
   Sink()
   {
      n.set_handler( std::bind( &Sink::handler, this, std::placeholders::_1 ) );
   }
   
   void handler( Notify& obj )
   {
      std::cout << "Handler called" << endl;
   }
};

int main()
{
   Sink s;
   n.set_value( 123 );
   return 0;
}
