Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost][proto] Type inference using transform
From: Eric Niebler (eric_at_[hidden])
Date: 2010-05-07 13:46:33


On 5/6/2010 11:09 AM, Manjunath Kudlur wrote:
>> Thanks, Joel. (Note to self : RTFM more often :)). I also discovered
>> that I didn't have to make the readonly and readwrite classes
>> templated. The following also works :
>>
> This is even simpler :
>
> template<typename T>
> struct readonly
> : proto::callable {
> typedef const T& result_type;
> };

<snip>

If you define it like this:

template<typename T, typename Dummy = proto::callable>
struct readonly
  : proto::callable {
  typedef const T& result_type;
};

... then you don't need this:

> namespace boost { namespace proto {
> template<class T> struct is_callable< readonly<T> > : mpl::true_ {};
> template<class T> struct is_callable< readwrite<T> > : mpl::true_ {};
> } }

HTH,

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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