LayerVector anotherLayer;
const LayerVector& currentLayers(anotherLayer);
I can not understand the why the reference & are used here.
EDIT:
My shame. I only know the reference could be defined in following way. The way above make me confused… Thank you guys!
const LayerVector ¤tLayers = anotherLayer
This declares
currentLayersas a const reference and initializes it toanotherLayer. This essentially means thatcurrentLayerswill be an alias foranotherLayer. It being const meansanotherLayercannot be changed via this reference, only read.