Using Boost¶
Note
Changes to this document must be approved by the System Architect (RFC-24). To request changes to these policies, please file an RFC.
A Boost library may be used only if:
the desired effect cannot be accomplished with a C++17 standard language feature, and
a C++ standard library equivalent is either unavailable or unusable with our minimum required compiler version.
In particular, the following Boost libraries are no longer accepted as they have standard equivalents in gcc 6.3.1 and above:
any
use
<any>
array
use
<array>
bind
prefer C++14 lambda functions instead, but use
std::bind
from<functional>
if you mustcstdint
use
<cstdint>
filesystem
use
<filesystem>
lambda
use C++14 lambda functions
lexical_cast
use
std::to_string
,std::stoi
,std::stod
etc.math
use
<cmath>
wherever possiblenoncopyable
use
= delete
on the copy constructor and assignment operatorrandom
use
<random>
ref
use
std::forward
and universal / forwarding references (orstd::ref
if you must)smart_ptr
use
std::shared_ptr
andstd::unique_ptr
(and its array specialization) from<memory>
instead ofboost::shared_ptr
,boost::scoped_ptr
andboost::scoped_array
static_assert
use C++14
static_assert
tuple
use
<tuple>
type_traits
use
<type_traits>
unordered_map
use
<unordered_map>
variant
use
<variant>
Certain Boost libraries are recommended: they should be used whenever applicable in preference to any other method of accomplishing the same effect. Among others, this category includes:
current_function
format
test
Additional Boost libraries are considered safe: they may be used freely where applicable.
GIL
iterator
MPI
multi_index
numeric
tokenizer
Most other Boost libraries may be used after appropriate design review. Particular caution should be used when the library involves substantial template metaprogramming or requires linking. Among others, the following libraries fall into the extra-caution category:
Fusion
MPL
regex
serialization
Certain Boost libraries conflict with LSST-standard ways of doing things, are inappropriate for LSST code, are insufficiently developed or well-maintained, or have been found to be excessively complicated. These are not allowed without special permission.
config
preprocessor
python
throw_exception