What is the correct way to initialize an instance of an object within matrix of struct?
My constructor Cita(int, int) need two parameters to create a new instance, but when I compile the program my shell told me I have to compile with -std=c++0x or -std=gnu++0x but I'm not allowed to do that. Here's the error..
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>
And here's my code..
Dia.cpp
horario_funcionarios = vector_horario_funcionarios (numero_funcionarios,
vector_horario(numero_horas, {true, Cita(0,0)}) );
Dia.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;
}
.
.
#include <initializer_list>at the top of your file.