utempl/examples/src/pipe.cpp

13 lines
341 B
C++
Raw Normal View History

2024-03-28 19:19:56 +00:00
#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});
};