| 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 | |
| 4 | #ifndef QTCONCURRENT_COMPILERTEST_H |
| 5 | #define QTCONCURRENT_COMPILERTEST_H |
| 6 | |
| 7 | #include <QtConcurrent/qtconcurrent_global.h> |
| 8 | |
| 9 | #ifndef QT_NO_CONCURRENT |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | namespace QtPrivate { |
| 14 | |
| 15 | template <class T, typename = void> |
| 16 | struct IsIterable : std::false_type {}; |
| 17 | template <class T> |
| 18 | struct IsIterable<T, std::void_t<decltype(std::declval<T>().begin()), |
| 19 | decltype(std::declval<T>().end())>> |
| 20 | : std::true_type |
| 21 | { }; |
| 22 | |
| 23 | template <class T> |
| 24 | inline constexpr bool IsIterableValue = IsIterable<T>::value; |
| 25 | |
| 26 | template <class T, typename = void> |
| 27 | struct IsDereferenceable : std::false_type {}; |
| 28 | template <class T> |
| 29 | struct IsDereferenceable<T, std::void_t<decltype(*std::declval<T>())>> |
| 30 | : std::true_type |
| 31 | { }; |
| 32 | |
| 33 | template <class T> |
| 34 | inline constexpr bool IsDereferenceableValue = IsDereferenceable<T>::value; |
| 35 | } |
| 36 | |
| 37 | QT_END_NAMESPACE |
| 38 | |
| 39 | #endif // QT_NO_CONCURRENT |
| 40 | |
| 41 | #endif |
| 42 | |