现在的位置: 首页 > 综合 > 正文

C++0x标准库改动一览

2013年12月11日 ⁄ 综合 ⁄ 共 1866字 ⁄ 字号 评论关闭

原文:http://blogs.msdn.com/xiangfan/archive/2009/01/12/standard-library-changes-in-c-0x.aspx 

C++0x会在不久的将来通过。那么你知道标准库都有哪些改变吗?我搜集了一份标准库改动的列表(这里没有包含一些行为上的细微改动以及和concept相关的改动)。

1. 新增内容

system_error:
    新增的头文件
array,vector,deque,list,string,map,set,unordered_map,unordered_set:
    成员函数:cbegin,cend,crbegin,crend
vector,deque,string:
    成员函数:shrink_to_fit
map,unordered_map:
    成员函数:at
type_traits:
    新增traits:
        is_lvalue_reference,is_rvalue_reference
        has_trivial_default_constructor,has_trivial_copy_constructor,has_nothrow_default_constructor,has_nothrow_copy_constructor
string:
    新增类型:u16string,u32string
    新增函数:
        stoi,stol,stoul,stoll,stoull,stof,stod,stold
        to_string,to_wstring
algorithm:
    新增函数:
        all_of,any_of,none_of,find_if_not,copy_if,partition_copy,is_partitioned,partition_point
        minmax_element
        is_heap_until,is_heap
        is_sorted_until,is_sorted
        next,prev
        min,max,minmax
        copy_n
random:
    新增类:seed_seq和许多新的随机分布
    新增函数:generate_canonical
    新增类型:
        ranlux24_base,ranlux48_base,ranlux24,ranlux48,knuth_b
        default_random_engine
    对于linear_congruential,subtract_with_carry,mersenne_twister,discard_block,xor_combine等类:
        新增了接受seed_seq类型参数的构造函数,成员函数"seed"以及相应的_engine类
memory:
    新增类:default_delete,unique_ptr
    新增函数:allocate_shared,make_shared
functional:
    新增仿函数:bit_and,bit_or,bit_xor
numeric:
    新增函数:iota
iomanip:
    新增函数:
        get_money,put_money
        get_time,put_time
ios:
    新增函数:defaultfloat
iosfwd:
    新增类型:char_traits<char16_t>,char_traits<char32_t>
limits:
    成员函数:max_digits10,lowest

2. 来自tr1

array
unordered_map
unordered_set
regex
random
type_traits
tuple
functional
utility
    get
ios
    hexfloat

3. 其它

set,map,unordered_map,unordered_set:
    成员函数"erase"将有返回值(和序列容器一致)
string:
    pop_back,front,back(和vector一致)
bitset:
    构造函数:unsigned long -> unsigned long long
fstream:
    构造函数和open成员函数接受传入string和wstring类型的filename(C++03只支持字符串指针)

抱歉!评论已关闭.