gcc refuses to use scoped_ptr on incomplete type, so let ImplPtr
authorMichael Andres <ma@suse.de>
Mon, 14 Nov 2005 22:57:33 +0000 (22:57 +0000)
committerMichael Andres <ma@suse.de>
Mon, 14 Nov 2005 22:57:33 +0000 (22:57 +0000)
default to use a shared_ptr. Will waste a refcount per Resolvable.

zypp/base/PtrTypes.h

index c87699e..8937ca2 100644 (file)
@@ -70,11 +70,33 @@ namespace zypp
      * nonconst implementation methods. In case you have to do so, call
      * unconst to get the <tt>_D *</tt>.
      *
-     * The second template argument defaults to <tt>_Ptr = scoped_ptr<_D></tt>.
+     * The second template argument defaults to <tt>_Ptr = shared__ptr<_D></tt>.
      *
      * \todo refine ctor and assign.
+     * \todo check whether scoped_ptr's refusal to handle an incomplete type
+     * is a compiler bug. Introducing ~CI does not help, although I is complete
+     * when ~CI is called. This renders scoped_ptr less usefull.
+     * \code
+     * #include <boost/scoped_ptr.hpp>
+     * struct I;
+     * struct CI
+     * {
+     *   ~CI();
+     *   private:
+     *   zypp::base::scoped_ptr<I> i;
+     * };
+     * int main( int argc, char * argv[] )
+     * {
+     *   CI c;
+     *   return 0;
+     * }
+     * struct I {};
+     * CI::~CI()
+     * {
+     * }
+     * \endcode
     */
-    template<class _D, class _Ptr = scoped_ptr<_D> >
+    template<class _D, class _Ptr = shared_ptr<_D> >
       struct ImplPtr
       {
         typedef _D element_type;