Hi all, I am trying to learn templates but i coudnt get the idea of templates easily. My aim is to mimic the cast function. Please look this -- template Cast(tp : typed, value : typed) = cast[tp](value) # Failed template Cast[T](tp : T, value : typed) = cast[tp](value) # Failed template Cast(tp : [T], value : typed) = cast[tp](value) # Failed Run
All i want to tell the compiler is - template Cast( tp : is_a_generic_type, value : any_typed_value) = cast[ _generic_type](typed_value) Run How to do it ? Any help ?