1e76eebc6SAndrew Rist/************************************************************** 2cdf0e10cSrcweir * 3e76eebc6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4e76eebc6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5e76eebc6SAndrew Rist * distributed with this work for additional information 6e76eebc6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7e76eebc6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8e76eebc6SAndrew Rist * "License"); you may not use this file except in compliance 9e76eebc6SAndrew Rist * with the License. You may obtain a copy of the License at 10e76eebc6SAndrew Rist * 11e76eebc6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12e76eebc6SAndrew Rist * 13e76eebc6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14e76eebc6SAndrew Rist * software distributed under the License is distributed on an 15e76eebc6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16e76eebc6SAndrew Rist * KIND, either express or implied. See the License for the 17e76eebc6SAndrew Rist * specific language governing permissions and limitations 18e76eebc6SAndrew Rist * under the License. 19e76eebc6SAndrew Rist * 20e76eebc6SAndrew Rist *************************************************************/ 21cdf0e10cSrcweir 22cdf0e10cSrcweir#ifndef SYSTEM_STL_HASHSET 23cdf0e10cSrcweir#define SYSTEM_STL_HASHSET 24cdf0e10cSrcweir 25dee715a7SHerbert Dürr#ifdef HAVE_STL_INCLUDE_PATH 26dee715a7SHerbert Dürr // TODO: use computed include file name 27dee715a7SHerbert Dürr #include_next <unordered_set> 28*a718d426SHerbert Dürr#elif defined(__cplusplus) && (__cplusplus >= 201103L) 29*a718d426SHerbert Dürr #include <unordered_set> 30dee715a7SHerbert Dürr#elif defined(_MSC_VER) 31dee715a7SHerbert Dürr #include <../../VC/include/unordered_set> 32dee715a7SHerbert Dürr #define STLP4_EMUBASE_NS ::std::tr1 33dee715a7SHerbert Dürr#else // fall back to boost/tr1 34dee715a7SHerbert Dürr #include <boost/tr1/tr1/unordered_set> 35dee715a7SHerbert Dürr #define STLP4_EMUBASE_NS ::boost 36dee715a7SHerbert Dürr#endif 37cdf0e10cSrcweir 38cdf0e10cSrcweir 39dee715a7SHerbert Dürr#ifndef NO_STLPORT4_EMULATION 40cdf0e10cSrcweir 41cdf0e10cSrcweirnamespace std 42cdf0e10cSrcweir{ 43dee715a7SHerbert Dürr#ifdef STLP4_EMUBASE_NS 44dee715a7SHerbert Dürr using STLP4_EMUBASE_NS::hash; 45dee715a7SHerbert Dürr using STLP4_EMUBASE_NS::unordered_set; 46dee715a7SHerbert Dürr using STLP4_EMUBASE_NS::unordered_multiset; 47dee715a7SHerbert Dürr #undef STLP4_EMUBASE_NS 48cdf0e10cSrcweir#endif 49cdf0e10cSrcweir 50dee715a7SHerbert Dürr 51dee715a7SHerbert Dürrtemplate< 52dee715a7SHerbert Dürr typename __K, 53dee715a7SHerbert Dürr typename __H = hash<__K>, 54dee715a7SHerbert Dürr typename __E = equal_to<__K>, 55dee715a7SHerbert Dürr typename __A = allocator<__K> > 56dee715a7SHerbert Dürrclass hash_set 57dee715a7SHerbert Dürr: public unordered_set<__K,__H,__E,__A> 58dee715a7SHerbert Dürr{ 59dee715a7SHerbert Dürr typedef unordered_set<__K,__H,__E,__A> _super; 60dee715a7SHerbert Dürrpublic: 61dee715a7SHerbert Dürr hash_set( void) {} 62dee715a7SHerbert Dürr hash_set( size_t n) : _super(n) {} 63dee715a7SHerbert Dürr 64dee715a7SHerbert Dürr#ifdef BOOST_TR1_UNORDERED_SET_INCLUDED // workaround pre-BOOST_UNORDERED_USE_MOVE problem 65dee715a7SHerbert Dürr // in derived classes the copy assignment operator can only be declared implicitly if 66dee715a7SHerbert Dürr // its base class's assignment operator has the canonical signature. 67dee715a7SHerbert Dürr // boost's assignment operators don't have this canonical signature when move-semantics are enabled 68dee715a7SHerbert Dürr hash_set& operator=( const hash_set& r) { hash_set c(r); this->swap(c); return *this; } 69cdf0e10cSrcweir#endif 70dee715a7SHerbert Dürr 71dee715a7SHerbert Dürrprivate: 72dee715a7SHerbert Dürr // setting the hasher dynamically is not supported in the emulation! 73dee715a7SHerbert Dürr hash_set( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented 74dee715a7SHerbert Dürr}; 75dee715a7SHerbert Dürr 76dee715a7SHerbert Dürrtemplate< 77dee715a7SHerbert Dürr typename __K, 78dee715a7SHerbert Dürr typename __H = hash<__K>, 79dee715a7SHerbert Dürr typename __E = equal_to<__K>, 80dee715a7SHerbert Dürr typename __A = allocator<__K> > 81dee715a7SHerbert Dürrclass hash_multiset 82dee715a7SHerbert Dürr: public unordered_multiset<__K,__H,__E,__A> 83dee715a7SHerbert Dürr{ 84dee715a7SHerbert Dürr typedef unordered_multiset<__K,__H,__E,__A> _super; 85dee715a7SHerbert Dürrpublic: 86dee715a7SHerbert Dürr hash_multiset( void) {} 87dee715a7SHerbert Dürr hash_multiset( size_t n) : _super( n) {} 88dee715a7SHerbert Dürr 89dee715a7SHerbert Dürr#ifdef BOOST_TR1_UNORDERED_SET_INCLUDED // workaround pre-BOOST_UNORDERED_USE_MOVE problem 90dee715a7SHerbert Dürr // in derived classes the copy assignment operator can only be declared implicitly if 91dee715a7SHerbert Dürr // its base class's assignment operator has the canonical signature. 92dee715a7SHerbert Dürr // boost's assignment operators don't have this canonical signature when move-semantics are enabled 93dee715a7SHerbert Dürr hash_multiset& operator=( const hash_multiset& r) { hash_multiset c(r); this->swap(c); return *this; } 94dee715a7SHerbert Dürr#endif 95dee715a7SHerbert Dürr 96dee715a7SHerbert Dürrprivate: 97dee715a7SHerbert Dürr // setting the hasher dynamically is not supported in the emulation! 98dee715a7SHerbert Dürr hash_multiset( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented 99dee715a7SHerbert Dürr}; 100dee715a7SHerbert Dürr 101dee715a7SHerbert Dürr} // namespace std 102dee715a7SHerbert Dürr 103dee715a7SHerbert Dürr#endif // NO_STLPORT4_EMULATION 104dee715a7SHerbert Dürr 105dee715a7SHerbert Dürr#endif 106dee715a7SHerbert Dürr 107