C++标准头文件

标签 c++

Accelerated C++: Practical Programming by Example书上说了以下..

... system header files need not be implemented as files. Even though the #include directive is used to access both our own header files and system headers, there is no requirement that they be implemented in the same way

这到底是什么意思?如果不是作为文件,系统头文件还能如何实现?

最佳答案

假设您编写自己的编译器和 C++ 标准库。你可以做到 #include <vector>不打开任何文件,而是简单地将一些状态加载到编译器中,使其理解 std::vector .然后,您可以用 C++ 以外的某种语言实现您的 vector 类,只要您的编译器足够理解使其工作“就像”您编写了一个名为 vector 的实际 C++ 源文件一样。 .

关于C++标准头文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25966971/

相关文章:

C++ 在类中声明数组并在类中声明二维数组

python - 如何制作启动Python脚本的Linux后台进程(在C中)

c++ - JNI 调用 c++ dll 发生 'UnsatisfiedLinkError: Invalid access to memory location'

c++ vector 的预期主表达式错误

c++ - 在 Vista 上调用 RPC 调用时为 "operation is not supported"

c++ - 什么是域错误

c++ - 我无法弄清楚如何在不使用 C++ 中的 climits 的情况下计算最大和最小有符号数

c++ - 多个 %lu 来格式化 ULONG64

c++ - 代码中void(*)()是什么意思

c++ - 应用程序连接到数据库