From 93576965d901e07a863ac678501d5077e04201f8 Mon Sep 17 00:00:00 2001 From: sha512sum Date: Thu, 28 Mar 2024 19:19:56 +0000 Subject: [PATCH] Add pipe example --- examples/src/pipe.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 examples/src/pipe.cpp diff --git a/examples/src/pipe.cpp b/examples/src/pipe.cpp new file mode 100644 index 0000000..bfc01ee --- /dev/null +++ b/examples/src/pipe.cpp @@ -0,0 +1,12 @@ +#include + +auto main() -> int { + using namespace utempl; + constexpr TupleLike auto tuple = Tuple{1, 2, 3, 4, 5, 6} + | Take<5>() + | Map([](int arg){return arg + 1;}) + | Map([](int arg) -> float {return arg;}) + | Reverse() + | Take<3>(); // Lazy evaluate + static_assert(tuple == Tuple{6.0f, 5.0f, 4.0f}); +};