I have a method as follows (from the class, which implements the TBB task interface, but not currently multithreading) My problem is that two ways to access the vector cause completely different behavior - one works and the other makes the whole program explode quite spectacularly (this is a plugin, and usually the crash will depend on the host), but it takes outside the host program, as I said quite spectacularly)
void PtBranchAndBoundIterationOriginRunner::runOrigin(int origin, int time) const
{
BOOST_FOREACH(int accessMode, m_props->GetAccessModes())
{
const vector<double>& rowTotalsForAccessMode = m_rowTotalsByAccessMode.find(accessMode)->second;
if (origin != 129) continue;
m_job->Write("size: " + ToString(rowTotalsForAccessMode.size()));
try {
if (!rowTotalsForAccessMode[origin]) continue;
if (!rowTotalsForAccessMode.at(origin)) continue;
} catch (...) {
m_job->Write("Caught an exception");
}
}
}
I hate not to ask clearly defined questions, but at the moment my best phrase is "WTF?"
I am compiling this using Intel C ++ 11.0.074 [IA-32] using Microsoft (R) Visual Studio version 9.0.21022.8, and my implementation is vector
const_reference operator[](size_type _Pos) const
{
#if _HAS_ITERATOR_DEBUGGING
if (size() <= _Pos)
{
_DEBUG_ERROR("vector subscript out of range");
_SCL_SECURE_OUT_OF_RANGE;
}
#endif
_SCL_SECURE_VALIDATE_RANGE(_Pos < size());
return (*(_Myfirst + _Pos));
}
(Iterator debugging is off - I'm sure) and
const_reference at(size_type _Pos) const
{
if (size() <= _Pos)
_Xran();
return (*(begin() + _Pos));
}
, , , , _Myfirst - ?
:
- 377, 129.
- , accessMode
, , @nikko:
map<int, vector<double>>::const_iterator it = m_rowTotalsByAccessMode.find(accessMode);
if (it != m_rowTotalsByAccessMode.end())
{
...
UPDATE 11.1.065, . , .