boost::adaptors::reversed

References

Headers

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

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

Examples

reversed-pipe.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: "
              << (str | boost::adaptors::reversed)
              << 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.