#include <boost/utility.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
namespace ki {



template<typename T>
class property
	: boost::noncopyable
{
private:
	typedef boost::function<T>              GetterType;
	typedef boost::function<void, const T&> SetterType;

public:
/*
	template<typename G>
	property( G g )
		: getterFunc( g )
	{
	}

	template<typename G, typename S>
	property( G g, S s )
		: getterFunc( g )
		, setterFunc( s )
	{
	}
*/

	template<typename Owner, typename G>
	property( Owner p, G g )
		: getterFunc( boost::bind( g, p ) )
	{
	}

	template<typename Owner, typename G, typename S>
	property( Owner p, G g, S s )
		: getterFunc( boost::bind( g, p ) )
		, setterFunc( boost::bind( s, p, _1 ) )
	{
	}

public:
	operator T() const
	{
		return getterFunc();
	}

	property& operator=( const T& rhs )
	{
		setterFunc( rhs );
		return *this;
	}

private:
	const GetterType getterFunc;
	const SetterType setterFunc;
};



}