Ignore:
Timestamp:
Feb 11, 2011, 10:05:14 PM (13 years ago)
Author:
イグトランス (egtra)
Message:

Hashmapの実装にunorderedを用いるよう変更

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/egtra/ab5.0/abdev/ab_common/src/Lexical/Const.cpp

    r700 r803  
    2929CConst *Consts::GetObjectPtr( const Symbol &symbol )
    3030{
    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;
    4237}
    4338
     
    131126ConstMacro *ConstMacros::Find( const Symbol &symbol )
    132127{
    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;
    144134}
Note: See TracChangeset for help on using the changeset viewer.