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

std::basic_string cppreference.com
cppreference.com
Espaces de noms
Variantes

std::basic_string

De cppreference.com
 
 
Bibliothque de chanes de caractres
Chanes zro terminal
Original:
Null-terminated strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Les chanes d'octets
Chaines multi-octets
Les chanes tendues
Classes
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string
char_traits
 
std::basic_string
Les fonctions membres
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::basic_string
basic_string::operator=
basic_string::assign
basic_string::get_allocator
Elment d'accs
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.
basic_string::at
basic_string::operator[]
basic_string::front (C++11)
basic_string::back (C++11)
basic_string::data
basic_string::c_str
Les itrateurs
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::begin
basic_string::cbegin

(C++11)
basic_string::end
basic_string::cend

(C++11)
basic_string::rbegin
basic_string::crbegin

(C++11)
basic_string::rend
basic_string::crend

(C++11)
Capacit
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::empty
basic_string::size
basic_string::length
basic_string::max_size
basic_string::reserve
basic_string::capacity
basic_string::shrink_to_fit (C++11)
Oprations
Original:
Operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::clear
basic_string::insert
basic_string::erase
basic_string::push_back
basic_string::pop_back (C++11)
basic_string::append
basic_string::operator+=
basic_string::compare
basic_string::replace
basic_string::substr
basic_string::copy
basic_string::resize
basic_string::swap
Recherche
Original:
Search
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::find
basic_string::rfind
basic_string::find_first_of
basic_string::find_first_not_of
basic_string::find_last_of
basic_string::find_last_not_of
Constantes
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::npos
Tiers fonctions
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator+
operator==
operator!=
operator<
operator>
operator<=
operator>=
swap(std::basic_string)
operator<<
operator>>
getline
stoi
stol
stoll
(C++11)
(C++11)
(C++11)
stoul
stoull
(C++11)
(C++11)
stof
stod
stold
(C++11)
(C++11)
(C++11)
to_string (C++11)
to_wstring (C++11)
Classes d'aide
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
hash<std::string>
hash<std::wstring>
hash<std::u32string>
hash<std::u16string>
(C++11)
 
<tbody> </tbody>
Dclar dans l'en-tte <string>
template< class CharT, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT> > class basic_string;
(1)
namespace pmr { template <class CharT, class Traits = std::char_traits<CharT>> using basic_string = std::basic_string< CharT, Traits, std::polymorphic_allocator<CharT>> }
(2)

Le modle de classe basic_string stocke et manipule des squences de char ou objets similaires, qui ne sont pas des tableaux de types triviaux de disposition-standard. La classe ne dpend ni du type de caractre, ni de la nature des oprations sur ce type. Les dfinitions des oprations sont fournies par le paramtre de modle Traits - une spcialisation de std::char_traits ou une classe de traits compatibles. Traits::char_type et CharT doivent dnommer le mme type; dans le cas contraire le programme est malform.

Les lments d'un basic_string sont stocks de manire contigu, ce qui signifie que pour une basic_string s, &*(s.begin() + n) == &*s.begin() + n pour tout n dans [0, s.size()), ou, de manire quivalente, un pointeur vers s[0] peut tre pass des fonctions que attendent un pointeur vers le premier lment d'un tableau charT[].

(depuis C++11)

std::basic_string satisfait les prrequis de AllocatorAwareContainer, SequenceContainer et ContiguousContainer (depuis C++17)

Plusieurs typedefs pour les types de caractres communs sont fournies:

Defined in header <string>
Type Definition
std::string std::basic_string<char>
std::wstring std::basic_string<wchar_t>
std::u8string (C++20) std::basic_string<char8_t>
std::u16string (C++11) std::basic_string<char16_t>
std::u32string (C++11) std::basic_string<char32_t>
std::pmr::string (C++17) std::pmr::basic_string<char>
std::pmr::wstring (C++17) std::pmr::basic_string<wchar_t>
std::pmr::u8string (C++20) std::pmr::basic_string<char8_t>
std::pmr::u16string (C++17) std::pmr::basic_string<char16_t>
std::pmr::u32string (C++17) std::pmr::basic_string<char32_t>

Parameters de modle

CharT - type de caractre
Traits - classe de traits spcifiant les oprations sur le type de caractre
Allocator - type Allocator utilis pour allouer du stockage en interne

Types membres

Membre type Dfinition
traits_type Traits
value_type CharT
allocator_type Allocator [edit]
size_type Type intgral non sign (gnralement size_t)[edit]
difference_type Type intgral sign (gnralement ptrdiff_t) [edit]
reference Allocator::reference (avant C++11)
value_type& (depuis C++11) [edit]
const_reference Allocator::const_reference (avant C++11)
const value_type& (depuis C++11) [edit]
pointer Allocator::pointer (avant C++11)
std::allocator_traits<Allocator>::pointer (depuis C++11) [edit]
const_pointer Allocator::const_pointer (avant C++11)
std::allocator_traits<Allocator>::const_pointer (depuis C++11) [edit]
iterator RandomAccessIterator [edit]
const_iterator Itrateur constant accs alatoire [edit]
reverse_iterator std::reverse_iterator<iterator> [edit]
const_reverse_iterator std::reverse_iterator<const_iterator> [edit]

Fonctions membres

construit un basic_string
(fonction membre publique) [edit]
(destructeur)
dtrtuit le string, dsallouant le stockage interne si utilis
(fonction membre publique)
assigne des valeurs la chane
(fonction membre publique) [edit]
attribuer une chane de caractres
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) [edit]
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) [edit]
Accs d'lment
accde au caractre spcifi avec contrle de bornes
(fonction membre publique) [edit]
accde au caractre spcifi
(fonction membre publique) [edit]
(C++11)
accde au premier caractre
(fonction membre publique) [edit]
(C++11)
accde au dernier caractre
(fonction membre publique) [edit]
renvoie un pointeur vers le premier caractre d'une chane
(fonction membre publique) [edit]
retourne la chaine de caractre sous sa forme standard C non-modifiable
(fonction membre publique) [edit]
retourne une string_view non-modifiable de l'entiret de la chane de carcatres
(fonction membre publique) [edit]
Itrateurs

(C++11)
retourne un itrateur au dbut
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) [edit]

(C++11)
retourne un itrateur 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) [edit]
retourne un itrateur inverse au dbut
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) [edit]

(C++11)
retourne un itrateur 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) [edit]
Capacit
vrifie si la chane 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) [edit]
returns the number of characters
(fonction membre publique) [edit]
retourne le nombre maximal de caractres
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) [edit]
rserve du stockage
(fonction membre publique) [edit]
retourne le nombre de caractres pouvant tre dtenus dans les stocks actuellement affects
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) [edit]
rduit l'utilisation de la mmoire en librant la mmoire inutilise
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) [edit]
Oprations
efface le contenu
(fonction membre publique) [edit]
insre des caractres
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) [edit]
supprime les caractres
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) [edit]
ajoute un caractre 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) [edit]
(C++11)
supprime le dernier caractre
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) [edit]
ajoute des caractres 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) [edit]
ajoute des caractres 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) [edit]
compare deux chanes
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) [edit]
(C++20)
vrifie si la chane de caractres commence par le prfixe donn
(fonction membre publique) [edit]
(C++20)
vtrifie si la chaine de caractres se termine par le suffixe donn
(fonction membre publique) [edit]
remplace chaque occurrence de caractres spcifis
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) [edit]
renvoie une sous-chane
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) [edit]
copies caractres
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) [edit]
modifie le nombre de caractres stocks
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) [edit]
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) [edit]
Recherche
trouver des caractres de la chane
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) [edit]
trouver la dernire occurrence d'une chane
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) [edit]
trouver la premire occurrence des caractres
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) [edit]
trouver la premire absence de caractres
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) [edit]
trouver la dernire occurrence de caractres
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) [edit]
trouver une dernire absence de caractres
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) [edit]

Constantes

[
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 spciale. La signification exacte dpend 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) [edit]

Fonctions annexes

concatne deux chanes ou une chane 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 gnrique) [edit]
compare lexicographiquement deux chanes
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 gnrique) [edit]
l'algorithme spcialis 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 gnrique) [edit]
Efface tous les lments rpondants un critre spcifique
(fonction gnrique) [edit]
D'entre / sortie
effectue des oprations d'entre/sortie de flux sur des chaines de caractres
(fonction gnrique) [edit]
lire des donnes depuis un flux d'E / S dans une chane
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) [edit]
Conversions numriques
(C++11)
(C++11)
(C++11)
convertit une chane 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) [edit]
(C++11)
(C++11)
convertit une chane 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) [edit]
(C++11)
(C++11)
(C++11)
convertit une chane en un nombre rel
(fonction) [edit]
(C++11)
convertit une valeur entire ou relle en string
(fonction) [edit]
(C++11)
convertit une valeur de point intgre 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) [edit]

Litralles

Defined in namespace std::literals::string_literals
(C++14)
Convertis une litrale de tableau de caractres en basic_string
(fonction) [edit]

Classes d'aide

soutien de hachage pour chaines de caractres
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 gnrique spcialise) [edit]

Guides de dduction (depuis C++17)


Web Proxy Viewer  |  New URL  |  Original Page