Advertisement
Guest User

Untitled

a guest
Oct 20th, 2012
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. class ExitBlockT{ typedef std::function<void()> T; public: T t; ExitBlockT(T t){this->t=t;} ~ExitBlockT() { t(); } };
  2. class SuccessBlockT{ typedef std::function<void()> T; public: T t; SuccessBlockT(T t){this->t=t;} ~SuccessBlockT() { if (!std::uncaught_exception()) { t(); } } };
  3. class FailBlockT{ typedef std::function<void()> T; public: T t; FailBlockT(T t){this->t=t;} ~FailBlockT() { if (std::uncaught_exception()) { t(); } } };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement