mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Variant
- Updated operator< to handle trivial values.
This commit is contained in:
parent
8e16a3e0e4
commit
7484b5a22f
1 changed files with 20 additions and 6 deletions
|
@ -296,11 +296,25 @@ bool Variant::operator< (const Variant& other) const
|
|||
}
|
||||
else
|
||||
{
|
||||
if (left.trivial () || right.trivial ())
|
||||
return false;
|
||||
|
||||
return left._string < right._string;
|
||||
}
|
||||
|
||||
case type_date: left.cast (type_date); return left._date < right._date;
|
||||
case type_duration: left.cast (type_duration); return left._duration < right._duration;
|
||||
case type_date:
|
||||
if (left.trivial () || right.trivial ())
|
||||
return false;
|
||||
|
||||
left.cast (type_date);
|
||||
return left._date < right._date;
|
||||
|
||||
case type_duration:
|
||||
if (left.trivial () || right.trivial ())
|
||||
return false;
|
||||
|
||||
left.cast (type_duration);
|
||||
return left._duration < right._duration;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -316,10 +330,10 @@ bool Variant::operator< (const Variant& other) const
|
|||
case type_string:
|
||||
case type_date:
|
||||
case type_duration:
|
||||
right.cast (type_date);
|
||||
if (left._date == 0 || right._date == 0)
|
||||
if (left.trivial () || right.trivial ())
|
||||
return false;
|
||||
|
||||
right.cast (type_date);
|
||||
return left._date < right._date;
|
||||
}
|
||||
break;
|
||||
|
@ -336,10 +350,10 @@ bool Variant::operator< (const Variant& other) const
|
|||
case type_string:
|
||||
case type_date:
|
||||
case type_duration:
|
||||
right.cast (type_duration);
|
||||
if (left._duration == 0 || right._duration == 0)
|
||||
if (left.trivial () || right.trivial ())
|
||||
return false;
|
||||
|
||||
right.cast (type_duration);
|
||||
return left._duration < right._duration;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue