這是一個特殊的值等於最大的值表示的類型size_type。依賴於上下文的確切含義,但人們廣泛使用,也能夠做爲字符串的結束指示符指望字符串索引,或者由函數返回一個字符串索引的錯誤指示器的功能. 示例 #include <iostream> #include <bitset> #include <string> int main() { // string search functions return npos if nothing is found std::string s = "test"; if(s.find('a') == std::string::npos) std::cout << "no 'a' in 'test'\n"; // functions that take string subsets as arguments // use npos as the "all the way to the end" indicator std::string s2(s, 2, std::string::npos); std::cout << s2 << '\n'; std::bitset<5> b("aaabb", std::string::npos, 'a', 'b'); std::cout << b << '\n'; } 輸出: no 'a' in 'test' st 00011
函數原型: template <class T> typename remove_reference<T>::type&& move (T&& arg) noexcept; Move as rvalue Returns an rvalue reference to arg. 返回一個arg的右值引用 右值引用的出現就讓咱們能夠取得臨時對象的控制權,終於能夠修改臨時對象了!
參考
http://www.cplusplus.com/reference/utility/move/?kw=move
http://www.cnblogs.com/chezxiaoqiang/archive/2012/10/24/2736630.htmlhtml