alpaqa
1.0.0a15
Nonconvex constrained optimization
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
i
j
l
m
n
o
p
r
s
t
u
v
w
Functions
a
b
c
d
e
f
g
i
j
l
m
n
o
p
r
s
t
u
w
Variables
Typedefs
a
c
d
f
i
l
m
p
r
s
t
u
v
Enumerations
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
û
ŷ
α
γ
δ
ε
λ
ρ
σ
τ
φ
ψ
ϵ
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
û
α
ρ
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
ŷ
α
γ
δ
ε
λ
ρ
σ
τ
φ
ψ
ϵ
Typedefs
a
b
c
d
e
f
h
i
l
m
n
o
p
r
s
t
v
w
Enumerations
Enumerator
a
f
i
s
u
Related Symbols
Files
File List
File Members
All
a
c
d
e
f
g
l
m
p
r
s
t
u
w
Functions
a
c
d
e
f
g
l
m
p
r
s
t
w
Variables
Typedefs
Enumerations
Enumerator
Macros
a
c
e
p
u
Examples
Sphinx
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
src
alpaqa
include
alpaqa
util
required-method.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
alpaqa/util/type-erasure.hpp
>
4
#include <functional>
// std::invoke
5
6
#define ALPAQA_TE_REQUIRED_METHOD(vtable, type, member) \
7
do { \
8
static_assert( \
9
requires { &type::member; }, \
10
"Missing required method '" #type "::" #member "'"); \
11
(vtable).member = util::type_erased_wrapped<type, &type::member>(); \
12
} while (0)
6
#define ALPAQA_TE_REQUIRED_METHOD(vtable, type, member) \
…
13
#define ALPAQA_TE_OPTIONAL_METHOD(vtable, type, member, instance) \
14
do { \
15
if constexpr (requires { &type::member; }) { \
16
using vtable_t = std::remove_cvref_t<decltype(vtable)>; \
17
auto assign_vtable = [&] { \
18
(vtable).member = \
19
util::type_erased_wrapped<type, &type::member, \
20
const vtable_t &>(); \
21
}; \
22
if constexpr (requires { &type::provides_##member; }) { \
23
if (std::invoke(&type::provides_##member, instance)) \
24
assign_vtable(); \
25
} else { \
26
assign_vtable(); \
27
} \
28
} \
29
} while (0)
13
#define ALPAQA_TE_OPTIONAL_METHOD(vtable, type, member, instance) \
…
type-erasure.hpp
Generated on Wed Nov 22 2023 for alpaqa by
1.9.8