Created
March 21, 2016 01:48
-
-
Save engelmarkus/f66f1b8956e4ed5b239a to your computer and use it in GitHub Desktop.
Test of C++ fold expressions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
constexpr auto all(auto&&... args) { | |
return (args && ...); | |
} | |
int main() { | |
cout << boolalpha; | |
cout << all() << endl; | |
cout << all(true) << endl; | |
cout << all(false) << endl; | |
cout << all(true, true) << endl; | |
cout << all(true, false) << endl; | |
cout << all(false, true, true) << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment