110d565efSmrg // std::tr1::hash definitions with new string -*- C++ -*- 210d565efSmrg 3*ec02198aSmrg // Copyright (C) 2014-2020 Free Software Foundation, Inc. 410d565efSmrg // 510d565efSmrg // This file is part of the GNU ISO C++ Library. This library is free 610d565efSmrg // software; you can redistribute it and/or modify it under the 710d565efSmrg // terms of the GNU General Public License as published by the 810d565efSmrg // Free Software Foundation; either version 3, or (at your option) 910d565efSmrg // any later version. 1010d565efSmrg 1110d565efSmrg // This library is distributed in the hope that it will be useful, 1210d565efSmrg // but WITHOUT ANY WARRANTY; without even the implied warranty of 1310d565efSmrg // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1410d565efSmrg // GNU General Public License for more details. 1510d565efSmrg 1610d565efSmrg // Under Section 7 of GPL version 3, you are granted additional 1710d565efSmrg // permissions described in the GCC Runtime Library Exception, version 1810d565efSmrg // 3.1, as published by the Free Software Foundation. 1910d565efSmrg 2010d565efSmrg // You should have received a copy of the GNU General Public License and 2110d565efSmrg // a copy of the GCC Runtime Library Exception along with this program; 2210d565efSmrg // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 2310d565efSmrg // <http://www.gnu.org/licenses/>. 2410d565efSmrg 2510d565efSmrg #define _GLIBCXX_USE_CXX11_ABI 1 2610d565efSmrg #include <string> 2710d565efSmrg 2810d565efSmrg #if ! _GLIBCXX_USE_DUAL_ABI 2910d565efSmrg # error This file should not be compiled for this configuration. 3010d565efSmrg #endif 3110d565efSmrg 3210d565efSmrg #include <tr1/functional> 3310d565efSmrg namespace std _GLIBCXX_VISIBILITY(default) 3410d565efSmrg { 3510d565efSmrg namespace tr1 3610d565efSmrg { 3710d565efSmrg template<> 3810d565efSmrg size_t operator ()(string __s) const3910d565efSmrg hash<string>::operator()(string __s) const 4010d565efSmrg { return _Fnv_hash::hash(__s.data(), __s.length()); } 4110d565efSmrg 4210d565efSmrg template<> 4310d565efSmrg size_t operator ()(const string & __s) const4410d565efSmrg hash<const string&>::operator()(const string& __s) const 4510d565efSmrg { return _Fnv_hash::hash(__s.data(), __s.length()); } 4610d565efSmrg 4710d565efSmrg #ifdef _GLIBCXX_USE_WCHAR_T 4810d565efSmrg template<> 4910d565efSmrg size_t operator ()(wstring __s) const5010d565efSmrg hash<wstring>::operator()(wstring __s) const 5110d565efSmrg { return _Fnv_hash::hash(__s.data(), __s.length() * sizeof(wchar_t)); } 5210d565efSmrg 5310d565efSmrg template<> 5410d565efSmrg size_t operator ()(const wstring & __s) const5510d565efSmrg hash<const wstring&>::operator()(const wstring& __s) const 5610d565efSmrg { return _Fnv_hash::hash(__s.data(), __s.length() * sizeof(wchar_t)); } 5710d565efSmrg #endif 5810d565efSmrg } 5910d565efSmrg } 60