| 251 | |
| 252 | template<typename R, typename E, typename... Args> |
| 253 | auto 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 | |
| 268 | template<typename F> |
| 269 | auto decorateExpected( F&& f ) |
nothing calls this directly
no test coverage detected