Yah, after looking back over my problem I refactored and removed the const 
ref. Just need to take my eyes of the problem for a bit.

Thanks for the help.

On Monday, October 27, 2014 11:15:32 AM UTC-6, Oliver wrote:
>
> On 24 October 2014 17:28, Peter Hubner <[email protected] <javascript:>> 
> wrote: 
> > All I am trying to achieve is to modify a message on the fly with a set 
> of 
> > fields that are supplied to the program at runtime. 
> > 
> > simple case: 
> > // message declared as - const google::protobuf::Message& message 
> > auto x = reflection->GetDouble(message, field); 
> > // do some modification to x 
> > reflection->SetDouble(message, field, x); 
> > 
> > my main question is how in the world do I get from a const ref (needed 
> for 
> > GetDouble() ) to a pointer (needed for SetDouble() )??? 
>
> const_cast<Message*>(&message) 
>
> This obviously casts away constness which is something to be careful 
> about. 
> If you want to mutate the message, why are you starting with a const ref? 
>
> Oliver 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to