Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. class IGame
  2. {
  3. public:
  4. virtual ~IGame(){};
  5. virtual void move_up(INFO &info)=0;
  6. }
  7.  
  8. #define INFO std::pair<struct GetMap*, struct WhereAmI*>
  9.  
  10. class CGame
  11. {
  12. private:
  13. IGame *game;
  14. int score;
  15. std::pair<struct GetMap*, struct WhereAmI*> info; // game information
  16.  
  17. std::vector<std::function<void(std::pair<struct GetMap*, struct WhereAmI*>&)>> ptr_move_ft; //function pointer vector
  18.  
  19. public:
  20. CGame();
  21. ~CGame();
  22. void return_get_map(INFO &info);
  23. }
  24.  
  25. CGame::CGame()
  26. {
  27. game = new Snake();
  28. this->info = std::make_pair(init_map(MAP_PATH_SNAKE,0), game->init_player());
  29.  
  30. ptr_move_ft.push_back(std::bind(&CGame::return_where_i_am, this,std::placeholders::_1)); //this work
  31.  
  32. ptr_move_ft.push_back(std::bind(&game->move_up, game, std::placeholders::_1)); //this create a error
  33.  
  34. }
  35.  
  36. source/CGame.cpp: In constructor ‘arcade::CGame::CGame()’:
  37. source/CGame.cpp:131:44: error: ISO C++ forbids taking the address of a bound member function to form a pointer to member function. Say ‘&arcade::IGame::move_up’ [-fpermissive]
  38. ptr_move_ft.push_back(std::bind(&game->move_up, game, std::placeholders::_1));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement