operator bool

This commit is contained in:
David Rose 2009-02-10 23:34:22 +00:00
parent 30eb8286a2
commit da684d4f49
8 changed files with 54 additions and 0 deletions

View File

@ -411,6 +411,18 @@ clear() {
_highest_bits = 0;
}
////////////////////////////////////////////////////////////////////
// Function: BitArray::operator bool
// Access: Published
// Description: The bool typecast operator returns true if any bits
// are set, false if none of them is set. That is, true
// if nonzero, false if zero.
////////////////////////////////////////////////////////////////////
INLINE BitArray::
operator bool () const {
return !is_zero();
}
////////////////////////////////////////////////////////////////////
// Function: BitArray::operator ==
// Access: Published

View File

@ -102,6 +102,7 @@ PUBLISHED:
void output_hex(ostream &out, int spaces_every = 4) const;
void write(ostream &out, int indent_level = 0) const;
INLINE operator bool () const;
INLINE bool operator == (const BitArray &other) const;
INLINE bool operator != (const BitArray &other) const;
INLINE bool operator < (const BitArray &other) const;

View File

@ -631,6 +631,19 @@ write(ostream &out, int indent_level) const {
indent(out, indent_level) << *this << "\n";
}
////////////////////////////////////////////////////////////////////
// Function: BitMask::operator bool
// Access: Published
// Description: The bool typecast operator returns true if any bits
// are set, false if none of them is set. That is, true
// if nonzero, false if zero.
////////////////////////////////////////////////////////////////////
template<class WType, int nbits>
INLINE BitMask<WType, nbits>::
operator bool () const {
return !is_zero();
}
////////////////////////////////////////////////////////////////////
// Function: BitMask::operator ==
// Access: Published

View File

@ -89,6 +89,7 @@ PUBLISHED:
void output_hex(ostream &out, int spaces_every = 4) const;
void write(ostream &out, int indent_level = 0) const;
INLINE operator bool () const;
INLINE bool operator == (const BitMask<WType, nbits> &other) const;
INLINE bool operator != (const BitMask<WType, nbits> &other) const;
INLINE bool operator < (const BitMask<WType, nbits> &other) const;

View File

@ -646,6 +646,19 @@ write(ostream &out, int indent_level) const {
indent(out, indent_level) << *this << "\n";
}
////////////////////////////////////////////////////////////////////
// Function: DoubleBitMask::operator bool
// Access: Published
// Description: The bool typecast operator returns true if any bits
// are set, false if none of them is set. That is, true
// if nonzero, false if zero.
////////////////////////////////////////////////////////////////////
template<class BMType>
INLINE DoubleBitMask<BMType>::
operator bool () const {
return !is_zero();
}
////////////////////////////////////////////////////////////////////
// Function: DoubleBitMask::operator ==
// Access: Published

View File

@ -89,6 +89,7 @@ PUBLISHED:
void output_hex(ostream &out, int spaces_every = 4) const;
void write(ostream &out, int indent_level = 0) const;
INLINE operator bool () const;
INLINE bool operator == (const DoubleBitMask<BMType> &other) const;
INLINE bool operator != (const DoubleBitMask<BMType> &other) const;
INLINE bool operator < (const DoubleBitMask<BMType> &other) const;

View File

@ -360,6 +360,18 @@ clear() {
_inverse = false;
}
////////////////////////////////////////////////////////////////////
// Function: SparseArray::operator bool
// Access: Published
// Description: The bool typecast operator returns true if any bits
// are set, false if none of them is set. That is, true
// if nonzero, false if zero.
////////////////////////////////////////////////////////////////////
INLINE SparseArray::
operator bool () const {
return !is_zero();
}
////////////////////////////////////////////////////////////////////
// Function: SparseArray::operator ==
// Access: Published

View File

@ -93,6 +93,7 @@ PUBLISHED:
void output(ostream &out) const;
INLINE operator bool () const;
INLINE bool operator == (const SparseArray &other) const;
INLINE bool operator != (const SparseArray &other) const;
INLINE bool operator < (const SparseArray &other) const;