Value expression sequences are now comparable
Fixes #228 / ED9388D7-E523-40EB-841B-9AE9BAA70329
This commit is contained in:
parent
63c7ba0322
commit
16f799767c
3 changed files with 32 additions and 10 deletions
|
|
@ -226,16 +226,12 @@ class sort_posts : public item_handler<post_t>
|
|||
|
||||
public:
|
||||
sort_posts(post_handler_ptr handler, const expr_t& _sort_order)
|
||||
: item_handler<post_t>(handler),
|
||||
sort_order(_sort_order) {
|
||||
TRACE_CTOR(sort_posts,
|
||||
"post_handler_ptr, const value_expr&");
|
||||
: item_handler<post_t>(handler), sort_order(_sort_order) {
|
||||
TRACE_CTOR(sort_posts, "post_handler_ptr, const value_expr&");
|
||||
}
|
||||
sort_posts(post_handler_ptr handler, const string& _sort_order)
|
||||
: item_handler<post_t>(handler),
|
||||
sort_order(_sort_order) {
|
||||
TRACE_CTOR(sort_posts,
|
||||
"post_handler_ptr, const string&");
|
||||
: item_handler<post_t>(handler), sort_order(_sort_order) {
|
||||
TRACE_CTOR(sort_posts, "post_handler_ptr, const string&");
|
||||
}
|
||||
virtual ~sort_posts() {
|
||||
TRACE_DTOR(sort_posts);
|
||||
|
|
|
|||
28
src/value.cc
28
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -878,7 +878,6 @@ public:
|
|||
sequence_t::iterator begin() {
|
||||
return as_sequence_lval().begin();
|
||||
}
|
||||
|
||||
sequence_t::iterator end() {
|
||||
return as_sequence_lval().end();
|
||||
}
|
||||
|
|
@ -886,7 +885,6 @@ public:
|
|||
sequence_t::const_iterator begin() const {
|
||||
return as_sequence().begin();
|
||||
}
|
||||
|
||||
sequence_t::const_iterator end() const {
|
||||
return as_sequence().end();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue