Boost logo

Boost :

Subject: Re: [boost] Header Inclusion practices
From: Robert Ramey (ramey_at_[hidden])
Date: 2017-04-12 15:38:07

On 4/12/17 12:09 AM, Olaf van der Spek via Boost wrote:
> On Tue, Apr 11, 2017 at 7:55 PM, Robert Ramey via Boost
> <boost_at_[hidden]> wrote:
>> a) use #include "header.hpp" for files in the same directory as the current
>> source file.
>> b) use #include "other directory/header.hpp" for files which are known to be
>> in a specific place relative to the current file. This shows up in things
>> like: #include "../include/header.hpp" for tests and examples.
> I'm not sure about #include " " in library code.. especially not
> #include "../ " as it breaks when you move the file.
>> #include "../include/cpp.hpp"
>> #include "../include/exception.hpp"
>> #include "../include/safe_integer.hpp"
>> #include "../include/safe_range.hpp"
> This too breaks when you move the example / test .cpp.
> The names are too generic as well, is a normal user supposed to do
> #include <exception.hpp>? Your lib might not be the only one with an
> exception.hpp file..
Hmmm, I'm not seeing this. Actually my motivation is to not avoid
breaking things when files are moved. When the library is moved the
tests still build and run without having to change switches,
environmental variables etc.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at