}
template <class T>
-bool Promise<T>::isFulfilled() {
+bool Promise<T>::isFulfilled() const noexcept {
if (core_) {
return core_->hasResult();
}
template <class T>
class Promise {
-public:
+ public:
Promise();
~Promise();
template <class F>
void setWith(F&& func);
- bool isFulfilled();
+ bool isFulfilled() const noexcept;
-private:
+ private:
typedef typename Future<T>::corePtr corePtr;
template <class> friend class Future;
Core& operator=(Core&&) = delete;
/// May call from any thread
- bool hasResult() const {
+ bool hasResult() const noexcept {
switch (fsm_.getState()) {
case State::OnlyResult:
case State::Armed:
}
/// May call from any thread
- bool ready() const {
+ bool ready() const noexcept {
return hasResult();
}
public:
explicit FSM(Enum startState) : state_(startState) {}
- Enum getState() const {
+ Enum getState() const noexcept {
return state_.load(std::memory_order_acquire);
}