AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
AImplementationManager.h
1
2#pragma once
3
4#include <AUI/Traits/concepts.h>
5#include <AUI/Common/SharedPtr.h>
6
12template<typename Base, aui::derived_from<Base>... Implementations>
14 template<aui::mapper<std::unique_ptr<Base>, std::unique_ptr<Base>> Callback>
15 static std::unique_ptr<Base> tryAllUntilSuccess(Callback&& callback) {
16 std::unique_ptr<Base> result;
17 (false || ... || [&]() -> bool {
18 try {
19 auto i = std::make_unique<Implementations>();
20 result = callback(std::move(i));
21 return result != nullptr;
22 } catch (...) {}
23 return false;
24 }());
25
26 return result;
27 }
28};
Helps with picking implementation specified in template arguments which does not throw an exception i...
Definition: AImplementationManager.h:13