36 template <SomeOperation OpType>
39 : pimpl_{std::make_unique<Model<OpType>>(std::forward<OpType>(operation))}
59 std::expected<std::any, ExecutionError>
76 virtual ~Concept() =
default;
87 struct Model : Concept {
90 template <
typename OType>
91 requires std::is_same_v<OType, OpType>
92 Model(OType&& operation) : operation{std::forward<OType>(operation)}
97 wait() noexcept
override
100 ASSERT(
false,
"Called wait() on an operation that does not support it");
107 std::expected<std::any, ExecutionError>
110 if constexpr (not SomeOperationWithData<OpType>) {
111 ASSERT(
false,
"Called get() on an operation that does not support it");
115 return operation.get();
122 if constexpr (not SomeCancellableOperation<OpType> and not SomeStoppableOperation<OpType> and
123 not SomeAbortable<OpType>) {
124 ASSERT(
false,
"Called abort() on an operation that can't be aborted, cancelled nor stopped");
126 if constexpr (SomeAbortable<OpType>) {
129 if constexpr (SomeCancellableOperation<OpType>)
131 if constexpr (SomeStoppableOperation<OpType>)
132 operation.requestStop();
139 std::unique_ptr<Concept> pimpl_;