grazie per l'interessamento innanzitutto.
allora io ho questa funzione
e l'esecuzione da segmentation fault prima di stampare "modulo nuovo2". il costruttore di ps_power_module_struct è il seguente:codice:void ps_configure_module::insert_data(void) { map_struct_iterator = ps_power_module::power_module_table.find(name); if(map_struct_iterator != ps_power_module::power_module_table.end()) { cout << "modulo gia presente" << endl; map_struct_iterator->second.add_operator(operator_type, data_type, model,parameter); } else { cout << "modulo nuovo1" << ps_power_module::power_module_table.size()<< endl; ps_power_module::power_module_table.insert(std::pair<string,ps_power_module_struct>(name, ps_power_module_struct(name))); cout << "modulo nuovo2" << endl; map_struct_iterator = ps_power_module::power_module_table.find(name); cout << "modulo nuovo3" << endl; map_struct_iterator->second.add_operator(operator_type, data_type, model,parameter); } };
come ho detto nell'altro post power_module_table è un oggetto di tipo std::map statico della classe ps_power_module.codice:ps_power_module_struct::ps_power_module_struct(string name):module_name(name) { cout << "ps_power_module_struct1" << endl; add_default_operator();//aggiungo gli operatori di default cout << "ps_power_module_struct4" << endl; }; void ps_power_module_struct::add_default_operator(void) { unsigned int tmp_int = 0; string tmp_string; cout << "ps_power_module_struct2" << endl; //aggiungo qui alla mappa i valori di default tipo "other &", "other |" con modello per la potenza il "costant" for(tmp_int=0 ; tmp_int < (sizeof(operator_possible)/sizeof(operator_possible[0])) ; ++tmp_int) { tmp_string = "other " + operator_possible[tmp_int]; cout << "ps_power_module_struct3" << endl; model_operator.insert(std::pair<string,ps_power_model*>( tmp_string, get_power_model(0)) ); }; };
lui stampa tutto compreso "ps_power_module_struct4" quindi la costruzione va a buon fine, giusto??
grazie per l'aiuto
Marco

Rispondi quotando