Chapter 5. Templates

Like many modern programming languages, D supports the use of generic programming to simplify coding. This is done using templates, and as you'll learn in this chapter, both type and function templates are supported. Additionally, this chapter covers template specialization, template metaprogramming, and compile-time function evaluation.

The Problem of Insufficient Information

In a statically typed language like D, object-oriented programming is a means of abstraction based on certain predefined characteristics. As you learned in Chapter 3, a set of characteristics common to a particular concept are specified in an interface, and a function written to operate on an interface is then able to manipulate any number of different ...

Get Learn to Tango with D now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.