Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jac18281828/istream_block_iterator
Header only implementation of a istream_block_iterator
https://github.com/jac18281828/istream_block_iterator
Last synced: about 1 month ago
JSON representation
Header only implementation of a istream_block_iterator
- Host: GitHub
- URL: https://github.com/jac18281828/istream_block_iterator
- Owner: jac18281828
- Created: 2021-06-18T18:57:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-24T16:09:39.000Z (about 1 year ago)
- Last Synced: 2024-10-15T19:13:58.847Z (3 months ago)
- Language: C++
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# istream_block_iterator
Although c++ is already imbued with the kitchen sink, it seems to lack a chunked character iterator for input streams. Thus, I present an implementation of a 'chunked' stream iterator with configurable chunk size `n`
# Example
#### given an input stream, split it into a vector of strings at most 3 in length
```
constexpr auto N = 3;
const auto example = "AAABBBCCC";
std::istringstream ss(example);
std::vector blocks{};
std::copy(istream_block_iterator(ss, N), istream_block_iterator(),std::back_inserter(blocks));
````blocks` now has three entries, `"AAA"`, `"BBB"` and `"CCC"`.