title: Setting filed of a Message inside Message Protobuf
body: <p>I have the following protobuf definition:</p>
  
  <pre><code>message CBMessage {
  
      required int32 type = 1; //defines the kind of message that we send
      optional RepoMessage repomessage = 2;
  
      message RepoMessage { 
          optional int32 nodeid = 1;
          optional int32 timestampsec = 2;
          optional int32 timestampmicrosec = 3;
      }
  }
  </code></pre>
  
  <p>As you can note, the <code>repomessage</code> filed, is a filed of the "outer" message <code>CBMessage</code>.</p>
  
  <p>I would like to access to <code>nodeid</code> filed (of the "inner" message <code>RepoMessage</code>) in order to modify this parameter. So I create a CBMessage object:</p>
  
  <pre><code>CBTxMessages::CBMessage* cbmsg;
  this-&gt;cbmsg = new CBTxMessages::CBMessage;
  </code></pre>
  
  <p>And I have tried to modify the <code>nodeid</code> filed in this way:</p>
  
  <pre><code>this-&gt;cbmsg-&gt;repomessage().set_nodeid(message[0]);
  </code></pre>
  
  <p>Yet, I get the following error when I compile:</p>
  
  <blockquote>
    <p>error: pasar ‘const CBTxMessages::CBMessage_RepoMessage’ como el argumento ‘this’ de ‘void CBTxMessages::CBMessage_RepoMessage::set_nodeid(google::protobuf::int32)’ descarta a los calificadores [-fpermissive]</p>
  </blockquote>
  
  <p>(The error is in Spanish but I think that you can understand).A possible translation will be:</p>
  
  <blockquote>
    <p>"the 'this' argument of 'void CBTxMessages :: CBMessage_RepoMessage :: set_nodeid (google :: protobuf :: int32)' discards the qualifiers")</p>
  </blockquote>
  
  <p>I have investigated it and found that the problem is related to the fact that the "basic getter" of the <code>repomessage</code> filed returns (<code>repomessage()</code>) is returned as const reference (thus it can not be modified directly), but I do wish to modify it.</p>
  
  <p>How can I solve this ?</p>
  
  <p>Thanks.</p>