Skip to content

Commit 2ecc6f5

Browse files
author
Hana Dusíková
committed
feature test macro (fixes issue #5)
1 parent 8ae73d3 commit 2ecc6f5

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

include/ctll/parser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ template <bool Result, typename Subject> struct parse_result {
1717
using output_type = Subject;
1818
};
1919

20-
#if !__has_cpp_attribute(__cpp_nontype_template_parameter_class)
20+
#if !__cpp_nontype_template_parameter_class
2121
template <typename Grammar, const auto & input, typename ActionSelector = empty_actions, bool IngoreUnknownActions = false> struct parser {
2222
#else
2323
template <typename Grammar, basic_fixed_string input, typename ActionSelector = empty_actions, bool IngoreUnknownActions = true> struct parser { // in c++20

include/ctre/functions.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace ctre {
1212

1313
// in moment when we get C++20 support this will start to work :)
1414

15-
#if __has_cpp_attribute(__cpp_nontype_template_parameter_class)
15+
#if __cpp_nontype_template_parameter_class
1616
template <basic_fixed_string input> __attribute__((flatten)) constexpr CTRE_FORCE_INLINE auto match(std::string_view sv) noexcept {
1717

1818
using tmp = typename ctll::parser<ctre::pcre, input, ctre::pcre_actions>::template output<pcre_context<>>;
@@ -23,7 +23,7 @@ template <basic_fixed_string input> __attribute__((flatten)) constexpr CTRE_FORC
2323
#endif
2424

2525

26-
#if __has_cpp_attribute(__cpp_nontype_template_parameter_class)
26+
#if __cpp_nontype_template_parameter_class
2727
template <basic_fixed_string input, typename ForwardIt> __attribute__((flatten)) constexpr CTRE_FORCE_INLINE auto match(ForwardIt first, ForwardIt last) noexcept {
2828

2929
using tmp = typename ctll::parser<ctre::pcre, input, ctre::pcre_actions>::template output<pcre_context<>>;
@@ -34,7 +34,7 @@ template <basic_fixed_string input, typename ForwardIt> __attribute__((flatten))
3434
#endif
3535

3636

37-
#if __has_cpp_attribute(__cpp_nontype_template_parameter_class)
37+
#if __cpp_nontype_template_parameter_class
3838
template <basic_fixed_string input> __attribute__((flatten)) constexpr CTRE_FORCE_INLINE auto search(std::string_view sv) noexcept {
3939

4040
using tmp = typename ctll::parser<ctre::pcre, input, ctre::pcre_actions>::template output<pcre_context<>>;
@@ -45,7 +45,7 @@ template <basic_fixed_string input> __attribute__((flatten)) constexpr CTRE_FORC
4545
#endif
4646

4747

48-
#if __has_cpp_attribute(__cpp_nontype_template_parameter_class)
48+
#if __cpp_nontype_template_parameter_class
4949
template <basic_fixed_string input, typename ForwardIt> __attribute__((flatten)) constexpr CTRE_FORCE_INLINE auto search(ForwardIt first, ForwardIt last) noexcept {
5050

5151
using tmp = typename ctll::parser<ctre::pcre, input, ctre::pcre_actions>::template output<pcre_context<>>;

include/ctre/literals.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ namespace ctre {
1414
// in C++17 (clang & gcc with gnu extension) we need translate character pack into basic_fixed_string
1515
// in C++20 we have `class nontype template parameters`
1616

17-
#if !__has_cpp_attribute(__cpp_nontype_template_parameter_class)
17+
#if !__cpp_nontype_template_parameter_class
1818
template <typename CharT, CharT... input> static inline constexpr auto _fixed_string_reference = ctll::basic_fixed_string<CharT, sizeof...(input)>({input...});
1919
#endif
2020

2121
namespace literals {
2222

23-
#if !__has_cpp_attribute(__cpp_nontype_template_parameter_class)
23+
#if !__cpp_nontype_template_parameter_class
2424
template <typename CharT, CharT... charpack> __attribute__((flatten)) constexpr CTRE_FORCE_INLINE auto operator""_fixed_pcre() noexcept {
2525
constexpr auto & input = _fixed_string_reference<CharT, charpack...>;
2626
#else
@@ -35,7 +35,7 @@ template <basic_fixed_string input> __attribute__((flatten)) constexpr CTRE_FORC
3535
// add this when we will have concepts
3636
// requires ctll::parser<ctre::pcre, _fixed_string_reference<CharT, charpack...>, ctre::pcre_actions>::template correct_with<pcre_context<>>
3737

38-
#if !__has_cpp_attribute(__cpp_nontype_template_parameter_class)
38+
#if !__cpp_nontype_template_parameter_class
3939
template <typename CharT, CharT... charpack> __attribute__((flatten)) constexpr CTRE_FORCE_INLINE auto operator""_pcre() noexcept {
4040
constexpr auto & input = _fixed_string_reference<CharT, charpack...>;
4141
#else
@@ -53,7 +53,7 @@ template <basic_fixed_string input> __attribute__((flatten)) constexpr CTRE_FORC
5353
// add this when we will have concepts
5454
// requires ctll::parser<ctre::pcre, _fixed_string_reference<CharT, charpack...>, ctre::pcre_actions>::template correct_with<pcre_context<>>
5555

56-
#if !__has_cpp_attribute(__cpp_nontype_template_parameter_class)
56+
#if !__cpp_nontype_template_parameter_class
5757
template <typename CharT, CharT... charpack> __attribute__((flatten)) constexpr CTRE_FORCE_INLINE auto operator""_ctre() noexcept {
5858
constexpr auto & input = _fixed_string_reference<CharT, charpack...>;
5959
#else
@@ -76,7 +76,7 @@ template <typename CharT, CharT... charpack> __attribute__((flatten)) constexpr
7676

7777
namespace test_literals {
7878

79-
#if !__has_cpp_attribute(__cpp_nontype_template_parameter_class)
79+
#if !__cpp_nontype_template_parameter_class
8080
template <typename CharT, CharT... charpack> __attribute__((flatten)) constexpr inline auto operator""_pcre_test() noexcept {
8181
constexpr auto & input = _fixed_string_reference<CharT, charpack...>;
8282
#else
@@ -85,7 +85,7 @@ template <basic_fixed_string input> __attribute__((flatten)) constexpr inline au
8585
return ctll::parser<ctre::pcre, input>::correct;
8686
}
8787

88-
#if !__has_cpp_attribute(__cpp_nontype_template_parameter_class)
88+
#if !__cpp_nontype_template_parameter_class
8989
template <typename CharT, CharT... charpack> __attribute__((flatten)) constexpr inline auto operator""_pcre_gen() noexcept {
9090
constexpr auto & input = _fixed_string_reference<CharT, charpack...>;
9191
#else
@@ -97,7 +97,7 @@ template <basic_fixed_string input> __attribute__((flatten)) constexpr inline au
9797
}
9898

9999

100-
#if !__has_cpp_attribute(__cpp_nontype_template_parameter_class)
100+
#if !__cpp_nontype_template_parameter_class
101101
template <typename CharT, CharT... charpack> __attribute__((flatten)) constexpr CTRE_FORCE_INLINE auto operator""_pcre_syntax() noexcept {
102102
constexpr auto & input = _fixed_string_reference<CharT, charpack...>;
103103
#else
@@ -107,7 +107,7 @@ template <basic_fixed_string input> __attribute__((flatten)) constexpr CTRE_FORC
107107
}
108108

109109

110-
#if !__has_cpp_attribute(__cpp_nontype_template_parameter_class)
110+
#if !__cpp_nontype_template_parameter_class
111111
template <typename CharT, CharT... charpack> __attribute__((flatten)) constexpr inline auto operator""_simple_test() noexcept {
112112
constexpr auto & input = _fixed_string_reference<CharT, charpack...>;
113113
#else

0 commit comments

Comments
 (0)