- 博客(3)
- 收藏
- 关注
原创 c++ typename与class区别
C++ 标准说,template 用于基础数据类型,typename 指类型名,T 可以取 char int double 等 ,template 用于类,T 可以取任何类。 实际在定义模板的时候typename和class作用完全一样。 typename另外一个作用为:使用嵌套依赖类型(nested depended name), 这个时候typename的作用就是告诉c++编译器,typen...
2019-11-28 09:14:27 290
原创 使用可变参数模板创建单例模式
#ifndef BASE_SINGLETON_H #define BASE_SINGLETON_H #include <iostream> #include <mutex> #include "logger.h" #include "base_exception.h" #include "singleton_objects.h" using namespace std;...
2019-11-27 22:43:52 241
原创 C++定义下标为0数组
C++定义下标为0数组 首先看个例子 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> struct helloworld_t { int num; char helloworld[0];//主要是用来得到一个数组的地址,再由数组的个...
2019-11-27 22:36:49 1341
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人