docopt / docopt.cpp

C++11 port of docopt
Boost Software License 1.0
1.04k stars 146 forks source link

Feat/ctre #143

Closed andijcr closed 9 months ago

andijcr commented 3 years ago

In this pull request, I replaced std::regex with ctre since the use of std::regex was perfect for ctre (an unchanging regex, used just for parsing)

In order to do so, I added ctre as a subtree, and I added a .clang-format that tries to match the style of the repo.

For this reason, a lot of files are charged, but the important stuff can be seen in this commit ca98f8496e0728371af5b0ae8a3fb26f1d3e4892

Basically changes in doctopt.cpp, docopt_private.h and docopt_util.h to swap std::regex with ctre and a couple of const std::string& with std::string_view

I don't expect this to be merged, because it's a bit messy and introduces a hard requirement for c++20. but maybe it can be useful as a starting point.

jaredgrubb commented 2 years ago

I love the idea, and I expect others might too! This would be a major version jump for the library, but maybe that's becoming more appropriate these days?

andijcr commented 2 years ago

probably. in a year c++23 will be here, so a hard requirement for c++20 can be justified, especially for a lib that has been feature-stable for a long time as docopt. as another issue suggested, it could be one stepping stone to get partial compile-time capabilities.