Beyond the C++ Standard Library: An Introduction to Boost [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Beyond the C++ Standard Library: An Introduction to Boost [Electronic resources] - نسخه متنی

Bjorn Karlsson

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید

How Does the Utility Library Improve Your Programs?


Compile time assertions with BOOST_STATIC_ASSERT

Safe destruction with checked_delete and checked_array_delete

Prohibition of copying with noncopyable

Retrieval of object addresses when operator& is overloaded through addressof

Controlled participation of overloads and specializations with enable_if and disable_if

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.

[1] If you feel that I'm out of line here, please send me your most compelling use cases for overloading operator&.

/ 124