pipe fittings between a container/range-v3 and a folly::gen
Summary: Create 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 ``` This diff supplies only adapters that transition from {std-containers and/or range-v3} to folly::gen, but not the other way around. Q&A: * Why distinguish containers from range-v3's? E.g., container_to_gen vs. rangev3_to_gen? * Containers and range-v3's have different copy-costs: range-v3's have O(1) copy * Using two different names lets us separate the implementations so we can know which can be copied without significant overhead. * Why `#include` range-v3 from inside folly::gen? Why the dependency? * That `#include` / dependency adds value to the process, and it is included only for the client-files that need it. * It adds value to the process since the subset of client-files to be migrated are precisely the same subset of client-files that _need_ to include range-v3. * The alternative would be to add the `#include` out in all the various client-files during the migration process, and we will do that as the last step in the migration process. * The migration process is sped up by including range-v3 for that specific subset of client-files _and_ it hurts no one since only those who need that `#include` actually get it. * Note: we limit the `#include` to the subset of files to be migrated via the `FOLLY_USE_RANGEV3` define; see folly-config.h. Reviewed By: yfeldblum Differential Revision: D15035294 fbshipit-source-id: 694979850d1f35dd382e3afde792ea51a2397af0
Showing
Please register or sign in to comment