If-else-if versus map
        Posted  
        
            by perezvon
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by perezvon
        
        
        
        Published on 2010-03-17T06:56:06Z
        Indexed on 
            2010/03/17
            7:01 UTC
        
        
        Read the original article
        Hit count: 286
        
Hi,
Suppose I have such an if/else-if chain:
if( x.GetId() == 1 ) { } else if( x.GetId() == 2 ) { } // ... 50 more else if statements
What I wonder is, if I keep a map, will it be any better in terms of performance? (assuming keys are integers)
© Stack Overflow or respective owner