首页 > 编程语言 >C++ 一个简洁的CHECK宏

C++ 一个简洁的CHECK宏

时间:2022-10-24 15:02:01浏览次数:43  
标签:std 简洁 C++ cerr CHECK condition

#define CHECK2(condition, message)                                                                                                                   \
  (!(condition)) ? (std::cerr << "Assertion failed: (" << #condition << "), "                                                                        \
                              << "function " << __FUNCTION__ << ", file " << __FILE__ << ", line " << __LINE__ << "." << std::endl                   \
                              << message << std::endl,                                                                                               \
                    abort(), 0)                                                                                                                      \
                 : 1

// CHECK2(condition, "message: " << var);

标签:std,简洁,C++,cerr,CHECK,condition
From: https://www.cnblogs.com/vaughnhuang/p/16821451.html

相关文章