Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As someone who used to have to do this sort of compile-time stuff with previous versions of the standard, I'm jealous of how much more can be done now that I don't have to.

If you're looking for an interesting follow-up project, here's something I had to do once that's now become much easier: compute a compile-time hash of the compilation for the current translation unit, e.g. __BASE_FILE__ hashed together with __TIMESTAMP__ or the equivalents for each platform.

This allows you to dynamically invalidate on-disk caches and trigger new-build tripwires based on ongoing revisions. Development and release builds are handled identically: if source file X handles a cache and X was recompiled, discard the cache.



Thanks for the idea! Yes constexpr std::vector feels like cheating




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: