| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | // Qt-Security score:significant reason:default |
| 4 | |
| 5 | #ifndef QTCONCURRENT_COMPILERTEST_H |
| 6 | #define QTCONCURRENT_COMPILERTEST_H |
| 7 | |
| 8 | #include <QtConcurrent/qtconcurrent_global.h> |
| 9 | |
| 10 | #ifndef QT_NO_CONCURRENT |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | namespace QtPrivate { |
| 15 | |
| 16 | template <class T, typename = void> |
| 17 | struct IsIterable : std::false_type {}; |
| 18 | template <class T> |
| 19 | struct IsIterable<T, std::void_t<decltype(std::declval<T>().begin()), |
| 20 | decltype(std::declval<T>().end())>> |
| 21 | : std::true_type |
| 22 | { }; |
| 23 | |
| 24 | template <class T> |
| 25 | inline constexpr bool IsIterableValue = IsIterable<T>::value; |
| 26 | |
| 27 | template <class T, typename = void> |
| 28 | struct IsDereferenceable : std::false_type {}; |
| 29 | template <class T> |
| 30 | struct IsDereferenceable<T, std::void_t<decltype(*std::declval<T>())>> |
| 31 | : std::true_type |
| 32 | { }; |
| 33 | |
| 34 | template <class T> |
| 35 | inline constexpr bool IsDereferenceableValue = IsDereferenceable<T>::value; |
| 36 | } |
| 37 | |
| 38 | QT_END_NAMESPACE |
| 39 | |
| 40 | #endif // QT_NO_CONCURRENT |
| 41 | |
| 42 | #endif |
| 43 | |