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); }