xref: /aoo41x/main/stlport/systemstl/slist (revision 7b77422c)
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_SLIST
23cdf0e10cSrcweir#define SYSTEM_STL_SLIST
24cdf0e10cSrcweir
25dee715a7SHerbert Dürr#ifdef HAVE_STL_INCLUDE_PATH
26dee715a7SHerbert Dürr	// TODO: use computed include file name
27dee715a7SHerbert Dürr	#include_next <forward_list>
28dee715a7SHerbert Dürr#elif defined(_MSC_VER)
29dee715a7SHerbert Dürr	#include <../../VC/include/list>
30dee715a7SHerbert Dürr	#define STLP4_SLIST_WITH_LIST
31dee715a7SHerbert Dürr	// MSVC's list would cause a lot of expression-result-unused warnings
32dee715a7SHerbert Dürr	// unless it is compiled in iterator-debugging mode. Silence this noise
33dee715a7SHerbert Dürr	#pragma warning(disable:4555)
34dee715a7SHerbert Dürr#else // fall back to boost/tr1 (forward_list or plain list)
35dee715a7SHerbert Dürr	#include <boost/config.hpp>
36dee715a7SHerbert Dürr	#ifndef BOOST_NO_0X_HDR_FORWARD_LIST
37dee715a7SHerbert Dürr		#include <boost/tr1/tr1/forward_list>
38dee715a7SHerbert Dürr	#else // fall back to the classic list
39dee715a7SHerbert Dürr		#include <boost/tr1/tr1/list>
40dee715a7SHerbert Dürr		#define STLP4_SLIST_WITH_LIST
41dee715a7SHerbert Dürr	#endif
42dee715a7SHerbert Dürr#endif
43dee715a7SHerbert Dürr
44dee715a7SHerbert Dürr
45dee715a7SHerbert Dürr#ifndef NO_STLPORT4_EMULATION
46cdf0e10cSrcweir
47dee715a7SHerbert Dürr#ifndef STLP4_SLIST_WITH_LIST
48dee715a7SHerbert Dürr    #define STLP4_SLIST_EMUBASE std::forward_list
49dee715a7SHerbert Dürr#else
50dee715a7SHerbert Dürr    #define STLP4_SLIST_EMUBASE std::list
51dee715a7SHerbert Dürr#endif
52cdf0e10cSrcweir
53cdf0e10cSrcweirnamespace std
54cdf0e10cSrcweir{
55dee715a7SHerbert Dürrusing STLP4_SLIST_EMUBASE;
56dee715a7SHerbert Dürr
57dee715a7SHerbert Dürr// lame emulation of the pre-C++11 slist using the std::forward_list (or std::list)
58dee715a7SHerbert Dürrtemplate< typename T, class A=allocator<T> >
59dee715a7SHerbert Dürrclass slist : public STLP4_SLIST_EMUBASE<T,A>
60dee715a7SHerbert Dürr{
61dee715a7SHerbert Dürrpublic:
62dee715a7SHerbert Dürr	typedef typename STLP4_SLIST_EMUBASE<T,A> _super;
63dee715a7SHerbert Dürr	typedef typename _super::iterator slist_mit;
64dee715a7SHerbert Dürr	typedef typename _super::const_iterator slist_cit;
65*7b77422cSHerbert Dürr
66*7b77422cSHerbert Dürrprivate: // prevent the use of methods not available in forward_list
67*7b77422cSHerbert Dürr	// signatures are intentionally mismatched to catch invocations
68*7b77422cSHerbert Dürr	size_t size() const;
69*7b77422cSHerbert Dürr	void insert( void) const;
70dee715a7SHerbert Dürr};
71cdf0e10cSrcweir
72dee715a7SHerbert Dürr}
73dee715a7SHerbert Dürr
74dee715a7SHerbert Dürr#endif // NO_STLPORT4_EMULATION
75cdf0e10cSrcweir
76cdf0e10cSrcweir#endif
77dee715a7SHerbert Dürr
78