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