Constrained Templates and Concepts

Ivor Horton,Peter Van Weert

Beginning C++20(2020)

引用 0|浏览0
暂无评分
摘要
Templates define parameterized families of C++ entities such as functions (Chapter 10 ) or class types (Chapter 17 ). In practice, templates are mostly parameterized on seemingly arbitrary types. Yet most templates cannot be instantiated for just any type; at least not without error. The binary std::max<>() function template, for instance, can only be instantiated for types that support the < operator. And the std::vector<> and std::optional<> class templates may not be instantiated for reference types, void, or array types. Most of your own templates have similar restrictions as well, whether you realized it or not.
更多
查看译文
关键词
constrained templates,concepts
AI 理解论文
溯源树
样例
生成溯源树,研究论文发展脉络
Chat Paper
正在生成论文摘要