sizeof
is applied to the result of a function call, not a declaration. It therefore gives the size of the return value, which in this case is a reference to an array of chars.
The template causes the array in the return type to have the same number of elements as the argument array, which is fed to the function from the macro.
Finally, sizeof
is then applied to a reference to this char array. sizeof
on a reference is the same as sizeof
on the type itself. Since sizeof(char) == 1
, this gives the number of elements in the array.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…