这是一个特殊的值等于最大的值表示的类型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