Changeset c8dfcd3 for src/Common


Ignore:
Timestamp:
Aug 30, 2016, 5:15:34 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
fba44f8
Parents:
fa463f1
Message:

insert implicit ctor/dtors if field is unhandled in a struct ctor/dtor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/utility.h

    rfa463f1 rc8dfcd3  
    246246}
    247247
     248// RAII object to regulate "save and restore" behaviour, e.g.
     249// void Foo::bar() {
     250//   ValueGuard<int> guard(var); // var is a member of type Foo
     251//   var = ...;
     252// } // var's original value is restored
     253template< typename T >
     254struct ValueGuard {
     255        T old;
     256        T& ref;
     257
     258        ValueGuard(T& inRef) : old(inRef), ref(inRef) {}
     259        ~ValueGuard() { ref = old; }
     260};
     261
    248262#endif // _UTILITY_H
    249263
Note: See TracChangeset for help on using the changeset viewer.