Question

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?

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top