boost::adaptors::reverse

References

Headers

boost::adaptors::reverse is available by including any of the following headers:

  • boost/range/adaptor/reversed.hpp or
  • boost/range/adaptors.hpp

Examples

reversed-function.cpp

#include <iostream>
#include <string>

#include <boost/range/adaptors.hpp>


int main() {
    std::string str = "abcdefghijklmnopqrstuvwxyz";

    // Reverse iteration order over a range. Pretty straight-forward.
    std::cout << "Reversed abc: "
              << boost::adaptors::reverse(str)
              << std::endl;

    return 0;
}

Output:

Reversed abc: zyxwvutsrqponmlkjihgfedcba

 

Boost Range for Humans

This reference is part of Boost Range for Humans. Click the link to the overview.