/* Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och mkcls - a program for making word classes . This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef MY_STL_H_DEFINED #define MY_STL_H_DEFINED #include #include #if __GNUC__>2 #include using __gnu_cxx::hash_map; using __gnu_cxx::hash; #else #include #endif #include using namespace std; #define over_string(a,i) for(unsigned int i=0;i int Hash(const pair&a) { return Hash(a.first)+4*Hash(a.second); } template istream& operator>>(istream &in,pair &ir) { char c; do in.get(c); while (in && isspace(c)); if (!in) return in; if (c != '(') in.putback(c); in >> ir.first; do in.get(c); while (isspace(c)); if (c != ',') in.putback(c); in >> ir.second; do in.get(c); while (c == ' '); if (c != ')') in.putback(c); return in; } template ostream& operator<<(ostream &out,const pair &ir) { out << "(" << ir.first << "," << ir.second << ")"; return out; } inline int Hash(const string& s) { int sum=0; string::const_iterator i=s.begin(),end=s.end(); for(;i!=end;i++)sum=5*sum+(*i); return sum; } void printSpaces(ostream&out,int n); void mysplit(const string &s,string &s1,string &s2); string untilChar(const string&s,char c); template class tri { public: A a; B b; C c; tri(){}; tri(const A&_a,const B&_b,const C&_c) : a(_a),b(_b),c(_c) {} }; template bool operator==(const tri&x,const tri&y) { return x.a==y.a&&x.b==y.b&&x.c==y.c;} template bool operator<(const tri&x,const tri&y) { if(x.a