-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Use the mutable_header() function instead. This creates the contained
object if it does not already exist, and returns a pointer instead of a
reference.

Chris

On Mon, 13 May 2013 02:34:49 -0700 (PDT)
Barzo <dba...@gmail.com> wrote:

> Hi,
> I have messages defined as:
> 
> message MsgHeader
> {
>   required EMessages  opCode        = 1;
>   required int32      sessionRef    = 2;
>   optional int32      transactionId = 3 [default = 0];
>   optional int32      status        = 4 [default = 0];
> }
> 
> message MSG_EVENT_METHOD_STATUS
> {
>   optional EMessages    opCode      = 1 [default = 
> E_MSG_EVENT_METHOD_STATUS];
>   required EMessages    opCodeSent  = 2;
>   required MsgHeader    header      = 3;
> }
> 
> In my code, when I wanna set the header params, I get the compiler
> error C2662 because the header() method is const.
> So I cannot do something like:
> 
> MSG_EVENT_METHOD_STATUS msg;
> msg.header().set_status(0);
> 
> Is there a way to avoid this or I have to make a const_cast on the
> header()?
> 
> BR,
> Daniele.
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iF4EAREIAAYFAlGRbhEACgkQMcVpqLZH/3xiVgD+Pzl+ZIwViRBGC2Czv/+y8Q+s
yjE1BncDwQI7RyJNOfMA+gP9O1FCTa9HIcKu4GM50o615D4h+NCzpkv+Koo/HTVj
=/e9k
-----END PGP SIGNATURE-----

-- 
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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to