wiki:TCT/BoostUsageProposal
Last modified 3 years ago Last modified on 04/27/2016 01:52:48 PM

Proposal for the use of Boost libraries

Accepted by the TCT on 1 Feb 2012

The canonical version of this page is now at http://developer.lsst.io/en/latest/coding/using_boost.html.

This proposal updates the Boost usage policy. It changes it from a list of specific pre-approved libraries and headers to a more general categorization with specific examples. Only a few libraries are banned, although a large number should only be used after design review.

New text

Certain Boost libraries are recommended; they should be used whenever applicable in preference to any other method of accomplishing the same effect. In general, any library that is tagged with "Standard .... {something}" in the Boost library listing at http://www.boost.org/doc/libs/ falls into this category, unless the feature is already supported by the currently-mandated LSST g++ version. Among others, this category includes:

  • current_function
  • format
  • regex (until we adopt gcc 4.9 as our minimum compiler version, at which point use std::regex)
  • test

Libraries that were accepted before we switched to C++11 (in particular made gcc 4.8 our minimum supported compiler), but have been or are being replaced by std:: equivalents include:

  • array: use std::array from <array>
  • cstdint: use <cstdint>
  • filesystem: use <filesystem>
  • noncopyable: use = delete on the copy constructor and assignment operator
  • smart_ptr: use std::shared_ptr and std::unique_ptr from <memory> instead of boost::shared_ptr and boost::scoped_ptr
  • static_assert: use static_assert
  • type_traits: use <type_traits>
  • unordered_map: use std::unordered_map from <unordered_map>

Additional Boost libraries are considered safe; they may be used freely where applicable.

  • any
  • GIL
  • iterator
  • MPI
  • multi_index
  • numeric
  • tokenizer
  • variant

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 (is not listed on the above page as "Build & Link .... Header-only"). Among others, the following libraries fall into the extra-caution category:

  • Fusion
  • MPL
  • 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