From f0959cc292c4bea1171114e83696aa6fc661db7c Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Sat, 3 Sep 2016 23:51:10 +0100 Subject: [PATCH] explicit operator bool --- src/DocIterator.h | 4 +--- src/frontends/qt4/TocWidget.cpp | 2 +- src/insets/InsetTabular.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/DocIterator.h b/src/DocIterator.h index 471f52d4be..3f718697ad 100644 --- a/src/DocIterator.h +++ b/src/DocIterator.h @@ -64,9 +64,7 @@ public: void resize(size_t i) { slices_.resize(i); } /// is the iterator valid? - operator const void*() const { return empty() ? 0 : this; } - /// is this iterator invalid? - bool operator!() const { return empty(); } + explicit operator bool() const { return !empty(); } /// does this iterator have any content? bool empty() const { return slices_.empty(); } diff --git a/src/frontends/qt4/TocWidget.cpp b/src/frontends/qt4/TocWidget.cpp index 23db10ec73..1f172a1a6d 100644 --- a/src/frontends/qt4/TocWidget.cpp +++ b/src/frontends/qt4/TocWidget.cpp @@ -156,7 +156,7 @@ bool TocWidget::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_OUTLINE_IN: case LFUN_OUTLINE_OUT: case LFUN_SECTION_SELECT: - status.setEnabled(item.dit() != 0); + status.setEnabled((bool)item.dit()); return true; case LFUN_LABEL_COPY_AS_REFERENCE: { diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index e83c895b54..4df9232936 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -543,7 +543,7 @@ InsetTableCell splitCell(InsetTableCell & head, docstring const & align_d, bool { InsetTableCell tail = InsetTableCell(head); DocIterator const dit = separatorPos(&head, align_d); - hassep = dit; + hassep = (bool)dit; if (hassep) { pit_type const psize = head.paragraphs().front().size(); head.paragraphs().front().eraseChars(dit.pos(), psize, false);