We had this situation and wondered about the best way to fix it
template<typename T>
struct A : T {
A(T &&t) noexcept(noexcept(T(std::move(t))))
:T(std::move(t))
{ }
};
This unfortunately fails to compile because T's move constructor is protected, and we are only allowed to call it in the constructor initialization list for *this
. What are the workarounds to make this work or is there even a standard way for it?