C++ Actor Framework 0.19
No Matches
Classes | Public Member Functions | Static Public Member Functions | Related Symbols | List of all members
caf::disposable Class Reference

Represents a disposable resource. More...

#include <disposable.hpp>

Inheritance diagram for caf::disposable:
caf::detail::comparable< disposable >


class  impl
 Internal implementation class of a disposable. More...

Public Member Functions

 disposable (intrusive_ptr< impl > pimpl) noexcept
 disposable (disposable &&) noexcept=default
 disposable (const disposable &) noexcept=default
disposableoperator= (disposable &&) noexcept=default
disposableoperator= (const disposable &) noexcept=default
disposableoperator= (std::nullptr_t) noexcept
void dispose ()
 Disposes the resource.
void swap (disposable &other)
 Exchanges the content of this handle with other.
bool disposed () const noexcept
 Returns whether the resource has been disposed.
bool valid () const noexcept
 Returns whether this handle still points to a resource.
 operator bool () const noexcept
 Returns valid();.
bool operator! () const noexcept
 Returns !valid();.
implptr () const noexcept
 Returns a pointer to the implementation.
intrusive_ptr< impl > && as_intrusive_ptr () &&noexcept
 Returns a smart pointer to the implementation.
intrusive_ptr< implas_intrusive_ptr () const &noexcept
 Returns a smart pointer to the implementation.
intptr_t compare (const disposable &other) const noexcept
 Compares the internal pointers.

Static Public Member Functions

static disposable make_composite (std::vector< disposable > entries)
 Combines multiple disposables into a single disposable.
static disposable make_flag ()
 Creates a disposable that simply represents a flag.
static size_t erase_disposed (std::vector< disposable > &xs)
 Erases each x from xs where x.disposed().

Related Symbols

(Note that these are not member symbols.)

using disposable_impl = disposable::impl

Detailed Description

Represents a disposable resource.

Member Function Documentation

◆ dispose()

void caf::disposable::dispose ( )

Disposes the resource.

Calling dispose() on a disposed resource is a no-op.

◆ erase_disposed()

size_t caf::disposable::erase_disposed ( std::vector< disposable > &  xs)

Erases each x from xs where x.disposed().

The number of erased elements.

◆ make_composite()

disposable caf::disposable::make_composite ( std::vector< disposable entries)

Combines multiple disposables into a single disposable.

The new disposable is disposed if all of its elements are disposed. Disposing the composite disposes all elements individually.

The documentation for this class was generated from the following files: