From bf5c1dbc9ed8d800fbbeb4b02692dd13da152e1d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 17 Jul 2020 21:26:53 -0400 Subject: [PATCH] accept const std::string as argument in Group::find() --- src/group.cpp | 4 ++-- src/group.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/group.cpp b/src/group.cpp index 61f28c2551..79405c9344 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -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; } diff --git a/src/group.h b/src/group.h index 4c7dca0835..b9a5c27140 100644 --- a/src/group.h +++ b/src/group.h @@ -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 *);