3 ms·
A compile-time C++ LISP interpreter I wrote a while ago just for fun: http://pastebin.com/yz4XvYra http://pastebin.com/yz4XvYra (scroll to the bottom for an exa
by Sharlin 13y ago
A compile-time C++ LISP interpreter I wrote a while ago just for fun: http://pastebin.com/yz4XvYra http://pastebin.com/yz4XvYra (scroll to the bottom for an example).
It's a shame that C++ lacks proper support for compile-time strings, but it would be trivial to write a preprocessor turning a string into a list of char literals.
- swift 13y agoPost-C++11 you can work with strings at compile-time using constexpr template functions. IIRC you need something along the lines of this: > template <size_t N> constexpr foo(const char str[N]) { ... } The fact that constexpr strings can't be template parameters boggles the mind.