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_SLIST 23#define SYSTEM_STL_SLIST 24 25#ifdef HAVE_STL_INCLUDE_PATH 26 // TODO: use computed include file name 27 #include_next <forward_list> 28#elif defined(_MSC_VER) 29 #include <../../VC/include/list> 30 #define STLP4_SLIST_WITH_LIST 31 // MSVC's list would cause a lot of expression-result-unused warnings 32 // unless it is compiled in iterator-debugging mode. Silence this noise 33 #pragma warning(disable:4555) 34#else // fall back to boost/tr1 (forward_list or plain list) 35 #include <boost/config.hpp> 36 #ifndef BOOST_NO_0X_HDR_FORWARD_LIST 37 #include <boost/tr1/tr1/forward_list> 38 #else // fall back to the classic list 39 #include <boost/tr1/tr1/list> 40 #define STLP4_SLIST_WITH_LIST 41 #endif 42#endif 43 44 45#ifndef NO_STLPORT4_EMULATION 46 47#ifndef STLP4_SLIST_WITH_LIST 48 #define STLP4_SLIST_EMUBASE std::forward_list 49#else 50 #define STLP4_SLIST_EMUBASE std::list 51#endif 52 53namespace std 54{ 55using STLP4_SLIST_EMUBASE; 56 57// lame emulation of the pre-C++11 slist using the std::forward_list (or std::list) 58template< typename T, class A=allocator<T> > 59class slist : public STLP4_SLIST_EMUBASE<T,A> 60{ 61public: 62 typedef typename STLP4_SLIST_EMUBASE<T,A> _super; 63 typedef typename _super::iterator slist_mit; 64 typedef typename _super::const_iterator slist_cit; 65#ifndef STLP4_SLIST_WITH_LIST 66 slist_mit insert( slist_cit aI, const T& rT) { return _super::insert_after( aI, rT); } 67#else 68private: 69 size_t size() const; // prevent use of slist::size() as forward_list doesn't have a size() method 70#endif 71}; 72 73} 74 75#endif // NO_STLPORT4_EMULATION 76 77#endif 78 79