Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the master branch, built from commit 064f557086.
PrevUpHomeNext

Cancellation slot requirements

A type X meets the CancellationSlot requirements if it satisfies the requirements of CopyConstructible (C++Std [copyconstructible]) and Destructible (C++Std [destructible]), as well as the additional requirements listed below.

In the table below, x1 and x2 denote (possibly const) values of type X, mx1 denotes an xvalue of type X, H denotes a type that satisfies CancellationHandler, h denotes an xvalue of type H, and u0 to uN denote identifiers.

Table 8. CancellationSlot requirements

expression

type

assertion/note
pre/post-conditions

X u(x1);

Shall not exit via an exception.

post: u == x1.

X u(mx1);

Shall not exit via an exception.

post: u equals the prior value of mx1.

x1 == x2

bool

Returns true only if x1 and x2 can be interchanged with identical effects.
operator== shall be reflexive, symmetric, and transitive, and shall not exit via an exception.

x1 != x2

bool

Same as !(x1 == x2).

x1.is_connected()

bool

Returns false only if the slot can never cause the invocation of a handler attached to the slot using assign or emplace.

x1.has_handler()

bool

Returns true if a handler has been attached to the slot.

x1.assign(h)

H&

Destroys the existing handler that is attached to the slot, if any, and attaches a move-constructed decay-copy of the handler h.

Returns a reference to the newly attached handler.

post: x1.has_handler() == true.

x1.emplace<H>(u0, ..., uN)

H&

Requires that is_constructible<H, decltype(u0), ..., decltype(u0)>::value be true.

Destroys the existing handler that is attached to the slot, if any, and attaches a handler of type H constructed with the specified arguments u0, ..., uN.

Returns a reference to the newly attached handler.

post: x1.has_handler() == true.

x1.clear()

Post: x1.has_handler() == false.



PrevUpHomeNext