CPlusPlusThings/learn_class/modern_C++_30/functionLambda/function.cpp
Light-City 1dca8dee82 update
2020-03-03 11:13:16 +08:00

32 lines
679 B
C++

//
// Created by light on 20-1-11.
//
#include <map>
#include <iostream>
#include <functional>
using namespace std;
int main() {
map<string, function<int(int, int)>>
op_dict{
{"+",
[](int x, int y) {
return x + y;
}},
{"-",
[](int x, int y) {
return x - y;
}},
{"*",
[](int x, int y) {
return x * y;
}},
{"/",
[](int x, int y) {
return x / y;
}},
};
}