How do you add a repeated field using Google's Protocol Buffer in C++?

No, you're doing the right thing.

Here's a snippet of my protocol buffer (details omitted for brevity):

message DemandSummary
{
    required uint32 solutionIndex     = 1;
    required uint32 demandID          = 2;
}
message ComputeResponse
{
    repeated DemandSummary solutionInfo  = 3;
}

...and the C++ to fill up ComputeResponse::solutionInfo:

ComputeResponse response;

for ( int i = 0; i < demList.size(); ++i ) {

    DemandSummary* summary = response->add_solutioninfo();
    summary->set_solutionindex(solutionID);
    summary->set_demandid(demList[i].toUInt());
}

response.solutionInfo now contains demList.size() elements.