You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The file src/texture.h includes the lines (43-45),
// A fancy C++11 feature. emplace_back constructs the element in place,// and in this case it uses the new {} list constructor syntax.
mipmap.emplace_back(MipLevel{width, height, pixels});
This comment is misleading. To be constructed in placed, we'd write, mipmap.emplace_back(width, height, pixels). But this isn't possible as MipLevel is an aggregate type. Instead, MipLevel is constructed by the call to MipLevel{...}, which is then passed to MipLevel's implicit move constructor to construct the actual MipLevel element in the vector.
To emphasize that we're not actually constructing the object in place, we should use push_back (and remove the comment):
The file
src/texture.h
includes the lines (43-45),This comment is misleading. To be constructed in placed, we'd write,
mipmap.emplace_back(width, height, pixels)
. But this isn't possible asMipLevel
is an aggregate type. Instead,MipLevel
is constructed by the call toMipLevel{...}
, which is then passed toMipLevel
's implicit move constructor to construct the actualMipLevel
element in the vector.To emphasize that we're not actually constructing the object in place, we should use
push_back
(and remove the comment):The text was updated successfully, but these errors were encountered: