mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -07:00
Catch polymorphic types by const-ref (#125)
This commit is contained in:
parent
20afac5572
commit
2320697562
1 changed files with 4 additions and 4 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue