diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-01-30 21:04:53 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-02-01 12:47:58 +0100 |
commit | 472722382d6aa7560eae716aca76763383ae7984 (patch) | |
tree | 9c6fd7f4c61a98146a4f2487b3af5c3c2f9f037a /src | |
parent | 0d9f4e7526fbf1e072aa3518e4e5313332ee4f18 (diff) |
QCoffPeParser: simplify std::optional check
Even in C++98 one could declare variables in if statements and
contextually convert them to bool:
if (D* d = dynamic_cast<D*>(base))
~~~
else if (D2* d = dynamic_cast<D2*>(base))
~~~
std::optional is contextually convertible to bool, so we don't need
C++17 if initializers. Just use
if (auto optional = ~~~~)
Pick-to: 6.3
Change-Id: Ie64c2c1ceb7b608eda0534d837f46d3c4be49bf8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/plugin/qcoffpeparser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/plugin/qcoffpeparser.cpp b/src/corelib/plugin/qcoffpeparser.cpp index 4813a07b27..15d1f64426 100644 --- a/src/corelib/plugin/qcoffpeparser.cpp +++ b/src/corelib/plugin/qcoffpeparser.cpp @@ -364,7 +364,7 @@ QLibraryScanResult QCoffPeParser::parse(QByteArrayView data, QString *errMsg) return {}; QByteArrayView stringTable; - if (auto optional = findStringTable(data, ntHeaders, error); optional) + if (auto optional = findStringTable(data, ntHeaders, error)) stringTable = *optional; else return {}; |