Boost logo

Boost Users :

Subject: Re: [Boost-users] make member functions (in)accessible
From: Stefan Funck (stefanfunck_at_[hidden])
Date: 2009-02-27 05:03:51


This looks brilliant! Thanks a lot!!
Stefan

> >
> > 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_;
> };


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net