Yes, you are correct.
The Object Structure can be any container of elements to be visited. Its purpose is just to iterate over the different elements, so what you have is fine. The elements could also be connected by a tree structure, like the Composite pattern.
A unique feature of the Visitor pattern is that the elements to be visited do not require any common hierarchy beyond a shared accept()
method. You could visit completely unrelated elements from unconnected sources, with no Object Structure at all (though that probably wouldn't be very useful).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…