/**************************************************************
 * 
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 * 
 *************************************************************/

#ifndef SYSTEM_STL_SLIST
#define SYSTEM_STL_SLIST

#ifdef HAVE_STL_INCLUDE_PATH
	// TODO: use computed include file name
	#include_next <forward_list>
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
	#include <forward_list>
#elif defined(_MSC_VER)
	#include <../../VC/include/list>
	#define STLP4_SLIST_WITH_LIST
	// MSVC's list would cause a lot of expression-result-unused warnings
	// unless it is compiled in iterator-debugging mode. Silence this noise
	#pragma warning(disable:4555)
#else // fall back to boost/tr1 (forward_list or plain list)
	#include <boost/config.hpp>
	#ifndef BOOST_NO_0X_HDR_FORWARD_LIST
		#include <boost/tr1/tr1/forward_list>
	#else // fall back to the classic list
		#include <boost/tr1/tr1/list>
		#define STLP4_SLIST_WITH_LIST
	#endif
#endif


#ifndef NO_STLPORT4_EMULATION

#ifndef STLP4_SLIST_WITH_LIST
    #define STLP4_SLIST_EMUBASE std::forward_list
#else
    #define STLP4_SLIST_EMUBASE std::list
#endif

namespace std
{
using STLP4_SLIST_EMUBASE;

// lame emulation of the pre-C++11 slist using the std::forward_list (or std::list)
template< typename T >
class slist : public STLP4_SLIST_EMUBASE<T>
{
public:
	typedef typename STLP4_SLIST_EMUBASE<T> _super;
	typedef typename _super::iterator slist_mit;
	typedef typename _super::const_iterator slist_cit;

private: // prevent the use of methods not available in forward_list
	// signatures are intentionally mismatched to catch invocations
	size_t size() const;
	void insert( void) const;
};

}

#endif // NO_STLPORT4_EMULATION

#endif