RepeatedPtrField

164 views
Skip to first unread message

Charles Hong

unread,
Jul 24, 2023, 5:19:41 PM7/24/23
to Protocol Buffers
Hello,
Is there a way to directly allocate a RepeatedPtrField with n empty pointers? I know that there is a Reserve() function, but that doesn't change the current_size variable. I am wondering why there is no "Resize()" function for RepeatedPtrField (not RepeatedField), similar to std::resize for a vector.

Best,
Charles

Samuel Benzaquen

unread,
Jul 25, 2023, 3:10:05 PM7/25/23
to Charles Hong, Protocol Buffers
On Mon, Jul 24, 2023 at 5:19 PM Charles Hong <chon...@ucr.edu> wrote:
Hello,
Is there a way to directly allocate a RepeatedPtrField with n empty pointers? I know that there is a Reserve() function, but that doesn't change the current_size variable. I am wondering why there is no "Resize()" function for RepeatedPtrField (not RepeatedField), similar to std::resize for a vector.

Currently, there isn't a Resize, no.
We are working on adding a more STL interface to these types, so a `resize` like the one in `std::vector` will exist in the future.
 

Best,
Charles

--
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 protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/caea2f12-ffe5-477d-a0cf-daaebefe60edn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages