I have a class containing pointers to objects and a subclass of it. The subclass "move" constructor I want to call the base class move constructor for obvious reasons. With MSVS 2017 compiler this does not seem to work.
template<class SubT>
class MyMovingBase {
typedef MyMovingBase<MtY> ThisT;
protected:
MyMovingBase(const ThisT &src) {
// update copy and or reference DO NOT Move
}
MyMovingBase(ThisT &&src) {
// move stuff from src to this, invalidate src
}
};
class Subclass
: public MyMovingBase<SubClass>
{
public:
Subclass(const Subclass &src) : MyMovingBase<SubClass>(src) {
// does what is expected, calls copy constructor.
}
Subclass(Subclass &&src) : MyMovingBase<SubClass>(src) {
// the above initializer calls copy constructor and NOT
// the move constructor for MyMovingBase !!!!!!
}
};
How do I make this do what I want ??
Of course I want it to work in gcc and clang as well.