-
初始化和赋值,初始化不是赋值,因为都是用“=”而混淆,
-
类型别名:typedef的作用
std::tuple<std::vector<int>::const_iterator, ptrdiff_t, size_t, double, MyType::do_you_know_what::why_dont_i_use_typedef::why> arg;
有了typedef,就可以这样了:
typedef std::tuple<std::vector<int>::const_iterator, ptrdiff_t, size_t, double, MyType::do_you_know_what::why_dont_i_use_typedef::why> m_tuple; m_tuple arg1; m_typle arg2;
这样看来typedef就是为了书写起来方便的,暂时就学到这些
-
const限定符,常量不能被修改
-
自定义数据结构,
//结构体类 struck data{ double num = 0.2; }; //定义类对象也就是结构体实例 data data1, data2 std::cout << data1.num << std::endl;
网友评论