I've learned C++ for some time now, and I've nearly finished my sensei test in the language. Rummaging through my stuff today, I found some papers from the "C++ without Fear" book, where it gave a brief note about preprocessor directives and #include :
If you’re new to C++, just remember you have to use #include to turn on
support for specific parts of the C++ standard library. Later, when we start
using math functions such as sqrt (square root), you’ll need to switch on
support for the math library:
#include <cmath>
Is this extra work? A little, yes. Include files originated because of a dis-
tinction between the C language and the standard runtime library. (Profes-
sional C/C++ programmers sometimes avoid the standard library and use
their own.)
Let us concentrate on
Professional C/C++ programmers sometimes avoid the standard library and use
their own.
Firstly, why would someone avoid things that professional programmers already set for him? And I think I would use my own library as a learning experience and some fun... So some pointers on how? Will I have to know some more C++: istream,ostream etc.?
Let us concentrate on
Professional C/C++ programmers sometimes avoid the standard library and use their own.
That is a profoundly false statement.
The grain of truth is that *some* components of the standard library may not be fitting the requirements of a project, in which case a programmer may have to write a library that does what they need.
For example, Facebook wrote their own version of std::vector because they wanted to take advantage of "relocatable types and jemalloc" (that is, they don't want to even call a move constructor when resizing a vector, if the object can survive memcpy, and their allocator can expand memory blocks in-place, so they make use of that too)
Well, thanks for that, so what is C++ with no STL? Can I write a functional program without using the STL? Is the STL just a wrapper over actual C++? How can I make my own STL (calling it the Simple Template Library[STL] ;) )? How is it most C++ programmers only know the STL, and barely know what's underneath it (ostream, istream)?
Most of the C++ Standard Library (not related to the STL, but borrows heavily from it) is just regular C++. There are only a few parts which cannot be implemented in C++ that require work on the compiler's end or which require you to directly interface with the operating system.
How is it most C++ programmers only know the STL, and barely know what's underneath it (ostream, istream)?
You'll have to clarify what you mean by "STL", since the infuential 1992 library known by that name was abandoned in 2000 or 2001, and had nothing to do with the I/O streams. The C++ standard makes no mention of STL or of anything called 'standard template library'.