use std::ptr;
use std::ops::*;
use num::PartialOrd;
pub trait Array where
Self: Index<usize, Output = <Self as Array>::Element>,
Self: IndexMut<usize, Output = <Self as Array>::Element>,
{
type Element: Copy;
#[inline]
fn as_ptr(&self) -> *const Self::Element {
&self[0]
}
#[inline]
fn as_mut_ptr(&mut self) -> *mut Self::Element {
&mut self[0]
}
#[inline]
fn swap_elements(&mut self, i: usize, j: usize) {
unsafe { ptr::swap(&mut self[i], &mut self[j]) };
}
fn sum(self) -> Self::Element where Self::Element: Add<Output = <Self as Array>::Element>;
fn product(self) -> Self::Element where Self::Element: Mul<Output = <Self as Array>::Element>;
fn min(self) -> Self::Element where Self::Element: PartialOrd;
fn max(self) -> Self::Element where Self::Element: PartialOrd;
}