https://github.com/neshkeev/cppipe
A bash's pipe-like operator for c++
https://github.com/neshkeev/cppipe
cpp20 header-only monadic pipeline variant
Last synced: 6 months ago
JSON representation
A bash's pipe-like operator for c++
- Host: GitHub
- URL: https://github.com/neshkeev/cppipe
- Owner: neshkeev
- License: mit
- Created: 2022-03-27T22:40:43.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-09T23:42:25.000Z (about 4 years ago)
- Last Synced: 2025-03-26T03:41:57.925Z (about 1 year ago)
- Topics: cpp20, header-only, monadic, pipeline, variant
- Language: C++
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Overview
Introduce the bash-like pipe functionality to C++. This is a header only library.
# Building
```
$ cd cppipe # local repository
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .
$ ctest -C Debug # run tests if needed
$ sudo cmake --install .
```
# Example
```cpp
#include
using namespace cppipe;
int main(int argc, char** argv)
{
Result start = 1;
auto inc = [](auto&& i) -> Result { return i + 1; };
Result result = start
>> [](auto&& i) -> Result { return i * 2; }
>> inc
>> inc;
int res = run(result,
[](auto&& i) { return i; },
[](auto&& err) { return -1; });
...
}
```
Please take a look at [tests](test/) for more