Generics are not really the statically typed answer to duck-typing. Subtyping with structural types, such as in TypeScript, is.
Those templates can be used to do something like generics, but they are also basically duck typing at compile time.
In Haskell terms, C++'s generics are like typeclass-instances without typeclasses themselves. (I think in Java terms they would be similar to not providing interfaces. But I don't know enough about Java to see whether that's actually true.)