My code includes the loop that appends two vectors and discards one of them.
Code:
for (int j = 0; j < superpixels[orgIndex].size(); j++)
{
superpixels[dstIndex].push_back(superpixels[orgIndex][j]);
}
superpixels[orgIndex].clear();
std::vector<int>().swap(superpixels[orgIndex]);
However, the Eclipse debugger reads that superpixels[dstIndex].size() is still unchanged after push_back().
In the first case before the code is executed, I have orgIndex = 1, dstIndex = 287, superpixels[1].size() = 191, superpixels[287].size() = 1.
After the loop executed once, I see that the 191 values of superpixels[1] has been successfully appended to superpixels[287] (that is, superpixels[287][191] is not a garbage and equals the former value of superpixels[1][190])
However, the 'Expression' tab in Eclipse debugger still reads superpixels[1].size() = 191 and superpixels[287].size() = 1 (which should be 0, 192 respectively)
The Eclipse debugger console reads:
Name : superpixels[1].size()
Details:0
Default:191
Decimal:191
Hex:0xbf
Binary:10111111
Octal:0277
Name : superpixels[287].size()
Details:192
Default:1
Decimal:192
Hex:0xc0
Binary:11000000
Octal:0300
Why this happens? What should I do to update them correctly?
My Eclipse version is: Version: Oxygen Release (4.7.0) Build id: 20170620-1800
Build flag: -c -fmessage-length=0 -std=c++11 -pthread
Aucun commentaire:
Enregistrer un commentaire