docopt.cpp icon indicating copy to clipboard operation
docopt.cpp copied to clipboard

replacing std::regex with ctre

Open andijcr opened this issue 3 years ago • 3 comments

I replaced std::regex with https://github.com/hanickadot/compile-time-regular-expressions . In doing so I had to add a .clang-format, remove boost regex, and move the standard to c++17 (this last one is a hard requirement for ctre). Is there an interest in these changes, or is it out of scope for this project?

you can find my fork here: https://github.com/andijcr/docopt.cpp/tree/feat/ctre

andijcr avatar May 24 '21 09:05 andijcr

I would vote for it because std::regex of Microsoft Visual C++ has mayn issues. The one you'll hit very soon is: Grouping within repetition causes regex stack error However, I would prefer a plugable regex approach allowing to add your own regex library. For instance PCRE.

nfrmtkr avatar Sep 01 '21 06:09 nfrmtkr

I do like this idea ... does it all work ok with CTRE? Whats the compile time change?

jaredgrubb avatar Sep 07 '21 20:09 jaredgrubb

I opened a pull request to compare the changes. The important changes are in this commit https://github.com/andijcr/docopt.cpp/commit/ca98f8496e0728371af5b0ae8a3fb26f1d3e4892 The compile time tends to be worse than before, but it's limited only to a translation unit of the library, so it's a price paid only once when at the first build. The major problem it's the hard requirement for c++20, but since the changes are localized I think some ifdefs should be able to handle it.

andijcr avatar Sep 08 '21 07:09 andijcr