Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
function returning a function demo
//clang 3.8.0 // function returning a function demo #include <iostream> auto powTo(int n) { return [=](double& x){const double y = x; for(int i=1; i<n; i++) x*=y;}; } int main() { double x = 1.99999999999997; int p = 16; std::cout<<x<<"**"<<p<<" = "; powTo(p)(x); std::cout<<x<<std::endl; return 0; }
run
|
edit
|
history
|
help
0
C++ Template
Random values and probability distribution
Dynamic call
Simple Generic Data Type Example
cv5_class
program_4
First test
Mi primer ejemplo con RexTester colgado en My wall
move_string
Recursive Function Calling Example with Stack Addresses