It's recommended to pass objects by reference to avoid copying, but on the other hand in Qt it's cheap to copy implicitly shared classes.
I was thinking about this for few days and I couldn't come up with any rules. You situation is a bit similar to: The argument is passed as reference, but it must be copied when QVector needs to reallocate data. You can easily identify such situation in a single data structure, but the problem arises when the data is passed between many classes. But I would simply classify that as one of those Bad Things(tm) that might happen when you use global variables (or you have cycles in call graph).




							
						
    
    
      
    
    
    
    
    
    
  
    
    
      
    
    
    
    
  
				
				
				
					
  Reply With Quote
Bookmarks