matchInto

Lua-like pattern matching.

bool
matchInto
(
S
R
Args...
)
(
S s
,
R r
,
ref Args args
)

Examples

string name, fruit;
int count;
assert("Mary has 5 apples"
	.matchInto(`^(\w+) has (\d+) (\w+)$`, name, count, fruit));
assert(name == "Mary" && count == 5 && fruit == "apples");

Meta