Skip to content

Instantly share code, notes, and snippets.

@dojeda
Created April 15, 2015 16:16
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 dojeda/e44426f5d69d49fa4c92 to your computer and use it in GitHub Desktop.
Save dojeda/e44426f5d69d49fa4c92 to your computer and use it in GitHub Desktop.
TIL about trigraphs in C and C++. Wat the fk!
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
int main(int , char *[]) {
vector<int> v1 = {0,1,2};
vector<int> v2 <%v1<:0:>,not v1<:1:>?2:1,2%>;
copy(v2.begin(),v2.end(),ostream_iterator<int>(cout,","));
cout << endl;
copy(v1.begin(),v1.end(),ostream_iterator<int>(cout,","));
cout << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment