Created
September 17, 2022 01:47
-
-
Save MasWag/3c6b8941fae4b7d21fe3163428143fe3 to your computer and use it in GitHub Desktop.
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; | |
template<bool Flag> | |
class Hello { | |
public: | |
void hello() const { | |
if constexpr (Flag) { | |
std::cout << "Wahoooo\n"; | |
} else { | |
std::cout << "Yahoooo\n"; | |
} | |
} | |
}; | |
int main(int argc, char *argv[]) { | |
if (argc > 1) { | |
const auto hello = Hello<true>(); | |
hello.hello(); | |
} else { | |
const auto hello = Hello<false>(); | |
hello.hello(); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment