Compile-time or runtime detection within a constexpr function
It is possible to detect if a given function-call expression is a constant expression, and thereby select between two different implementations. Requires C++14 for the generic lambda used below. (This answer grew out this answer from @Yakk to a question I asked last year). I’m not sure how far I’m pushing the Standard. This is … Read more