00001 /*-*- Mode: C++ -*-*/ 00002 00003 /* 00004 libmoot : moocow's part-of-speech tagging library 00005 Copyright (C) 2003-2004 by Bryan Jurish <moocow@ling.uni-potsdam.de> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2.1 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 /*---------------------------------------------------------------------- 00023 * Name: mootSTLHacks.h 00024 * Author: Bryan Jurish <moocow@ling.uni-potsdam.de> 00025 * Description: 00026 * + STL hacks for libmoot 00027 *----------------------------------------------------------------------*/ 00028 00029 #ifndef _MOOT_STL_HACKS_H 00030 #define _MOOT_STL_HACKS_H 00031 00032 #if defined(__GNUC__) 00033 # if __GNUC__ >= 3 00034 # if __GNUC_MINOR__ == 0 00035 # define moot_STL_NAMESPACE std 00036 # else 00037 # define moot_STL_NAMESPACE __gnu_cxx 00038 # endif /* __GNUC_MINOR__ == 0 */ 00039 # include <ext/hash_map> 00040 # include <ext/hash_set> 00041 # else /* __GNUC__ >= 3 */ 00042 # define moot_STL_NAMESPACE std 00043 # include <hash_map> 00044 # include <hash_set> 00045 # endif /* __GNUC__ >= 3 */ 00046 00047 # ifndef MOOT_HAVE_HASH_STRING 00048 /*-- hack for string hashing --*/ 00049 namespace moot_STL_NAMESPACE { 00050 template<> struct hash<std::string> { 00051 std::size_t operator()(const std::string &__s) const { 00052 return __stl_hash_string(__s.c_str()); 00053 } 00054 }; 00055 }; 00056 # endif // MOOT_HAVE_HASH_STRING 00057 00058 #else /* !defined(__GNUC__) */ 00059 # include <hash_map> 00060 # include <hash_set> 00061 # define moot_STL_NAMESPACE std 00062 #endif /* defined(__GNUC__) */ 00063 00064 /* Namespace definitions */ 00065 #define moot_NAMESPACE moot 00066 #define moot_BEGIN_NAMESPACE namespace moot { 00067 #define moot_END_NAMESPACE }; 00068 00069 00070 #endif // _MOOT_STL_HACKS_H