Я пытаюсь прочитать массив из файла конфигурации, но появляется сообщение: "in option 'PARAM_ARRAY': недопустимое значение параметра".
тема не помогает меня, потому что он читает массив из командной строки.
Код (только важные строки) примерно такой:
typedef boost::numeric::ublas::bounded_vector<double,6> vec6;
po::options_description parameters("Options");
parameters.add_options()
("PARAM_ARRAY", po::value< vec6 >(&configParameters.PARAM_ARRAY), "parameters array comment")
;
то у меня тоже есть эти строки:
po::options_description config_file_options;
config_file_options.add(parameters);
// Parser the command line options
po::variables_map vm;
po::store(po::command_line_parser(ac, av).
options(cmdline_options).run(), vm);
po::notify(vm);
// Verify if a config file was passed as an option
if (vm.count("config")) {
const std::vector<std::string> &config_files = vm["config"].as< std::vector<std::string> >();
for(std::vector<std::string>::const_iterator it = config_files.begin();
it != config_files.end(); ++it) {
ifstream ifs(it->c_str());
if (!ifs)
{
cout << "can not open config file: " << *it << "\n";
exit(1);
}
// Parse the options on the config file.
// NOTE: They are not going to be updated if they were already set by the command line option
po::store(parse_config_file(ifs, config_file_options), vm);
po::notify(vm);
}
}
И, наконец, мой файл конфигурации (.yaml) имеет: PARAM_ARRAY= (0,0,0,0,0,0)
Я также пробовал: PARAM_ARRAY= {0,0,0,0,0,0} и многие другие форматы.