Is method B any faster than method A below? I have legacy code written with method A and I need to know if there would be a performance increase if I modified it to use method B or is it just semantics?
Method A (Using pointer)
for(vector<TriggerAlgorithm*>::iterator it = _pTrigs.begin(); it != _pTrigs.end(); ++it)
{
TriggerAlgorithm* pTrig = *it; // Pointer to the Trigger
pTrig->doSomething(); // Use pointer to do something
}
Method B (Using reference)
for(vector<TriggerAlgorithm*>::iterator it = _pTrigs.begin(); it != _pTrigs.end(); ++it)
{
TriggerAlgorithm& trig = *it; // Reference to the Trigger
trig.doSomething(); // Use reference to do something
}
Thanks!