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
    • Python Programming
    • The C Programming Language
    • C++ < 11
      • Introduction
      • Data Encapsulation
      • Functions and Methods
      • Exceptions
      • C++ Template Basics
      • Standard Template Library
        • Standard Template Library: Basics
        • std::vector (And std::copy())
        • Algorithms
        • Sequential Containers
        • Associative Containers
        • Allocators
        • STL: Exercises
      • 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++: TODO List
    • C++: Miscellaneous Live-Hacking
    • C++ Code
    • C++ Exercises
    • CMake
    • Is Software A Craft? Software Is A Craft! ⟶ Clean Code
    • Unit Testing With googletest
  • Training Courses
  • Complete Slide Material
  • 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