Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ standard header files

Tags:

c++

Accelerated C++: Practical Programming by Example book says the following..

... 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

What exactly does this mean? If not as a file how else can a system header file be implemented?

like image 939
Manohar Avatar asked Dec 09 '22 06:12

Manohar


1 Answers

Imagine you write your own compiler and C++ standard library. You could make it so that #include <vector> does not open any file, but instead simply loads some state into the compiler which makes it understand std::vector. You could then implement your vector class in some language other than C++, so long as your compiler understands enough to make it work "as if" you had written an actual C++ source file called vector.

like image 156
John Zwinck Avatar answered Dec 10 '22 20:12

John Zwinck