Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:07:14

0001 // Copyright (C) 2021 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 #ifndef Q20ITERATOR_H
0004 #define Q20ITERATOR_H
0005 
0006 #include <QtCore/qglobal.h>
0007 
0008 #include <iterator>
0009 
0010 //
0011 //  W A R N I N G
0012 //  -------------
0013 //
0014 // This file is not part of the Qt API. Types and functions defined in this
0015 // file can reliably be replaced by their std counterparts, once available.
0016 // You may use these definitions in your own code, but be aware that we
0017 // will remove them once Qt depends on the C++ version that supports
0018 // them in namespace std. There will be NO deprecation warning, the
0019 // definitions will JUST go away.
0020 //
0021 // If you can't agree to these terms, don't use these definitions!
0022 //
0023 // We mean it.
0024 //
0025 
0026 QT_BEGIN_NAMESPACE
0027 
0028 // like std::ssize
0029 namespace q20 {
0030 #ifdef __cpp_lib_ssize
0031     using std::ssize;
0032 #else
0033     template<class C> constexpr auto ssize(const C &c)
0034       -> std::common_type_t<std::ptrdiff_t, std::make_signed_t<decltype(c.size())>>
0035     { return static_cast<std::common_type_t<std::ptrdiff_t, std::make_signed_t<decltype(c.size())>>>(c.size()); }
0036 
0037     template<class T, std::ptrdiff_t N> constexpr std::ptrdiff_t ssize(const T (&)[N]) noexcept
0038     { return N; }
0039 #endif
0040 } // namespace q20
0041 
0042 // like q20::iter_reference_t
0043 namespace q20 {
0044 #ifdef __cpp_lib_ranges
0045     using std::iter_reference_t;
0046 #else
0047     template <typename Dereferencable> // unconstrained (constraint requires concepts)
0048     using iter_reference_t = decltype(*std::declval<Dereferencable&>());
0049 #endif // __cpp_lib_ranges
0050 } // namespace q20
0051 
0052 QT_END_NAMESPACE
0053 
0054 #endif /* Q20ITERATOR_H */