My understand is in generic programming you can have multiple containers, which use iterators but use the same algorithm. Wouldn't template be considered a ADT? Really confused.

Abstraction is the process of generalization: taking a concrete implementation and making it applicable to different, albeit somewhat related, types of data. The classical example of abstraction is C's qsort function which sorts data.

The thing about qsort is that it doesn't care about the data it sorts – in fact, it doesn't know what data it sorts. The important point is that the implementation of qsort always stays the same, regardless of data type. The only thing that has to change is the compare function, which differs from data type to data type. qsort therefore expects the user to provide said compare function as a function argument. Generic programming : Text from WiKi

Generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters.

The Generic Programming process focuses on finding commonality among similar implementations of the same algorithm, then providing suitable abstractions so that a single, generic algorithm can cover many concrete implementations.

Edited 7 Years Ago by __avd: n/a

This question has already been answered. Start a new discussion instead.