Commit 6161b9a5 authored by Marshall Cline's avatar Marshall Cline Committed by Facebook Github Bot

constify constifiable methods

Summary:
Make these const:
- {Future,SemiFuture}::hasValue()
- {Future,SemiFuture}::hasException()
- {Future,SemiFuture}::isActive()
- Promise::throwIfFulfilled()

Reviewed By: yfeldblum

Differential Revision: D7824879

fbshipit-source-id: 035b4bbcfd5b88825580e22b37b13e07158898f3
parent 38f07639
...@@ -217,12 +217,12 @@ bool FutureBase<T>::isReady() const { ...@@ -217,12 +217,12 @@ bool FutureBase<T>::isReady() const {
} }
template <class T> template <class T>
bool FutureBase<T>::hasValue() { bool FutureBase<T>::hasValue() const {
return result().hasValue(); return result().hasValue();
} }
template <class T> template <class T>
bool FutureBase<T>::hasException() { bool FutureBase<T>::hasException() const {
return result().hasException(); return result().hasException();
} }
......
...@@ -114,10 +114,10 @@ class FutureBase { ...@@ -114,10 +114,10 @@ class FutureBase {
bool isReady() const; bool isReady() const;
/// sugar for getTry().hasValue() /// sugar for getTry().hasValue()
bool hasValue(); bool hasValue() const;
/// sugar for getTry().hasException() /// sugar for getTry().hasException()
bool hasException(); bool hasException() const;
/// If the promise has been fulfilled, return an Optional with the Try<T>. /// If the promise has been fulfilled, return an Optional with the Try<T>.
/// Otherwise return an empty Optional. /// Otherwise return an empty Optional.
...@@ -132,7 +132,7 @@ class FutureBase { ...@@ -132,7 +132,7 @@ class FutureBase {
template <class F> template <class F>
void setCallback_(F&& func); void setCallback_(F&& func);
bool isActive() { bool isActive() const {
return getCore().isActive(); return getCore().isActive();
} }
......
...@@ -49,7 +49,7 @@ Promise<T>& Promise<T>::operator=(Promise<T>&& other) noexcept { ...@@ -49,7 +49,7 @@ Promise<T>& Promise<T>::operator=(Promise<T>&& other) noexcept {
} }
template <class T> template <class T>
void Promise<T>::throwIfFulfilled() { void Promise<T>::throwIfFulfilled() const {
if (getCore().hasResult()) { if (getCore().hasResult()) {
throwPromiseAlreadySatisfied(); throwPromiseAlreadySatisfied();
} }
......
...@@ -158,7 +158,7 @@ class Promise { ...@@ -158,7 +158,7 @@ class Promise {
explicit Promise(futures::detail::EmptyConstruct) noexcept; explicit Promise(futures::detail::EmptyConstruct) noexcept;
void throwIfFulfilled(); void throwIfFulfilled() const;
void detach(); void detach();
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment