Changes in src/Common/utility.h [134322e:13932f14]
- File:
-
- 1 edited
-
src/Common/utility.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
r134322e r13932f14 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 ); } }266 246 }; 267 247
Note:
See TracChangeset
for help on using the changeset viewer.