Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/erikzenker/chainiterator

Concat multiple C++ containers to a single iterable object
https://github.com/erikzenker/chainiterator

cpp cpp14 iterator

Last synced: 26 days ago
JSON representation

Concat multiple C++ containers to a single iterable object

Awesome Lists containing this project

README

        

# Chain Iterator #
[![Build Status](https://travis-ci.org/erikzenker/chainiterator.svg?branch=master)](https://travis-ci.org/erikzenker/chainiterator) [![codecov](https://codecov.io/gh/erikzenker/chainiterator/branch/master/graph/badge.svg)](https://codecov.io/gh/erikzenker/chainiterator)
=

**Chain Iterator** is a C++ class which concats multiple C++ containers to a single iterable object.

## Usage ##
```c++
// STL
#include
#include
#include
#include

#include

int main()
{
std::vector a{ 1, 2 };
std::vector b{ 3, 4 };
std::array c{ 5, 6 };
std::list d{ 7, 8 };

auto chainIterator = makeChainIterator(a,b,c,d);

for(auto& element : chainIterator){
std::cout << element << std::endl;
}

return 0;
}

```

Output:
```text
1
2
3
4
5
6
7
8
```

## Build Example ##
```bash
mkdir build; cd build
cmake ..
cmake --build chainiterator_example
./example/chainiterator_example
```

## Build Tests ##
```bash
mkdir build; cd build
cmake ..
cmake --build chainiterator_unit_test
./test/unit/chainiterator_unit_test

```

## Dependencies ##
* boost 1.67
* c++14

## Licence ##
MIT

## Author ##
Written by Erik Zenker (erikzenker (at) hotmail.com)