Commit 8f0073eda5855244babab50e11ae6e5bdb91540f

Authored by m-holger
1 parent d4a56364

Refactor `NNTreeIterator::lastPathElement`: simplify logic with conditional `std::prev` usage.

Showing 1 changed file with 1 additions and 5 deletions
libqpdf/NNTree.cc
... ... @@ -337,11 +337,7 @@ NNTreeIterator::split(Dictionary to_split, std::list<PathElement>::iterator pare
337 337 std::list<NNTreeIterator::PathElement>::iterator
338 338 NNTreeIterator::lastPathElement()
339 339 {
340   - auto result = path.end();
341   - if (!path.empty()) {
342   - --result;
343   - }
344   - return result;
  340 + return path.empty() ? path.end() : std::prev(path.end());
345 341 }
346 342  
347 343 void
... ...