MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / decorateExpected

Function decorateExpected

source/MRPython/MRPython.h:253–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251
252template<typename R, typename E, typename... Args>
253auto decorateExpected( std::function<Expected<R, E>( Args... )>&& f ) -> std::function<R( Args... )>
254{
255 return[fLocal = std::move( f )]( Args&&... args ) mutable -> R
256 {
257 auto res = fLocal(std::forward<Args>( args )...);
258 if (!res.has_value())
259 throwExceptionFromExpected(res.error());
260
261 if constexpr (std::is_void<R>::value)
262 return;
263 else
264 return res.value();
265 };
266}
267
268template<typename F>
269auto decorateExpected( F&& f )

Callers

nothing calls this directly

Calls 3

errorMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected