会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
thammer
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
9
···
24
下一页
2024年6月30日
函数模板
摘要: 什么是函数模板 C++的函数模板提供了一种方法,让编译器根据你写的模板,来自动按需生成函数。这个模板就称之为函数模板。函数模板格式如下: template <typename AnyType> void MyFunctionTemplate(AnyType ¶m) { } 这里AnyType
阅读全文
posted @ 2024-06-30 10:36 thammer
阅读(56)
评论(0)
推荐(0)
2024年6月28日
C++关键字decltype
摘要: decltype引入的原因之一是在函数模板中遇到如下情形: template <typename T1, typename T2> void foo(T1 a, T2 b) { ?type? tmp = a + b; } 此时,tmp类型该定义为哪种呢?我们知道基础数据类型相加时会自动进行类型提升,
阅读全文
posted @ 2024-06-28 15:17 thammer
阅读(57)
评论(0)
推荐(0)
模板函数定义和实现分开写时遇到的问题
摘要: 定义了一个类A,里面有个模板函数。因为我习惯每个类的声明和实现分开用*.h,*.cpp写。所以类A的源码如下: A.h #ifndef A_H #define A_H class A { public: A(); template <typename T> void fuck(T a); }; #e
阅读全文
posted @ 2024-06-28 10:55 thammer
阅读(69)
评论(0)
推荐(0)
g++ typeid.name()对应表
摘要: 转自 https://blog.csdn.net/boysoft2002/article/details/114263346
阅读全文
posted @ 2024-06-28 09:59 thammer
阅读(13)
评论(0)
推荐(0)
2024年6月13日
ubuntu22.04编译openwrt的lede-17.01一些错误的处理方式
摘要: m4 c-stack.c:55:26: error: missing binary operator before token “(“ 55 | #elif HAVE_LIBSIGSEGV && 解决方法: wget https://raw.githubusercontent.com/keyfour
阅读全文
posted @ 2024-06-13 20:30 thammer
阅读(836)
评论(0)
推荐(0)
2024年4月29日
构造函数的成员初始化列表
摘要: 为什么要初始化成员 对于类成员是基础数据类型,例如int、char这些,构造对象时,成员不会被初始化,值是随机的。下面代码可以验证下: class A { public: A(){} void showMember() const { std::cout << "a:" << a << std::e
阅读全文
posted @ 2024-04-29 12:00 thammer
阅读(151)
评论(0)
推荐(0)
2024年4月25日
C++构造函数中使用new时的注意事项
摘要: 初级 1. 内存管理:需要在构造函数中分配内存给 ptr,并在析构函数中释放内存,以避免内存泄漏。 MyClass::MyClass() { ptr = new int; } MyClass::~MyClass() { delete ptr; } new delete, new[] delete[]
阅读全文
posted @ 2024-04-25 19:27 thammer
阅读(153)
评论(0)
推荐(0)
2024年4月3日
lua的协程
摘要: lua协程的创建通常是通过coroutine.create(f),其中f就是协程的主体程序,它必须是一个函数。coroutine.create返回一个类型为thread(lua的8种内建类型之一)的变量。 Creates a new coroutine, with body `f`. `f` mus
阅读全文
posted @ 2024-04-03 10:07 thammer
阅读(698)
评论(0)
推荐(0)
2024年4月1日
clion + EmmyLua插件实现Lua的本地调试
摘要: 安装好EmmyLua插件后,它会提供两种调试方式:1.使用mobdebug调试 2.使用EmmyDebugger调试。mobdebug是用lua写的一个调试模块,基于网络通信(所以依赖luasocket),以字符形式传递调试命令和返回结果。所以使用mobdebug前先需要安装luasocket模块。
阅读全文
posted @ 2024-04-01 09:57 thammer
阅读(633)
评论(0)
推荐(0)
2024年3月20日
openwrt上使用emmylua + emmyluadebugger + clion调试luci
摘要: lua-emmyluadebugger A OpenWrt package of EmmyLuaDebugger IntelliJ-EmmyLua EmmyLuaDebugger IntelliJ-EmmyLua是一个给JetBrains全家桶用的lua插件,也有VSCode版本VSCode-Emm
阅读全文
posted @ 2024-03-20 19:46 thammer
阅读(397)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
9
···
24
下一页
公告