std::getline C++ Strings library std::basic_string Defined in header<string> template<classCharT,classTraits,classAllocator> std::basic_istream<CharT, Traits>& getline(std::basic_istream<CharT, Traits>&input, std::basic_string<CharT, Traits, Allocator>&str, CharT delim); ...
2) 同getline(input, str, input.widen('\n')),即默认分隔符是换行符。参数input - 获取数据来源的流 str - 放置数据的目标字符串 delim - 分隔字符 返回值input 注解消耗空白符分隔的输入(例如 int n; std::cin >> n;)时,任何后随的空白符,包括换行符都会被留在流中。然后当切换到面向行的输入...
返回类型是左值引用的函数调用或重载运算符表达式,例如std::getline(std::cin, str)、std::cout<<1、str1=str2或++it; [展开]延伸内容 a=b,a+=b,a%=b,以及所有其他内建的赋值及复合赋值表达式; ++a和--a,内建的前置自增与前置自减表达式; ...
即使这个变量的类型是右值引用,由它的名字组成的表达式也是个左值表达式。 2) 把左值引用作为返回的函数或者重载操作符。 比如,std::getline(std::cin,str),std::cout << 1, str1 = str2, 或 ++it; 3) a = b, a += b, a %= b, 以及其他所有内置[built-in]的赋值或者复合赋值[compound assignmen...
basic_istream& getline( char_type* s, std::streamsize count, char_type delim ); (2) Extracts characters from stream until end of line or the specified delimiter delim. The first overload is equivalent to getline(s, count, widen('\n')). ...
a function call or an overloaded operator expression of lvalue reference return type, such as std::getline(std::cin, str), std::cout << 1, str1 = str2, or ++it; (运算符重载并且返回值是引用的方法) a = b, a += b, a %= b, and all other built-in assignment and compound assig...
References, pointers, and iterators referring to the elements of abasic_stringmay be invalidated by any standard library function taking a reference to non-constbasic_stringas an argument, such asstd::getline,std::swap, oroperator>>, and by calling non-const member functions, exceptoperator[],...
class Allocator = std::allocator<CharT> > class basic_string; Das Klassen-Template basic_string speichert und manipuliert Sequenzen von char-ähnliche Objekte (dh Objekte, für die eine Spezialisierung der std::char_traits oder kompatible Merkmale Klasse bereitgestellt wird) . Original: The ...
std::basic_string C++ Bibliothèque de chaînes de caractères std::basic_string Déclaré dans l'en-tête<string> template< classCharT, classTraits=std::char_traits<CharT>, classAllocator=std::allocator<CharT> >classbasic_string; (1) ...
(public функция-элементstd::basic_istream)[править] getline извлекаетсимволы, поканебудетнайдензаданныйсимвол Оригинал: extracts characters until the given character is found ...