diff --git a/include/ctre/first.hpp b/include/ctre/first.hpp index 69e38371..81932d55 100644 --- a/include/ctre/first.hpp +++ b/include/ctre/first.hpp @@ -332,7 +332,7 @@ template constexpr int64_t negative_helper(ctre::character } else { return A; } -} +} template constexpr int64_t negative_helper(ctre::char_range, CB & cb, int64_t start) { if (A != (std::numeric_limits::min)()) { @@ -345,7 +345,7 @@ template constexpr int64_t negative_helper(ctre::c } else { return B; } -} +} template constexpr int64_t negative_helper(ctre::enumeration, CB & cb, int64_t start) { int64_t nstart = negative_helper(ctre::character{}, cb, start); @@ -417,7 +417,7 @@ template class point_set { auto last = end(); auto it = first; auto count = std::distance(first, last); - while (count != 0) { + while (count != 0) { it = first; auto step = count / 2; std::advance(it, step); @@ -487,6 +487,15 @@ template class point_set { constexpr bool check(can_be_anything) { return used > 0; } + template + constexpr bool check(ctre::binary_property) { + return check(can_be_anything{}); + } + + template + constexpr bool check(ctre::property) { + return check(can_be_anything{}); + } template constexpr bool check(ctre::negative_set nset) { bool collision = false; negative_helper(nset, [&](int64_t low, int64_t high){ diff --git a/single-header/ctre-unicode.hpp b/single-header/ctre-unicode.hpp index d9c0e3c1..056decb8 100644 --- a/single-header/ctre-unicode.hpp +++ b/single-header/ctre-unicode.hpp @@ -4282,7 +4282,7 @@ template constexpr int64_t negative_helper(ctre::character } else { return A; } -} +} template constexpr int64_t negative_helper(ctre::char_range, CB & cb, int64_t start) { if (A != (std::numeric_limits::min)()) { @@ -4295,7 +4295,7 @@ template constexpr int64_t negative_helper(ctre::c } else { return B; } -} +} template constexpr int64_t negative_helper(ctre::enumeration, CB & cb, int64_t start) { int64_t nstart = negative_helper(ctre::character{}, cb, start); @@ -4367,7 +4367,7 @@ template class point_set { auto last = end(); auto it = first; auto count = std::distance(first, last); - while (count != 0) { + while (count != 0) { it = first; auto step = count / 2; std::advance(it, step); @@ -4437,6 +4437,15 @@ template class point_set { constexpr bool check(can_be_anything) { return used > 0; } + template + constexpr bool check(ctre::binary_property) { + return check(can_be_anything{}); + } + + template + constexpr bool check(ctre::property) { + return check(can_be_anything{}); + } template constexpr bool check(ctre::negative_set nset) { bool collision = false; negative_helper(nset, [&](int64_t low, int64_t high){ diff --git a/single-header/ctre.hpp b/single-header/ctre.hpp index 5650df9f..25abe055 100644 --- a/single-header/ctre.hpp +++ b/single-header/ctre.hpp @@ -4279,7 +4279,7 @@ template constexpr int64_t negative_helper(ctre::character } else { return A; } -} +} template constexpr int64_t negative_helper(ctre::char_range, CB & cb, int64_t start) { if (A != (std::numeric_limits::min)()) { @@ -4292,7 +4292,7 @@ template constexpr int64_t negative_helper(ctre::c } else { return B; } -} +} template constexpr int64_t negative_helper(ctre::enumeration, CB & cb, int64_t start) { int64_t nstart = negative_helper(ctre::character{}, cb, start); @@ -4364,7 +4364,7 @@ template class point_set { auto last = end(); auto it = first; auto count = std::distance(first, last); - while (count != 0) { + while (count != 0) { it = first; auto step = count / 2; std::advance(it, step); @@ -4434,6 +4434,15 @@ template class point_set { constexpr bool check(can_be_anything) { return used > 0; } + template + constexpr bool check(ctre::binary_property) { + return check(can_be_anything{}); + } + + template + constexpr bool check(ctre::property) { + return check(can_be_anything{}); + } template constexpr bool check(ctre::negative_set nset) { bool collision = false; negative_helper(nset, [&](int64_t low, int64_t high){ diff --git a/tests/_bad_cycle.cpp b/tests/_bad_cycle.cpp index 24b38bc3..db4e3c19 100644 --- a/tests/_bad_cycle.cpp +++ b/tests/_bad_cycle.cpp @@ -18,3 +18,4 @@ using namespace std::string_view_literals; static_assert(match("ab"sv, ctre::plus, ctre::character<'a'>>>()), "(ab|a)+"); // this will need fix in different branch as this is a long standing problem //static_assert(match("ab"sv, ctre::plus, ctre::string<'a','b'>>>()), "(a|ab)+"); + diff --git a/tests/matching3.cpp b/tests/matching3.cpp index 2be15c4c..69077d65 100644 --- a/tests/matching3.cpp +++ b/tests/matching3.cpp @@ -1,4 +1,4 @@ -#include +#include #include void empty_symbol() { } @@ -230,5 +230,7 @@ TEST_NOT_SEARCH(222, u8"(?<=ě)b", u8"čb"); TEST_MATCH(223, "(?>abc)?", "abc"); TEST_MATCH(224, "(?>abc)?", ""); - +TEST_MATCH(225, R"( ?[\p{N}])", " 1"); +TEST_MATCH(226, R"( ?\p{N})", " 1"); +TEST_MATCH(227, R"( ?\p{N}+)", " 1234");