在结构矩阵中初始化对象实例的正确方法是什么?
我的构造函数Cita(int, int)
需要两个参数来创建一个新实例,但是当我编译程序时,我的 shell 告诉我必须使用它进行编译,-std=c++0x or -std=gnu++0x
但我不允许这样做。这是错误..
Dia.cpp: In constructor ‘Dia::Dia(int, int, int)’:
Dia.cpp:9:56: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x [enabled by default]
Dia.cpp:9:75: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x [enabled by default]
Dia.cpp:9:75: error: deducing from brace-enclosed initializer list requires #include <initializer_list>
这是我的代码..
直径cpp
horario_funcionarios = vector_horario_funcionarios (numero_funcionarios,
vector_horario(numero_horas, {true, Cita(0,0)}) );
直径.hpp
struct hora_dia {
bool habil;
Cita cita;
};
typedef vector<hora_dia> vector_horario;
typedef vector<vector_horario> vector_horario_funcionarios;
class Dia {
private:
int id;
vector_horario_funcionarios horario_funcionarios;
.
.
.
Cita.cpp
Cita::Cita(int id, int nivel) {
this->id = id;
this->nivel = nivel;
}
.
.