accept const std::string as argument in Group::find()

This commit is contained in:
Axel Kohlmeyer 2020-07-17 21:26:53 -04:00
parent eff159baf4
commit bf5c1dbc9e
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
2 changed files with 3 additions and 3 deletions

View File

@ -584,10 +584,10 @@ void Group::create(char *name, int *flag)
return group index if name matches existing group, -1 if no such group
------------------------------------------------------------------------- */
int Group::find(const char *name)
int Group::find(const std::string &name)
{
for (int igroup = 0; igroup < MAX_GROUP; igroup++)
if (names[igroup] && strcmp(name,names[igroup]) == 0) return igroup;
if (names[igroup] && (name == names[igroup])) return igroup;
return -1;
}

View File

@ -33,7 +33,7 @@ class Group : protected Pointers {
void assign(int, char **); // assign atoms to a group
void assign(const std::string &); // convenience function
void create(char *, int *); // add flagged atoms to a group
int find(const char *); // lookup name in list of groups
int find(const std::string &); // lookup name in list of groups
int find_or_create(const char *); // lookup name or create new group
void write_restart(FILE *);
void read_restart(FILE *);