Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!ub!csn!arrayb!wicklund From: wicklund@intellistor.com (Tom Wicklund) Newsgroups: comp.lang.c++ Subject: Re: How are strings efficiently concatenated? Message-ID: <1991Jun17.234430.8877@intellistor.com> Date: 17 Jun 91 23:44:30 GMT References: <2825@umriscc.isc.umr.edu> Organization: Intellistor Lines: 17 In <2825@umriscc.isc.umr.edu> jamesh@cs.umr.edu (James Hartley) writes: >The expression s1 + s2 will allocate space for "onetwo", but s0 will create >a new copy "onetwo". How is the intermediate string deallocated? What I >would really like to do is write efficient code for the following -- > s0 = s1 + s2 + s3; Another way is to implement an append operation analagous to the "<<" of stream output: s0 = ""; s0 << s1 << s2 << s3; Ideally this should then be merged into streams so that a string can act as an input or output stream.