1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22#ifndef SYSTEM_STL_HASHMAP 23#define SYSTEM_STL_HASHMAP 24 25#ifdef HAVE_STL_INCLUDE_PATH 26 // TODO: use computed include file name 27 #include_next <unordered_map> 28#elif defined(__cplusplus) && (__cplusplus >= 201103L) 29 #include <unordered_map> 30#elif defined(_MSC_VER) 31 #pragma warning(push) 32 #pragma warning(disable:4555) 33 #include <../../VC/include/unordered_map> 34 #pragma warning(pop) 35 #define STLP4_EMUBASE_NS ::std::tr1 36#else // fall back to boost/tr1 37 #include <boost/tr1/tr1/unordered_map> 38 #define STLP4_EMUBASE_NS ::boost 39#endif 40 41 42#ifndef NO_STLPORT4_EMULATION 43 44namespace std 45{ 46#ifdef STLP4_EMUBASE_NS 47 using STLP4_EMUBASE_NS::hash; 48 using STLP4_EMUBASE_NS::unordered_map; 49 using STLP4_EMUBASE_NS::unordered_multimap; 50 #undef STLP4_EMUBASE_NS 51#endif 52 53 54template< 55 typename __K, 56 typename __T, 57 typename __H = hash<__K>, 58 typename __E = equal_to<__K>, 59 typename __A = allocator<pair<__K,__T> > > 60class hash_map 61: public unordered_map<__K,__T,__H,__E,__A> 62{ 63public: 64 typedef unordered_map<__K,__T,__H,__E,__A> _super; 65 66 hash_map( void) {} 67 hash_map( size_t n) : _super( n) {} 68 69private: 70 // setting the hasher dynamically is not supported in the emulation! 71 hash_map( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented 72}; 73 74template< 75 typename __K, 76 typename __T, 77 typename __H = hash<__K>, 78 typename __E = equal_to<__K>, 79 typename __A = allocator<pair<__K,__T> > > 80class hash_multimap 81: public unordered_multimap<__K,__T,__H,__E,__A> 82{ 83public: 84 typedef unordered_multimap<__K,__T,__H,__E,__A> _super; 85 86 hash_multimap( void) {} 87 hash_multimap( size_t n) : _super( n) {} 88 89private: 90 // setting the hasher dynamically is not supported in the emulation! 91 hash_multimap( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented 92}; 93 94} // namespace std 95 96#endif // NO_STLPORT4_EMULATION 97 98#endif 99 100