Skip to main content
Ctrl+K
Jörg Faschingbauer - Home Jörg Faschingbauer - Home
  • Training Courses
  • About
  • Blog
  • Training Courses
  • About
  • Blog

Section Navigation

  • Course Descriptions
  • Pricing, Organizational
  • Log Of Past Courses
  • Complete Slide Material
    • Linux: Introduction, Userland/Kernel Programming, Hardware/Embedded
    • Python Programming
    • C Programming
    • C++ Programming
      • C++ < 11
        • Introduction
        • Data Encapsulation
        • Functions and Methods
        • Exceptions
        • C++ Template Basics
        • Standard Template Library
        • Dynamic Memory Allocation, Resource Management
        • Inheritance And Object Oriented Design
        • The Standard Library: Miscellaneous Topics
        • Exercises: User Database
        • Exercises: Miscellaneous
      • C++ >= 11
      • Design Patterns With C++
      • C++: Miscellaneous Live-Hacking
      • C++ Code
      • C++ Exercises
    • Build Tools, Unit Testing, Design, And More
  • Training Courses
  • Complete Slide Material
  • C++ Programming
  • C++ < 11
  • Standard Template Library
  • Algorithms
  • reverse_copy<>: Copying and Reversing

Documentation

  • std::reverse_copy @ cppreference.com

  • std::reverse_copy @ cplusplus.com

reverse_copy<>: Copying and Reversing#

  • Usage

  • Live Hacking

Usage#

Attention

Does not allocate ⟶ undefined behavior!

Live Hacking#

code/reverse-string-reverse-copy.cpp#
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;


int main()
{
    string s("abc");

    string reversed_s(s.size(), '*');
    std::reverse_copy(s.cbegin(), s.cend(), reversed_s.begin());
    cout << reversed_s << endl;

    return 0;
}
On this page
  • Usage
  • Live Hacking

© Copyright 2019-2025 (GPLv3), Jörg Faschingbauer.

Created using Sphinx 8.1.3.

Built with the PyData Sphinx Theme 0.16.1.

Show Source