Ex4.2 feedback: CaloGrid::cell() return pointer instead of object
This commit is contained in:
		
							parent
							
								
									83bf4e34dc
								
							
						
					
					
						commit
						52d1f4e4e9
					
				
					 2 changed files with 4 additions and 1 deletions
				
			
		|  | @ -13,6 +13,6 @@ CaloCell* CaloGrid::cell(int x, int y ) { | |||
| 		return nullptr; | ||||
| 	} | ||||
| 
 | ||||
| 	return cells[ x * nx + y ] ; | ||||
| 	return &cells[ x*nx + y ] ; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -25,6 +25,9 @@ class CaloGrid | |||
| 		} | ||||
| 
 | ||||
| 		CaloCell* cell(int x, int y); | ||||
| 		const CaloCell* cell(int x, int y) const { | ||||
| 			return const_cast<CaloCell*> (cell(x, y)); | ||||
| 		} | ||||
| 
 | ||||
| 
 | ||||
| 	private: | ||||
|  |  | |||
		Reference in a new issue