Вопрос

For example,

struct A {};

struct B
{
    B(A&& a)
       : mA(std::move(a)) // Is A's constructor called here?
    {}

    A&& mA;
};

Is A's constructor called in the initialization list of B? Or it's like a reference implemented by a pointer?

Это было полезно?

Решение

No; mA is not an object but merely a reference, so there is nothing to construct.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top