REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
version.hpp
Go to the documentation of this file.
1
12#ifndef REAL_VERSION_HPP
13#define REAL_VERSION_HPP
14
15// Language-standard guard. REAL is C++20 throughout (concepts, <span>, constexpr engine), so a
16// pre-C++20 compile fails here with a clear message instead of a wall of template errors. The
17// _MSVC_LANG branch is required because MSVC leaves __cplusplus at 199711L unless /Zc:__cplusplus
18// is passed — a non-CMake MSVC consumer that forgets it would otherwise slip past a bare
19// __cplusplus check. This is the only thing exercising the _MSVC_LANG path, so keep it.
20#if defined(_MSVC_LANG)
21# if _MSVC_LANG < 202002L
22# error "real requires C++20 or newer"
23# endif
24#elif __cplusplus < 202002L
25# error "real requires C++20 or newer (compile with -std=c++20 or later)"
26#endif
27
28// These three are deliberately preprocessor macros, not an enum or constexpr constants: a
29// version header must expose them to the *preprocessor* so a consumer can branch on
30// `#if REAL_VERSION_MAJOR >= …`, and they feed REAL_VERSION_STRING's stringization. macro-to-enum
31// / macro-usage are sound style defaults that simply do not fit the universal LIBFOO_VERSION_*
32// idiom — a documented, narrowly-scoped deviation, not a hidden bug.
33// NOLINTBEGIN(cppcoreguidelines-macro-to-enum,modernize-macro-to-enum,cppcoreguidelines-macro-usage)
35#define REAL_VERSION_MAJOR 2026
37#define REAL_VERSION_MINOR 7
39#define REAL_VERSION_PATCH 25
40// NOLINTEND(cppcoreguidelines-macro-to-enum,modernize-macro-to-enum,cppcoreguidelines-macro-usage)
41
42// Two-level stringize so the macro *values* (not their names) are pasted into the string.
43// Stringization (#x) is a preprocessor-only operation — the suggested constexpr template cannot
44// express it — so macro-usage's advice does not apply here.
45// NOLINTBEGIN(cppcoreguidelines-macro-usage)
46#define REAL_STRINGIZE_IMPL(x) #x
47#define REAL_STRINGIZE(x) REAL_STRINGIZE_IMPL(x)
48// NOLINTEND(cppcoreguidelines-macro-usage)
49
51#define REAL_VERSION_STRING \
52 REAL_STRINGIZE(REAL_VERSION_MAJOR) "." \
53 REAL_STRINGIZE(REAL_VERSION_MINOR) "." \
54 REAL_STRINGIZE(REAL_VERSION_PATCH)
55
56#endif // REAL_VERSION_HPP