There is a function dealii::Utilities::string_to_int() that takes a vector<string> and returns a vector<unsigned int>. With that you can remove this loop.