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); } void resize(size_t i) { slices_.resize(i); }
/// is the iterator valid? /// is the iterator valid?
operator const void*() const { return empty() ? 0 : this; } explicit operator bool() const { return !empty(); }
/// is this iterator invalid?
bool operator!() const { return empty(); }
/// does this iterator have any content? /// does this iterator have any content?
bool empty() const { return slices_.empty(); } 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_IN:
case LFUN_OUTLINE_OUT: case LFUN_OUTLINE_OUT:
case LFUN_SECTION_SELECT: case LFUN_SECTION_SELECT:
status.setEnabled(item.dit() != 0); status.setEnabled((bool)item.dit());
return true; return true;
case LFUN_LABEL_COPY_AS_REFERENCE: { 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); InsetTableCell tail = InsetTableCell(head);
DocIterator const dit = separatorPos(&head, align_d); DocIterator const dit = separatorPos(&head, align_d);
hassep = dit; hassep = (bool)dit;
if (hassep) { if (hassep) {
pit_type const psize = head.paragraphs().front().size(); pit_type const psize = head.paragraphs().front().size();
head.paragraphs().front().eraseChars(dit.pos(), psize, false); head.paragraphs().front().eraseChars(dit.pos(), psize, false);