Add pipe example
This commit is contained in:
parent
7608faa225
commit
93576965d9
1 changed files with 12 additions and 0 deletions
12
examples/src/pipe.cpp
Normal file
12
examples/src/pipe.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include <utempl/utils.hpp>
|
||||
|
||||
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});
|
||||
};
|
Loading…
Reference in a new issue