I have a class with a parameterized type that I want to do comparison operators on. I assmue I need to use the Ordered trait to achieve this but the compiler doesn\'t like my us
This occurs because Int
is not a subclass of Ordered[Int]
(see here why).
However, there is an implicit coercion from Int
to RichInt
which is a subclass of Ordered[Int]
, but it isn't triggered for lower bounds. Use <%
(view bounds) instead which will consider implicit coercions:
class Test[T <% Ordered[T]]