- std::string::assign range - 3 Updates
- std::string::assign range - 1 Update
- Formatting for casts - 1 Update
Victor Bazarov <v.bazarov@comcast.invalid>: Mar 05 05:47PM -0500 On 3/5/2015 5:26 PM, Victor Bazarov wrote: > Inserting into a text string, one character at a time, at the beginning, > most likely involves too many reallocations and too many copy > operations. OK, I take it back. I obviously don't know how 'std::inserter' works. > Have you tried profiling your program? Still, the only way to know for sure why the iterator method is slower is to profile it. V -- I do not respond to top-posted replies, please don't ask |
Christopher Pisz <nospam@notanaddress.com>: Mar 05 05:14PM -0600 On 3/5/2015 4:47 PM, Victor Bazarov wrote: > Still, the only way to know for sure why the iterator method is slower > is to profile it. > V I am not sure how to go about profiling it any deeper. I'd have to start the research and purchase of a native C++ profiler campaign up again. The last one ended in failure. Supposedly the Windows SDK comes with Xperf according to Google and that can be used. I don't know where to start, but its worth learning at this point. -- I have chosen to troll filter/ignore all subthreads containing the words: "Rick C. Hodgins", "Flibble", and "Islam" So, I won't be able to see or respond to any such messages --- |
Christopher Pisz <nospam@notanaddress.com>: Mar 05 05:26PM -0600 On 3/5/2015 5:19 PM, Stefan Ram wrote: > Otherwise, it's simple, because the rest of the program > can always be written in a single line (assuming it does > not include preprocessor directives). You a funny guy! Statement. One statement. -- I have chosen to troll filter/ignore all subthreads containing the words: "Rick C. Hodgins", "Flibble", and "Islam" So, I won't be able to see or respond to any such messages --- |
ram@zedat.fu-berlin.de (Stefan Ram): Mar 05 11:19PM >I know there exists a way to copy a filestream into a string in one >line If you take the required #include lines into account, it's not possible, because every #include line must be written on its own line. Otherwise, it's simple, because the rest of the program can always be written in a single line (assuming it does not include preprocessor directives). |
Paavo Helde <myfirstname@osa.pri.ee>: Mar 05 02:05AM -0600 Paul N <gw7rib@aol.com> wrote in > But this is still ugly, and is difficult to read - the round brackets > look like an optional extra instead of being an essential part of the > cast. This just tells that you have not written enough templated C++ code yet. > Does anyone have anything better? Or is it the case, as one > tutorial seemed to hint, that the casts are deliberately ugly to > dissuade people from writing code that uses them? This, and they are easier to search in the codebase than the C-style casts. You can hide it by wrapping the cast in a suitable function. This example looks like it is preparing some kind of Windows tooltip structure or like. In this case the buffer pointed to by the lpszText member may be modified by the tooltip functions or not, depending on the flags and usage. It might be a good idea to encapsulate this tooltip setup in a single function which also contains assert statements checking that the flags and usage are such that const_cast is indeed benign. hth Paavo |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment