From: <ric...@us...> - 2011-09-21 23:25:00
|
Revision: 1114 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1114&view=rev Author: rich_sposato Date: 2011-09-21 23:24:54 +0000 (Wed, 21 Sep 2011) Log Message: ----------- Added comment about policy incompatibility. Modified Paths: -------------- trunk/include/loki/SmartPtr.h Modified: trunk/include/loki/SmartPtr.h =================================================================== --- trunk/include/loki/SmartPtr.h 2011-09-20 23:32:29 UTC (rev 1113) +++ trunk/include/loki/SmartPtr.h 2011-09-21 23:24:54 UTC (rev 1114) @@ -400,6 +400,13 @@ /// /// \ingroup SmartPointerStorageGroup /// Implementation of the ArrayStorage used by SmartPtr +/// This assumes the pointer points to the zeroth element in an array, and uses +/// the array-delete operator to deconstruct and deallocate the array. DeepCopy +/// is not compatible with ArrayStorage DeepCopy::Clone will only copy the first +/// element in the array and won't know the size of the array. Even if it did +/// know the size, it would need to use array new to safely work the array +/// delete operator in ArrayStorage, but array new will not copy the elements +/// in the source array since it calls the default constructor for each element. //////////////////////////////////////////////////////////////////////////////// @@ -663,7 +670,12 @@ /// \ingroup SmartPointerOwnershipGroup /// Implementation of the OwnershipPolicy used by SmartPtr /// Implements deep copy semantics, assumes existence of a Clone() member -/// function of the pointee type +/// function of the pointee type. DeepCopy is not compatible with ArrayStorage +/// DeepCopy::Clone will only copy the first element in the array and won't +/// know the size of the array. Even if it did know the size, it would need to +/// use array new to safely work the array delete operator in ArrayStorage, but +/// array new will not copy the elements in the source array since it calls the +/// default constructor for each array element. //////////////////////////////////////////////////////////////////////////////// template <class P> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |