C++中移动构造函数的调用

Calling of move constructor in c++

我有以下代码:

struct Base
{
    std::vector<int> a;
}

struct Derived : public Base
{
    Derived(Base && rhs):
        Base( std::forward<Base>(rhs))
    {
    }
    //some more fields
}
//...
Base a;
Derived b(std::move(a));

调用Derived构造函数是否会导致调用包含在Baseclass中的std::vector的移动构造函数?

是的,Baseimplicitly-defined move constructor被调用了,它会对其数据成员a进行move。

For non-union class types (class and struct), the move constructor performs full member-wise move of the object's bases and non-static members, in their initialization order, using direct initialization with an xvalue argument.

LIVE for confirming