Changeset a32b204 for translator/Common


Ignore:
Timestamp:
May 17, 2015, 1:19:35 PM (9 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, string, with_gc
Children:
0dd3a2f
Parents:
b87a5ed
Message:

licencing: second groups of files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/Common/utility.h

    rb87a5ed ra32b204  
    2222maybeClone( const T *orig )
    2323{
    24   if( orig ) {
     24  if ( orig ) {
    2525    return orig->clone();
    2626  } else {
     
    3333maybeBuild( const U *orig )
    3434{
    35   if( orig ) {
     35  if ( orig ) {
    3636    return orig->build();
    3737  } else {
     
    4444printEnums( Input_iterator begin, Input_iterator end, const char * const *name_array, std::ostream &os )
    4545{
    46   for( Input_iterator i = begin; i != end; ++i ) {
     46  for ( Input_iterator i = begin; i != end; ++i ) {
    4747    os << name_array[ *i ] << ' ';
    4848  }
     
    5353deleteAll( Container &container )
    5454{
    55   for( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
     55  for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    5656    delete *i;
    5757  }
     
    6262printAll( const Container &container, std::ostream &os, int indent = 0 )
    6363{
    64   for( typename Container::const_iterator i = container.begin(); i != container.end(); ++i ) {
    65     if( *i ) {
     64  for ( typename Container::const_iterator i = container.begin(); i != container.end(); ++i ) {
     65    if ( *i ) {
    6666      os << std::string(indent,  ' ');
    6767      (*i)->print( os, indent + 2 );
     
    7777  typename SrcContainer::const_iterator in = src.begin();
    7878  std::back_insert_iterator< DestContainer > out( dest );
    79   while( in != src.end() ) {
     79  while ( in != src.end() ) {
    8080    *out++ = (*in++)->clone();
    8181  }
     
    8787{
    8888  int count = 0;
    89   for( typename Container::const_iterator i = container.begin(); i != container.end(); ++i ) {
    90     if( !(*i) ) {
     89  for ( typename Container::const_iterator i = container.begin(); i != container.end(); ++i ) {
     90    if ( !(*i) ) {
    9191      std::cerr << count << " is null" << std::endl;
    9292    }
     
    9797assign_strptr( std::string *str )
    9898{
    99   if( str == 0 ) {
     99  if ( str == 0 ) {
    100100    return "";
    101101  } else {
     
    115115std::list<T> tail( std::list<T> l )
    116116{
    117   if(! l.empty()){
     117  if (! l.empty()){
    118118    std::list<T> ret(++(l.begin()), l.end());
    119119    return ret;
     
    127127  Ts ret;
    128128
    129   switch( l.size() ){
     129  switch ( l.size() ){
    130130  case 0:
    131131    return ret;
     
    193193{
    194194  while ( begin++ != end )
    195     if( pred(*begin) ) *out++ = *begin;
     195    if ( pred(*begin) ) *out++ = *begin;
    196196
    197197  return;
     
    200200template< class InputIterator1, class InputIterator2, class OutputIterator >
    201201void zip( InputIterator1 b1, InputIterator1 e1, InputIterator2 b2, InputIterator2 e2, OutputIterator out ) {
    202   while( b1 != e1 && b2 != e2 )
     202  while ( b1 != e1 && b2 != e2 )
    203203    *out++ = std::pair<typename InputIterator1::value_type, typename InputIterator2::value_type>(*b1++, *b2++);
    204204}
     
    206206template< class InputIterator1, class InputIterator2, class OutputIterator, class BinFunction >
    207207void zipWith( InputIterator1 b1, InputIterator1 e1, InputIterator2 b2, InputIterator2 e2, OutputIterator out, BinFunction func ) {
    208   while( b1 != e1 && b2 != e2 )
     208  while ( b1 != e1 && b2 != e2 )
    209209    *out++ = func(*b1++, *b2++);
    210210}
Note: See TracChangeset for help on using the changeset viewer.