Skip to content

Instantly share code, notes, and snippets.

@loliGothicK
Last active February 18, 2018 01:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loliGothicK/070d812d9601849b0fafe566a879b30a to your computer and use it in GitHub Desktop.
Save loliGothicK/070d812d9601849b0fafe566a879b30a to your computer and use it in GitHub Desktop.
ラムダ式で再帰する方法のメモ
int main() {
// factorial
static_assert(
[impl=[](auto fac, unsigned n) {
if (!n) return 1u;
return n * fac(fac, n - 1);
}](unsigned n){
return impl(impl, n);
}(4)
== 24
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment