mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-02-04 02:54:42 +08:00
support bazel complie this project and format code.
This commit is contained in:
19
learn_class/modern_cpp_30/functionLambda/function.cpp
Normal file
19
learn_class/modern_cpp_30/functionLambda/function.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Created by light on 20-1-11.
|
||||
//
|
||||
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
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; }},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user