Changes in src/include/cassert [dafe9e1:f685679]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/include/cassert
rdafe9e1 rf685679 10 10 // Created On : Thu Aug 18 13:19:26 2016 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 3 13:11:00 201713 // Update Count : 1 812 // Last Modified On : Thu May 23 15:30:00 2017 13 // Update Count : 17 14 14 // 15 15 … … 43 43 #endif 44 44 45 template<typename T, typename U> 45 enum StrictAllowNull {NonNull, AllowNull}; 46 47 template<typename T, StrictAllowNull nullable = NonNull, typename U> 46 48 static inline T strict_dynamic_cast( const U & src ) { 49 if (nullable == AllowNull && src == nullptr) { 50 return nullptr; 51 } 47 52 assert(src); 48 53 T ret = dynamic_cast<T>(src); 49 54 assertf(ret, "%s", toString(src).c_str()); 50 55 return ret; 51 }52 53 template<typename T, decltype(nullptr) null, typename U>54 static inline T strict_dynamic_cast( const U & src ) {55 return src ? strict_dynamic_cast<T, U>( src ) : nullptr;56 56 } 57 57
Note: See TracChangeset
for help on using the changeset viewer.