Changeset f80e0218 for src/Common/utility.h
- Timestamp:
- Jun 30, 2016, 4:32:56 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- ea29e73
- Parents:
- 1b5c81ed (diff), 84d4d6f (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
-
src/Common/utility.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
r1b5c81ed rf80e0218 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // utility.h -- 7 // utility.h -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 2 18:04:41 201513 // Update Count : 1612 // Last Modified On : Wed Jun 8 17:33:59 2016 13 // Update Count : 22 14 14 // 15 15 … … 33 33 } 34 34 35 template<typename T, typename U> 36 struct maybeBuild_t { 37 static T * doit( const U *orig ) { 38 if ( orig ) { 39 return orig->build(); 40 } else { 41 return 0; 42 } // if 43 } 44 }; 45 35 46 template< typename T, typename U > 36 47 static inline T * maybeBuild( const U *orig ) { 37 if ( orig ) { 38 return orig->build(); 39 } else { 40 return 0; 41 } // if 48 return maybeBuild_t<T,U>::doit(orig); 42 49 } 43 50 … … 62 69 os << std::string( indent, ' ' ); 63 70 (*i)->print( os, indent + 2 ); 71 // need an endl after each element because it's not easy to know when each individual item should end 64 72 os << std::endl; 65 73 } // if … … 128 136 } 129 137 130 template < typename T > 138 template < typename T > 131 139 std::string toString ( T value ) { 132 140 std::ostringstream os;
Note:
See TracChangeset
for help on using the changeset viewer.