Why are include directives on top of header files?
===

I was once told in a programming class that C++ had achieved a better readability by letting the programmer declare its variable anywhere in a function block. This way, the variables were grouped together with the section of the code that dealt with it.

Why don’t we do the same for includes?
Put differently, why is it discouraged to put the include file next to the definition that will actually use it?


    parser::parser()
    {
      // some initialization goes there which does not make use of regex
    }
    
    #include <boost/regex.hpp>
    parser::start()
    {
      // here we need to use boost regex to parse the document
    }