Go to the source code of this file.
|
template<class lambda_t > |
recursive_lambda< std::decay_t< lambda_t > > | qx::make_recursive_lambda (lambda_t &&lambda) |
| Create lambda that can be called recursively. More...
|
|
- Author
- Khrapov
- Date
- 3.08.2022
- Copyright
- © Nick Khrapov, 2022. All right reserved.
Definition in file recursive_lambda.h.
◆ make_recursive_lambda()
template<class lambda_t >
recursive_lambda<std::decay_t<lambda_t> > qx::make_recursive_lambda |
( |
lambda_t && |
lambda | ) |
|
Create lambda that can be called recursively.
- Template Parameters
-
lambda_t | - lambda type: see code example |
- Parameters
-
- Return values
-
- | lambda that can be called recursively |
[](const auto& calc_fibonacci, int n) -> int
{
if (n == 1 || n == 2)
return 1;
if (n == 0)
return 0;
return calc_fibonacci(n - 1) + calc_fibonacci(n - 2);
});
int nResult = calc_fibonacci(6);
recursive_lambda< std::decay_t< lambda_t > > make_recursive_lambda(lambda_t &&lambda)
Create lambda that can be called recursively.
Definition at line 59 of file recursive_lambda.h.