summaryrefslogtreecommitdiffstats
path: root/Source/cmStandardIncludes.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-02-12 16:53:04 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-02-12 16:53:04 (GMT)
commite6ae3c6ae0540de51b3d615aea3abd49ccc70a34 (patch)
tree09f74e0bf09b27dd51e95530cbee7783db3301bd /Source/cmStandardIncludes.h
parentfc7e15691a870f8f5e199e615279c7eb4dba8f6f (diff)
parent7c3f637680ac0cdb6cec5e75ba4a9b188de5017b (diff)
downloadCMake-e6ae3c6ae0540de51b3d615aea3abd49ccc70a34.zip
CMake-e6ae3c6ae0540de51b3d615aea3abd49ccc70a34.tar.gz
CMake-e6ae3c6ae0540de51b3d615aea3abd49ccc70a34.tar.bz2
Merge topic 'use-cmRange'
7c3f6376 Convert loop into two algorithms. 8a399c8c Convert loop to the common pattern. abfca975 Move loop inside of condition. 0b61b86d Handle last element outside of the loop. e21f7829 cmTarget: Use a sorted vector in place of a set. 559dc155 cmSet: Replace loop with cmJoin. 0ea71932 cmFindBase: Replace loop with cmJoin on range. 9380e85f Convert loops to cmJoin algorithm with cmRange. bb10012f cmStringCommand: Accumulate with cmJoin and range adaptors. 0c12f1ea cmAlgorithms: Add a range adaptor and API for adjusting a range. 27c6f017 Use cmJoin to accumulate string ranges. 4e78ebbd cmAlgorithms: Add a Range container and adaptor method. 89102249 Replace common loop pattern with cmJoin 7b8725bf Convert loops populating maybe-empty content into the common pattern. 7ee56f03 Convert loops into the commonly used pattern. 0a4e5674 cmMacroCommand: Remove counting variable. ...
Diffstat (limited to 'Source/cmStandardIncludes.h')
-rw-r--r--Source/cmStandardIncludes.h134
1 files changed, 0 insertions, 134 deletions
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index 77b4f62..a9796b9 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -131,138 +131,4 @@ static thisClass* SafeDownCast(cmObject *c) \
} \
class cmTypeMacro_UseTrailingSemicolon
-template<typename Range>
-std::string cmJoin(Range const& r, const char* delimiter)
-{
- if (r.empty())
- {
- return std::string();
- }
- std::ostringstream os;
- typedef typename Range::value_type ValueType;
- typedef typename Range::const_iterator InputIt;
- InputIt first = r.begin();
- InputIt last = r.end();
- --last;
- std::copy(first, last,
- std::ostream_iterator<ValueType>(os, delimiter));
-
- os << *last;
-
- return os.str();
-}
-
-template<typename Range>
-std::string cmJoin(Range const& r, std::string delimiter)
-{
- return cmJoin(r, delimiter.c_str());
-};
-
-inline bool cmHasLiteralPrefixImpl(const std::string &str1,
- const char *str2,
- size_t N)
-{
- return strncmp(str1.c_str(), str2, N) == 0;
-}
-
-inline bool cmHasLiteralPrefixImpl(const char* str1,
- const char *str2,
- size_t N)
-{
- return strncmp(str1, str2, N) == 0;
-}
-
-inline bool cmHasLiteralSuffixImpl(const std::string &str1,
- const char *str2,
- size_t N)
-{
- size_t len = str1.size();
- return len >= N && strcmp(str1.c_str() + len - N, str2) == 0;
-}
-
-inline bool cmHasLiteralSuffixImpl(const char* str1,
- const char* str2,
- size_t N)
-{
- size_t len = strlen(str1);
- return len >= N && strcmp(str1 + len - N, str2) == 0;
-}
-
-template<typename T, size_t N>
-const T* cmArrayBegin(const T (&a)[N]) { return a; }
-template<typename T, size_t N>
-const T* cmArrayEnd(const T (&a)[N]) { return a + N; }
-template<typename T, size_t N>
-size_t cmArraySize(const T (&)[N]) { return N; }
-
-template<typename T, size_t N>
-bool cmHasLiteralPrefix(T str1, const char (&str2)[N])
-{
- return cmHasLiteralPrefixImpl(str1, str2, N - 1);
-}
-
-template<typename T, size_t N>
-bool cmHasLiteralSuffix(T str1, const char (&str2)[N])
-{
- return cmHasLiteralSuffixImpl(str1, str2, N - 1);
-}
-
-struct cmStrCmp {
- cmStrCmp(const char *test) : m_test(test) {}
- 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.c_str()) == 0;
- }
-
-private:
- const std::string m_test;
-};
-
-namespace ContainerAlgorithms {
-
-template<typename T>
-struct cmIsPair
-{
- enum { value = false };
-};
-
-template<typename K, typename V>
-struct cmIsPair<std::pair<K, V> >
-{
- enum { value = true };
-};
-
-template<typename Container,
- bool valueTypeIsPair = cmIsPair<typename Container::value_type>::value>
-struct DefaultDeleter
-{
- void operator()(typename Container::value_type value) {
- delete value;
- }
-};
-
-template<typename Container>
-struct DefaultDeleter<Container, /* valueTypeIsPair = */ true>
-{
- void operator()(typename Container::value_type value) {
- delete value.second;
- }
-};
-
-}
-
-template<typename Container>
-void cmDeleteAll(Container const& c)
-{
- std::for_each(c.begin(), c.end(),
- ContainerAlgorithms::DefaultDeleter<Container>());
-}
-
#endif