JLBorges, maybe I misunderstand the OP's question, but I feel the use of replace(), std::cout <<operator, and functions like that are only tangentially related to Wootenstein's design question.
The OP's problem seems to be more of a design question, asking about two related subjects: (1) the advantage or disadvantages of excessive composition/"layering" of objects inside classes, and (2) whether or not the public interface should let the user skip the layering by making both the Renderer class have a public function called GetPosition() even though the Cell class also has a function called GetPosition().
I think OP is worried that he's forming his program like Matryoshka dolls, if that makes sense.
I'm not sure what the solution is. I've kinda ran into this problem myself, for example: A game has a list of rooms. A room has a list of walls. A wall has its bounding coordinates. I don't have the code with me now, but I think I mitigate this through the user of (a) helper functions and (b) using object references for any repeated chaining.
(a) example: Design your program so that there wouldn't be a reason in the first place for the user of the Renderer class to have to access the map to access each cell to access each position. Instead, the Renderer class should have a function called Draw() or something, and inside the Draw() function, you can internally access whatever you need.
(b) If you must repeatedly use "Renderer.m_Map.GetCell(x, y).GetPosition()", then make a reference to map instead.
1 2 3 4
|
Map& map = Renderer.m_Map;
for (int y = 0; y < 10; y++)
for (int x = 0; x < 10; x++)
map.GetCell(x, y).GetPosition();
|
Doesn't really change much, but can make it look nicer.