|
An implementation that only makes unique copies when a string is modified is said to use a copy-on-write strategy. This approach saves time and space when strings are used only as value parameters or in other read-only situations.
Whether a library implementation uses reference counting or not should be transparent to users of the string class. Unfortunately, this is not always the case. In multithreaded programs, it is practically impossible to use a reference-counting implementation safely.
这是bruce eckel的thinking in c++卷二中的一段,介绍的是string类,第一段看明白了,是指当字符串要修改的时候才为另一个复制他的对象拷贝复本。第二段不明白,reference counting是什么意思啊?晕晕中,哪位帮忙给翻译或讲解一下,谢谢了。
不知道这贴发到这里合不合适,呵呵,不过常来linuxsir,就不想往别的地方发了,见谅。 |
|