C++基础::函数、类、类型所在的头文件 && 接口的介绍

来源:互联网 发布:数学网络课程哪个好 编辑:程序博客网 时间:2024/06/06 03:12

除非特别说明,所在的命名空间均是:标准命名空间,也即std

stuff header 说明 ifstream
ofstream
fstream <fstream> 文件流
in>>
out << istringstream
ostringstream
stringstream <sstream 字符串流 <shared_ptr>
<unique_ptr> <memory> <memory>是标准命名空间的头文件
<boost\shared_ptr.hpp>头文件,命名空间为boost也有智能指针的定义 pair <utility> complex <complex> numeric_limits <limits> accumulate <numeric> ptrdiff_t <crtdef.h> size_t <cstddef> unordered_map
unordered_mulitmap <unordered_map> unordered_set
unordered_multiset <unordered_set> is_pointer(模板结构体)
is_integral(模板结构体) <type_traits> ifstream
ofstream <fstream> pair <utility> tuple <tuple> for_each <algorithm> getline <string> while(std::getline(in, str, ‘\n’)){…}
第三个参数(分隔符)的类型为char,而不是string setw <iomanip> cout << setw(10) << left << …

接口

没有pair_size和pair_element,pair对象也统一交由tuple_like接口(tuple_size、tuple_element)管理。

  • tuple_size:返回参数个数,

  • tuple_element:返回每一位上的类型,第一个模板参数为非类型模板参数

typedef std::tuple<int, float, std::string> TupleType;cout << std::tuple_size<TupleType>::value << endl;std::tuple_element<2, TupleType>::type s("hello world");
0 0
原创粉丝点击