[Fusion] Adapting read-only fields of ADTs

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? Sebastian

On Mon, Apr 11, 2011 at 9:18 AM, Sebastian Redl
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(), ) ; -- Eld på åren og sol på eng gjer mannen fegen og fjåg. [Jøtul] <demo> 2011 Tore Halvorsen || +052 0553034554

On 4/11/2011 7:05 PM, Tore Halvorsen wrote:
On Mon, Apr 11, 2011 at 9:18 AM, Sebastian Redl
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

Joel de Guzman
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,
A simple workaround is to fall back to an invalid expression.
--8<---------------cut here---------------start------------->8---
#include

On 4/13/2011 1:18 AM, Christopher Schmidt wrote:
Joel de Guzman
writes: [...]
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,
A simple workaround is to fall back to an invalid expression.
[...] Good idea, Christopher! So perhaps this is just a matter of documentation? Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
participants (4)
-
Christopher Schmidt
-
Joel de Guzman
-
Sebastian Redl
-
Tore Halvorsen