cplusplus.co.il

Archive for December 2010

Generic programming is very common and has different names (and features) in various programming languages; C++ provides Turing-Complete Templates, Java offers Generics (along with Ada, Eiffel, C#, and Visual Basic .Net), and Parametric Polymorphism is present in ML, Scala, and Haskell.

While I am generally pretty happy with what C++ has to offer, adopting some of the features offered by other mechanisms can come in handy sometimes. To be more specific, in this post we will mimic Java’s support for defining an upper bound for generic elements (i.e. List<T extends Comparable>).

Read the rest of this entry »


Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 27 other subscribers

Categories