Commit 438afd7d authored by Philip Pronin's avatar Philip Pronin Committed by Facebook GitHub Bot

define GENERATOR_REF

Summary:
Version of `GENERATOR` that we're already using in a few places where
it doesn't leave its original scope.

Reviewed By: ddrcoder, luciang

Differential Revision: D26909115

fbshipit-source-id: 5fbae8bd44c62d4d96427a4fd3ef60a8d9cb40e3
parent 3af4c3db
......@@ -488,9 +488,14 @@ Yield generator(Source&& source) {
* Create inline generator, used like:
*
* auto gen = GENERATOR(int) { yield(1); yield(2); };
*
* GENERATOR_REF can be useful for creating a generator that doesn't
* leave its original scope.
*/
#define GENERATOR(TYPE) \
::folly::gen::detail::GeneratorBuilder<TYPE>() + [=](auto&& yield)
#define GENERATOR_REF(TYPE) \
::folly::gen::detail::GeneratorBuilder<TYPE>() + [&](auto&& yield)
/*
* empty() - for producing empty sequences.
......
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