std::inplace_vector<T,N>:: rbegin, std::inplace_vector<T,N>:: crbegin
|
constexpr
reverse_iterator rbegin
(
)
noexcept
;
|
(1) | (depuis C++26) |
|
constexpr
const_reverse_iterator rbegin
(
)
const
noexcept
;
|
(2) | (depuis C++26) |
|
constexpr
const_reverse_iterator crbegin
(
)
const
noexcept
;
|
(3) | (depuis C++26) |
Retourne un itérateur inverse vers le premier élément du conteneur inversé * this . Il correspond au dernier élément du conteneur non inversé * this .
Si * this est vide, l'itérateur retourné est égal à rend() .
Table des matières |
Valeur de retour
Itérateur inverse vers le premier élément.
Complexité
Constante.
Notes
L' itérateur sous-jacent de l'itérateur inverse retourné est l' itérateur de fin . Par conséquent, l'itérateur retourné est invalidé si et lorsque l'itérateur de fin est invalidé.
Exemple
#include <algorithm> #include <inplace_vector> #include <iostream> #include <string> #include <string_view> void print(const std::string_view s) { std::cout << s << ' '; } int main() { const std::inplace_vector<std::string_view, 8> data { "▁", "▂", "▃", "▄", "▅", "▆", "▇", "█" }; std::inplace_vector<std::string, 8> arr(8); std::copy(data.cbegin(), data.cend(), arr.begin()); print("Print “arr” in direct order using [cbegin, cend):\t"); std::for_each(arr.cbegin(), arr.cend(), print); print("\n\nPrint “arr” in reverse order using [crbegin, crend):\t"); std::for_each(arr.crbegin(), arr.crend(), print); }
Sortie :
Print “arr” in direct order using [cbegin, cend): ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ Print “arr” in reverse order using [crbegin, crend): █ ▇ ▆ ▅ ▄ ▃ ▂ ▁
Voir aussi
|
retourne un itérateur inverse vers la fin
(fonction membre publique) |
|
|
(C++14)
|
retourne un itérateur inverse vers le début d'un conteneur ou d'un tableau
(fonction template) |