There are some utilities that just don't constitute a library in their own right, and are therefore grouped together with other entities. This is what Boost.Utility is, a collection of useful tools with no better home. They are useful enough to warrant inclusion in Boost, yet they are too small to deserve their own library. This chapter covers some of Boost.Utility's most fundamental and widely applicable tools. We'll start with BOOST_STATIC_ASSERT, a facility for asserting integral constant expressions at compile time. Then, we'll see what happens when you delete an object through a pointer to an incomplete typethat is, when the layout of the object being destroyed is unknown. checked_delete makes that discussion more interesting. We'll also see how noncopyable prevents a class from ever being copied, which is arguably the most important topic of this chapter. Then, we'll check out addressof, which defeats the ill doings of menacing programmers[1] who overload operator&. Finally, we shall examine enable_if, which is really useful for controlling whether function overloads and template specializations are considered during name lookup or not.
|