1 /*
2  * Copyright (c) 2022 NVIDIA Corporation
3  *
4  * Licensed under the Apache License Version 2.0 with LLVM Exceptions
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  *   https://llvm.org/LICENSE.txt
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include "../stdexec/__detail/__scope.hpp"
19 
20 namespace exec
21 {
22 
23 template <class _Fn, class... _Ts>
24     requires stdexec::__nothrow_callable<_Fn, _Ts...>
25 struct scope_guard
26 {
27     stdexec::__scope_guard<_Fn, _Ts...> __guard_;
28 
dismissexec::scope_guard29     void dismiss() noexcept
30     {
31         __guard_.__dismiss();
32     }
33 };
34 template <class _Fn, class... _Ts>
35 scope_guard(_Fn, _Ts...) -> scope_guard<_Fn, _Ts...>;
36 
37 } // namespace exec
38