Advertisement
STANAANDREY

map fun

Feb 7th, 2020
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     map<const char, function<double(double, double)>> mp;
  7.     mp['+'] = [](double a, double b)
  8.     {
  9.         return a + b;
  10.     };
  11.  
  12.     cout << mp['+'](2, 3.2);
  13.     return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement