Fix valid function invoke failed in future class (#75)

In C++11, shared_ptr has an explicit operator bool which
means that a shared_ptr can't be implicitly converted to a bool.
adding an explicit cast is a valid fix to the code.
This commit is contained in:
luzhen 2021-12-23 15:21:55 +08:00 committed by GitHub
parent 5f3169421e
commit a841177c5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,7 @@ future<T>::future(const std::shared_ptr<State>& s) : state(s) {}
template <typename T>
bool future<T>::valid() const {
return state;
return static_cast<bool>(state);
}
template <typename T>