Hi,

I'm not sure it is an defect or failure to fully understand from my side. I'd 
like to sort an array. Unfortunately, it is not easy to understand which sort 
function should be used, but looks like quick_sort3 is good enough. 

Than:

  1 extern mod std;
  2 use std::sort::*;
  3 
  4 fn foo_generic<T>(data : &[T]) {
  5     let part = data.slice(0, data.len()/2);
  6     quick_sort3(part);                                                      
                                                            
  7     io::println(part.to_str());
  8 }
  9 
 10 fn foo(data : &[int]) {
 11     let mut part = data.slice(0, data.len()/2);
 12     quick_sort3(part);
 13     io::println(part.to_str());
 14 }
 15 fn main() {
 16     let data = ~[1, 3, 5, 2, 4, 6];
 17     foo(data);
 18     foo_generic(data);
 19 }


test.rs:6:4: 6:15 error: failed to find an implementation of trait 
@core::cmp::Ord for <V13>
test.rs:6     quick_sort3(part);
              ^~~~~~~~~~~

Is the foo_generic correct function?

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

Reply via email to