Boost logo

Boost Users :

Subject: Re: [Boost-users] [Fusion] Adapting read-only fields of ADTs
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-04-12 11:15:41


On 4/11/2011 7:05 PM, Tore Halvorsen wrote:
> On Mon, Apr 11, 2011 at 9:18 AM, Sebastian Redl
> <sebastian.redl_at_[hidden]> wrote:
>> Hi,
>>
>> How would I use BOOST_FUSION_ADAPT_ADT to turn an ADT that doesn't expose
>> setters into a read-only sequence? In other words, what do I pass as
>> set_exprN if there is no valid set expression?
>
> Just pass it nothing.
>
> e.g.
>
> BOOST_FUSION_ADAPT_ADT(
> name,
> (std::string const&, std::string const&, obj.get(), )
> ;

That's a good workaround, but really, we ought to have read-only
adaptors. Doing above would still allow elem = val; albeit will
be a no-op.

Please add a trac "feature request" ticket, if you will.

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://boost-spirit.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