From 4c69f45241b2aae902461164a4fb8fead72a0244 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Fri, 26 Jul 2019 16:15:56 +0200 Subject: [PATCH] take strings as const& --- libsrc/core/utils.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libsrc/core/utils.hpp b/libsrc/core/utils.hpp index e20bb977..3645ea18 100644 --- a/libsrc/core/utils.hpp +++ b/libsrc/core/utils.hpp @@ -103,15 +103,16 @@ namespace ngcore void operator delete[] (void * p) { aligned_free(p); } }; - // Two helper functions for string checking - inline bool StartsWith(std::string str, std::string start) + // checks if string starts with sequence + inline bool StartsWith(const std::string& str, const std::string& start) { if(start.size() > str.size()) return false; return std::equal(start.begin(), start.end(), str.begin()); } - inline bool EndsWith(std::string str, std::string end) + // checks if string ends with sequence + inline bool EndsWith(const std::string& str, const std::string& end) { if(end.size() > str.size()) return false;