Quote:Original post by pammatt
Why aren't you using boost::shared_ptr?? Well, many people do not want a hugely bloated library when they merely want referenced counted pointers.
Boost's smart pointers are implemented fully in the header files and require no linking. They generate safer, more compact and more efficient code than we can with a home baked solution. For things that do require linking, boost allows you to generate small libraries only for features that you need. Even if you did link to the full library, the linker would take only the necessary components.
Quote:Original post by pammatt
As a seasoned software engineer, I dont' even want to use boost smart pointers.
That's fine, if you could give a good reason for not using them. If you can't, then you should probably use them.
Quote:Original post by pammatt
As for using for_each, sure its cleaner looking, but that's no reason to say that writing a normal for loop is bad.
I didn't say writing a normal for loop is bad. I said that if you iterate through an STL collection you should probably use for_each unless you can give a good reason for not doing so. You will end up with a safer, more efficient, less buggy code by using for_each. The original poster clearly didn't know how to write a proper for loop to iterate through a collection (which is fine, I have to look this up all the time). Using for_each would have saved a lot of trouble (though in this case smart pointers allong with collection.clear() is a better idea).