Program Listing for File slide_n.hpp

Return to documentation for file (include/sgpl/algorithm/slide_n.hpp)

#pragma once
#ifndef SGPL_ALGORITHM_SLIDE_N_HPP_INCLUDE
#define SGPL_ALGORITHM_SLIDE_N_HPP_INCLUDE

#include <iterator>

#include "slide_to.hpp"

namespace sgpl {

template<typename RandomIt>
RandomIt slide_n(RandomIt first, RandomIt last, const int amount) {

  const RandomIt to = (amount > 0)
    ? last + amount
    : first + amount
  ;
  return sgpl::slide_to(first, last, to);

}

} // namespace sgpl

#endif // #ifndef SGPL_ALGORITHM_SLIDE_N_HPP_INCLUDE