Lots of windows fixes and some more improvements.

This commit is contained in:
2025-06-24 15:20:42 +02:00
parent 36a908ab8a
commit 573c431dbd
14 changed files with 379 additions and 63 deletions

View File

@@ -26,7 +26,7 @@ namespace mijin
//
// public types
//
template<typename TValue>
template<typename TValue, template<typename> typename TAllocator = MIJIN_DEFAULT_ALLOCATOR>
class Future;
// TODO: add support for mutexes and waiting for futures
@@ -57,16 +57,17 @@ struct FutureStorage<void>
};
} // namespace impl
template<typename TValue>
template<typename TValue, template<typename> typename TAllocator>
class Future
{
private:
impl::FutureStorage<TValue> value_;
[[no_unique_address]] impl::FutureStorage<TValue> value_;
bool isSet_ = false;
public:
Future() = default;
Future(const Future&) = delete;
Future(Future&&) MIJIN_NOEXCEPT = default;
explicit Future(TAllocator<void> allocator) : sigSet(std::move(allocator)) {}
public:
Future& operator=(const Future&) = delete;
Future& operator=(Future&&) MIJIN_NOEXCEPT = default;
@@ -126,11 +127,11 @@ public: // modification
}
}
public: // signals
Signal<> sigSet;
BaseSignal<TAllocator> sigSet;
};
template<typename TValue>
using FuturePtr = std::shared_ptr<Future<TValue>>;
template<typename TValue, template<typename> typename TAllocator = MIJIN_DEFAULT_ALLOCATOR>
using FuturePtr = std::shared_ptr<Future<TValue, TAllocator>>;
//
// public functions