MCPcopy Create free account
hub / github.com/davisking/dlib / try_invoke

Function try_invoke

dlib/test/constexpr_if.cpp:120–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118
119 template <typename Func, typename... Args>
120 bool try_invoke(Func&& f, Args&&... args)
121 {
122 return switch_(bools(is_invocable<Func, Args...>{}),
123 [&](true_t, auto _) {
124 _(std::forward<Func>(f))(std::forward<Args>(args)...);
125 return true;
126 },
127 [](auto...) {
128 return false;
129 }
130 );
131 }
132
133 void test_try_invoke()
134 {

Callers 1

test_try_invokeFunction · 0.85

Calls 3

switch_Function · 0.85
_Function · 0.85
boolsClass · 0.50

Tested by

no test coverage detected