boost::adaptors::stride

References

Headers

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

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

Examples

slice_stride-function.cpp

#include <iostream>
#include <map>
#include <string>

#include <boost/range/adaptors.hpp>

const std::string str = "abcde";


int main() {
    std::cout << "\"" << str << "\" sliced to (1, 4): "
              << (boost::adaptors::slice(str, 1, 4))
              << std::endl;
    std::cout << "\"" << str << "\" | strided(2): "
              << (boost::adaptors::stride(str, 2))
              << std::endl;

    return 0;
}

Output:

"abcde" sliced to (1, 4): bcd
"abcde" | strided(2): ace

 

Boost Range for Humans

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