C++泛型编程与STL技术详解

需积分: 9 0 下载量 184 浏览量 更新于2024-02-02 收藏 16.49MB PDF 举报
Summary: The "C Advanced Programming.pdf" focuses on the concepts of generic programming and STL technology in C programming. It explores the deeper usage of C through templates, specifically function templates. Templates in C are like generic molds that greatly improve reusability. They can be compared to templates in real life, such as photo templates or PPT templates. However, templates cannot be directly used, they are just frameworks. Function templates in C provide a mechanism for creating generic functions, where the return type and parameter types can be represented by a virtual type. The syntax for function templates includes using the "template" keyword, followed by the "typename" keyword to specify a data type, and using a generic type name like "T" to represent the generic data type. In the example provided, a function template for swapping integers is shown.
2023-04-04 上传