mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-11 07:46:01 -07:00
Updating HistoryViewModel::SaveHistory so it (#819)
Taking a const ref of history items vector in HistoryViewModel::SaveHistory and iterating over those items using a range for loop.
This commit is contained in:
parent
369843dd37
commit
d0785b2fad
1 changed files with 3 additions and 3 deletions
|
@ -267,16 +267,16 @@ void HistoryViewModel::ClearHistory()
|
|||
void HistoryViewModel::SaveHistory()
|
||||
{
|
||||
ApplicationDataContainer ^ historyContainer = GetHistoryContainer(m_currentMode);
|
||||
auto currentHistoryVector = m_calculatorManager->GetHistoryItems(m_currentMode);
|
||||
auto const& currentHistoryVector = m_calculatorManager->GetHistoryItems(m_currentMode);
|
||||
bool failure = false;
|
||||
int index = 0;
|
||||
Platform::String ^ serializedHistoryItem;
|
||||
|
||||
for (auto iter = currentHistoryVector.begin(); iter != currentHistoryVector.end(); ++iter)
|
||||
for (auto const& item : currentHistoryVector)
|
||||
{
|
||||
try
|
||||
{
|
||||
serializedHistoryItem = SerializeHistoryItem(*iter);
|
||||
serializedHistoryItem = SerializeHistoryItem(item);
|
||||
historyContainer->Values->Insert(index.ToString(), serializedHistoryItem);
|
||||
}
|
||||
catch (Platform::Exception ^)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue