playground.cpp 602 B

12345678910111213141516171819202122232425262728293031
  1. #include <luwra.hpp>
  2. #include <string>
  3. #include <iostream>
  4. #include <functional>
  5. using namespace luwra;
  6. static int foo(int a, int b) {
  7. return a + b;
  8. }
  9. int main() {
  10. StateWrapper state;
  11. push(state, 13);
  12. push(state, 37);
  13. std::function<int(int, int)> bar(&foo);
  14. std::function<int(int, int)> baz([](int a, int b) -> int {
  15. return a + b;
  16. });
  17. std::cout << apply(state, 1, &foo) << std::endl;
  18. std::cout << apply(state, 1, bar) << std::endl;
  19. std::cout << apply(state, 1, baz) << std::endl;
  20. std::cout << apply(state, 1, [](int a, int b) -> int {
  21. return a + b;
  22. }) << std::endl;
  23. return 0;
  24. }