留意上面的图片中 底部的蓝底白字 的警告内容。
因为类型是不确定的,所以初始化也比较麻烦的。
不过我们也可以使用 T* 指针类型的来初始化为 NULL
/ nullptr
下面测试代码:
// jave.lin - testing for template_type_member_init
#include
#include
template
class Test {
public:
// T test_default = static_cast(0);
T test_default = static_cast(NULL);
};
template
class TestPointer {
public:
T* test_default = NULL;
};
class Custom_CLZ { };
class Custom_STC { };
class CAN_NOT_OUTPUT_CLZ { };
#define P(content)\
std::cout
关注
打赏
热门博文
- 3D Assets (Textures & Model & Animations) & Game Design Ideas & DCC Tutorials & TA
- LearnGL - 学习笔记目录
- Unity - Timeline 知识汇总
- Unity Graphics - 知识点目录 - 停止翻译,因为发现官方有中文文档了
- Graphic资料
- Unity Lightmap&LightProbe局部动态加载(亲测2020以及以上版本官方修复了)
- Unity - 踩坑日志 - 低版本线性颜色空间渲染异常的 “BUG”
- Unity Shader - PBR 渲染 SP 导出的素材
- 什么是 3A 游戏?
- Photosohp - 实现 2D MetaBall、MetaFont