template <typename R>
void
Receive (::cmw::ReceiveBufferTCPCompressed<R>& buf
, ::std::vector<cmw::File>& az1
)
{
uint32_t headCount[1];
buf.Give(headCount[0]);
az1.reserve(az1.size() + headCount[0]);
for (; headCount[0] > 0; --headCount[0]) {
cmw::File rep2(buf);
az1.push_back(rep2);
}
}
My question has to do with the code in the loop. File.hh is here and File.cc is here. (All of the code in question can be downloaded here.)
If I change the last line in the loop to:
az1.push_back(::std::move(rep2));
the size of the executable is reduced by 492 bytes. I thought that since File has a user defined copy constructor and destructor, the compiler wouldn't generate a move constructor for the class. I figured the compiler would ignore the std::move call and use the copy constructor and the two versions would produce the same size executables. What am I missing? Thanks.
Edit: The compiler is g++ 4.8 released a few days ago -- April 29th.
(I'm also wondering how to build just g++ when I download a gcc snapshot. It builds a bunch of Fortran and Java stuff that I'm not interested in.)