Return a GeneratorType
instance whose next
method invokes
body
and returns the result.
Example:
var
x
=
7
let
g
=
anyGenerator
{
x
<
15
?
x
++ :
nil
}
let
a
=
Array
(
g
)
// [ 7, 8, 9, 10, 11, 12, 13, 14 ]
Declaration
func
anyGenerator
<
Element
>
(
body
: () -
>
Element
?) -
>
AnyGenerator
<
Element
>
Return a
GeneratorType
instance that wrapsbase
but whose type depends only on the type ofG.Element
.Example:
Declaration
func
anyGenerator
<
G
:
GeneratorType
>
(
base
:
G
) -
>
AnyGenerator
<
G
.
Element
>