随笔分类 - CPP
摘要:编译选项 -g -rdynamic #include <execinfo.h> void print_stacktrace() { void *buffer[100]; int nptrs = backtrace(buffer, 100); char **strings = backtrace_sy
阅读全文
摘要:#安装 valgrind sudo apt-get install valgrind #使用 memcheck 打开程序 valgrind --tool=memcheck myprogram [args...]
阅读全文
摘要:#if defined(__GNUC__) && __GNUC__ < 7 # include <experimental/string_view> # include <experimental/optional> # define string_view experimental::string
阅读全文
摘要:#include <iostream> #include <string_view> template<typename T> struct TypeName { constexpr static std::string_view fullname_intern() { #if defined(__
阅读全文
摘要:#include <iostream> template<class derived> struct base { derived getDerivedType(){}; void interface(){ static_cast<derived*>(this)->interface();}; };
阅读全文
摘要:# We'll use defaults Microsoft from the LLVM style, but with 4 columns indentation. BasedOnStyle: Microsoft IndentWidth: 4 ColumnLimit: 0 Language: Cp
阅读全文
摘要:
阅读全文
摘要:#include <iostream> #include <string> #include <locale> #include <codecvt> std::wstring s2ws(const std::string& str) { using convert_typeX = std::code
阅读全文