 
            
            
            
            
                2 Jun
                
                    2020
                
            
            
                2 Jun
                
                '20
                
            
            
            
        
    
                4:32 p.m.
            
        Alexander Grund wrote:
Not sure if that really proves the point. I think you need to compare a result<X> function to a function returning X directly. Like so: https://godbolt.org/z/JFmn_j
And for that there is a difference: There are 4 main memory accesses in the result<X> function and none in the "regular" one.
That's not because of NRVO, it's because X fits in registers and result<X> doesn't.