c++ log functions using template SFINAE for conditional compile -
i evaluating if possible leverage c++11 features replace logging macros without run-time additional cost. i come out demo: enum class loglevel { fatal = 0, dfatal = 1, error = 2, normal = 3, verbose = 4, debug = 5 }; constexpr loglevel log_compiled = loglevel::normal; loglevel log_runtime = loglevel::error; #ifdef ndebug constexpr loglevel log_fatal = loglevel::fatal; #else constexpr loglevel log_fatal = loglevel::dfatal; #endif template <loglevel l, typename std::enable_if<(l <= log_fatal)>::type* = nullptr> void log(std::string message) { std::cout << "fatal level: " << (int) l << " message: " << message << std::endl; exit(0); } template <loglevel l, typename std::enable_if<(l>log_fatal && l <= log_compiled)>::type* = nullptr> void log(std::string message) { if (l <= log_runtime) { std::cout << "level: " << (int...