Re: [boost] [variant2] Need rationale for never-empty guarantee
 
            
            
            
            
                1 Mar
                
                    2019
                
            
            
                1 Mar
                
                '19
                
            
            
            
        
    
                9:08 p.m.
            
        This reply actually addresses my question: visitation on boost::variant2 is faster than on std::variant because it does not have to account for the valueless state.
I would not expect perfomance differences on CPUs with branch predictor or if visitation translated into jump table (variant uses switch for this?).
For example, resizing a std::vector implements the strong guarantee that state will be restored to before the resize if an exception is thrown in the middle of the resize.
Probably one should use different container type if a data types move/copy can throw. There even a vector implementation that will not copy/move on resize https://www.youtube.com/watch?v=Ke1mJiGO-pU (for CPU with virtual memory).
        2436
        
      
          Age (days ago)
        
      
        2436
        
    
          Last active (days ago)
        
        
        
        0 comments
    
    
        
        1 participants
    
    
    
    
    
    
    
    
    participants (1)
- 
                 Nikita Kniazev Nikita Kniazev