Comment #3 on issue 336 by olafvds...@gmail.com: Support generic string type
http://code.google.com/p/protobuf/issues/detail?id=336

Compare 1, 2 and 3. Which one looks cleaner?

array<char, 20> a();
string s();
vector<char> v();

1. { auto z = a(); b.set_field(z.data(), z.size()); }
2. b.set_field(s());
3. { auto z = v(); b.set_field(z.data(), z.size()); }

and will potentially be broken if the template type has data() and size() but doesn't work like string.

Maybe you should remove the (const char*) overload too, as it might not be a null terminated string... ;) Seriously, what's the chance a developer uses such a class with set_field() and doesn't get compile errors?


--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to