explicit operator bool

This commit is contained in:
Guillaume Munch 2016-09-03 23:51:10 +01:00
parent f1582a2acb
commit f0959cc292
3 changed files with 3 additions and 5 deletions

View File

@ -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(); }

View File

@ -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: {

View File

@ -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);