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

gen-to-ranges: rename folly::gen::detail types

Summary:
Context: migration of fbcode from folly::gen to range-v3 by way of pipe-adapters ("pipe fittings") that allow a `|`-based pipeline mixing {std-containers and/or range-v3} with folly::gen, e.g.,

```
auto result = myVec              // anything consistent with range-v3 or these adapters
    | ranges::view::filter(...)  // zero-or-more range-v3 pipe-elems
    | <adapter-goes-here>        // <==**one of the pipe-adapters provided by this task**
    | folly::gen::blah();        // trailing pipe-elems are folly::gen
```

Goal of this task: rename the pipe-adapter folly::gen::detail types so those names are consistent with the names of the corresponding folly::gen::objects.

Reviewed By: yfeldblum

Differential Revision: D16138397

fbshipit-source-id: 3e6145f5bb35c8d2bd14a9a3eb645e153743d499
parent 11cc0c8f
...@@ -2542,25 +2542,25 @@ class RangeV3CopySource ...@@ -2542,25 +2542,25 @@ class RangeV3CopySource
static constexpr bool infinite = false; static constexpr bool infinite = false;
}; };
struct container_to_gen_fn { struct from_container_fn {
template <typename Container> template <typename Container>
friend auto operator|(Container&& c, container_to_gen_fn) { friend auto operator|(Container&& c, from_container_fn) {
return gen::from(std::forward<Container>(c)); return gen::from(std::forward<Container>(c));
} }
}; };
struct rangev3_to_gen_fn { struct from_rangev3_fn {
template <typename Range> template <typename Range>
friend auto operator|(Range&& r, rangev3_to_gen_fn) { friend auto operator|(Range&& r, from_rangev3_fn) {
using DecayedRange = std::decay_t<Range>; using DecayedRange = std::decay_t<Range>;
using DecayedValue = std::decay_t<decltype(*r.begin())>; using DecayedValue = std::decay_t<decltype(*r.begin())>;
return RangeV3Source<DecayedRange, DecayedValue>(r); return RangeV3Source<DecayedRange, DecayedValue>(r);
} }
}; };
struct rangev3_to_gen_copy_fn { struct from_rangev3_copy_fn {
template <typename Range> template <typename Range>
friend auto operator|(Range&& r, rangev3_to_gen_copy_fn) { friend auto operator|(Range&& r, from_rangev3_copy_fn) {
using RangeDecay = std::decay_t<Range>; using RangeDecay = std::decay_t<Range>;
using Value = std::decay_t<decltype(*r.begin())>; using Value = std::decay_t<decltype(*r.begin())>;
return RangeV3CopySource<RangeDecay, Value>(std::move(r)); return RangeV3CopySource<RangeDecay, Value>(std::move(r));
...@@ -2573,16 +2573,16 @@ struct rangev3_to_gen_copy_fn { ...@@ -2573,16 +2573,16 @@ struct rangev3_to_gen_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 | container_to_gen | folly::gen::filter(...); * Example: vec | gen::from_container | folly::gen::filter(...);
* Example: vec | ranges::view::filter(...) | rangev3_to_gen | folly::gen::xxx; * Example: vec | ranges::view::filter(...) | gen::from_rangev3 | gen::xxx;
****************************************************************************** ******************************************************************************
*/ */
constexpr detail::container_to_gen_fn from_container; constexpr detail::from_container_fn from_container;
constexpr detail::rangev3_to_gen_fn from_rangev3; constexpr detail::from_rangev3_fn from_rangev3;
constexpr detail::rangev3_to_gen_copy_fn from_rangev3_copy; constexpr detail::from_rangev3_copy_fn from_rangev3_copy;
template <typename Range> template <typename Range>
auto rangev3_to_gen_call(Range&& r) { auto from_rangev3_call(Range&& r) {
using Value = std::decay_t<decltype(*r.begin())>; using Value = std::decay_t<decltype(*r.begin())>;
return detail::RangeV3Source<Range, Value>(r); return detail::RangeV3Source<Range, Value>(r);
} }
......
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