use initializer list instead of explicit constructor
This commit is contained in:
@ -1011,7 +1011,7 @@ std::vector<std::string> Info::get_available_styles(const std::string &category)
|
||||
} else if (category == "command") {
|
||||
return get_style_names(input->command_map);
|
||||
}
|
||||
return std::vector<std::string>();
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename ValueType>
|
||||
|
||||
@ -2035,7 +2035,7 @@ std::string Molecule::parse_keyword(int flag, char *line)
|
||||
|
||||
MPI_Bcast(&eof,1,MPI_INT,0,world);
|
||||
if (eof) {
|
||||
return std::string("");
|
||||
return {""};
|
||||
}
|
||||
|
||||
// bcast keyword line to all procs
|
||||
|
||||
@ -415,7 +415,7 @@ std::string platform::mpi_info(int &major, int &minor)
|
||||
major = 1;
|
||||
minor = 0;
|
||||
#endif
|
||||
return std::string(version);
|
||||
return {version};
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -543,8 +543,8 @@ void *platform::dlopen(const std::string &fname)
|
||||
std::string platform::dlerror()
|
||||
{
|
||||
const char *errmesg = ::dlerror();
|
||||
if (errmesg) return std::string(errmesg);
|
||||
else return "";
|
||||
if (errmesg) return {errmesg};
|
||||
else return {""};
|
||||
}
|
||||
|
||||
// close a shared object
|
||||
|
||||
@ -143,7 +143,7 @@ void utils::fmtargs_logmesg(LAMMPS *lmp, fmt::string_view format, fmt::format_ar
|
||||
|
||||
std::string utils::getsyserror()
|
||||
{
|
||||
return std::string(strerror(errno));
|
||||
return {strerror(errno)};
|
||||
}
|
||||
|
||||
// read line into buffer. if line is too long keep reading until EOL or EOF
|
||||
@ -738,7 +738,7 @@ std::string utils::trim_comment(const std::string &line)
|
||||
{
|
||||
auto end = line.find_first_of('#');
|
||||
if (end != std::string::npos) { return line.substr(0, end); }
|
||||
return std::string(line);
|
||||
return {line};
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user