Advertisement
WeltEnSTurm

Untitled

Sep 2nd, 2011
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1.  
  2. #include <string>
  3. #include <vector>
  4. #include <iostream>
  5.  
  6. struct hookentry {
  7.     hookentry(void(*h)(), std::string n): hook(h), name(n){}
  8.     void(*hook)();
  9.     std::string name;
  10. };
  11.  
  12. std::vector<hookentry> hooks = {
  13.     {
  14.         [](){
  15.             std::cout << " Do you like this?" << std::endl;
  16.         },
  17.         "What am I doing here?"
  18.     },
  19.     {
  20.         [](){
  21.             std::cout << ", what the hell" << std::endl;
  22.         },
  23.         "goddamnit"
  24.     }
  25. };
  26.  
  27. int main(){
  28.     for(long i=0; i<(long)hooks.size(); i++){
  29.         std::cout << hooks[i].name;
  30.         hooks[i].hook();
  31.         std::cout << std::endl;
  32.     }
  33.     return 0;
  34. }
  35.  
  36. /*
  37.  
  38. What am I doing here? Do you like this?
  39.  
  40. goddamnit, what the hell
  41.  
  42.  
  43. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement