What is the correct usage of StringValue in C++.

google::protobuf::StringValue* test = new google::protobuf::StringValue();
test->set_value("some string");

someRequest.set_allocated_value(test);

Do i have to delete the StringValue manually at the end? Why this isn't 
possible?
std::unique_ptr<google::protobuf::StringValue> test (new 
google::protobuf::StringValue());
test.get()->set_value("some string");

someRequest.set_allocated_value(test.get());

When i use a smartpointer i got errors when the destructor of the request 
is called.

And why there are no examples for StringValue. Also the official c++ 
documentation of protobuf is using string instead of StringValue.

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/0cf07260-3335-4162-854f-17c49f4243c1%40googlegroups.com.

Reply via email to