summaryrefslogtreecommitdiffstats
path: root/Source/cmStandardIncludes.h
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2014-01-17 18:38:27 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-08 18:05:28 (GMT)
commit381d50c149183183378b446fd789b1bd18c7524c (patch)
tree41f13826232b6b3650df64ef564a9a18d2a21479 /Source/cmStandardIncludes.h
parent3742bb0d324b971f63cc7e557b1cb8a9d08c5cdd (diff)
downloadCMake-381d50c149183183378b446fd789b1bd18c7524c.zip
CMake-381d50c149183183378b446fd789b1bd18c7524c.tar.gz
CMake-381d50c149183183378b446fd789b1bd18c7524c.tar.bz2
stringapi: Accept strings in cmStrCmp
Diffstat (limited to 'Source/cmStandardIncludes.h')
-rw-r--r--Source/cmStandardIncludes.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index b4ae657..04e1bc8 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -449,11 +449,16 @@ bool cmHasLiteralSuffix(T str1, const char (&str2)[N])
struct cmStrCmp {
cmStrCmp(const char *test) : m_test(test) {}
- cmStrCmp(std::string &test) : m_test(test.c_str()) {}
+ cmStrCmp(const std::string &test) : m_test(test) {}
+
+ bool operator()(const std::string& input) const
+ {
+ return m_test == input;
+ }
bool operator()(const char * input) const
{
- return strcmp(input, m_test) == 0;
+ return strcmp(input, m_test.c_str()) == 0;
}
// For use with binary_search
@@ -463,7 +468,7 @@ struct cmStrCmp {
}
private:
- const char * const m_test;
+ const cmStdString m_test;
};
#endif