Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate new clang-tidy checks, fix them #395

Merged
merged 1 commit into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,16 @@ Checks: "-*,\
-bugprone-narrowing-conversions,\
google-readability-casting,\
misc-*,\
-misc-no-recursion,\
-misc-non-private-member-variables-in-classes,\
modernize-*,\
-modernize-avoid-c-arrays,\
-modernize-return-braced-init-list,\
-modernize-use-nodiscard,\
-modernize-use-noexcept,\
-modernize-use-trailing-return-type,\
performance-*,\
portability-*,\
readability-*,\
-readability-function-cognitive-complexity,\
-readability-identifier-naming,\
-readability-magic-numbers,\
-readability-qualified-auto,\
-readability-uppercase-literal-suffix,\
"
HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$'
CheckOptions:
Expand Down
2 changes: 1 addition & 1 deletion src/api/common/src/cryptowatchapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const json& CollectResults(const json& dataJson) {
}

File GetFiatCacheFile(std::string_view dataDir) {
return File(dataDir, File::Type::kCache, "fiatcache.json", File::IfError::kNoThrow);
return {dataDir, File::Type::kCache, "fiatcache.json", File::IfError::kNoThrow};
}

constexpr std::string_view kCryptowatchBaseUrl = "https://api.cryptowat.ch";
Expand Down
4 changes: 2 additions & 2 deletions src/api/common/src/exchangeprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,8 @@ ReceivedWithdrawInfo ExchangePrivate::isWithdrawReceived(
}
RecentDeposit expectedDeposit(netEmittedAmount, Clock::now());
const RecentDeposit *pClosestRecentDeposit = expectedDeposit.selectClosestRecentDeposit(recentDeposits);
return ReceivedWithdrawInfo(pClosestRecentDeposit == nullptr ? MonetaryAmount() : pClosestRecentDeposit->amount(),
pClosestRecentDeposit != nullptr);
return {pClosestRecentDeposit == nullptr ? MonetaryAmount() : pClosestRecentDeposit->amount(),
pClosestRecentDeposit != nullptr};
}

} // namespace cct::api
10 changes: 5 additions & 5 deletions src/api/exchanges/src/binanceprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ MonetaryAmount BinancePrivate::WithdrawFeesFunc::operator()(CurrencyCode currenc
if (!withdrawFeeDetails["withdrawStatus"].get<bool>()) {
log::error("{} is currently unavailable for withdraw from {}", currencyCode, _exchangePublic.name());
}
return MonetaryAmount(withdrawFeeDetails["withdrawFee"].get<std::string_view>(), currencyCode);
return {withdrawFeeDetails["withdrawFee"].get<std::string_view>(), currencyCode};
}

namespace {
Expand Down Expand Up @@ -449,7 +449,7 @@ InitiatedWithdrawInfo BinancePrivate::launchWithdraw(MonetaryAmount grossAmount,
}
json result = PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kPost, "/sapi/v1/capital/withdraw/apply",
std::move(withdrawPostData));
return InitiatedWithdrawInfo(std::move(destinationWallet), std::move(result["id"].get_ref<string&>()), grossAmount);
return {std::move(destinationWallet), std::move(result["id"].get_ref<string&>()), grossAmount};
}

SentWithdrawInfo BinancePrivate::isWithdrawSuccessfullySent(const InitiatedWithdrawInfo& initiatedWithdrawInfo) {
Expand Down Expand Up @@ -500,7 +500,7 @@ SentWithdrawInfo BinancePrivate::isWithdrawSuccessfullySent(const InitiatedWithd
break;
}
}
return SentWithdrawInfo(netEmittedAmount, fee, isWithdrawSent);
return {netEmittedAmount, fee, isWithdrawSent};
}

ReceivedWithdrawInfo BinancePrivate::isWithdrawReceived(const InitiatedWithdrawInfo& initiatedWithdrawInfo,
Expand All @@ -526,8 +526,8 @@ ReceivedWithdrawInfo BinancePrivate::isWithdrawReceived(const InitiatedWithdrawI
}
RecentDeposit expectedDeposit(sentWithdrawInfo.netEmittedAmount(), Clock::now());
const RecentDeposit* pClosestRecentDeposit = expectedDeposit.selectClosestRecentDeposit(recentDeposits);
return ReceivedWithdrawInfo(pClosestRecentDeposit == nullptr ? MonetaryAmount() : pClosestRecentDeposit->amount(),
pClosestRecentDeposit != nullptr);
return {pClosestRecentDeposit == nullptr ? MonetaryAmount() : pClosestRecentDeposit->amount(),
pClosestRecentDeposit != nullptr};
}

} // namespace cct::api
7 changes: 3 additions & 4 deletions src/api/exchanges/src/binancepublicapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ const json& RetrieveMarketData(const ExchangeInfoDataByMarket& exchangeInfoData,
template <class ExchangeInfoDataByMarket>
VolAndPriNbDecimals QueryVolAndPriNbDecimals(const ExchangeInfoDataByMarket& exchangeInfoData, Market mk) {
const json& marketData = RetrieveMarketData(exchangeInfoData, mk);
return VolAndPriNbDecimals(marketData["baseAssetPrecision"].get<int8_t>(),
marketData["quoteAssetPrecision"].get<int8_t>());
return {marketData["baseAssetPrecision"].get<int8_t>(), marketData["quoteAssetPrecision"].get<int8_t>()};
}
} // namespace

Expand Down Expand Up @@ -450,7 +449,7 @@ MarketOrderBook BinancePublic::OrderBookFunc::operator()(Market mk, int depth) {
MonetaryAmount BinancePublic::TradedVolumeFunc::operator()(Market mk) {
json result = PublicQuery(_commonInfo._curlHandle, "/api/v3/ticker/24hr", {{"symbol", mk.assetsPairStrUpper()}});
std::string_view last24hVol = result["volume"].get<std::string_view>();
return MonetaryAmount(last24hVol, mk.base());
return {last24hVol, mk.base()};
}

LastTradesVector BinancePublic::queryLastTrades(Market mk, int nbTrades) {
Expand Down Expand Up @@ -478,7 +477,7 @@ LastTradesVector BinancePublic::queryLastTrades(Market mk, int nbTrades) {
MonetaryAmount BinancePublic::TickerFunc::operator()(Market mk) {
json result = PublicQuery(_commonInfo._curlHandle, "/api/v3/ticker/price", {{"symbol", mk.assetsPairStrUpper()}});
std::string_view lastPrice = result["price"].get<std::string_view>();
return MonetaryAmount(lastPrice, mk.quote());
return {lastPrice, mk.quote()};
}

} // namespace cct::api
6 changes: 3 additions & 3 deletions src/api/exchanges/src/bithumbprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ json PrivateQuery(CurlHandle& curlHandle, const APIKey& apiKey, std::string_view
}

File GetBithumbCurrencyInfoMapCache(std::string_view dataDir) {
return File(dataDir, File::Type::kCache, "bithumbcurrencyinfocache.json", File::IfError::kNoThrow);
return {dataDir, File::Type::kCache, "bithumbcurrencyinfocache.json", File::IfError::kNoThrow};
}

} // namespace
Expand Down Expand Up @@ -683,7 +683,7 @@ InitiatedWithdrawInfo BithumbPrivate::launchWithdraw(MonetaryAmount grossAmount,
withdrawPostData.append("destination", destinationWallet.tag());
}
PrivateQuery(_curlHandle, _apiKey, "/trade/btc_withdrawal", std::move(withdrawPostData));
return InitiatedWithdrawInfo(std::move(destinationWallet), "", grossAmount);
return {std::move(destinationWallet), "", grossAmount};
}

SentWithdrawInfo BithumbPrivate::isWithdrawSuccessfullySent(const InitiatedWithdrawInfo& initiatedWithdrawInfo) {
Expand All @@ -708,7 +708,7 @@ SentWithdrawInfo BithumbPrivate::isWithdrawSuccessfullySent(const InitiatedWithd
MonetaryAmount consumedAmt(std::string_view(unitsStr.begin() + first, unitsStr.end()), currencyCode);
if (consumedAmt == initiatedWithdrawInfo.grossEmittedAmount()) {
bool isWithdrawSuccess = searchGb == 5;
return SentWithdrawInfo(initiatedWithdrawInfo.grossEmittedAmount() - realFee, realFee, isWithdrawSuccess);
return {initiatedWithdrawInfo.grossEmittedAmount() - realFee, realFee, isWithdrawSuccess};
}
// TODO: Could we have rounding issues in case Bithumb returns to us a string representation of an amount coming
// from a double? In this case, we should offer a security interval, for instance, accepting +- 1 % error.
Expand Down
2 changes: 1 addition & 1 deletion src/api/exchanges/src/bithumbpublicapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ MonetaryAmount BithumbPublic::TradedVolumeFunc::operator()(Market mk) {
log::error("Bithumb time is not synchronized with us (Bithumb: {}, us: [{} - {}])", bithumbTimestamp, t1Ms, t2Ms);
}

return MonetaryAmount(last24hVol, mk.base());
return {last24hVol, mk.base()};
}

namespace {
Expand Down
4 changes: 2 additions & 2 deletions src/api/exchanges/src/huobiprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ InitiatedWithdrawInfo HuobiPrivate::launchWithdraw(MonetaryAmount grossAmount, W
json result = PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kPost, "/v1/dw/withdraw/api/create",
std::move(withdrawPostData));
string withdrawIdStr = ToString(result["data"].get<int64_t>());
return InitiatedWithdrawInfo(std::move(destinationWallet), std::move(withdrawIdStr), grossAmount);
return {std::move(destinationWallet), std::move(withdrawIdStr), grossAmount};
}

SentWithdrawInfo HuobiPrivate::isWithdrawSuccessfullySent(const InitiatedWithdrawInfo& initiatedWithdrawInfo) {
Expand Down Expand Up @@ -481,7 +481,7 @@ SentWithdrawInfo HuobiPrivate::isWithdrawSuccessfullySent(const InitiatedWithdra
break;
}
}
return SentWithdrawInfo(netEmittedAmount, fee, isWithdrawSent);
return {netEmittedAmount, fee, isWithdrawSent};
}

int HuobiPrivate::AccountIdFunc::operator()() {
Expand Down
2 changes: 1 addition & 1 deletion src/api/exchanges/src/huobipublicapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ MonetaryAmount HuobiPublic::queryWithdrawalFee(CurrencyCode currencyCode) {
for (const json& chainDetail : curDetail["chains"]) {
std::string_view chainName = chainDetail["chain"].get<std::string_view>();
if (chainName == cur) {
return MonetaryAmount(chainDetail["transactFeeWithdraw"].get<std::string_view>(), cur);
return {chainDetail["transactFeeWithdraw"].get<std::string_view>(), cur};
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/api/exchanges/src/krakenprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,7 @@ InitiatedWithdrawInfo KrakenPrivate::launchWithdraw(MonetaryAmount grossAmount,
}

// {"refid":"BSH3QF5-TDIYVJ-X6U74X"}
return InitiatedWithdrawInfo(std::move(destinationWallet), std::move(withdrawData["refid"].get_ref<string&>()),
grossAmount);
return {std::move(destinationWallet), std::move(withdrawData["refid"].get_ref<string&>()), grossAmount};
}

SentWithdrawInfo KrakenPrivate::isWithdrawSuccessfullySent(const InitiatedWithdrawInfo& initiatedWithdrawInfo) {
Expand All @@ -531,7 +530,7 @@ SentWithdrawInfo KrakenPrivate::isWithdrawSuccessfullySent(const InitiatedWithdr
log::info("{} withdraw status: {}", exchangeName(), status);
MonetaryAmount netWithdrawAmount(trx["amount"].get<std::string_view>(), currencyCode);
MonetaryAmount fee(trx["fee"].get<std::string_view>(), currencyCode);
return SentWithdrawInfo(netWithdrawAmount, fee, status == "Success");
return {netWithdrawAmount, fee, status == "Success"};
}
}
throw exception("Kraken: unable to find withdrawal confirmation of {}", initiatedWithdrawInfo.grossEmittedAmount());
Expand Down
9 changes: 5 additions & 4 deletions src/api/exchanges/src/krakenpublicapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bool CheckCurrencyExchange(std::string_view krakenEntryCurrencyCode, std::string
}

File GetKrakenWithdrawInfoFile(std::string_view dataDir) {
return File(dataDir, File::Type::kCache, "krakenwithdrawinfo.json", File::IfError::kNoThrow);
return {dataDir, File::Type::kCache, "krakenwithdrawinfo.json", File::IfError::kNoThrow};
}

} // namespace
Expand Down Expand Up @@ -379,14 +379,15 @@ std::pair<MarketSet, KrakenPublic::MarketsFunc::MarketInfoMap> KrakenPublic::Mar
}

MarketOrderBookMap KrakenPublic::AllOrderBooksFunc::operator()(int depth) {
MarketOrderBookMap ret;
string allAssetPairs;
const CurrencyExchangeFlatSet& krakenCurrencies = _tradableCurrenciesCache.get();
const auto& [markets, marketInfoMap] = _marketsCache.get();
allAssetPairs.reserve(markets.size() * 8);

using KrakenAssetPairToStdMarketMap = std::unordered_map<string, Market>;
KrakenAssetPairToStdMarketMap krakenAssetPairToStdMarketMap;
krakenAssetPairToStdMarketMap.reserve(markets.size());

string allAssetPairs;
MarketOrderBookMap ret;
ret.reserve(markets.size());
for (Market mk : markets) {
auto lb = krakenCurrencies.find(mk.base());
Expand Down
5 changes: 2 additions & 3 deletions src/api/exchanges/src/kucoinprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,7 @@ InitiatedWithdrawInfo KucoinPrivate::launchWithdraw(MonetaryAmount grossAmount,
}

json result = PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kPost, "/api/v1/withdrawals", std::move(opts));
return InitiatedWithdrawInfo(std::move(destinationWallet), std::move(result["withdrawalId"].get_ref<string&>()),
grossAmount);
return {std::move(destinationWallet), std::move(result["withdrawalId"].get_ref<string&>()), grossAmount};
}

SentWithdrawInfo KucoinPrivate::isWithdrawSuccessfullySent(const InitiatedWithdrawInfo& initiatedWithdrawInfo) {
Expand Down Expand Up @@ -422,7 +421,7 @@ SentWithdrawInfo KucoinPrivate::isWithdrawSuccessfullySent(const InitiatedWithdr
break;
}
}
return SentWithdrawInfo(netEmittedAmount, fee, isWithdrawSent);
return {netEmittedAmount, fee, isWithdrawSent};
}

} // namespace cct::api
10 changes: 6 additions & 4 deletions src/api/exchanges/src/kucoinpublicapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ MonetaryAmount KucoinPublic::queryWithdrawalFee(CurrencyCode currencyCode) {
if (it == currencyInfoSet.end()) {
throw exception("Unable to find withdrawal fee for {}", currencyCode);
}
return MonetaryAmount(it->withdrawalMinFee, it->currencyExchange.standardCode());
return {it->withdrawalMinFee, it->currencyExchange.standardCode()};
}

MarketOrderBookMap KucoinPublic::AllOrderBooksFunc::operator()(int depth) {
Expand All @@ -194,7 +194,9 @@ MarketOrderBookMap KucoinPublic::AllOrderBooksFunc::operator()(int depth) {
const MarketsFunc::MarketInfo& marketInfo = marketInfoMap.find(mk)->second;

// Use avg traded volume by second as ask/bid vol
MonetaryAmount askVol = dayVolume / (2 * 24 * 3600);
static constexpr MonetaryAmount::AmountType kAskVolPerDay = static_cast<MonetaryAmount::AmountType>(2) * 24 * 3600;

MonetaryAmount askVol = dayVolume / kAskVolPerDay;
askVol.round(marketInfo.baseIncrement, MonetaryAmount::RoundType::kNearest);
if (askVol == 0) {
askVol = marketInfo.baseIncrement;
Expand Down Expand Up @@ -295,7 +297,7 @@ MonetaryAmount KucoinPublic::sanitizeVolume(Market mk, MonetaryAmount vol) {

MonetaryAmount KucoinPublic::TradedVolumeFunc::operator()(Market mk) {
json result = PublicQuery(_curlHandle, "/api/v1/market/stats", GetSymbolPostData(mk));
return MonetaryAmount(result["vol"].get<std::string_view>(), mk.base());
return {result["vol"].get<std::string_view>(), mk.base()};
}

LastTradesVector KucoinPublic::queryLastTrades(Market mk, [[maybe_unused]] int nbTrades) {
Expand All @@ -317,6 +319,6 @@ LastTradesVector KucoinPublic::queryLastTrades(Market mk, [[maybe_unused]] int n

MonetaryAmount KucoinPublic::TickerFunc::operator()(Market mk) {
json result = PublicQuery(_curlHandle, "/api/v1/market/orderbook/level1", GetSymbolPostData(mk));
return MonetaryAmount(result["price"].get<std::string_view>(), mk.quote());
return {result["price"].get<std::string_view>(), mk.quote()};
}
} // namespace cct::api
6 changes: 3 additions & 3 deletions src/api/exchanges/src/upbitprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ MonetaryAmount UpbitPrivate::WithdrawFeesFunc::operator()(CurrencyCode currencyC
json result = PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kGet, "/v1/withdraws/chance",
{{"currency", currencyCode.str()}});
std::string_view amountStr = result["currency"]["withdraw_fee"].get<std::string_view>();
return MonetaryAmount(amountStr, currencyCode);
return {amountStr, currencyCode};
}

InitiatedWithdrawInfo UpbitPrivate::launchWithdraw(MonetaryAmount grossAmount, Wallet&& destinationWallet) {
Expand All @@ -448,7 +448,7 @@ InitiatedWithdrawInfo UpbitPrivate::launchWithdraw(MonetaryAmount grossAmount, W
}
json result =
PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kPost, "/v1/withdraws/coin", std::move(withdrawPostData));
return InitiatedWithdrawInfo(std::move(destinationWallet), std::move(result["uuid"].get_ref<string&>()), grossAmount);
return {std::move(destinationWallet), std::move(result["uuid"].get_ref<string&>()), grossAmount};
}

SentWithdrawInfo UpbitPrivate::isWithdrawSuccessfullySent(const InitiatedWithdrawInfo& initiatedWithdrawInfo) {
Expand All @@ -472,7 +472,7 @@ SentWithdrawInfo UpbitPrivate::isWithdrawSuccessfullySent(const InitiatedWithdra
log::error("{} withdraw of {} has been cancelled", _exchangePublic.name(), currencyCode);
}
const bool isDone = stateUpperStr == "DONE";
return SentWithdrawInfo(netEmittedAmount, fee, isDone || isCanceled);
return {netEmittedAmount, fee, isDone || isCanceled};
}

} // namespace cct::api
8 changes: 4 additions & 4 deletions src/api/interface/test/exchangeretrieverbase_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class ExchangeTest {

ExchangeTest(std::string_view name, std::string_view keyName) : _name(name), _keyName(keyName) {}

std::string_view name() const { return _name; }
std::string_view keyName() const { return _keyName; }
[[nodiscard]] std::string_view name() const { return _name; }
[[nodiscard]] std::string_view keyName() const { return _keyName; }

ExchangePublic &apiPublic() { return *this; }
const ExchangePublic &apiPublic() const { return *this; }
[[nodiscard]] const ExchangePublic &apiPublic() const { return *this; }

bool matches(const ExchangeName &exchangeName) const {
[[nodiscard]] bool matches(const ExchangeName &exchangeName) const {
return exchangeName.name() == _name && (!exchangeName.isKeyNameDefined() || exchangeName.keyName() == _keyName);
}

Expand Down
4 changes: 2 additions & 2 deletions src/engine/src/coincentercommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace cct {
bool CoincenterCommand::isPublic() const {
switch (_type) {
case CoincenterCommandType::kHealthCheck:
case CoincenterCommandType::kHealthCheck: // NOLINT(bugprone-branch-clone)
[[fallthrough]];
case CoincenterCommandType::kMarkets:
[[fallthrough]];
Expand Down Expand Up @@ -33,7 +33,7 @@ bool CoincenterCommand::isReadOnly() const {
return true;
}
switch (_type) {
case CoincenterCommandType::kBalance:
case CoincenterCommandType::kBalance: // NOLINT(bugprone-branch-clone)
[[fallthrough]];
case CoincenterCommandType::kDepositInfo:
[[fallthrough]];
Expand Down
6 changes: 3 additions & 3 deletions src/engine/src/coincentercommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ CoincenterCmdLineOptions CoincenterCommands::ParseOptions(int argc, const char *

MonitoringInfo CoincenterCommands::CreateMonitoringInfo(std::string_view programName,
const CoincenterCmdLineOptions &cmdLineOptions) {
return MonitoringInfo(cmdLineOptions.useMonitoring, programName, cmdLineOptions.monitoringAddress,
cmdLineOptions.monitoringPort, cmdLineOptions.monitoringUsername,
cmdLineOptions.monitoringPassword);
return {cmdLineOptions.useMonitoring, programName,
cmdLineOptions.monitoringAddress, cmdLineOptions.monitoringPort,
cmdLineOptions.monitoringUsername, cmdLineOptions.monitoringPassword};
}

namespace {
Expand Down
5 changes: 2 additions & 3 deletions src/engine/src/exchangesorchestrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,8 @@ TradedAmountsPerExchange ExchangesOrchestrator::trade(MonetaryAmount startAmount
if (privateExchangeNames.size() == 1 && !isPercentageTrade) {
// In this special case we don't need to call the balance - call trade directly
Exchange &exchange = _exchangeRetriever.retrieveUniqueCandidate(privateExchangeNames.front());
return TradedAmountsPerExchange(
1,
std::make_pair(std::addressof(exchange), exchange.apiPrivate().trade(startAmount, toCurrency, tradeOptions)));
return {1, std::make_pair(std::addressof(exchange),
exchange.apiPrivate().trade(startAmount, toCurrency, tradeOptions))};
}

const CurrencyCode fromCurrency = startAmount.currencyCode();
Expand Down
8 changes: 3 additions & 5 deletions src/engine/src/stringoptionparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ ExchangeNames GetExchanges(std::string_view str) {
return exchanges;
}

std::string_view StrEnd(std::string_view opt, std::size_t startPos) {
return std::string_view(opt.begin() + startPos, opt.end());
}
std::string_view StrEnd(std::string_view opt, std::size_t startPos) { return {opt.begin() + startPos, opt.end()}; }

bool IsExchangeName(std::string_view str) {
string lowerStr = ToLower(str);
Expand All @@ -51,7 +49,7 @@ std::string_view GetNextStr(std::string_view opt, CharOrStringType sep, std::siz
while (endPos > 0U && isblank(opt[endPos - 1U])) {
--endPos;
}
return std::string_view(opt.begin() + begPos, opt.begin() + endPos);
return {opt.begin() + begPos, opt.begin() + endPos};
}

auto GetNextPercentageAmount(std::string_view opt, std::string_view sepWithPercentageAtLast, std::size_t &pos) {
Expand Down Expand Up @@ -114,7 +112,7 @@ StringOptionParser::CurrencyPrivateExchanges StringOptionParser::getCurrencyPriv
throw invalid_argument("Expected a currency code first");
}

return CurrencyPrivateExchanges(CurrencyCode(curStr), GetExchanges(exchangesStr));
return {CurrencyCode(curStr), GetExchanges(exchangesStr)};
}

StringOptionParser::CurrenciesPrivateExchanges StringOptionParser::getCurrenciesPrivateExchanges(
Expand Down
Loading