36 template <SomeOperation OpType>
39 : pimpl_{std::make_unique<Model<OpType>>(std::forward<OpType>(operation))}
59 std::expected<std::any, ExecutionError>
82 virtual ~Concept() =
default;
95 struct Model : Concept {
98 template <
typename OType>
99 requires std::is_same_v<OType, OpType>
100 Model(OType&& operation) : operation{std::forward<OType>(operation)}
105 wait() noexcept
override
107 if constexpr (not SomeAwaitable<OpType>) {
108 ASSERT(
false,
"Called wait() on an operation that does not support it");
115 std::expected<std::any, ExecutionError>
118 if constexpr (not SomeOperationWithData<OpType>) {
119 ASSERT(
false,
"Called get() on an operation that does not support it");
123 return operation.get();
130 if constexpr (not SomeCancellableOperation<OpType> and not SomeStoppableOperation<OpType> and
131 not SomeAbortable<OpType>) {
132 ASSERT(
false,
"Called abort() on an operation that can't be aborted, cancelled nor stopped");
134 if constexpr (SomeAbortable<OpType>) {
137 if constexpr (SomeCancellableOperation<OpType>)
139 if constexpr (SomeStoppableOperation<OpType>)
140 operation.requestStop();
148 if constexpr (not SomeForceInvocableOperation<OpType>) {
149 ASSERT(
false,
"Called invoke() on an operation that can't be force-invoked");
157 std::unique_ptr<Concept> pimpl_;