Guest User

Untitled

a guest
Oct 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. static constexpr MyStruct ops[6] = {
  2. {'+', [&] (double a, double b) { return a+b; } },
  3. {'-', [&] (double a, double b) { return a-b; } },
  4. ...
  5. };
  6.  
  7. typedef double (*binOp)(double, double);
  8. struct MyStruct {
  9. char c;
  10. binOp fn;
  11. };
  12.  
  13. std::function <double(double,double)> fn;
  14.  
  15. static const MyStruct ops[6] = {
  16. {'+', [] (double a, double b) { return a+b; } },
  17. {'-', [] (double a, double b) { return a-b; } },
  18. };
Add Comment
Please, Sign In to add comment