K
kfriddile
I'm working with a math library that uses some 16-byte-aligned types.
Under MSVC at least, alignment can't be specified for function
parameters. So, when I try to create a std::vector of one of these
types, I get a compilation error from vector::resize because it takes
the object by value like so:
void resize(size_type _Newsize, _Ty _Val)
but then just passes it as a const reference to an implementation
function. If i change the above to:
void resize(size_type _Newsize, const _Ty& _Val)
everything works fine. I believe passing by value is standard-
conformant, but I'm wondering what the rationale for that is?
Under MSVC at least, alignment can't be specified for function
parameters. So, when I try to create a std::vector of one of these
types, I get a compilation error from vector::resize because it takes
the object by value like so:
void resize(size_type _Newsize, _Ty _Val)
but then just passes it as a const reference to an implementation
function. If i change the above to:
void resize(size_type _Newsize, const _Ty& _Val)
everything works fine. I believe passing by value is standard-
conformant, but I'm wondering what the rationale for that is?