Changeset 28c9ff3 for src/Common/utility.h
- Timestamp:
- Jun 1, 2017, 4:57:02 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, 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:
- b1d4d60
- Parents:
- b78275b (diff), 676cc8c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
rb78275b r28c9ff3 244 244 ValueGuard(T& inRef) : old(inRef), ref(inRef) {} 245 245 ~ValueGuard() { ref = old; } 246 }; 247 248 template< typename T > 249 struct ValueGuardPtr { 250 T old; 251 T* ref; 252 253 ValueGuardPtr(T * inRef) : old( inRef ? *inRef : T() ), ref(inRef) {} 254 ~ValueGuardPtr() { if( ref ) *ref = old; } 255 }; 256 257 template< typename T > 258 struct ValueGuardPtr< std::list< T > > { 259 std::list< T > old; 260 std::list< T >* ref; 261 262 ValueGuardPtr( std::list< T > * inRef) : old(), ref(inRef) { 263 if( ref ) { swap( *ref, old ); } 264 } 265 ~ValueGuardPtr() { if( ref ) { swap( *ref, old ); } } 246 266 }; 247 267 … … 334 354 {} 335 355 356 CodeLocation( const CodeLocation& rhs ) = default; 357 336 358 bool isSet () const { 337 359 return -1 != linenumber;
Note: See TracChangeset
for help on using the changeset viewer.