stlab 2.3.0
Modern, modular C++ algorithms, data structures, and concurrency primitives
Loading...
Searching...
No Matches
immediate_executor.hpp
Go to the documentation of this file.
1/*
2 Copyright 2015 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6
7/**************************************************************************************************/
8
9#ifndef STLAB_CONCURRENCY_IMMEDIATE_EXECUTOR_HPP
10#define STLAB_CONCURRENCY_IMMEDIATE_EXECUTOR_HPP
11
15
16#include <stlab/config.hpp>
17
18#include <type_traits>
19#include <utility>
20
21/**************************************************************************************************/
22
23namespace stlab {
24STLAB_VERSION_NAMESPACE_BEGIN()
25
26
31
32/**************************************************************************************************/
33
34namespace detail {
35
36/**************************************************************************************************/
37
38struct immediate_executor_type {
39 template <typename F>
40 auto operator()(F&& f) const -> std::enable_if_t<std::is_nothrow_invocable_v<F>> {
41 std::forward<F>(f)();
42 }
43};
44
45/**************************************************************************************************/
46
47} // namespace detail
48
49/**************************************************************************************************/
50
52inline constexpr auto immediate_executor = detail::immediate_executor_type{};
53
54/**************************************************************************************************/
55
57
58STLAB_VERSION_NAMESPACE_END()
59} // namespace stlab
60
61/**************************************************************************************************/
62
63#endif
64
65/**************************************************************************************************/
constexpr auto immediate_executor
Invokes work inline on the calling thread (synchronous executor).
Definition immediate_executor.hpp:52
Definition reverse.hpp:28