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
|
else
|
||||||
{
|
{
|
||||||
|
if (left.trivial () || right.trivial ())
|
||||||
|
return false;
|
||||||
|
|
||||||
return left._string < right._string;
|
return left._string < right._string;
|
||||||
}
|
}
|
||||||
|
|
||||||
case type_date: left.cast (type_date); return left._date < right._date;
|
case type_date:
|
||||||
case type_duration: left.cast (type_duration); return left._duration < right._duration;
|
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;
|
break;
|
||||||
|
|
||||||
|
@ -316,10 +330,10 @@ bool Variant::operator< (const Variant& other) const
|
||||||
case type_string:
|
case type_string:
|
||||||
case type_date:
|
case type_date:
|
||||||
case type_duration:
|
case type_duration:
|
||||||
right.cast (type_date);
|
if (left.trivial () || right.trivial ())
|
||||||
if (left._date == 0 || right._date == 0)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
right.cast (type_date);
|
||||||
return left._date < right._date;
|
return left._date < right._date;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -336,10 +350,10 @@ bool Variant::operator< (const Variant& other) const
|
||||||
case type_string:
|
case type_string:
|
||||||
case type_date:
|
case type_date:
|
||||||
case type_duration:
|
case type_duration:
|
||||||
right.cast (type_duration);
|
if (left.trivial () || right.trivial ())
|
||||||
if (left._duration == 0 || right._duration == 0)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
right.cast (type_duration);
|
||||||
return left._duration < right._duration;
|
return left._duration < right._duration;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue