Summary

This has been a heavy chapter. We've covered the basics of templates in D, such as how to declare them, and have seen the different types of templates and template parameters available. We then got a little more advanced with template specializations, template constraints, template mixins, and variadic templates with tuples. After that we saw how to implement operator overloading for user-defined types and closed out with some additions to MovieMan.

In the next chapter, we're going to begin the final stretch of the language feature discussion. We'll dig into ranges—what they are, how to create them, and the basics of using them—in preparation for putting them to good use with functional pipelines in the subsequent chapter.

Get Learning 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.