[Insight-developers] Potential SmartPointer improvement
    Brad King 
    brad.king at kitware.com
       
    Mon Aug  2 09:08:47 EDT 2010
    
    
  
On 07/30/2010 06:41 AM, Hauke Heibel wrote:
> I am wondering what you think about the following modification of the
> SmartPointer's copy constructor.
> 
>   template<class OtherObjectType>
>   SmartPointer (const SmartPointer<OtherObjectType> &p):
>   m_Pointer(p.GetPointer())
>   { this->Register(); }
> 
> The function can be even improved on C++0x systems by enabling it only
> when ObjectType* and OtherObjectType* are convertible to each other
> (see std::is_convertible).
I think this can be achieved on C++98 using enable_if and clever
compile-time conversion tests.
-Brad
    
    
More information about the Insight-developers
mailing list