Hacker News new | ask | show | jobs
by nly 1003 days ago
Boost Xpressive has had static/"compile time" regex in C++ since the mid 2000s

https://www.boost.org/doc/libs/1_83_0/doc/html/xpressive.htm...

A performance comparison would be interesting.

1 comments

I had great results with this back in the day. The template meta programming DSL you had to use was pretty horrifying but it was a triumph of what you could do with template metaprogramming (which was something discovered, not designed, in C++).

The first compile time regular expressions I saw that just used normal regular expressions was D's CTRE which produced an even faster "engine" than Boost Xpressive. This was thanks to D's compile time function evaluation reaching a point something like this was possible.

I just started using this CTRE for a regular expression whose performance had become problematic and I'm very impressed with it so far. It's pretty easy to surpass std::regex but not sacrificing usability was surprising. Build times haven't been affected too much either (for my use case).