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