Vadim Zeitlin <[EMAIL PROTECTED]> writes: > Hello (Robert), > > as I couldn't build M after updating from the cvs today using VC6 I had to > look at pointers.h and, as you might have noticed, this resulted in some > changes. > > First of all, I documented the class. I know that we don't generate > doxygen docs regularly right now but this is really not an excuse to not > write comments for the new code. > > Second, I removed implicit conversions of RefCounter<T> to "T *" and to > "bool". This is by far too dangerous and, especially with the bool one, > quite unnecessary -- there is a nice trick to avoid having it without > losing the ability to write code as if it were there, have a look at > unspecified_bool_type definition (shamelessly stolen from boost). > > Third, I've added Get() and Release() to be more consistent with the old > smart pointers and std::auto_ptr<> (and probably should have added Reset() > too). > > Fourth, I've inlined all the functions you had because they were not > inlined before (you'd have to define them before hte point of use for this > to happen but in this particular case I really don't see any point in > having them at all). I'd also like to inline RefCounterIncrement/...() > functions, I see no reason for hiding them in MObject.cpp, everybody > includes MObject.h anyhow. > > I'd like to ask you to do the same changes for AutoPtr which I didn't have > time to fix (nor did I have to as I didn't have compilation problems with > it...). Also, I'd like to rename it to ScopedPtr because this is what it is > and calling it AutoPtr is just too confusing. I'd also like to remove > AttachAndIncRef() because IMHO it is confusing and thus dangerous to have > ctor which takes ownership of the pointer and a function which doesn't (if > we decide to keep it I think to something like CopyFrom() makes more sense > as a name for it, but this is a minor issue). > > If you object to anything I did, please let me know, but I do hope that we > can agree on this interface.
I probably should keep smart-aleck questions to myself, but I have to ask why you're writing your own smart pointers at all? Boost's shared_ptr is pretty damned amazing; all of these little safety issues and design details have been taken care of, and it has an almost astounding ability to handle all kinds of interoperability issues... and of course we have scoped_ptr as well. Naturally, I can't imagine writing an application of the scale of Mahogany without simply adopting Boost as a standard piece of the infrastructure. There are just so many things that work better, faster, smarter when you take advantage of carefully designed libraries. OK, enough blowing my (our) own horn, -- Dave Abrahams Boost Consulting www.boost-consulting.com ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Mahogany-Developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mahogany-developers