On Wed, Sep 30, 2015 at 11:35:37AM -0700, Nicol Bolas wrote:
> By default it stores a value, but if you construct one yourself, it can
> store a reference.
>
> That doesn't seem feasible, not in the intended use case.
I meant something like this:
auto almost_fib = [](auto fib, int x) -> int {
return x <= 1 ? x : fib(x - 1) + fib(x - 2);
};
auto fib = std::y_wrapper<decltype(almost_fib) &>(almost_fib);
std::cout << fib(42) << std::endl;
Perhaps, I should add this example to the paper.
Naming is not an important issue for now. std::y is good enough for the
start, we can always pick a better name later, once we agree we need
this function in the library.
--
Yegor Derevenets