Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/program--/pipe
A forward-pipe for C++14
https://github.com/program--/pipe
cpp cpp14 header-only pipeline
Last synced: about 2 months ago
JSON representation
A forward-pipe for C++14
- Host: GitHub
- URL: https://github.com/program--/pipe
- Owner: program--
- License: mit
- Created: 2023-09-20T00:08:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-20T00:08:28.000Z (over 1 year ago)
- Last Synced: 2024-09-29T23:41:31.581Z (3 months ago)
- Topics: cpp, cpp14, header-only, pipeline
- Language: C++
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pipe: an over-engineered forward-pipe C++14 library
## Usage
`pipe::with` describes your initial input value. This can then be piped into objects that provide an `operator()` member, such as lambdas, using the `|` operator. Finally, adding `| pipe::done` signals that the operation is complete, and should be evaluated.
If the piped functors are `constexpr`-able, then the entire pipeline is `constexpr`-able.
### Example
```cpp
// example.cpp
#include "pipe.hpp"#include
#includeint print_string(const std::string& msg)
{
std::cout << msg << std::endl;
return 1;
}int main() {
pipe::with(3)
| [](double v) -> double { return v + 10; }
| [](double v) -> char { return static_cast(v); }
| [](char c) -> std::string { return std::to_string(c); }
| [](const std::string& msg) { return print_string(msg); }
| pipe::done;
}
```