stlab 2.3.0
Modern, modular C++ algorithms, data structures, and concurrency primitives
Loading...
Searching...
No Matches
scope

Detailed Description

RAII scope helpers (scope, mutex guard).

Functions

template<typename T, typename... Args>
auto stlab::scope (Args &&... args)
 Scopes the lifetime of an instance of T. All but the last arguments construct T; the last argument is a nullary function invoked while T is alive. T is destroyed after that function returns.
template<typename T, typename F>
auto stlab::scope (std::mutex &m, F &&f)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Function Documentation

◆ scope()

template<typename T, typename F>
auto stlab::scope ( std::mutex & m,
F && f )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Workaround until VS2017 bug is fixed; prefer the variadic scope when possible.