In C++ I'm messing with the boost library, and I have the "boost\" directory with all of the boost .hpp files and directories and such in my compiler's include folder at "MinGW\include\boost\". Now what confuses me is that when I want to use the file "lambda.hpp" I have to actually type:
#include <boost/lambda/lambda.hpp>
but if I'm including an entire directory such as "boost\algorithm\" I only have to type:
#include <algorithm>
even though the "algorithm" folder is not in the directory "MinGW\include", it's in "MinGW\include\boost\". Why don't I need to give a full path when including whole directories as opposed to individual header files?
The header file <algorithm>
is part of the standard library, not of Boost.
The paths are relative to a list of paths the pre-processor searches for header files. So in the case of <algorithm>
there is a file algorithm
in the root of one of those paths, while in the case of <boost/lambda/lambda.hpp>
there is another search path that have a subfolder boost
which has a subfolder lambda
which has a file lambda.hpp
.
By the way, all Boost header files have the suffix (i.e. extension) .hpp
while the standard library header file has none at all.
As for thinking you include the complete directory algorithm
, the pre-processor doesn't have support for that, instead you have to include the files in the path boost/algorithm
separately.