std::basic_string
De cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Defined in header <string>
|
||
template< class CharT, |
||
Le modèle de classe
basic_string
magasins et manipule des séquences de caractères de type objets (c'est-à-objets pour lesquels une spécialisation de std::char_traits ou compatible traits de la classe est fourni) . Original:
The class template
basic_string
stores and manipulates sequences of char-like objects (that is, objects for which a specialization of std::char_traits or compatible traits class is provided). The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Les éléments d'un
basic_string
sont stockés de manière contiguë, qui est, pour une basic_string s
, &*(s.begin() + n) == &*s.begin() + n pour tout n dans [0, s.size())
, ou, de manière équivalente, un pointeur vers s[0]
peuvent être transmises à des fonctions que peut attendre un pointeur vers le premier élément d'un tableau charT[]
. (depuis C++11)Original:
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. (depuis C++11)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Plusieurs spécialisations pour les types de caractères communs sont fournis:
Original:
Several specializations for common character types are provided:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Defined in header
<string> | |
Type
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
std::string | std::basic_string<char> |
std::wstring | std::basic_string<wchar_t> |
std::u16string | std::basic_string<char16_t> |
std::u32string | std::basic_string<char32_t> |
[modifier] Types de membres
Type du membre | Définition |
traits_type
|
Traits
|
value_type
|
Traits::char_type
|
allocator_type
|
Allocator
|
size_type
|
Type intégral non signé (généralement size_t) |
difference_type
|
Type intégral signé (généralement ptrdiff_t) |
reference
|
Allocator::reference (avant C++11)value_type& (depuis C++11)
|
const_reference
|
Allocator::const_reference (avant C++11)const value_type& (depuis C++11)
|
pointer
|
Allocator::pointer (avant C++11)std::allocator_traits<Allocator>::pointer (depuis C++11) |
const_pointer
|
Allocator::const_pointer (avant C++11) std::allocator_traits<Allocator>::const_pointer (depuis C++11) |
iterator
|
RandomAccessIterator
|
const_iterator
|
Itérateur constant à accès aléatoire |
reverse_iterator
|
std::reverse_iterator<iterator> |
const_reverse_iterator
|
std::reverse_iterator<const_iterator> |
[modifier] Fonctions membres
construit un basic_string Original: constructs a basic_string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
attribue des valeurs à la chaîne Original: assigns values to the string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
attribuer à une chaîne de caractères Original: assign characters to a string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
renvoie l'allocateur associé Original: returns the associated allocator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
Original: Element access The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
accéder à caractère spécifié avec des limites de contrôle Original: access specified character with bounds checking The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
accéder à caractère spécifié Original: access specified character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
(C++11) |
accède au premier caractère Original: accesses the first character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) |
(C++11) |
accède au dernier caractère Original: accesses the last character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) |
renvoie un pointeur sur le premier caractère d'une chaîne Original: returns a pointer to the first character of a string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
retourne un non-modifiables C standard Version tableau de caractères de la chaîne Original: returns a non-modifiable standard C character array version of the string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
Original: Iterators The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
(C++11) |
retourne un itérateur au début Original: returns an iterator to the beginning The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) |
(C++11) |
retourne un itérateur à la fin Original: returns an iterator to the end The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) |
(C++11) |
retourne un itérateur inverse au début Original: returns a reverse iterator to the beginning The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) |
(C++11) |
retourne un itérateur inverse à la fin Original: returns a reverse iterator to the end The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) |
Original: Capacity The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
vérifie si la chaîne est vide Original: checks whether the string is empty The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
returns the number of characters (fonction membre publique) | |
retourne le nombre maximal de caractères Original: returns the maximum number of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
réserves de stockage Original: reserves storage The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
retourne le nombre de caractères pouvant être détenus dans les stocks actuellement affectés Original: returns the number of characters that can be held in currently allocated storage The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
(C++11) |
réduit l'utilisation de la mémoire en libérant la mémoire inutilisée Original: reduces memory usage by freeing unused memory The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) |
Original: Operations The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
efface le contenu Original: clears the contents The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
insère des caractères Original: inserts characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
supprime les caractères Original: removes characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
ajoute un caractère à la fin Original: appends a character to the end The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
(C++11) |
supprime le dernier caractère Original: removes the last character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) |
ajoute des caractères à la fin Original: appends characters to the end The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
ajoute des caractères à la fin Original: appends characters to the end The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
compare deux chaînes Original: compares two strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
remplace chaque occurrence de caractères spécifiés Original: replaces every occurrence of specified characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
renvoie une sous-chaîne Original: returns a substring The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
copies caractères Original: copies characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
modifie le nombre de caractères stockés Original: changes the number of characters stored The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
permute les contenus Original: swaps the contents The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
Original: Search The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
trouver des caractères de la chaîne Original: find characters in the string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
trouver la dernière occurrence d'une chaîne Original: find the last occurrence of a substring The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
trouver la première occurrence des caractères Original: find first occurrence of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
trouver la première absence de caractères Original: find first absence of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
trouver la dernière occurrence de caractères Original: find last occurrence of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
trouver une dernière absence de caractères Original: find last absence of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
Original: Constants The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
valeur spéciale. La signification exacte dépend du contexte Original: special value. The exact meaning depends on the context The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (constante membre statique publique) |
[modifier] Fonctions annexes
concatène deux chaînes ou une chaîne et un char Original: concatenates two strings or a string and a char The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
compare lexicographiquement deux chaînes Original: lexicographically compares two strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
Original: Input/output The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
effectue flux d'E / S sur les cordes Original: performs stream I/O on strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
lire des données depuis un flux d'E / S dans une chaîne Original: read data from an I/O stream into a string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
Original: Numeric conversions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
(C++11) (C++11) (C++11) |
convertit une chaîne en un entier signé Original: converts a string to an signed integer The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) |
(C++11) (C++11) |
convertit une chaîne en un entier non signé Original: converts a string to an unsigned integer The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) |
(C++11) (C++11) (C++11) |
convertit une chaîne en une valeur à virgule flottante Original: converts a string to an floating point value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) |
(C++11) |
convertit une valeur de point intégrée ou flottante string Original: converts an integral or floating point value to string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) |
(C++11) |
convertit une valeur de point intégrée ou flottante wstring Original: converts an integral or floating point value to wstring The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) |
[modifier] Classes d'aide
(C++11) (C++11) (C++11) (C++11) |
soutien de hachage pour cordes Original: hash support for strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe générique spécialisée) |