Version 0.9.f is released. It includes implementation of the < operator, in addition to some more documentation.
I removed the distinction between str and str_const, in favor of only using the constant version. There isn't really any reason to have a method that returns a copy; if you need a copy you can grab the reference and copy that.
On the web page I note some future plans:
http://david.the-haleys.org/index.php?page=shared-str
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
I'm still planning to make use of this code, I just haven't had the time to do anything with it yet. It looks like it should do exactly what I want though.
I can forsee that adding substr, find, and replace methods would be a huge help if that's at all possible. I have several spots in the code where that would be useful since I'm already using std::string for those now.
SmaugMuds.org: http://www.smaugmuds.org - The Smaug MUDs Community Center
"The past was erased, the erasure was forgotten, the lie became truth." -- George Orwell, 1984
My base is built from Scratch and doesnt really employ the library to its full extent too well, though that will soon change. Thus, I don't really have any problems just yet. I'll be sure to report back once the base perks up and objects/mobs start making more of an appearance.
Installation was nice and easy, especially since you provided an example program. The only problem I had was due to my own stupidity (I had forgotten I had an older version of the include files laying around...).
For the things I was doing, though rather brief, the + and += methods, along with str() and c_str(), handled everything I needed. A few more methods that the std::string class employs might be useful (substr, etc.) as well, though I doubt it would really be needed.
The documentation was very helpful. I wasn't quite sure what I could and could not do, and it until I read the documentation. It, along with the example program, made it very clear.
Overall it seemed very clear, and everything worked very easily. Definitely one of the best libraries I've delt with in recent times.
Great! Did you have any problems? How is it going for you?
I finished mine as well. It was a horribly tedious process removing the STRALLOCs etc. but I feel much safer now that the majority of them are gone. (I did keep a few just because I was tired of changing everything.) I think it's using about another megabyte of memory, but I'm not entirely sure and it's hard to take exact measurements. I imagine this is due to the overhead of the hash table, but it's a little more than I expected. I'll have to check out the implementation of the buckets and see if I can't come up with something more efficient. (My first implementation was just something "quick and dirty" to make sure that it worked.)
Most important to me would be feedback on the interface of the shared string. Do you find yourself wanting more methods to the underlying string? (e.g. substr, etc.) I found that generally it worked out quite well for me, once I added the +, += and < operators. (I needed < to store the shared_strs in a map.)
Also, is the documentation good? Any places where it wasn't clear, and/or could be better?
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
Amended on Sun 05 Mar 2006 02:09 AM (UTC) by David Haley
Message
Yes, it's a shared-string manager. It makes sure that you only have one instance of every string in memory. And it's completely automatic -- no need to worry about STRALLOC and STRFREE vs. DISPOSE, str_dup, etc.
It's not quite a complete substitute for std::string -- it has a few common methods that I've needed but hardly all. That being said, you can call shared_str.str() to get a const std::string& for whatever you'd need to do.
The documentation, while not stellar, isn't too bad -- hopefully it should help explain what's going on and how to use it.
I'm almost done with a near-complete switchover in my code base from old to new string management. I'll have some memory statistics shortly. I'm not expecting much of a memory gain, but you never know. And I have no way of easily measuring CPU use, so I won't bother with that.
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
Now, just to refresh my memory, this code of yours handles the same kind of string counting as the hashstr.c stuff in Smaug, right? And it's also a substitute for having to use std::string in C++ STL?
SmaugMuds.org: http://www.smaugmuds.org - The Smaug MUDs Community Center
"The past was erased, the erasure was forgotten, the lie became truth." -- George Orwell, 1984
I've released 0.9d of the library. The only new functionality it adds over 0.9c is a new, smarter hash function for the hash table manager. It also adds some documentation.
For those instances when you need IE to access a page (it requires ActiveX like Windows Update, for instance) you can use a browser called Maxthon.
It offers the IE rendering engine, ActiveX, tabbed browsing, and most of the security features of Firefox. It also allows plugins/extensions/themes like Firefox.
For pages where you don't want ActiveX, you can block it. It some ways, it is actually BETTER than Firefox.
Yeah, I've had funky problems downloading with IE as well. That's why I haven't used IE for anything other than Windows Update for over two years. :-)
I'm glad your compile worked fine. I discovered that I use the function stricmp which seems to be non-standard, and it didn't compile out-of-the-box on one of the systems I installed it on. Fortunately, stricmp is very easy to reimplement.
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.