Hi,
I am turning my whole library into a generic-type-based one. But I have some trouble.
For example, The present-form is like this:
fn foo(a:i32, b:i32) -> i32 {
let mut bar: i32 = 1;
for _ in 0..10 {
bar = bar + a + b;
}
bar
}
But, when I'm going to convert this form into generic one, I do this:
fn foo<T: /* some traits */> (a:T, b:T) -> T {
let mut bar: T = 1;
for _ in 0..10 {
bar = bar + a + b;
}
bar
}
Easy to see, this is the wrong code, but how to deal with adding (or subbing, etc.) between generic types and const?
Thank you!