Код: Выделить всё
struct C {};
struct S
{
S() = default;
S(const C& c) : _c(c)
{}
const C& _c; // I always have to use a pointer here
};
int main()
{
C c;
std::array arr{ c }; // Can c be passed here?
return 0;
}
Вышеупомянутое не компилируется.
Код: Выделить всё
error: no matching constructor for initialization of 'S'
Подробнее здесь: https://stackoverflow.com/questions/783 ... onstructor
Мобильная версия