2025-07-31 22:25:14 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Include a common used STL header for convenient test.
|
|
|
|
#include <cinttypes>
|
|
|
|
|
|
|
|
#if defined(_MSVC_STL_VERSION)
|
|
|
|
#define YYCC_STL_MSSTL
|
|
|
|
#elif defined(__GLIBCXX__) || defined(__GLIBCPP__)
|
|
|
|
#define YYCC_STL_GNUSTL
|
|
|
|
#elif defined(_LIBCPP_VERSION)
|
|
|
|
#define YYCC_STL_CLANGSTL
|
|
|
|
#else
|
|
|
|
#error "Current STL is not supported!"
|
|
|
|
#endif
|
2025-08-11 21:57:42 +08:00
|
|
|
|
|
|
|
namespace yycc::macro::stl {
|
|
|
|
|
|
|
|
/// @brief The STL implementation kind.
|
|
|
|
enum class StlKind {
|
2025-08-15 16:55:39 +08:00
|
|
|
MsStl, ///< Microsoft STL
|
|
|
|
GnuStl, ///< GNU STL
|
|
|
|
ClangStl ///< Clang STL
|
2025-08-11 21:57:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Fetch the STL implementation
|
|
|
|
* @return The kind of STL implementation.
|
|
|
|
*/
|
|
|
|
inline constexpr StlKind get_stl() {
|
|
|
|
#if defined(YYCC_STL_MSSTL)
|
2025-08-15 16:55:39 +08:00
|
|
|
return StlKind::MsStl;
|
2025-08-11 21:57:42 +08:00
|
|
|
#elif defined(YYCC_STL_GNUSTL)
|
2025-08-15 16:55:39 +08:00
|
|
|
return StlKind::GnuStl;
|
2025-08-11 21:57:42 +08:00
|
|
|
#else
|
2025-08-15 16:55:39 +08:00
|
|
|
return StlKind::ClangStl;
|
2025-08-11 21:57:42 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace yycc::macro::stl
|