Prevented unneeded copies from being made.

Removed an unneeded catch
This commit is contained in:
Nicholas Baron 2019-04-16 23:27:54 -07:00
commit b6b4f41f53

View file

@ -20,7 +20,7 @@ String^ CopyPasteManager::supportedFormats[] =
StandardDataFormats::Text StandardDataFormats::Text
}; };
constexpr wstring_view c_validCharacterSet{ L"0123456789()+-*/.abcdefABCDEF" }; static constexpr wstring_view c_validCharacterSet{ L"0123456789()+-*/.abcdefABCDEF" };
// The below values can not be "constexpr"-ed, // The below values can not be "constexpr"-ed,
// as both wstring_view and wchar[] can not be concatenated // as both wstring_view and wchar[] can not be concatenated
@ -269,10 +269,7 @@ bool CopyPasteManager::ExpressionRegExMatch(vector<wstring> operands, ViewMode m
bool expMatched = true; bool expMatched = true;
vector<wregex> patterns{}; vector<wregex> patterns{};
// Could this be auto? const auto [maxOperandLength, maxOperandValue] = GetMaxOperandLengthAndValue(mode, modeType, programmerNumberBase, bitLengthType);
pair<size_t, uint64_t> operandLimits = GetMaxOperandLengthAndValue(mode, modeType, programmerNumberBase, bitLengthType);
size_t maxOperandLength = operandLimits.first;
uint64_t maxOperandValue = operandLimits.second;
if (mode == ViewMode::Standard) if (mode == ViewMode::Standard)
{ {
@ -442,15 +439,11 @@ bool CopyPasteManager::TryOperandToULL(const wstring& operand, int numberBase, u
result = stoull(operand, &size, intBase); result = stoull(operand, &size, intBase);
return true; return true;
} }
catch (invalid_argument) catch (const invalid_argument&)
{ {
// Do nothing // Do nothing
} }
catch (out_of_range) catch (const out_of_range&)
{
// Do nothing
}
catch(...)
{ {
// Do nothing // Do nothing
} }