W
I'm still wondering about this
http://www.gamedev.net/topic/624328-confused-about-move-semantics/
I'm still wondering about this
http://www.gamedev.net/topic/624328-confused-about-move-semantics/
You changed
for (; headCount[0] > 0; --headCount[0]) {
cmw::File rep2(buf);
az1.push_back(rep2);
}
to
for (; headCount[0] > 0; --headCount[0]) {
cmw::File rep2(buf);
az1.push_back(std::move(rep2));
}
and observed a 492 byte decrease of the executable's size. But the C++
ISO standard does not specify anything related to the size of an
executable or object file as far as I remember. Anyhow, I am surprized
to see this reduction. I would expect to see no change or a slight
increase since a move-version of push_back is instantiated even though
cmw::File has no move constructor (since cmw::File has only a user-
declared copy ctor and no move ctor will be generated implicitly in
this case).
Perhaps in all other places you only use the moving push_back
function. Without std::move in this place your executable would
contain both versions of push_back. With std::move in this place your
executable would only contains the moving push_back (because the other
one is never used) and be therefore 492 bytes smaller. It's hard to
tell without knowing all the other code.
The code can be downloaded here --
http://webEbenezer.net/misc/direct.tar.bz2 .
The program is my middle tier which I call the cmwAmbassador.
Your theory is interesting, but I'm not sure if it is right.
cmwa_config_data.cc: accounts.push_back(accountInfo);
cmwa_config_data.cc: accounts.push_back(accountInfo);
cmwAmbassador.cc: pendingTransactions.push_back:std::move(request));
cmw_user_input.cc: headers.push_back( File(static_cast<char const*>(strtok(nullptr, "\n "))) );
MarshallingFunctions.hh: intrlst.push_back(*T::value_type::BuildPolyInstance(buf));
remote_messages_middle.cg.hh: az1.push_back(rep2);
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.