From 3af86d72a100cef0bee8fb9d5755e701700af9a7 Mon Sep 17 00:00:00 2001 From: rich_sposato Date: Tue, 13 Sep 2011 00:50:05 +0000 Subject: [PATCH] Added call to OnDereference to constructor. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1100 7ec92016-0320-0410-acc4-a06ded1c099a --- include/loki/SmartPtr.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/loki/SmartPtr.h b/include/loki/SmartPtr.h index d5385b7..6b3325a 100644 --- a/include/loki/SmartPtr.h +++ b/include/loki/SmartPtr.h @@ -1252,7 +1252,7 @@ namespace Loki template class SP1, template class CNP1 > - SmartPtr(const SmartPtr& rhs) + SmartPtr( const SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 >& rhs ) : SP(rhs), OP(rhs), KP(rhs), CP(rhs) { KP::OnDereference( GetImpl( rhs ) ); @@ -1268,7 +1268,7 @@ namespace Loki template class SP1, template class CNP1 > - SmartPtr(SmartPtr& rhs) + SmartPtr( SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 >& rhs ) : SP(rhs), OP(rhs), KP(rhs), CP(rhs) { KP::OnDereference( GetImpl( rhs ) ); @@ -1277,7 +1277,11 @@ namespace Loki SmartPtr(RefToValue rhs) : SP(rhs), OP(rhs), KP(rhs), CP(rhs) - {} + { + SmartPtr & ref = rhs; + KP::OnDereference( GetImpl( ref ) ); + GetImplRef( *this ) = OP::Clone( GetImplRef( ref ) ); + } operator RefToValue() { return RefToValue(*this); }