
30 Mar
2012
30 Mar
'12
3:11 p.m.
Hi, I am implementing custom smart pointer with move semantics and I am having problems with implementing move constructor with template param. In fact clone_ptr presented in docs suffers from that issue also. This code: class B {} class D: public B {} clone_ptr<D> makeD(); void main() { clone_ptr<B> b = makeD() // gives "error C2440: 'initializing' : cannot convert from 'clone_ptr<T>' to 'clone_ptr<T>'" } adding template <class U> clone_ptr(BOOST_RV_REF(clone_ptr<U>) p) //Move constructor : ptr(p.ptr) { p.ptr = 0; } to clone_ptr class does not help. Additional c-tor seems to be ignored. How to fix that? Cheers, Simon -- Szymon Gatner The Lordz Games Studio www.thelordzgamesstudio.com