<commit_before># C++ Range

[![Build Status](https://travis-ci.org/whoshuu/cpp_range.svg?branch=master)](https://travis-ci.org/whoshuu/cpp_range)

Have your cake and eat it too. Who says you can't have nice things in an efficient, type-safe, compiled language? Don't let your Python coworkers have the last laugh, this is C++ Range:

```c++
#include <iostream>
#include "range.h"

using namespace whoshuu;

int main(int argc, char** argv) {
    for (auto i : range(100)) {
        std::cout << i << std::endl; // Prints 0 to 99
    }

    for (auto i : range(10, 100)) {
        std::cout << i << std::endl; // Prints 10 to 99
    }

    for (auto i : range(10, 0, -1) {
        std::cout << i << std::endl; // Prints 10 to 1, counting down
    }

    for (auto i : range(2.718, 100.0, 3.14) {
        std::cout << i << std::endl; // Prints 2.178 to 96.918, by increments of π, yum!
    }
}
```

## Benchmarks

Here's an initial benchmark of my library against a [naive vector range implementation](https://gist.github.com/whoshuu/246b10cdd7341895453f) and [basic for-loop](https://gist.github.com/whoshuu/6eea496a891ef03a5b9e):
<commit_msg>Add more bitterness to README.md<commit_after># C++ Range

[![Build Status](https://travis-ci.org/whoshuu/cpp_range.svg?branch=master)](https://travis-ci.org/whoshuu/cpp_range)

Have your cake and eat it too. Who says you can't have nice things in an efficient, type-safe, compiled language? Don't let your Python-slinging coworkers have the last laugh, this is C++ Range:

```c++
#include <iostream>
#include "range.h"

using namespace whoshuu;

int main(int argc, char** argv) {
    for (auto i : range(100)) {
        std::cout << i << std::endl; // Prints 0 to 99
    }

    for (auto i : range(10, 100)) {
        std::cout << i << std::endl; // Prints 10 to 99
    }

    for (auto i : range(10, 0, -1) {
        std::cout << i << std::endl; // Prints 10 to 1, counting down
    }

    for (auto i : range(2.718, 100.0, 3.14) {
        std::cout << i << std::endl; // Prints 2.178 to 96.918, by increments of π, yum!
    }
}
```

## Benchmarks

Here's an initial benchmark of my library against a [naive vector range implementation](https://gist.github.com/whoshuu/246b10cdd7341895453f) and [basic for-loop](https://gist.github.com/whoshuu/6eea496a891ef03a5b9e):

{'fraction_non_alphanumeric': 0.15497835497835497, 'fraction_numerical': 0.05887445887445888, 'mean_word_length': 3.240366972477064, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '390170', 'n_tokens_mistral': 932, 'n_tokens_neox': 815, 'n_words': 252}