-
Notifications
You must be signed in to change notification settings - Fork 165
Include Directives Order
Mateusz Łoskot edited this page Jan 8, 2020
·
5 revisions
The CONTRIBUTING guide recommends to make sure that headers are self-contained, i.e. that they include all headers they need. In other words, no header should (implicitly) rely on other headers to include some other header it requires.
One technique that helps to ensure a header is as self-contained as possible is to group include directives from specific to general and, for readability, order alphabetically within each group.
#include <boost/gil/extension/*.hpp>
#include <boost/gil/*.hpp>
#include <boost/*.hpp>
- C++ standard library headers
- Other third-party and system headers
-
#include "unit_test.hpp"
#ifndef BOOST_TEST_MODULE #define BOOST_TEST_MODULE test_xxx #endif #include "unit_test.hpp"
#include <boost/gil/*.hpp>
#include <boost/*.hpp>
- C++ standard library headers
- Other third-party and system headers
-
#include "test_fixture.hpp"
and other local headers
#include <boost/gil/*.hpp>
#include <boost/*.hpp>
- C++ standard library headers
- Other third-party and system headers
-
#include "xxx.hpp"
for directory local headers