Changeset 702e826 for src/Parser/parserutility.h
- Timestamp:
- Mar 9, 2023, 2:37:53 PM (19 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- fed03b3
- Parents:
- a29477f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parserutility.h
ra29477f r702e826 10 10 // Created On : Sat May 16 15:31:46 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Feb 16 12:34:00 202313 // Update Count : 512 // Last Modified On : Thr Mar 9 12:16:00 2023 13 // Update Count : 6 14 14 // 15 15 … … 20 20 Expression *notZeroExpr( Expression *orig ); 21 21 22 template< typename T, typename U > 23 struct maybeBuild_t { 24 static T * doit( const U *orig ) { 25 if ( orig ) { 26 return orig->build(); 27 } else { 28 return 0; 29 } 30 } 31 }; 32 33 template< typename T, typename U > 34 static inline T * maybeBuild( const U *orig ) { 35 return maybeBuild_t<T,U>::doit(orig); 22 template< typename T > 23 static inline auto maybeBuild( const T *orig ) -> decltype(orig->build()) { 24 return (orig) ? orig->build() : nullptr; 36 25 } 37 26 38 template< typename T , typename U>39 static inline T * maybeMoveBuild( const U *orig) {40 T*ret = maybeBuild<T>(orig);27 template< typename T > 28 static inline auto maybeMoveBuild( const T *orig ) -> decltype(orig->build()) { 29 auto ret = maybeBuild<T>(orig); 41 30 delete orig; 42 31 return ret;
Note: See TracChangeset
for help on using the changeset viewer.