簡介
? Class pair<> and class tuple<>
? Smart pointer classes (class shared_ptr<> and class unique_ptr)
? Numeric limits
? Type traits and type utilities
? Auxiliary functions (for example, min(), max(), and swap())
? Class ratio<>
? Clocks and timers
? Some important C functions
pairs

1,具有成員模板構(gòu)造函數(shù)(當(dāng)pair類型不同但可以隱式類型轉(zhuǎn)換時(shí)調(diào)用)
2,pair的成員的類型的拷貝構(gòu)造函數(shù)必須是常量引用
tuples
擴(kuò)展pair,使得tuple支持多個(gè)元素

1,使用get<0>(t)等獲取每個(gè)元素
2,賦值操作時(shí)右操作數(shù)必須顯式的為tuple類型,不支持隱式轉(zhuǎn)換
tuple_size<tupletype>::value返回tuple的元素個(gè)數(shù)
tuple_element<index, tupletype>::type返回tuple的第index個(gè)元素的類型
tuple_cat()將多個(gè)tuple組合為一個(gè)整體
shared_ptr
多個(gè)指針共享同一資源,當(dāng)最后一個(gè)指針銷毀時(shí)會將資源釋放。



1,weak_ptr的的拷貝和賦值不會增加或減少對應(yīng)的shared_ptr的引用計(jì)數(shù)
2,使用lock()函數(shù)獲取weak_ptr綁定的shared_ptr



數(shù)值極限<limits>



類型萃取<type_traits>
A type trait provides a way to deal with the properties of a type. It is a template, which at compile time yields a specific type or value based on one or more passed template arguments, which are usually types.





引用轉(zhuǎn)換
std::reference_wrapper<>定義在<functional>,將參數(shù)轉(zhuǎn)化為引用類型來適用函數(shù)模板std::vector<std::reference_wrapper<MyClass>> coll; // OK
比較輔助函數(shù)
定義在<algorithm>

std::swap函數(shù)定義在<utility>
編譯時(shí)分?jǐn)?shù)計(jì)算類
ratio<>定義在<ratio>
例如ratio<3, 5>表示五分之三,類成員num,den分別表示分子和分母

例如std::ratio_add<std::ratio<2, 7>, std::ratio<2,6>>::type為std::ratio<13, 21>

例如std::nano,等價(jià)于std::ratio<1, 1000000000LL>