when someone abandons you,it is him that gets loss because he lost someone who truly loves him but you just lost one who doesn’t love you.
c++11 中的 auto 是一个占位符,编译器在编译期间自动推导出变量的类型,并适当地改变结果类型使其更符合初始化规则,因此 auto 定义的变量必须有初始值
1 | int x; |
搭建 Git 服务器
1 | $ mkdir test.git # 创建 Git 资源的存储目录 test.git |
1
2
3
4
5
6
7
8
9
10
11
12struct child
{
char name[10];
};
struct child she = { "Jerry" };
int main()
{
static struct child she1 = { "Jerry1" };
struct child she2 = { "Jerry2" };
return 0;
}
std::variant 是 C++17 中一个新加入标准函式库的 template 容器,使用时需要 #include
它的概念基本上是和 union 一样,是一个可以用来储存多种型别资料的容器;和 union 不同的是,std::variant 是 type-safe 的,再加上有许多函数可以搭配使用,所以在使用上应该算是相对安全
由于它是标准函式库的 template class,在使用时不需要另外去宣告一个新的类型
std::variant 在储存数据的时候,内部会有一个索引值来记录目前存储的是哪一个类型的数据
ln 命令用于给文件创建链接,链接的方式分为以下 2 种:
今天在看编译报错的时候发现一个神奇的 extern “C”
1 |
|
这是什么?我涉及的明明是 c++ 的工程,而且这个 extern 好像也不是单纯声明用的
CRTP(Curiously Recurring Template Pattern)是 c++ 使用范型实现静态多态的方法,这种方法和虚拟函数比起来优点就是可以节省内存,不需要额外的空间存储 virtual table,并且提高运行速度,运行时不需要动态查找对应的函数
the only present love demands is love