File indexing completed on 2024-05-19 05:37:25

0001 /*
0002  *   SPDX-FileCopyrightText: 2016 Ivan Cukic <ivan.cukic(at)kde.org>
0003  *
0004  *   SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 //
0008 // W A R N I N G
0009 // -------------
0010 //
0011 // This file is not part of the AsynQt API. It exists purely as an
0012 // implementation detail. This header file may change from version to
0013 // version without notice, or even be removed.
0014 //
0015 // We mean it.
0016 //
0017 
0018 namespace AsynQt
0019 {
0020 namespace detail
0021 {
0022 template<typename _Out, typename _In>
0023 QFuture<_Out> qfuture_cast_impl(const QFuture<_In> &future)
0024 {
0025     return transform(future, [](const _In &value) -> _Out {
0026         return static_cast<_Out>(value);
0027     });
0028 }
0029 
0030 namespace operators
0031 {
0032 template<typename _Out>
0033 struct CastModifier {
0034 };
0035 
0036 template<typename _In, typename _Out>
0037 auto operator|(const QFuture<_In> &future, CastModifier<_Out> &&) -> decltype(qfuture_cast_impl<_Out>(future))
0038 {
0039     return qfuture_cast_impl<_Out>(future);
0040 }
0041 
0042 } // namespace operators
0043 
0044 }
0045 }