1// Copyright (C) 2025 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#if 0
5#pragma qt_class(QtStdLibDetection)
6#pragma qt_sync_skip_header_check
7#pragma qt_sync_stop_processing
8#endif
9
10#ifndef QSTDLIBDETECTION_H
11#define QSTDLIBDETECTION_H
12
13#include <QtCore/qtconfiginclude.h>
14
15#ifdef __cplusplus
16
17/* If <version> exists, qtconfiginclude.h will have included it. */
18/* If not, we need to include _something_, and <utility> is included by qcompilerdetection.h, too */
19#if !__has_include(<version>)
20# include <utility>
21#endif
22
23/*
24 The std lib, must be one of: (Q_STL_x)
25
26 LIBCPP - libc++ (shipped with Clang, e.g.)
27 LIBSTDCPP - libstdc++ (shipped with GCC, e.g.)
28 MSSTL - Microsoft STL
29 DINKUMWARE - Dinkumware (shipped with QNX, VxWorks, Integrity, origin of MSSTL)
30 STLPORT - STLport (merged with SGI)
31 SGI - The original STL
32 ROGUEWAVE - RogueWave ((used to be) popular on ARM?)
33
34 Not included:
35 EASTL - EASTL (this is not a drop-in STL, e.g. it doesn't have <vector>-style headers)
36
37 Should be sorted most to least authoritative.
38*/
39
40#if defined(_LIBCPP_VERSION) /* libc++ */
41# define Q_STL_LIBCPP
42#elif defined(_GLIBCXX_RELEASE) /* libstdc++ */
43# define Q_STL_LIBSTDCPP
44#elif defined(_MSVC_STL_VERSION) /* MSSTL (must be before Dinkumware) */
45# define Q_STL_MSSTL
46#elif defined(_YVALS) || defined(_CPPLIB_VER) /* Dinkumware */
47# define Q_STL_DINKUMWARE
48#elif defined(_STLPORT_VERSION) /* STLport, cf. _stlport_version.h */
49# define Q_STL_STLPORT
50#elif defined(__SGI_STL) /* must be after STLport, which mimics as SGI STL */
51# define Q_STL_SGI
52#elif defined(_RWSTD_VER) /* RogueWave, at least as contributed to Apache stdcxx, cf. rw/_config.h */
53# define Q_STL_ROGUEWAVE
54#else
55# error Unknown std library implementation, please file a report at bugreports.qt.io.
56#endif
57
58#endif // __cplusplus
59
60#endif // QSTDLIBDETECTION_H
61

source code of qtbase/src/corelib/global/qstdlibdetection.h