
private: template<class Pwd, class ExpectedPwd> void set_impl( Type const& value , typename boost::enable_if<boost::is_same<Pwd, ExpectedPwd> >::type* enable =0 ) { value_ = value; }
Actually ExpectedPwd is not required as template parameter, but it helps to understand the flow. It is possible to rewrite the Property as: template<class Type, class PasswordT=void> class Property { public: Type const& get()const { return value_; } template<class PwdT> void set( Type const& value) { set_impl<PwdT>(value); } void set(Type const& value) { set_impl<void>(value); } private: template<class Pwd> void set_impl( Type const& value , typename boost::enable_if<boost::is_same<Pwd, PasswordT>
::type* enable =0 ) { value_ = value; }
private: Type value_; };