- Mastering the C++17 STL
- Arthur O'Dwyer
- 177字
- 2021-07-08 10:20:19
Classical Polymorphism and Generic Programming
The C++ standard library has two distinct, yet equally important, missions. One of these missions is to provide rock-solid implementations of certain concrete data types or functions that have tended to be useful in many different programs, yet aren't built into the core language syntax. This is why the standard library contains std::string, std::regex, std::filesystem::exists, and so on. The other mission of the standard library is to provide rock-solid implementations of widely used abstract algorithms such as sorting, searching, reversing, collating, and so on. In this first chapter, we will nail down exactly what we mean when we say that a particular piece of code is "abstract," and describe the two approaches that the standard library uses to provide abstraction: classical polymorphism and generic programming.
We will look at the following topics in this chapter:
- Concrete (monomorphic) functions, whose behavior is not parameterizable
- Classical polymorphism by means of base classes, virtual member functions, and inheritance
- Generic programming by means of concepts, requirements, and models
- The practical advantages and disadvantages of each approach
- Vue.js設(shè)計(jì)與實(shí)現(xiàn)
- 信息可視化的藝術(shù):信息可視化在英國
- Java Web程序設(shè)計(jì)
- Learning Neo4j 3.x(Second Edition)
- Learning Python Design Patterns(Second Edition)
- C++反匯編與逆向分析技術(shù)揭秘(第2版)
- Python 3.7從入門到精通(視頻教學(xué)版)
- OpenStack Networking Essentials
- Django 3.0應(yīng)用開發(fā)詳解
- SQL Server 2016 從入門到實(shí)戰(zhàn)(視頻教學(xué)版)
- SQL Server實(shí)例教程(2008版)
- 趣學(xué)數(shù)據(jù)結(jié)構(gòu)
- Learning Google Apps Script
- Unity與C++網(wǎng)絡(luò)游戲開發(fā)實(shí)戰(zhàn):基于VR、AI與分布式架構(gòu)
- Learning Swift