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 in the request i only have these "set_allocated_value" 
functions and not just "set_value"?

And one more thing, 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 
"Protocol Buffers" 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/protobuf/1eb16435-4d86-4df6-9661-ddab223db4d1%40googlegroups.com.

Reply via email to