Lambda self call
senatus
6,314 views
Welcome!
This C++ template lets you get started quickly with a simple one-page playground.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <functional>
#include <iostream>
int main() {
const std::function<std::size_t (const std::size_t)> f_fib = [&f_fib](const std::size_t v) {
if (v <= 1)
return v;
return f_fib(v - 2) + f_fib(v - 1);
};
std::cout << f_fib(25); // 75025
}
Advanced usage
If you want a more complex example (external libraries, viewers...), use the Advanced C++ template
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.