tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
language_standard.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_VERSION_LANGUAGE_STANDARD_HPP
4#define TETL_VERSION_LANGUAGE_STANDARD_HPP
5
6#include <etl/_config/all.hpp>
7
8namespace etl {
9
14enum struct language_standard : unsigned char {
15 cpp_17 = 17,
16 cpp_20 = 20,
17 cpp_23 = 23,
18 cpp_26 = 26,
19};
20
22[[nodiscard]] constexpr auto operator==(language_standard lhs, language_standard rhs) noexcept -> bool
23{
24 return static_cast<unsigned char>(lhs) == static_cast<unsigned char>(rhs);
25}
26
27[[nodiscard]] constexpr auto operator!=(language_standard lhs, language_standard rhs) noexcept -> bool
28{
29 return !(lhs == rhs);
30}
31
32[[nodiscard]] constexpr auto operator<(language_standard lhs, language_standard rhs) noexcept -> bool
33{
34 return static_cast<unsigned char>(lhs) < static_cast<unsigned char>(rhs);
35}
36
37[[nodiscard]] constexpr auto operator<=(language_standard lhs, language_standard rhs) noexcept -> bool
38{
39 return static_cast<unsigned char>(lhs) <= static_cast<unsigned char>(rhs);
40}
41
42[[nodiscard]] constexpr auto operator>(language_standard lhs, language_standard rhs) noexcept -> bool
43{
44 return static_cast<unsigned char>(lhs) > static_cast<unsigned char>(rhs);
45}
46
47[[nodiscard]] constexpr auto operator>=(language_standard lhs, language_standard rhs) noexcept -> bool
48{
49 return static_cast<unsigned char>(lhs) >= static_cast<unsigned char>(rhs);
50}
51
52#if defined(_MSVC_LANG)
53 #define TETL_CPP_STANDARD_FULL _MSVC_LANG
54#else
55 #define TETL_CPP_STANDARD_FULL __cplusplus
56#endif
57
58#if TETL_CPP_STANDARD_FULL > 202302L
59 #define TETL_CPP_STANDARD 26
62#elif TETL_CPP_STANDARD_FULL > 202002L
63 #define TETL_CPP_STANDARD 23
65inline constexpr auto current_standard = language_standard::cpp_23;
66#elif TETL_CPP_STANDARD_FULL > 201703L
67 #define TETL_CPP_STANDARD 20
69inline constexpr auto current_standard = language_standard::cpp_20;
70#else
71 #error "Unsupported C++ language standard. TETL requires at least C++20"
72#endif
73
74} // namespace etl
75
76#endif // TETL_VERSION_LANGUAGE_STANDARD_HPP
Definition adjacent_find.hpp:8
constexpr auto operator==(inplace_function< R(Args...), Capacity, Alignment > const &f, nullptr_t) noexcept -> bool
Compares a etl::inplace_function with a null pointer. Empty functions (that is, functions without a c...
Definition inplace_function.hpp:262
constexpr auto operator!=(inplace_function< R(Args...), Capacity, Alignment > const &f, nullptr_t) noexcept -> bool
Compares a etl::inplace_function with a null pointer. Empty functions (that is, functions without a c...
Definition inplace_function.hpp:272
constexpr auto current_standard
The currently configured C++ standard.
Definition language_standard.hpp:61
language_standard
Enumeration for the currently selected C++ standard version. Unlike the official macro __cplusplus,...
Definition language_standard.hpp:14
@ cpp_20
Definition language_standard.hpp:16
@ cpp_17
Definition language_standard.hpp:15
@ cpp_23
Definition language_standard.hpp:17
@ cpp_26
Definition language_standard.hpp:18
constexpr auto operator<(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:167
constexpr auto operator<=(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:177
constexpr auto operator>(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:185
constexpr auto operator>=(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:195