Show
Ignore:
Timestamp:
08/20/09 08:57:55 (15 years ago)
Author:
vbarta
Message:

supporting shared_ptr<const T>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/shared_ptr.h

    r565 r570  
    183183 
    184184        /*! 
     185          \brief const cast 
     186 
     187          Shared pointer to T can be converted to shared pointer to 
     188          const T, just like T * can be converted to T const *. 
     189        */ 
     190        template<typename U> 
     191        operator shared_ptr<const U>() const { 
     192                shared_ptr<const U> cptr;                
     193                cptr.refCnt = refCnt; 
     194                cptr.payload = payload; 
     195                add_ref(); 
     196                return cptr; 
     197        } 
     198 
     199        /*! 
    185200          \brief Efficient swap for shared_ptr. 
    186201         */