Skip to content

Commit b0790fd

Browse files
author
Hana Dusíková
committed
readme update
1 parent 850d583 commit b0790fd

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

README.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,35 @@ ctre::match<"REGEX">(subject); // C++20
2020
* `std::string`-like object (`std::string_view` or your own string if it's providing `begin`/`end` functions with forward iterators)
2121
* pair of forward iterators
2222

23+
## Supported compilers
24+
25+
* clang 5.0+ (template UDL, C++17 syntax)
26+
* gcc 7.2+ (template UDL, C++17 syntax)
27+
* gcc 9.0+ (C++17 & C++20 cNTTP syntax)
28+
* MSVC 15.8.8+ (C++17 syntax only)
29+
30+
#### Template UDL syntax
31+
32+
Compiler must support N3599 extension (as GNU extension in gcc and clang).
33+
34+
#### C++17 syntax
35+
36+
You can provide pattern as a `constexpr ctll::basic_fixed_string` variable.
37+
38+
```c++
39+
static constexpr auto pattern = ctll::basic_fixed_string{ "h.*" };
40+
41+
constexpr auto match(std::string_view sv) noexcept {
42+
return ctre::re<pattern>().match(sv);
43+
}
44+
```
45+
46+
(this is tested in MSVC 15.8.8)
47+
48+
#### C++20 syntax
49+
50+
Currently only compiler which supports cNTTP syntax `ctre::match<PATTERN>(subject)` is GCC 9+.
51+
2352
## Examples
2453

2554
#### Extracting number from input
@@ -94,25 +123,3 @@ for (auto match: ctre::range(input,"[0-9]++"_ctre)) {
94123
std::cout << std::string_view{match} << "\n";
95124
}
96125
```
97-
98-
## Supported compilers
99-
100-
* clang 5.0+
101-
* gcc 7.2+
102-
* MSVC 15.8.8+ (experimental, without string_literal support)
103-
104-
Compiler must support N3599 extension (as GNU extension in gcc and clang) or C++20 class NTTP (P0732).
105-
106-
### MSVC
107-
108-
Because current MSVC doesn't support custom templated string literals or NTTP, you need to use workaround:
109-
110-
```c++
111-
static constexpr inline auto pattern = ctll::basic_fixed_string{ "h.*" };
112-
113-
constexpr auto match(std::string_view sv) noexcept {
114-
return ctre::re<pattern>().match(sv);
115-
}
116-
```
117-
118-
(this is tested in MSVC 15.8.8)

0 commit comments

Comments
 (0)