std::basic_string<CharT,Traits,Allocator>::size, (3) - Linux Manuals
std::basic_string<CharT,Traits,Allocator>::size,: std::basic_string<CharT,Traits,Allocator>::size,
NAME
std::basic_string<CharT,Traits,Allocator>::size, - std::basic_string<CharT,Traits,Allocator>::size,
Synopsis
size_type size()
size_type size()
size_type length()
size_type length()
Returns the number of CharT elements in the string, i.e. std::distance(begin(),
end()).
Parameters
(none)
Return value
The number of CharT elements in the string.
Complexity
Unspecified
Constant Notes
For std::string, the elements are bytes
same as characters if a multibyte encoding such as UTF-8 is used.
Example
// Run this code
std::distance(s.begin(), s.end())));
See also
empty
max_size returns the maximum number of characters