if it is a std::string, most likely it is not possible. in c++0x you may have option to use moving semantics but i don't see obvious benefit here. if it is a char*, you may do it, however usually it's not a good design.
【在 l*********s 的大作中提到】 : Since the returned value is a substring of the original input, can it be : done without memory copy operations?
【在 t****t 的大作中提到】 : if it is a std::string, most likely it is not possible. in c++0x you may : have option to use moving semantics but i don't see obvious benefit here. : if it is a char*, you may do it, however usually it's not a good design.
Many years ago, I saw a piece of code that tries to modify the string by removing the left-most character, one at a time. That turns an O(n) algorithm into an O(n^2) one, and of course it becomes the bottleneck ...
【在 g*****g 的大作中提到】 : I doubt that'll be a bottleneck in most systems.
【在 p***o 的大作中提到】 : Many years ago, I saw a piece of code that tries to modify the string : by removing the left-most character, one at a time. That turns an O(n) : algorithm into an O(n^2) one, and of course it becomes the bottleneck ...
Not likely if it's a standard function. My point is 20% of codes are ran 80% of time, I prefer the readable code => profile => resolve bottleneck approach. The common mistake is to optimize prematurely.
【在 p***o 的大作中提到】 : Many years ago, I saw a piece of code that tries to modify the string : by removing the left-most character, one at a time. That turns an O(n) : algorithm into an O(n^2) one, and of course it becomes the bottleneck ...
首先LZ就不应该在图书馆大声叫嚷;这个supreviser 没这样说你也只是因为你是顾客 不方便说, 不等于你这样是对的。那个学生工只是说你没说清楚,又没有骂你也没有 大叫, 你为什么要大叫?你就坚持你是说清楚的不就行了? 而且你的原文对前面一段的叙述没有英文。也许就是你的英文没说清楚。“我说只要 是没有check-out的,我都要” 如果你说的是,"as long as it is (they are ) not checked out, I want it(them)", 那他完全可以理解为只要是没有checkout 的任何蓝 光碟,你都会要。给你任何一张,就达到你的要求了。 如果你全部要,应该说, I want all the blue-ray discs that are not checked out. 他拿出来的时候你不应该问, 好像还有什么蓝色星球的? 应该问,“Are you sure that this is the only one that you have?" 就我看来这个学生没必要故意跟你撒谎。很可能就是你没说清楚。当然可能责任在你 说的不清楚, 也可能他
My point is you should retell what you said in English, then we can tell you whether you did not express yourself clearly 你讲故事的时候用中文陈述, 没法判断究竟是你没讲清楚, 还是他理解的问题,或 者故意坑你啊。
这个, i think the situation can only improve if we improve ourselves. Asking/Expecting the other party to improve is never going to solve any problem. Because we can only wish; we cannot make them change.
我的怒槽当时就满了,使出了大招,我用尽全身的力气,让图书馆大厅里每一个角落的 人都能听到的声音对他说:“I was clear on all my words. You('d) bett You are really fucking stupid !!!!!!!!!!!!!!! Shame on you.!!!!!!!!!!!!!!!!