/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/cpp/cpp-506-17-001/main.cpp
16 строк
324 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
#include <functional> std::function<int(int, int)> op; op = add; std::cout << op(1, 2); // 3 op = [](int a, int b) { return a * b; }; std::cout << op(3, 4); // 12 struct Multiplier { int factor; int operator()(int x, int y) const { return (x + y) * factor; } }; op = Multiplier{10}; std::cout << op(1, 2); // 30