...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This section explains how to setup a system to use this library.
Programmers should have enough knowledge to use this library after reading the Introduction, Getting Started, and Tutorial sections. The Reference section can be consulted at a later point for quick reference. All the other sections of this documentation can be considered optional.
Some footnotes are marked by the word "Rationale". They explain reasons behind decisions made during the design and implementation of this library.
In most of the examples presented in this documentation, the Boost.Detail/LightweightTest
(boost/detail/lightweight_test.hpp
) macro BOOST_TEST
is used to check correctness
conditions. The BOOST_TEST
macro is conceptually similar to assert
but a failure of the checked condition does not abort the program, instead
it makes boost::report_errors
return a non-zero program
exit code. [2]
The authors originally developed and tested the library on GNU Compiler Collection
(GCC) C++ 3.3, 3.4, 4.1, 4.2, 4.5.3 (with and without C++11 features -std=c++0x
),
Microsoft Visual C++ (MSVC) 8.0, and Intel 10.1 under Linux, Cygwin, and
Windows 7. However, this library should be usable on any compiler that supports
Boost.Typeof except:
See the library regression
test results for detailed information on supported compilers and
platforms. Check the library regression test Jamfile.v2
for any special configuration that might be required for a specific compiler.
This library is composed of header files only. Therefore there is no pre-compiled
object file which needs to be installed. Programmers can simply instruct
the compiler where to find the library header files (-I
option on GCC, /I
option on MSVC, etc) and compile code
using the library.
The library implementation uses Boost.Typeof
to automatically deduce the types of the Boost.ScopeExit
captured variables (see the Tutorial
section). In order to compile code in type-of
emulation mode, all types should be properly registered using BOOST_TYPEOF_REGISTER_TYPE
and BOOST_TYPEOF_REGISTER_TEMPLATE
, or appropriate
Boost.Typeof headers
should be included (see the source code of most examples presented in this
documentation).
[2] Rationale. Using Boost.Detail/LightweightTest allows to add the examples to the library regression tests so to make sure that they always compile and run correctly.