Function sparse_interp::refpow[][src]

pub fn refpow<T>(base: &T, exp: usize) -> T where
    T: Clone + One + Mul<Output = T> + MulAssign

Computes base^exp, where the base is a reference and not an owned value.

The number of clones is kept to a minimum. This is useful when objects of type T are large and copying them is expensive.

let x = 10u128;
assert_eq!(refpow(&x, 11), 100000000000u128)

see also: https://docs.rs/num-traits/0.2.14/src/num_traits/pow.rs.html#189-211