the following two weak_ptr constructors are: http://msdn.microsoft.com/en-us/library/bb982126.aspx
weak_ptr(const weak_ptr&); template<class Other> weak_ptr(const weak_ptr<Other>&);
valid code (from memory ):
weak_ptr(const weak_ptr& _Other) { // construct weak_ptr object for resource pointed to by _Other this->_Resetw(_Other); } template<class _Ty2> weak_ptr(const weak_ptr<_Ty2>& _Other, typename enable_if<is_convertible<_Ty2 *, _Ty *>::value, void *>::type * = 0) { // construct weak_ptr object for resource pointed to by _Other this->_Resetw(_Other); }
Q1: Why does the top copy constructor even exist? It seems that the lower part takes into account each case (including the upper). Is he even called? and if they did not turn it on, then the lower part will take place?
Q2: What happens to the second argument to the bottom (templated) constructor. I think I understand the SFINAE aspect, but I don't understand why there are additional * after ::type
source share