Skip to content

Instantly share code, notes, and snippets.

@caloni
Created October 15, 2020 23:47
Show Gist options
  • Save caloni/4561532940f9111deb8ddeb9fd058bbb to your computer and use it in GitHub Desktop.
Save caloni/4561532940f9111deb8ddeb9fd058bbb to your computer and use it in GitHub Desktop.
#include <string>
#include <iostream>
#define switch(a) auto switch_cmp = a;
#define case(a) if( switch_cmp == a )
int main()
{
std::string test = "3";
switch(test)
{
case("1")
{
std::cout << "1\n";
}
case("2")
{
std::cout << "2\n";
}
case("3")
{
std::cout << "3\n";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment