I don't know about any other implementations, but a word of caution: I think that this would be especially complicated/hacky for gcc 4.3, which as I recall switched to a copy-on-write implementation for std::string. You'd probably want to make sure that the performance difference is really worth it.
On Thu, Mar 4, 2010 at 9:25 AM, Sean Rhea <[email protected]> wrote: > All, > > Does anyone have an implementation of STLStringResizeUninitialized > (see stl_util-inl.h) for gcc version 4.3.2? > > The inability to use std::string as a zero-copy buffer has been a > long-running annoyance of mine, and I'm really excited by the > string_as_array function provided in stl_util-inl.h. Unfortunately, > it isn't worth as much without STLStringResizeUninitialized, since you > still end-up zero-filling the array (via resize) before writing into > it. > > I understand why Google wouldn't want to include their version by > default, as until the standard catches up it will by necessity be an > ugly hack, but it would be great to have an implementation for my own > use. > > As far as I can tell, vector<char> suffers from the same problem (no > way to resize without zero-filling the array). > > Sean > -- > "I refuse to accept the idea that the ‘isness’ of man’s present nature > makes him morally incapable of reaching up for the eternal ‘oughtness’ > that forever confronts him." --MLK > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<protobuf%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
