From 199f8bcadee2f9a5db2f057ea097a26b0574a100 Mon Sep 17 00:00:00 2001 From: rich_sposato Date: Wed, 21 Sep 2011 23:24:54 +0000 Subject: [PATCH] Added comment about policy incompatibility. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1114 7ec92016-0320-0410-acc4-a06ded1c099a --- include/loki/SmartPtr.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/loki/SmartPtr.h b/include/loki/SmartPtr.h index aaf5d40..6d8e11e 100644 --- a/include/loki/SmartPtr.h +++ b/include/loki/SmartPtr.h @@ -400,6 +400,13 @@ namespace Loki /// /// \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 @@ namespace Loki /// \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