fork download
  1. #include <iostream>
  2. #include <functional>
  3. #include <memory>
  4.  
  5. struct ACancelable {};
  6. struct ACancelableToken {};
  7.  
  8. template<typename T, typename U>
  9. class ANotifier : public ACancelable
  10. {
  11. public:
  12. using NotificationFn = std::function<void(T&)>;
  13. virtual std::weak_ptr<ACancelableToken> RegisterNotification( U msgType, NotificationFn fn ) = 0;
  14. virtual void Notify( U msgType, T& value ) = 0;
  15. };
  16.  
  17. template<typename T, typename U>
  18. class ASingleNotifier : public ANotifier<T, U>
  19. {
  20. using NotificationFn = typename ANotifier<T,U>::NotificationFn;
  21. virtual std::weak_ptr<ACancelableToken> RegisterNotification( U msgType, NotificationFn fn );
  22. };
  23.  
  24. int main() {
  25. // your code goes here
  26. return 0;
  27. }
Success #stdin #stdout 0s 3408KB
stdin
Standard input is empty
stdout
Standard output is empty