Is std :: string a container class in the C ++ standard library, limited only to char elements?
This is actually a typedef std::basic_string<char>. std::basic_string- a container class specifically designed for string operations. This container can be used for wide characters ( wchar_t); for this case its typedef will be wstring.
std::basic_string<char>
std::basic_string
wchar_t
wstring
A std::basic_string<> - , . , std::basic_string POD, char ( std::string) wchar_t (std::wstring).
std::basic_string<>
char
std::string
std::wstring
, basic_string . , , POD. , basic_string , , , .
basic_string
, , , basic_string. , basic_string, std::basic_string ( ) .
std::string typedef basic_string<char, std::char_traits<char>, std::allocator<char> > char.
basic_string<char, std::char_traits<char>, std::allocator<char> >
, basic_string (, , ).
#include <string> #include <cassert> int main() { std::basic_string<int> numbers_1, numbers_2; numbers_1 += 1; numbers_2 += 2; std::basic_string<int> numbers_3 = numbers_1 + numbers_2 + 3; unsigned pos = numbers_3.find(10); assert(pos == std::basic_string<int>::npos); }
std::string _. char, char http://www.cplusplus.com/reference/string/char_traits/
Source: https://habr.com/ru/post/1723779/More articles:how to check users leave page - javascriptMany new items in SharePoint - content-typeC # mvc dynamically creates a controller from a string name - eval? - c #Как проверить правильность URL-адреса flickr - flickrHide text from printing - htmlThe same session variable for different systems - phpHow to use strtol to read from __int64 value? - cPHP request SoapClient - soaphow to prevent conflicts between mooTools and Prototype - jqueryPHP / MySQL - saving an array in a database - arraysAll Articles