A sequence is false if all it contains is false

This commit is contained in:
John Wiegley 2009-02-23 14:38:36 -04:00
parent 6e4581690d
commit 27fc3a3d43

View file

@ -94,7 +94,13 @@ value_t::operator bool() const
case STRING:
return ! as_string().empty();
case SEQUENCE:
return ! as_sequence().empty();
if (! as_sequence().empty()) {
foreach (const value_t& value, as_sequence()) {
if (value)
return true;
}
}
return false;
case POINTER:
return ! as_any_pointer().empty();
default: