Changeset e04ef3a for src/Common


Ignore:
Timestamp:
Jun 14, 2016, 12:53:03 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
c8c03683
Parents:
55ba7339
Message:

add gcc extension, first attempt, not done yet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/utility.h

    r55ba7339 re04ef3a  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Apr 28 13:18:24 2016
    13 // Update Count     : 16
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Jun  8 17:33:59 2016
     13// Update Count     : 22
    1414//
    1515
     
    3333}
    3434
     35template<typename T, typename U>
     36struct 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
    3546template< typename T, typename U >
    3647static 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);
    4249}
    4350
Note: See TracChangeset for help on using the changeset viewer.