proxsuite
0.6.7
The Advanced Proximal Optimization Toolbox
Loading...
Searching...
No Matches
defer.hpp
Go to the documentation of this file.
1
#ifndef VEG_DEFER_HPP_SQPONLRGS
2
#define VEG_DEFER_HPP_SQPONLRGS
3
4
#include "
proxsuite/linalg/veg/type_traits/constructible.hpp
"
5
#include "
proxsuite/linalg/veg/type_traits/invocable.hpp
"
6
#include "
proxsuite/linalg/veg/internal/prologue.hpp
"
7
8
namespace
proxsuite
{
9
namespace
linalg {
10
namespace
veg {
11
template
<
typename
Fn>
12
struct
VEG_NODISCARD
Defer
13
{
14
Fn
fn
;
15
constexpr
Defer
(
Fn
_fn
)
VEG_NOEXCEPT_IF
(
VEG_CONCEPT
(
nothrow_movable<Fn>
))
16
: fn(
VEG_FWD
(
_fn
))
17
{
18
}
19
Defer
(
Defer
const
&) =
delete
;
20
Defer
(
Defer
&&)
VEG_NOEXCEPT
=
delete
;
21
auto
operator
=(
Defer
const
&) ->
Defer
& =
delete
;
22
auto
operator
=(
Defer
&&)
VEG_NOEXCEPT
->
Defer
& =
delete
;
23
VEG_CPP20
(
constexpr
)
24
VEG_INLINE
~
Defer
()
25
VEG_NOEXCEPT_IF
(
VEG_NOEXCEPT_IF
(
VEG_CONCEPT
(
nothrow_fn_once
<
Fn
,
void
>)))
26
{
27
VEG_FWD
(fn)();
28
}
29
};
30
VEG_CPP17
(
31
32
template<typename Fn>
Defer
(
Fn
) ->
Defer<Fn>
;
33
34
)
35
36
namespace
nb {
37
struct
defer
38
{
39
VEG_TEMPLATE
(
typename
Fn
,
40
requires
(
VEG_CONCEPT
(
fn_once<Fn, void>
)),
41
VEG_INLINE
VEG_CPP20
(
constexpr
)
auto
42
operator
(),
43
(fn,
Fn
&&))
44
const
VEG_NOEXCEPT_IF
(
VEG_CONCEPT
(
nothrow_movable<Fn>
))
45
->proxsuite::linalg::veg::Defer<
Fn
>
46
{
47
return
{
VEG_FWD
(fn) };
48
}
49
};
50
}
// namespace nb
51
VEG_NIEBLOID
(defer);
52
}
// namespace veg
53
}
// namespace linalg
54
}
// namespace proxsuite
55
56
#include "
proxsuite/linalg/veg/internal/epilogue.hpp
"
57
#endif
/* end of include guard VEG_DEFER_HPP_SQPONLRGS */
constructible.hpp
epilogue.hpp
invocable.hpp
VEG_CONCEPT
#define VEG_CONCEPT(...)
Definition
macros.hpp:1243
VEG_TEMPLATE
#define VEG_TEMPLATE(TParams, Constraint, Attr_Name,...)
Definition
macros.hpp:385
VEG_NIEBLOID
#define VEG_NIEBLOID(Name)
Definition
macros.hpp:545
VEG_INLINE
#define VEG_INLINE
Definition
macros.hpp:118
VEG_FWD
#define VEG_FWD(X)
Definition
macros.hpp:569
proxsuite
Definition
common.hpp:14
prologue.hpp
VEG_CPP20
#define VEG_CPP20(...)
Definition
prologue.hpp:83
VEG_NODISCARD
#define VEG_NODISCARD
Definition
prologue.hpp:97
VEG_NOEXCEPT
#define VEG_NOEXCEPT
Definition
prologue.hpp:30
VEG_CPP17
#define VEG_CPP17(...)
Definition
prologue.hpp:77
VEG_NOEXCEPT_IF
#define VEG_NOEXCEPT_IF(...)
Definition
prologue.hpp:31
proxsuite::linalg::veg::Defer
Definition
defer.hpp:13
proxsuite::linalg::veg::Defer::Defer
Defer(Defer const &)=delete
proxsuite::linalg::veg::Defer::fn
Fn fn
Definition
defer.hpp:14
proxsuite::linalg::veg::Defer::Defer
constexpr Defer(Fn _fn) VEG_NOEXCEPT_IF(VEG_CONCEPT(nothrow_movable< Fn >))
Definition
defer.hpp:15
proxsuite::linalg::veg::Defer::Defer
Defer(Defer &&) VEG_NOEXCEPT=delete
proxsuite::linalg::veg::Ref
Definition
ref.hpp:30
include
proxsuite
linalg
veg
util
defer.hpp
Generated by
1.10.0