...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Header files are the place where a library comes into contact with user code and other libraries. To co-exist peacefully and productively, headers must be "good neighbors".
Here are the standards for boost headers. Many of these are also reasonable guidelines for general use.
// Boost general library furball.hpp header file ---------------------------// < Copyright and license notice, as indicated in the license page > // See http://www.boost.org/ for latest version. #ifndef BOOST_FURBALL_HPP #define BOOST_FURBALL_HPP namespace boost { // Furball class declaration -----------------------------------------------// class furball { public: void throw_up(); private: int whatever; }; // furball } // namespace #endif // include guard
The alert reader will have noticed that the sample header employs a certain coding style for indentation, positioning braces, commenting ending braces, and similar formatting issues. These stylistic issues are viewed as personal preferences and are not part of the Boost Header Policy.
Revised 02 October, 2003
© Copyright Beman Dawes 1998
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)