bool conversion for record references (see also #477)
I decided to allow for an 'unbound' reference to allow default construction of elements involving record references. I am aware of the implications, but I place the focus on the value nature of GenNode elements; the RecordRef was introduced only as a means to cary out diff comparisons and similar computations.
This commit is contained in:
parent
f15266e435
commit
8c78af2adc
2 changed files with 7 additions and 1 deletions
|
|
@ -428,6 +428,12 @@ namespace diff{
|
|||
// standard copy operations acceptable
|
||||
|
||||
|
||||
explicit
|
||||
operator bool() const
|
||||
{
|
||||
return bool(record_);
|
||||
}
|
||||
|
||||
/** target is accessed by cast
|
||||
* @throws error::Logic on bottom reference
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ namespace test{
|
|||
RecordRef<string> empty;
|
||||
CHECK (bool(empty) == false);
|
||||
CHECK (nullptr == empty.get());
|
||||
VERIFY_ERROR (BOTTOM_VALUE, RecS& (empty));
|
||||
VERIFY_ERROR (BOTTOM_VALUE, empty.operator RecS&() );
|
||||
|
||||
RecordRef<string> ref(oo);
|
||||
CHECK (ref);
|
||||
|
|
|
|||
Loading…
Reference in a new issue