Skip to main content

fixstr::basic_fixed_string::rend
fixstr::basic_fixed_string::crend

1#
[[nodiscard]] constexpr reverse_iterator rend() noexcept;
2#
[[nodiscard]] constexpr const_reverse_iterator rend() const noexcept;
3#
[[nodiscard]] constexpr const_reverse_iterator crend() const noexcept;

Returns a reverse iterator to the character following the last character of the reversed fixed string. It corresponds to the character preceding the first character of the non-reversed fixed string. This character acts as a placeholder, attempting to access it results in undefined behavior.

Image explaining reverse iterators

Parameters#

(none)

Return value#

Iterator to the character following the last character.

Complexity#

Constant.

Example#

#include <algorithm>#include <fixed_string.hpp>#include <iostream>#include <iterator>#include <string>
int main(){    fixstr::fixed_string s = "A man, a plan, a canal: Panama";    {        std::string c;        std::copy(s.rbegin(), s.rend(), std::back_inserter(c));        std::cout << c << '\n'; // "amanaP :lanac a ,nalp a ,nam A"    }
    {        std::string c;        std::copy(s.crbegin(), s.crend(), std::back_inserter(c));        std::cout << c << '\n'; // "amanaP :lanac a ,nalp a ,nam A"    }}
Output:
amanaP :lanac a ,nalp a ,nam AamanaP :lanac a ,nalp a ,nam A