yc.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <functional> | ||
| 4 | #include <utility> | ||
| 5 | |||
| 6 | namespace std { | ||
| 7 | |||
| 8 | template<class Fun> | ||
| 9 | class y_combinator_result { | ||
| 10 | Fun fun_; | ||
| 11 | public: | ||
| 12 | template<class T> | ||
| 13 | 92 | explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {} | |
| 14 | |||
| 15 | template<class ...Args> | ||
| 16 | 33675384 | decltype(auto) operator()(Args &&...args) { | |
| 17 |
1/3None:
✓ Branch 16 → 17 taken 21 times.
decltype(auto) std::y_combinator_result<static_forest_t::static_forest_t(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<int, std::allocator<int> > const&)::{lambda(int)#1}::operator()(int) const::{lambda(auto:1&&, int, int, int, int, bool)#1}>::operator()<int&, int&, int&, int, bool>(int&, int&, int&, int&&, bool&&):
✗ Branch 13 → 14 not taken.
decltype(auto) std::y_combinator_result<static_forest_t::static_forest_t(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<int, std::allocator<int> > const&)::{lambda(int)#1}::operator()(int) const::{lambda(auto:1&&, int, int, int, int, bool)#1}>::operator()<int&, int, int, int, bool>(int&, int&&, int&&, int&&, bool&&):
✗ Branch 13 → 14 not taken.
|
33675384 | return fun_(std::ref(*this), std::forward<Args>(args)...); |
| 18 | } | ||
| 19 | }; | ||
| 20 | |||
| 21 | template<class Fun> | ||
| 22 | 92 | decltype(auto) y_combinator(Fun &&fun) { | |
| 23 | 92 | return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun)); | |
| 24 | } | ||
| 25 | |||
| 26 | } // namespace std | ||
| 27 |