On Sat, Nov 16, 2013 at 11:08:01AM +0200, Tommi wrote:
> On 2013-11-16, at 1:37, Tommi Tissari <[email protected]> wrote:
> 
> > But shouldn't the signature be:
> > fn cmp<T>(x: &[T], y: &[T]) -> bool
> 
> Oh, wait I think I know what the answer to that question is going to be. The 
> comparison trait requires the signature to be (&self, &Self) and since the 
> pointer sigils seems to be part of the type in this language, the type Self 
> is ~[T] and the signature has to be (&~[T], &~[T]).

Yes, that is the point. The type *being compared* is `~[T]`, and the
comparison trait is generic and just prepends a `&` to whatever type
is being compared.


Niko
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to