The default method of vec_proxy_compare()
assumes that all classes built
on top of atomic vectors or records are comparable. Internally the default
calls vec_proxy_equal()
. If your class is not comparable, you will need
to provide a vec_proxy_compare()
method that throws an error.
The behavior of vec_proxy_order()
is identical to vec_proxy_compare()
,
with the exception of lists. Lists are not comparable, as comparing
elements of different types is undefined. However, to allow ordering of
data frames containing list-columns, the ordering proxy of a list is
generated as an integer vector that can be used to order list elements
by first appearance.
If a class implements a vec_proxy_compare()
method, it usually doesn't need
to provide a vec_proxy_order()
method, because the latter is implemented
by forwarding to vec_proxy_compare()
by default. Classes inheriting from
list are an exception: due to the default vec_proxy_order()
implementation,
vec_proxy_compare()
and vec_proxy_order()
should be provided for such
classes (with identical implementations) to avoid mismatches between
comparison and sorting.