Skip to content

Instantly share code, notes, and snippets.

@marionette-of-u
Created January 8, 2015 19:09
Show Gist options
  • Select an option

  • Save marionette-of-u/097c9f82dedbe2a7839d to your computer and use it in GitHub Desktop.

Select an option

Save marionette-of-u/097c9f82dedbe2a7839d to your computer and use it in GitHub Desktop.
#include <set>
#include <iostream>
int main(){
std::set<int> single, first1, first2, second1, second2;
for(int i = 0x21; i <= 0x5B; ++i){
single.insert(i);
}
for(int i = 0x5D; i <= 0x7D; ++i){
single.insert(i);
}
for(int i = 0xA1; i <= 0xDF; ++i){
single.insert(i);
}
for(int i = 0x81; i <= 0x9F; ++i){
first1.insert(i);
}
for(int i = 0xE0; i <= 0xEF; ++i){
first2.insert(i);
}
for(int i = 0x40; i <= 0x7E; ++i){
second1.insert(i);
}
for(int i = 0x80; i <= 0x9E; ++i){
second1.insert(i);
}
for(int i = 0x9F; i <= 0xFC; ++i){
second2.insert(i);
}
auto put_table = [](const std::set<int> &s) -> void {
auto increment = [](std::set<int>::iterator i) -> std::set<int>::iterator{ ++i; return i; };
int count = 1;
for(auto i = s.begin(); i != s.end(); ++i, ++count){
std::cout << *i << (increment(i) != s.end() ? ",\t" : "") << (count % 4 == 0 && increment(i) != s.end() ? "\n" : "");
}
std::cout << std::endl;
};
std::cout << "---- single" << std::endl;
put_table(single);
std::cout << std::endl;
std::cout << "---- first 1" << std::endl;
put_table(first1);
std::cout << std::endl;
std::cout << "---- first 2" << std::endl;
put_table(first2);
std::cout << std::endl;
std::cout << "---- second 1" << std::endl;
put_table(second1);
std::cout << std::endl;
std::cout << "---- second 2" << std::endl;
put_table(second2);
std::cout << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment