diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2019-08-04 08:49:16 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-09-20 14:01:37 (GMT) |
commit | c688b401d3adaacc820ef4b589010e8aefa808b1 (patch) | |
tree | 83e46e3dc7c9847692e61d0e6629b1cf9b65d2a5 /Source/cmAlgorithms.h | |
parent | 9c31d83aa2a3d3f5921f4a5a559e126e285b96c5 (diff) | |
download | CMake-c688b401d3adaacc820ef4b589010e8aefa808b1.zip CMake-c688b401d3adaacc820ef4b589010e8aefa808b1.tar.gz CMake-c688b401d3adaacc820ef4b589010e8aefa808b1.tar.bz2 |
cmstd: Modernize CMake system headers
Provide a standardized way to handle the C++ "standard" headers
customized to be used with current CMake C++ standard constraints.
Offer under directory `cm` headers which can be used as direct
replacements of the standard ones. For example:
#include <cm/string_view>
can be used safely for CMake development in place of the `<string_view>`
standard header.
Fixes: #19491
Diffstat (limited to 'Source/cmAlgorithms.h')
-rw-r--r-- | Source/cmAlgorithms.h | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 60b746c..06ea9f6 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -238,81 +238,4 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t) return std::find_if(r.begin(), r.end(), [&t](T const& i) { return i != t; }); } -template <class Iter> -std::reverse_iterator<Iter> cmMakeReverseIterator(Iter it) -{ - return std::reverse_iterator<Iter>(it); -} - -namespace cm { - -#if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L - -using std::size; - -#else - -// std::size backport from C++17. -template <class C> -# if !defined(_MSC_VER) || _MSC_VER >= 1900 -constexpr -# endif - auto - size(C const& c) -> decltype(c.size()) -{ - return c.size(); -} - -template <typename T, size_t N> -# if !defined(_MSC_VER) || _MSC_VER >= 1900 -constexpr -# endif - std::size_t - size(const T (&)[N]) throw() -{ - return N; -} - -#endif - -template <typename T> -int isize(const T& t) -{ - return static_cast<int>(cm::size(t)); -} - -#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L - -using std::cbegin; -using std::cend; - -#else - -// std::c{begin,end} backport from C++14 -template <class C> -# if defined(_MSC_VER) && _MSC_VER < 1900 -auto cbegin(C const& c) -# else -constexpr auto cbegin(C const& c) noexcept(noexcept(std::begin(c))) -# endif - -> decltype(std::begin(c)) -{ - return std::begin(c); -} - -template <class C> -# if defined(_MSC_VER) && _MSC_VER < 1900 -auto cend(C const& c) -# else -constexpr auto cend(C const& c) noexcept(noexcept(std::end(c))) -# endif - -> decltype(std::end(c)) -{ - return std::end(c); -} - -#endif - -} // namespace cm - #endif |