Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct TChangeBlock
- {
- TChangeBlock( TBase & base ):
- base( &base),
- previousState( base.isChangeBlocked() )
- {
- base.setChangeBlock( true );
- }
- ~TChangeBlock()
- {
- base->setChangeBlock( previousState );
- }
- private:
- TChangeBlock( const TChangeBlock & );
- TChangeBlock & operator = ( const TChangeBlock & );
- TBase * base;
- bool previousState;
- };
- class TBase(...)
- {
- ...
- public:
- void setChangeBlock(bool block )
- {
- ...
- }
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement