Skip to content

Commit

Permalink
Catch polymorphic types by const-ref
Browse files Browse the repository at this point in the history
  • Loading branch information
janisozaur committed Mar 6, 2019
1 parent 1eb717f commit 71436e1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/CalcManager/CalculatorVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CalculatorVector
{
*item = m_vector.at(index);
}
catch (std::out_of_range /*ex*/)
catch (const std::out_of_range& /*ex*/)
{
hr = E_BOUNDS;
}
Expand All @@ -34,7 +34,7 @@ class CalculatorVector
{
m_vector[index] = item;
}
catch (std::out_of_range /*ex*/)
catch (const std::out_of_range& /*ex*/)
{
hr = E_BOUNDS;
}
Expand Down Expand Up @@ -63,7 +63,7 @@ class CalculatorVector
auto iter = m_vector.begin() + index;
m_vector.insert(iter, item);
}
catch (std::bad_alloc /*ex*/)
catch (const std::bad_alloc& /*ex*/)
{
hr = E_OUTOFMEMORY;
}
Expand Down Expand Up @@ -92,7 +92,7 @@ class CalculatorVector
{
m_vector.push_back(item);
}
catch (std::bad_alloc /*ex*/)
catch (const std::bad_alloc& /*ex*/)
{
hr = E_OUTOFMEMORY;
}
Expand Down

0 comments on commit 71436e1

Please sign in to comment.