You might be interested in metaparse [1] which can greatly simplify compile time parsing of strings but has a very steep learning curve.
You might be interested in metaparse [1] which can greatly simplify compile time parsing of strings but has a very steep learning curve.
Useful strings at compile time is a desirable feature beyond c++, though. A perfect hash could be a nice solution, I thought, but I got around to trying out gperf, and it was much slower than I expected. Probably too slow to use in ordinary situations. I guess gperf is for when (runtime) performance is incredibly important.
Another possible approach to strings at compile time is something like flex, or re2c. I haven't tested them in this type of scenario. But, apparently Zed Shaw used ragel to parse http in Mongrel to excellent effect. My problem with ragel is its complicated syntax.