Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/erikzenker/chainiterator
- Owner: erikzenker
- Created: 2018-08-25T22:02:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-06T12:57:45.000Z (over 6 years ago)
- Last Synced: 2024-10-30T01:44:47.444Z (2 months ago)
- Topics: cpp, cpp14, iterator
- Language: CMake
- Homepage:
- Size: 16.6 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)