struct tcharset{ bool charset[256]; .. bool checkchar(char ch){ return charset[ch]; } void include(char ch){ charset[ch] = true; } .. } tcharset tcharset_union(tcharset a, tcharset b){ tcharset tmp; for (unsigned int i=0;i<256;i++){ if (a.checkchar(i) || b.checkchar(i)){ // tmp.include(i); } } return tmp; }