2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Move to std::optional.

This commit is contained in:
John Preston
2018-09-21 19:28:46 +03:00
parent 850efbde95
commit 2e5a0e056c
115 changed files with 632 additions and 672 deletions

View File

@@ -151,9 +151,9 @@ private:
void configLoadDone(const MTPConfig &result);
bool configLoadFail(const RPCError &error);
base::optional<ShiftedDcId> queryRequestByDc(
std::optional<ShiftedDcId> queryRequestByDc(
mtpRequestId requestId) const;
base::optional<ShiftedDcId> changeRequestByDc(
std::optional<ShiftedDcId> changeRequestByDc(
mtpRequestId requestId, DcId newdc);
// RPCError::NoError means do not toggle onError callback.
@@ -806,17 +806,17 @@ bool Instance::Private::configLoadFail(const RPCError &error) {
return false;
}
base::optional<ShiftedDcId> Instance::Private::queryRequestByDc(
std::optional<ShiftedDcId> Instance::Private::queryRequestByDc(
mtpRequestId requestId) const {
QMutexLocker locker(&_requestByDcLock);
auto it = _requestsByDc.find(requestId);
if (it != _requestsByDc.cend()) {
return it->second;
}
return base::none;
return std::nullopt;
}
base::optional<ShiftedDcId> Instance::Private::changeRequestByDc(
std::optional<ShiftedDcId> Instance::Private::changeRequestByDc(
mtpRequestId requestId,
DcId newdc) {
QMutexLocker locker(&_requestByDcLock);
@@ -829,7 +829,7 @@ base::optional<ShiftedDcId> Instance::Private::changeRequestByDc(
}
return it->second;
}
return base::none;
return std::nullopt;
}
void Instance::Private::checkDelayedRequests() {