
Maxim Yegorushkin wrote:
I've been working on a small library - an immutable C++ string. Now it is in usable state and has been put in use in a couple of real projects. Although it needs further polishing, I would like to know is there any interest in such a library?
Here is the link: http://conststring.sourceforge.net/
First, I'll say that yes, I am very interested in a library such as this. Second, let me say that "const_string<>" and "immutable string" don't seem like the right terms to me. The fact that you can call operator?=() and append() on it tell me that there is little that is "const" or "immutable" about it. It seems to me that "cow_string<>" would be more appropriate, but perhaps others have different opinions. Without taking a super-deep look at the code, I will say that it looks fairly clean and appears to appropriately use modern techniques. A small detail is that I would tend to call const_string_storage a policy, since that is basically how it is being used. You could call it a StoragePolicy for the string. Also, types ending in _t tend to be reserved for typedefs of fundamental types. By convention, we usually name template parameters with Capitalized names. charT, Allocator, StoragePolicy, etc. I suppose its not completely a COW string, since you don't support the full set of mutating operations. However, some more documentation would be nice. In particular, I would like to see guarantees about size and performance as compared to basic_string<>, etc. Dave