Adding to @Air's answer, there's also the issue of boundary conditions. A simple span where neither support allows for axial displacements will have a slight gain in length, including along the "neutral axis". This is because, in this case, the "neutral axis" will hold a tensile stress. Since the beam deforms, the neutral axis changes from a horizontal straight line to a polynomial curve, which obviously has a greater length going from A to B. This increase in length of the neutral axis implies in a uniform tensile stress along the entire beam (in addition to the transversely linear stress profile due to bending). This tensile stress is usually not taken into account since the increase in length (and therefore the requisite tensile stress) is very small.
However, if one of the supports allows for axial displacements, then there will be no increase in length of the neutral axis, since the support will simply move slightly inwards to compensate. Obviously, in the case of the cantilever there is also no change in neutral axis length since the free end simply moves closer to the fixed end. This does, however, imply that a horizontal beam of length $L$ will, once loaded, have a horizontal length of $L - \Delta$ (and a vertical displacement such that the total length equals $L$).