Hi all! 2009/12/11 Henning Meyer <tutm...@gmail.com>: > Q1: As general suggestion I'd propose an approach I've learned from ITK > (www.itk.org). There they provide a typedef: SomeITKClass::Pointer with > each class. So I'd propose to define types like Term::ScopedPtr, > Term::AutoPtr, Term::SharedPtr and Term::WeakPtr for each major Object > in CLucene. These types can then be used internally as well as externally.
In my point of view a sound approach. But this will change the class interfaces as well as method signatures (Or do I miss something?). Users with own implementations of CLucene parts, e.g. query parser, have to adapt their code. In this case some wrappers or guidance to support the migration from raw pointer code to smart pointer code will be useful. > Q2: Overall I'd recommend to get rid of all raw pointers in the long > run. With boost::scoped_ptr and std::auto_ptr C++ offers two Pointer > types with almost no performace issues. You might think there is little > gain from using these, but at a closer look you'll recognize you get > various syntactic checks and proper resource handling in case of > exceptions for free. > When it comes to reference counts I agree with Itamar and go for > boost::shared_ptr and boost::weak_ptr. I prefer smart pointers too. Managing pointers fault-prone task and "atomization" with smart pointers can reduce error frequency of the code. But on the other side, I agree with Itamar, that for a transitional time smart pointers should be only used where problems occur or new functions are implemented. Moving all raw pointers to smart pointers will is in my opinion a complete new task (and should be considered in an new release cycle?). Kind regards, Veit ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ CLucene-developers mailing list CLucene-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/clucene-developers