std::basic_string<CharT,Traits,Allocator>::size,std::basic_string<CharT,Traits,Allocator>::length (3) - Linux Manuals
std::basic_string<CharT,Traits,Allocator>::size,std::basic_string<CharT,Traits,Allocator>::length: std::basic_string<CharT,Traits,Allocator>::size,std::basic_string<CharT,Traits,Allocator>::length
NAME
std::basic_string<CharT,Traits,Allocator>::size,std::basic_string<CharT,Traits,Allocator>::length - std::basic_string<CharT,Traits,Allocator>::size,std::basic_string<CharT,Traits,Allocator>::length
Synopsis
size_type size() const; (until C++11)
size_type size() const noexcept; (since C++11)
size_type length() const; (until C++11)
size_type length() const noexcept; (since C++11)
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 (until C++11)
Constant (since C++11)
Notes
For std::string, the elements are bytes (objects of type char), which are not the same as characters if a multibyte encoding such as UTF-8 is used.
Example
// Run this code
See also
empty (public member function)
max_size (public member function)