Would I write a function or class that takes ints and another just like it except it takes strings and another except it takes doubles? That doesn’t sound lazy! This chapter enables us to write it once, using templates.
20. Templates
Get C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners 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.