Commit 3685bdd1 authored by Eric Niebler's avatar Eric Niebler Committed by Facebook Github Bot

Update fbcode for range-v3 0.9.1-pre

Summary:
Range-v3 v0.9.1-pre deprecated and renamed a bunch of interfaces to harmonize with the direction of C++20's `std::ranges`. In this diff, I:

* Rename the `ranges::view` namespace qualification to `ranges::views` (plural),
* Rename the `ranges::action` namespace qualification to `ranges::actions` (plural),
* Rename `ranges::view::bounded` to `ranges::views::common`,
* Rename `ranges::to_` to `ranges::to`,
* Replace _some_ implicit conversions of views to containers with explicit invocations of `ranges::to` (more work to be done here, but can wait).

Reviewed By: mzlee

Differential Revision: D17061465

fbshipit-source-id: f28205ecf3965d3560e9cffe2805d0b404597b21
parent 2d5ad1d0
...@@ -149,7 +149,7 @@ constexpr decltype(auto) fetch(Sequence&& sequence, Index&& index); ...@@ -149,7 +149,7 @@ constexpr decltype(auto) fetch(Sequence&& sequence, Index&& index);
/* /*
* If you just want the element values, please use this (ranges-v3) construct: * If you just want the element values, please use this (ranges-v3) construct:
* *
* for (auto&& element : collection | view::reverse) * for (auto&& element : collection | views::reverse)
* *
* If you need access to the iterators please write an explicit iterator loop * If you need access to the iterators please write an explicit iterator loop
*/ */
...@@ -179,11 +179,11 @@ constexpr decltype(auto) fetch(Sequence&& sequence, Index&& index); ...@@ -179,11 +179,11 @@ constexpr decltype(auto) fetch(Sequence&& sequence, Index&& index);
/** /**
* If you just want the keys, please use this (ranges-v3) construct: * If you just want the keys, please use this (ranges-v3) construct:
* *
* for (auto&& element : collection | view::keys) * for (auto&& element : collection | views::keys)
* *
* If you just want the values, please use this (ranges-v3) construct: * If you just want the values, please use this (ranges-v3) construct:
* *
* for (auto&& element : collection | view::values) * for (auto&& element : collection | views::values)
* *
* If you need to see both, use: * If you need to see both, use:
* *
......
...@@ -165,11 +165,12 @@ auto collectAllTry(SemiAwaitables&&... awaitables) ...@@ -165,11 +165,12 @@ auto collectAllTry(SemiAwaitables&&... awaitables)
// //
// Note that the expression `*it` must be SemiAwaitable. // Note that the expression `*it` must be SemiAwaitable.
// This typically means that containers of Task<T> must be adapted to produce // This typically means that containers of Task<T> must be adapted to produce
// moved-elements by applying the ranges::view::move transform. // moved-elements by applying the ranges::views::move transform.
// e.g. // e.g.
// //
// std::vector<Task<T>> tasks = ...; // std::vector<Task<T>> tasks = ...;
// std::vector<T> vals = co_await collectAllRange(tasks | ranges::view::move); // std::vector<T> vals = co_await collectAllRange(tasks |
// ranges::views::move);
// //
template < template <
typename InputRange, typename InputRange,
...@@ -210,20 +211,20 @@ auto collectAllTryRange(InputRange awaitables) ...@@ -210,20 +211,20 @@ auto collectAllTryRange(InputRange awaitables)
// collectAllRange()/collectAllTryRange() overloads that simplifies the // collectAllRange()/collectAllTryRange() overloads that simplifies the
// common-case where an rvalue std::vector<Task<T>> is passed. // common-case where an rvalue std::vector<Task<T>> is passed.
// //
// This avoids the caller needing to pipe the input through ranges::view::move // This avoids the caller needing to pipe the input through ranges::views::move
// transform to force the Task<T> elements to be rvalue-references since the // transform to force the Task<T> elements to be rvalue-references since the
// std::vector<T>::reference type is T& rather than T&& and Task<T>& is not // std::vector<T>::reference type is T& rather than T&& and Task<T>& is not
// awaitable. // awaitable.
template <typename T> template <typename T>
auto collectAllRange(std::vector<Task<T>> awaitables) auto collectAllRange(std::vector<Task<T>> awaitables)
-> decltype(collectAllRange(awaitables | ranges::view::move)) { -> decltype(collectAllRange(awaitables | ranges::views::move)) {
co_return co_await collectAllRange(awaitables | ranges::view::move); co_return co_await collectAllRange(awaitables | ranges::views::move);
} }
template <typename T> template <typename T>
auto collectAllTryRange(std::vector<Task<T>> awaitables) auto collectAllTryRange(std::vector<Task<T>> awaitables)
-> decltype(collectAllTryRange(awaitables | ranges::view::move)) { -> decltype(collectAllTryRange(awaitables | ranges::views::move)) {
co_return co_await collectAllTryRange(awaitables | ranges::view::move); co_return co_await collectAllTryRange(awaitables | ranges::views::move);
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
...@@ -293,9 +294,9 @@ auto collectAllWindowed( ...@@ -293,9 +294,9 @@ auto collectAllWindowed(
std::vector<Task<T>> awaitables, std::vector<Task<T>> awaitables,
std::size_t maxConcurrency) std::size_t maxConcurrency)
-> decltype( -> decltype(
collectAllWindowed(awaitables | ranges::view::move, maxConcurrency)) { collectAllWindowed(awaitables | ranges::views::move, maxConcurrency)) {
co_return co_await collectAllWindowed( co_return co_await collectAllWindowed(
awaitables | ranges::view::move, maxConcurrency); awaitables | ranges::views::move, maxConcurrency);
} }
template <typename T> template <typename T>
...@@ -303,10 +304,10 @@ auto collectAllTryWindowed( ...@@ -303,10 +304,10 @@ auto collectAllTryWindowed(
std::vector<Task<T>> awaitables, std::vector<Task<T>> awaitables,
std::size_t maxConcurrency) std::size_t maxConcurrency)
-> decltype(collectAllTryWindowed( -> decltype(collectAllTryWindowed(
awaitables | ranges::view::move, awaitables | ranges::views::move,
maxConcurrency)) { maxConcurrency)) {
co_return co_await collectAllTryWindowed( co_return co_await collectAllTryWindowed(
awaitables | ranges::view::move, maxConcurrency); awaitables | ranges::views::move, maxConcurrency);
} }
} // namespace coro } // namespace coro
......
...@@ -2574,7 +2574,7 @@ struct from_rangev3_copy_fn { ...@@ -2574,7 +2574,7 @@ struct from_rangev3_copy_fn {
****************************************************************************** ******************************************************************************
* Pipe fittings between a container/range-v3 and a folly::gen. * Pipe fittings between a container/range-v3 and a folly::gen.
* Example: vec | gen::from_container | folly::gen::filter(...); * Example: vec | gen::from_container | folly::gen::filter(...);
* Example: vec | ranges::view::filter(...) | gen::from_rangev3 | gen::xxx; * Example: vec | ranges::views::filter(...) | gen::from_rangev3 | gen::xxx;
****************************************************************************** ******************************************************************************
*/ */
constexpr detail::from_container_fn from_container; constexpr detail::from_container_fn from_container;
...@@ -2594,7 +2594,7 @@ template <typename Range> ...@@ -2594,7 +2594,7 @@ template <typename Range>
auto rangev3_will_be_consumed(Range&& r) { auto rangev3_will_be_consumed(Range&& r) {
// intentionally use `r` instead of `std::forward<Range>(r)`; see above. // intentionally use `r` instead of `std::forward<Range>(r)`; see above.
// range-v3 ranges copy in O(1) so it is appropriate. // range-v3 ranges copy in O(1) so it is appropriate.
return ranges::view::all(r); return ranges::views::all(r);
} }
#endif // FOLLY_USE_RANGEV3 #endif // FOLLY_USE_RANGEV3
......
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