Given the declarations
class DBuffer
{
//...
};
typedef QList<DBuffer*> DBuffers;
QList<int> fds;
QMap<int, DBuffers> buffers;
what does the line of code in the function given below mean.
function()
{
// what does this line mean? what is "&bufs"
DBuffers &bufs=buffers[fds[i]];
}
The & in the declaration indicates this variable is a reference, i.e. bufs doesn't create a new copy of the output but just refers to the object that is assigned to it. Reference types in this context can be thought of as alias for the object they are assigned to.
The RHS of the expression is pretty straight forward: look up an integer off the fds list by the index i, then use this value to get the corresponding Dbuffer from the map.