diff --git a/src/aevol_create.cpp b/src/aevol_create.cpp index 638cc002856775dd85b9f5cf5a69f0df27c813e1..4c50b0748f2e041340bcb0940b93027161c3b5b8 100644 --- a/src/aevol_create.cpp +++ b/src/aevol_create.cpp @@ -176,6 +176,17 @@ void interpret_cmd_line_options(int argc, char* argv[]) { } } +auto read_sequence(std::ifstream& chromosome_file, const std::string& chromosome_file_name) { + std::string chromosome; + + std::getline(chromosome_file, chromosome); + if (not chromosome_file or chromosome.length() == 0) { + Utils::ExitWithUsrMsg(std::string("failed to read from chromosome file ") + chromosome_file_name); + } + + return chromosome; +} + std::list<std::string> read_sequence_file(const std::string& chromosome_file_name) { assert(chromosome_file_name.length() != 0); @@ -186,12 +197,7 @@ std::list<std::string> read_sequence_file(const std::string& chromosome_file_nam Utils::ExitWithUsrMsg(std::string("failed to open source chromosome file ") + chromosome_file_name); } - std::string chromosome; - std::getline(chromosome_file, chromosome); - if (not chromosome_file or chromosome.length() == 0) { - Utils::ExitWithUsrMsg(std::string("failed to read from chromosome file ") + chromosome_file_name); - } - chromosomes.push_back(std::move(chromosome)); + chromosomes.push_back(read_sequence(chromosome_file, chromosome_file_name)); return chromosomes; }