0001 #define N_CHAR (0x80 - 0x20) //仅以可打印字符为例 0002 struct HuffChar { //Huffman(超)字符 0003 char ch; unsigned int weight; //字符、频率 0004 HuffChar ( char c = '^', unsigned int w = 0 ) : ch ( c ), weight ( w ) {}; 0005 HuffChar ( HuffChar const & hc ) : ch( hc.ch ), weight( hc.weight ) {}; 0006 // 比较器、判等器(各列其一,其余自行补充) 0007 bool operator< ( HuffChar const& hc ) { return weight > hc.weight; } //此处故意大小颠倒 0008 bool operator== ( HuffChar const& hc ) { return weight == hc.weight; } 0009 };