Skip to content

Instantly share code, notes, and snippets.

View przybylski's full-sized avatar

Bartosz Przybylski przybylski

  • Toronto, Canada
View GitHub Profile
@przybylski
przybylski / ranges.cpp
Created December 15, 2015 22:59
python style range and xrange in c++
#include <iterator>
#include <vector>
#include <cmath>
namespace btp {
template<typename T>
std::vector<T> range(T begin, T end, T step = 1) {
if (signbit(step) != signbit(end-begin)) return {};