Video Coming Soon...
48: Lambdas
- Teach lambdas in prep for doing ranges/views.
The Code
View Source file ex48.cpp Only
#include <fmt/core.h>
#include <string>
auto make_adder(auto base) {
return [=](auto a) -> auto {
return base + a;
};
}
int main() {
auto int_adder = make_adder(100);
auto float_adder = make_adder(23.4f);
fmt::println("{} + {} = {}", 100, 3, int_adder(4));
fmt::println("{} + {} = {}", 23.4f, 32.8f, float_adder(32.8f));
}
The Breakdown
line of code- Description.
The Discussion
Blah blah.
Further Study
- Do this next.
Register for Learn C++ the Hard Way
Register to gain access to additional videos which demonstrate each exercise. Videos are priced to cover the cost of hosting.