Advertisement
tinyevil

Untitled

Aug 5th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. template<class Evt>
  2. class Multicast{
  3. public:
  4. void addObserver(Observer<Evt>&& obs){
  5. observers.push_back(std::move(obs));
  6. }
  7.  
  8. void broadcast(Evt event){
  9. for ( auto& obs : observers ){
  10. obs.observe(event);
  11. }
  12. }
  13. private:
  14. std::vector< Observer<Evt> > observers;
  15. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement