/* * Copyright (c) 1997-1999 * Silicon Graphics Computer Systems, Inc. * * Copyright (c) 1999 * Boris Fomitchev * * This material is provided "as is", with absolutely no warranty expressed * or implied. Any use is at your own risk. * * Permission to use or copy this software for any purpose is hereby granted * without fee, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ #ifndef __SGI_STL_STRING #define __SGI_STL_STRING # ifndef __STL_CONFIG_H # include # endif #ifndef __SGI_STL_HASH_FUN_H # include #endif #if defined (__STL_USE_NATIVE_STRING) // STLport uses native string if new iostreams are being used, // as part of compiled runtime library depends on it. // Edit relative path below (or put full path) to get native included. // DO NOT use SGI with native unless you recompile // standard C++ runtime library with STLport installed. # if defined (__STL_MSVC) // lower #ifdef level //# include //# include //# include # include # endif # if defined ( __STL_REDEFINE_STD ) && defined (std) # undef std # define __STL_RESUME_STD_FOR_STRING # define __STLPORT_NATIVE_PASS # endif # include __STL_NATIVE_HEADER(string) # if defined ( __STL_RESUME_STD_FOR_STRING ) # undef __STL_RESUME_STD_FOR_STRING # define std __STLPORT_NAMESPACE # undef __STLPORT_NATIVE_PASS # endif # endif /* __STL_USE_NATIVE_STRING */ # if !defined (__STL_USE_NATIVE_STRING) || defined (__STL_USE_OWN_NAMESPACE) # include # endif /*__STL_USE_NATIVE_STRING */ # if defined (__STL_DEBUG) && ( !defined (__STL_USE_NATIVE_STRING) || defined (__STL_USE_OWN_NAMESPACE)) # define _Make_ptr(__i) (__i)._M_iterator # else # define _Make_ptr(__i) __i # endif __STL_BEGIN_NAMESPACE template __STL_INLINE_LOOP size_t __stl_string_hash(const basic_string<_CharT,_Traits,_Alloc>& __s) { unsigned long __h = 0; typedef typename basic_string<_CharT,_Traits,_Alloc>::const_pointer const_ptr; for ( const_ptr __i = _Make_ptr(__s.begin()); __i != _Make_ptr(__s.end()); ++__i) __h = 5*__h + *__i; return size_t(__h); } #if defined( __STL_CLASS_PARTIAL_SPECIALIZATION) && \ ! defined(CGAL_LIMITED_ITERATOR_TRAITS_SUPPORT) template struct hash > { size_t operator()(const basic_string<_CharT,_Traits,_Alloc>& __s) const { return __stl_string_hash(__s); } }; #else __STL_TEMPLATE_NULL struct __STL_CLASS_DECLSPEC hash { size_t operator()(const string& __s) const { return __stl_string_hash(__s); } }; # if defined (__STL_HAS_WCHAR_T) __STL_TEMPLATE_NULL struct __STL_CLASS_DECLSPEC hash { size_t operator()(const wstring& __s) const { return __stl_string_hash(__s); } }; # endif #endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ __STL_END_NAMESPACE // cleanup # if !(defined (__IBMCPP__) || defined (__xlC__)) # undef _Make_ptr # endif #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) #pragma reset woff 1174 #pragma reset woff 1375 #endif #endif /* __SGI_STL_STRING */ // Local Variables: // mode:C++ // End: