I have a struct:
typedef struct Wire {
std::vector<gate_id_t> _enters_to;
gate_id_t _out_from;
bool _is_output;
void* _data;
int _sig;
Wire(bool out)
:_sig(NO_SIGNAL), _is_output(out),_out_from(NULL),_data(NULL)
{}
} Wire;
and an initializer macro:
#define INIT_WIRE {_sig:NO_SIGNAL, _is_output:false, _out_from:NULL, _data:NULL}
- I have a
std::vector<Wire> wires;
- When I do
wires.resize(new_size,Wire(false));
it works. - When I do
wires.resize(new_size);
and thenwires[index]=INIT_WIRE;
I get the error:error: no match for ‘operator=’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<Wire> >::value_type {aka Wire}’ and ‘<brace-enclosed initializer list>’)
- now, when I initialize
const Wire INIT_WIRE = {_sig:NO_SIGNAL, _is_output:false, _out_from:NULL, _data:NULL};
I get the error:error: could not convert ‘{2, false, 0l, 0l}’ from ‘<brace-enclosed initializer list>’ to ‘const Wire’