From 16f799767ce86731f67735e9a59bde5faa4cf645 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 5 Jun 2010 03:22:02 -0400 Subject: Value expression sequences are now comparable Fixes #228 / ED9388D7-E523-40EB-841B-9AE9BAA70329 --- src/value.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/value.cc') diff --git a/src/value.cc b/src/value.cc index a967eeb8..e9313f0c 100644 --- a/src/value.cc +++ b/src/value.cc @@ -935,6 +935,20 @@ bool value_t::is_less_than(const value_t& val) const } return ! no_amounts; } + case SEQUENCE: { + sequence_t::const_iterator i = as_sequence().begin(); + sequence_t::const_iterator j = val.as_sequence().begin(); + for (; (i != as_sequence().end() && + j != val.as_sequence().end()); i++, j++) { + if (! ((*i) < (*j))) + return false; + } + if (i == as_sequence().end()) + return true; + else + return false; + break; + } default: break; } @@ -1041,6 +1055,20 @@ bool value_t::is_greater_than(const value_t& val) const } return ! no_amounts; } + case SEQUENCE: { + sequence_t::const_iterator i = as_sequence().begin(); + sequence_t::const_iterator j = val.as_sequence().begin(); + for (; (i != as_sequence().end() && + j != val.as_sequence().end()); i++, j++) { + if (! ((*i) > (*j))) + return false; + } + if (i == as_sequence().end()) + return false; + else + return true; + break; + } default: break; } -- cgit v1.2.3