Commit 3e9186f1 authored by Kirk Shoop's avatar Kirk Shoop Committed by Facebook GitHub Bot

create explicit instantiations for folly::Unit

Summary:
move template instantiations for folly::Unit of several types into explicit instantiations in cpp files.

`folly::Future<folly::Unit>`
`folly::SemiFuture<folly::Unit>`
`folly::Promise<folly::Unit>`
`folly::SharedPromise<folly::Unit>`
`folly::futures::detail::FutureBase<folly::Unit>`
`folly::futures::detail::Core<folly::Unit>`
`folly::Try<folly::Unit>`

Reviewed By: yfeldblum, ericniebler

Differential Revision: D22092858

fbshipit-source-id: b8faa1c8aedfc193c17e2c3bc2e5b0f429ae6b0f
parent 9426d302
......@@ -346,4 +346,7 @@ auto unwrapTryTuple(Tuple&& instance) {
return try_detail::unwrapTryTupleImpl(Seq{}, std::forward<Tuple>(instance));
}
// limited to the instances unconditionally forced by the futures library
extern template class Try<Unit>;
} // namespace folly
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <folly/Try.h>
namespace folly {
template class Try<Unit>;
} // namespace folly
......@@ -2571,4 +2571,14 @@ SemiFuture<Unit> Timekeeper::at(std::chrono::time_point<Clock> when) {
return after(std::chrono::duration_cast<HighResDuration>(when - now));
}
#if FOLLY_USE_EXTERN_FUTURE_UNIT
// limited to the instances unconditionally forced by the futures library
namespace futures {
namespace detail {
extern template class FutureBase<Unit>;
} // namespace detail
} // namespace futures
extern template class Future<Unit>;
extern template class SemiFuture<Unit>;
#endif
} // namespace folly
......@@ -79,4 +79,16 @@ SemiFuture<Unit> wait(std::shared_ptr<fibers::Baton> baton) {
#endif
} // namespace futures
#if FOLLY_USE_EXTERN_FUTURE_UNIT
namespace futures {
namespace detail {
template class FutureBase<Unit>;
} // namespace detail
} // namespace futures
template class Future<Unit>;
template class SemiFuture<Unit>;
#endif
} // namespace folly
......@@ -159,4 +159,9 @@ bool Promise<T>::isFulfilled() const noexcept {
return true;
}
#if FOLLY_USE_EXTERN_FUTURE_UNIT
// limited to the instances unconditionally forced by the futures library
extern template class Promise<Unit>;
#endif
} // namespace folly
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <folly/futures/Promise.h>
namespace folly {
#if FOLLY_USE_EXTERN_FUTURE_UNIT
template class Promise<Unit>;
#endif
} // namespace folly
......@@ -105,4 +105,9 @@ bool SharedPromise<T>::isFulfilled() const {
return hasResult();
}
#if FOLLY_USE_EXTERN_FUTURE_UNIT
// limited to the instances unconditionally forced by the futures library
extern template class SharedPromise<Unit>;
#endif
} // namespace folly
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <folly/futures/SharedPromise.h>
namespace folly {
#if FOLLY_USE_EXTERN_FUTURE_UNIT
template class SharedPromise<Unit>;
#endif
} // namespace folly
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <folly/futures/detail/Core.h>
namespace folly {
namespace futures {
namespace detail {
#if FOLLY_USE_EXTERN_FUTURE_UNIT
template class Core<folly::Unit>;
#endif
} // namespace detail
} // namespace futures
} // namespace folly
......@@ -1027,6 +1027,12 @@ class Core final {
std::unique_ptr<exception_wrapper> interrupt_{};
std::function<void(exception_wrapper const&)> interruptHandler_{nullptr};
};
#if FOLLY_USE_EXTERN_FUTURE_UNIT
// limited to the instances unconditionally forced by the futures library
extern template class Core<folly::Unit>;
#endif
} // namespace detail
} // namespace futures
......
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