fork download
  1. #include <functional>
  2. #include <cstdlib>
  3.  
  4. void mahexit();
  5.  
  6. struct registar {
  7. registar(){atexit(&mahexit); }
  8. } registerThat; // чтобы само регистрировалось без участия пользователя. Конструктор будет вызываться в мейне сам.
  9.  
  10. static std::function <void ()> customExit=[](){};
  11.  
  12. void mahexit() {
  13. customExit();
  14. }
  15.  
  16. extern void setexit(std::function <void ()> f) {
  17. customExit=f;
  18. }
  19. //всё то, что до этого места, ты суёшь в заголовок
  20. int main(){}
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty