Catch polymorphic types by const-ref (#125)

This commit is contained in:
Michał Janiszewski 2019-03-07 18:45:51 +01:00 committed by Matt Cooley
parent 20afac5572
commit 2320697562

View File

@ -14,7 +14,7 @@ public:
{ {
*item = m_vector.at(index); *item = m_vector.at(index);
} }
catch (std::out_of_range /*ex*/) catch (const std::out_of_range& /*ex*/)
{ {
hr = E_BOUNDS; hr = E_BOUNDS;
} }
@ -34,7 +34,7 @@ public:
{ {
m_vector[index] = item; m_vector[index] = item;
} }
catch (std::out_of_range /*ex*/) catch (const std::out_of_range& /*ex*/)
{ {
hr = E_BOUNDS; hr = E_BOUNDS;
} }
@ -63,7 +63,7 @@ public:
auto iter = m_vector.begin() + index; auto iter = m_vector.begin() + index;
m_vector.insert(iter, item); m_vector.insert(iter, item);
} }
catch (std::bad_alloc /*ex*/) catch (const std::bad_alloc& /*ex*/)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
} }
@ -92,7 +92,7 @@ public:
{ {
m_vector.push_back(item); m_vector.push_back(item);
} }
catch (std::bad_alloc /*ex*/) catch (const std::bad_alloc& /*ex*/)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
} }