Changeset 803 in dev for branches/egtra/ab5.0/abdev/ab_common/src/Lexical/Const.cpp
- Timestamp:
- Feb 11, 2011, 10:05:14 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/egtra/ab5.0/abdev/ab_common/src/Lexical/Const.cpp
r700 r803 29 29 CConst *Consts::GetObjectPtr( const Symbol &symbol ) 30 30 { 31 CConst *pConst = GetHashArrayElement( symbol.GetName().c_str() ); 32 while( pConst ) 33 { 34 if( pConst->IsEqualSymbol( symbol ) ) 35 { 36 break; 37 } 38 pConst = pConst->GetChainNext(); 39 } 40 41 return pConst; 31 auto c = GetHashArrayElement(symbol.GetName()); 32 auto it = std::find_if(c.begin(), c.end(), 33 [&](CConst* t) {return t->IsEqualSymbol(symbol);}); 34 return it != c.end() 35 ? *it 36 : nullptr; 42 37 } 43 38 … … 131 126 ConstMacro *ConstMacros::Find( const Symbol &symbol ) 132 127 { 133 ConstMacro *pConstMacro = GetHashArrayElement( symbol.GetName().c_str() ); 134 while( pConstMacro ) 135 { 136 if( pConstMacro->IsEqualSymbol( symbol ) ) 137 { 138 break; 139 } 140 pConstMacro = pConstMacro->GetChainNext(); 141 } 142 143 return pConstMacro; 128 auto c = GetHashArrayElement(symbol.GetName()); 129 auto it = std::find_if(c.begin(), c.end(), 130 [&](ConstMacro* t) {return t->IsEqualSymbol(symbol);}); 131 return it != c.end() 132 ? *it 133 : nullptr; 144 134 }
Note:
See TracChangeset
for help on using the changeset viewer.