I have created a vector and filled data as part of an object initialization. The vector will not be modified after initialization. The declaration of the vector is
std::vector<AnalyticalChuckRing_t> m_analyticalRings;
We will call a method named GroupCirclesByRing
from multiple async tasks. The following lines of code access the vector object in this method. I am almost sure that these statement does not need protection as it does not modify the object. Where can I find the documentation to ensure that thread synchronization is not required?
auto GetRingAndAngle = [=](const CPoint& point)
{
double dDistance = DistanceFromOrigin(point);
double dAngle{ 0.0 };
for (int nRing = 1; nRing <= TotalRings; ++nRing)
{
if (abs(dDistance - m_analyticalRings[nRing].dRadius) < 3 )
{
dAngle = atan2((resultRings[0][0].center.m_dY - point.m_dY), (point.m_dX - resultRings[0][0].center.m_dX));
// Convert angle to range [0 : 2 PI]
dAngle = (dAngle < 0) ? (2 * M_PI + dAngle) : dAngle;
return make_tuple(nRing, dAngle);
}
}
return make_tuple(InvalidRingNo, dAngle);
};