Suppose I have the following:
#include
struct A { int x; };
class B {
B(int x, std::unique_ptr a);
};
class C : public B {
C(st
As alternative to Praetorian's answer, you can use constructor delegate:
class C : public B {
public:
C(std::unique_ptr a) :
C(a->x, std::move(a)) // this move doesn't nullify a.
{}
private:
C(int x, std::unique_ptr&& a) :
B(x, std::move(a)) // this one does, but we already have copied x
{}
};