[ Web Proxy ]
URL:
Viewing: https://ko.cppreference.com/cpp/string/basic_string [Back]  [Original]

std::basic_string - cppreference.com
cppreference.com

std::basic_string

cppreference.com
 
 
 
std::basic_string
 
<tbody> </tbody>
<string> .
template< class CharT, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT> > class basic_string;

basic_string char . . Traits , std::char_traits traits .

The elements of a basic_string are stored contiguously, that is, for a basic_string s, &*(s.begin() + n) == &*s.begin() + n for any n in [0, s.size()), or, equivalently, a pointer to s[0] can be passed to functions that expect a pointer to the first element of a CharT[] array.

(since C++11)

, .

<string> .
std::string std::basic_string<char>
std::wstring std::basic_string<wchar_t>
std::u16string (C++11) std::basic_string<char16_t>
std::u32string (C++11) std::basic_string<char32_t>

CharT -
Traits - traits
Allocator - Allocator

traits_type Traits
value_type Traits::char_type
allocator_type [edit]
size_type (unsigned int) ( std::size_t) [edit]
difference_type (signed int) ( std::ptrdiff_t) [edit]
reference Allocator::reference (until C++11)
value_type& (since C++11) [edit]
const_reference Allocator::const_reference (until C++11)
const value_type& (since C++11) [edit]
pointer Allocator::pointer (until C++11)
std::allocator_traits<Allocator>::pointer (since C++11) [edit]
const_pointer Allocator::const_pointer (until C++11)
std::allocator_traits<Allocator>::const_pointer (since C++11) [edit]
iterator RandomAccessIterator [edit]
const_iterator (constant) (iterator) [edit]
reverse_iterator std::reverse_iterator<iterator> [edit]
const_reverse_iterator std::reverse_iterator<const_iterator> [edit]

Member functions

constructs a basic_string
(public member function) [edit]
assigns values to the string
(public member function) [edit]
assign characters to a string
(public member function) [edit]
returns the associated allocator
(public member function) [edit]
Element access
access specified character with bounds checking
(public member function) [edit]
access specified character
(public member function) [edit]
(C++11)
accesses the first character
(public member function) [edit]
(C++11)
accesses the last character
(public member function) [edit]
returns a pointer to the first character of a string
(public member function) [edit]
returns a non-modifiable standard C character array version of the string
(public member function) [edit]
Iterators
returns an iterator to the beginning
(public member function) [edit]

(C++11)
returns an iterator to the end
(public member function) [edit]
returns a reverse iterator to the beginning
(public member function) [edit]
returns a reverse iterator to the end
(public member function) [edit]
Capacity
checks whether the string is empty
(public member function) [edit]
returns the number of characters
(public member function) [edit]
returns the maximum number of characters
(public member function) [edit]
reserves storage
(public member function) [edit]
returns the number of characters that can be held in currently allocated storage
(public member function) [edit]
reduces memory usage by freeing unused memory
(public member function) [edit]
Operations
clears the contents
(public member function) [edit]
inserts characters
(public member function) [edit]
removes characters
(public member function) [edit]
appends a character to the end
(public member function) [edit]
(C++11)
removes the last character
(public member function) [edit]
appends characters to the end
(public member function) [edit]
appends characters to the end
(public member function) [edit]
compares two strings
(public member function) [edit]
replaces specified portion of a string
(public member function) [edit]
returns a substring
(public member function) [edit]
copies characters
(public member function) [edit]
changes the number of characters stored
(public member function) [edit]
swaps the contents
(public member function) [edit]
Search
find characters in the string
(public member function) [edit]
find the last occurrence of a substring
(public member function) [edit]
find first occurrence of characters
(public member function) [edit]
find first absence of characters
(public member function) [edit]
find last occurrence of characters
(public member function) [edit]
find last absence of characters
(public member function) [edit]

Constants

[static]
special value. The exact meaning depends on the context
(public static member constant) [edit]

Non-member functions


(function template) [edit]

(function template) [edit]
std::swap
(function template) [edit]
Input/output

(function template) [edit]

(function) [edit]
Numeric conversions
(C++11)
(C++11)
(C++11)

(function) [edit]
(C++11)
(C++11)

(function) [edit]
(C++11)
(C++11)
(C++11)

(function) [edit]
(C++11)
string
(function) [edit]
wstring
(function) [edit]

Literals

Defined in namespace std::literals::string_literals
basic_string
(function) [edit]

Helper classes

hash support for strings
(class template specialization) [edit]

Web Proxy Viewer  |  New URL  |  Original Page