我不知道这段代码有什么问题。我得到这个错误: error: member function 'swap' not viable: 'this' argument has type 'const array', but function is not marked const #include <algorithm>
#include <memory>
#include <iostream>
我想在另一个类的构造函数中初始化一个std ::数组的对象。看来聚合初始化应该在这里工作,但我无法弄清楚适当的语法。我如何去做这件事? class A {
const int a;
public:
A(int an_int) : a(an_int) {}
};
class B {
std::array<A,3> stuff;
public: