summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNasser Grainawi <nasser@codeaurora.org>2010-11-12 07:41:33 -0800
committerJack Profit <jprofit@codeaurora.org>2010-11-16 11:17:27 -0800
commit95a15ba80639ed2289fdd0babef5408711c47d58 (patch)
treeba74a07a294ab1932e58dfcc52f8b236f5fc8aa6
parent2ab2953ece9098e0bb349632492476285531da69 (diff)
downloadandroid_external_connectivity-95a15ba80639ed2289fdd0babef5408711c47d58.tar.gz
android_external_connectivity-95a15ba80639ed2289fdd0babef5408711c47d58.tar.bz2
android_external_connectivity-95a15ba80639ed2289fdd0babef5408711c47d58.zip
Add additional stlport files
-rwxr-xr-xstlport/configure333
-rw-r--r--stlport/stlport/algorithm62
-rw-r--r--stlport/stlport/bitset70
-rw-r--r--stlport/stlport/cctype47
-rw-r--r--stlport/stlport/cfloat45
-rw-r--r--stlport/stlport/cstdio53
-rw-r--r--stlport/stlport/cstring47
-rw-r--r--stlport/stlport/deque57
-rw-r--r--stlport/stlport/exception68
-rw-r--r--stlport/stlport/float.h52
-rw-r--r--stlport/stlport/hash_map49
-rw-r--r--stlport/stlport/hash_set49
-rw-r--r--stlport/stlport/limits50
-rw-r--r--stlport/stlport/memory130
-rw-r--r--stlport/stlport/queue57
-rw-r--r--stlport/stlport/slist54
-rw-r--r--stlport/stlport/stack57
-rw-r--r--stlport/stlport/stl/_algo.c2028
-rw-r--r--stlport/stlport/stl/_algo.h745
-rw-r--r--stlport/stlport/stl/_auto_ptr.h133
-rw-r--r--stlport/stlport/stl/_bitset.c235
-rw-r--r--stlport/stlport/stl/_bitset.h880
-rw-r--r--stlport/stlport/stl/_cctype.h49
-rw-r--r--stlport/stlport/stl/_ctraits_fns.h91
-rw-r--r--stlport/stlport/stl/_cwchar.h342
-rw-r--r--stlport/stlport/stl/_deque.c823
-rw-r--r--stlport/stlport/stl/_deque.h1115
-rw-r--r--stlport/stlport/stl/_exception.h193
-rw-r--r--stlport/stlport/stl/_function.h433
-rw-r--r--stlport/stlport/stl/_function_adaptors.h783
-rw-r--r--stlport/stlport/stl/_hash_fun.h146
-rw-r--r--stlport/stlport/stl/_hash_map.h500
-rw-r--r--stlport/stlport/stl/_hash_set.h495
-rw-r--r--stlport/stlport/stl/_hashtable.c553
-rw-r--r--stlport/stlport/stl/_hashtable.h658
-rw-r--r--stlport/stlport/stl/_heap.c246
-rw-r--r--stlport/stlport/stl/_heap.h125
-rw-r--r--stlport/stlport/stl/_iosfwd.h159
-rw-r--r--stlport/stlport/stl/_limits.c405
-rw-r--r--stlport/stlport/stl/_limits.h519
-rw-r--r--stlport/stlport/stl/_mbstate_t.h41
-rw-r--r--stlport/stlport/stl/_queue.h268
-rw-r--r--stlport/stlport/stl/_raw_storage_iter.h80
-rw-r--r--stlport/stlport/stl/_relops_hash_cont.h13
-rw-r--r--stlport/stlport/stl/_slist.c231
-rw-r--r--stlport/stlport/stl/_slist.h914
-rw-r--r--stlport/stlport/stl/_slist_base.c104
-rw-r--r--stlport/stlport/stl/_slist_base.h90
-rw-r--r--stlport/stlport/stl/_stack.h133
-rw-r--r--stlport/stlport/stl/_string.c673
-rw-r--r--stlport/stlport/stl/_string.h1182
-rw-r--r--stlport/stlport/stl/_string_base.h231
-rw-r--r--stlport/stlport/stl/_string_fwd.h60
-rw-r--r--stlport/stlport/stl/_string_hash.h71
-rw-r--r--stlport/stlport/stl/_string_npos.h27
-rw-r--r--stlport/stlport/stl/_string_operators.h602
-rw-r--r--stlport/stlport/stl/_tempbuf.c57
-rw-r--r--stlport/stlport/stl/_tempbuf.h167
-rw-r--r--stlport/stlport/stl/char_traits.h278
-rw-r--r--stlport/stlport/stl/config/_auto_link.h61
-rw-r--r--stlport/stlport/stl/config/_detect_dll_or_lib.h74
-rw-r--r--stlport/stlport/stl/config/_epilog.h29
-rw-r--r--stlport/stlport/stl/config/_feedback.h43
-rw-r--r--stlport/stlport/stl/config/_msvc.h265
-rw-r--r--stlport/stlport/stl/config/_native_headers.h50
-rw-r--r--stlport/stlport/stl/config/_prolog.h43
-rw-r--r--stlport/stlport/stl/config/_warnings_off.h51
-rw-r--r--stlport/stlport/stl/config/_windows.h291
-rw-r--r--stlport/stlport/string59
-rw-r--r--stlport/stlport/utility60
-rw-r--r--stlport/stlport/wchar.h64
71 files changed, 19248 insertions, 0 deletions
diff --git a/stlport/configure b/stlport/configure
new file mode 100755
index 0000000..2f48511
--- /dev/null
+++ b/stlport/configure
@@ -0,0 +1,333 @@
+#!/bin/sh
+
+# Time-stamp: <08/06/07 15:22:19 yeti>
+
+base=`cd \`dirname $0\`; echo $PWD`
+
+configmak=$base/build/Makefiles/gmake/config.mak
+
+write_option() {
+ target=`echo $1 | sed -e 's/^[^=]*=//'`
+ echo $2 := $3$target >> ${configmak}
+}
+
+write_over_option() {
+ target=`echo $1 | sed -e 's/^[^=]*=//'`
+ echo $2 ?= $target >> ${configmak}
+}
+
+print_help() {
+ cat <<EOF
+Configuration utility.
+
+Usage:
+
+ configure [options]
+
+Available options:
+
+ --prefix=<dir> base install path (/usr/local/)
+ --bindir=<dir> install path for executables (PREFIX/bin)
+ --libdir=<dir> install path for libraries (PREFIX/lib)
+ --includedir=<dir> install path for headers (PREFIX/include)
+
+ --target=<target> target platform (cross-compiling)
+
+ --help print this help message and exit
+
+ --with-stlport=<dir> use STLport in catalog <dir>
+ --without-stlport compile without STLport
+ --with-boost=<dir> use boost headers in catalog <dir>
+ --with-system-boost use boost installed on this system
+ --with-msvc=<dir> use MS VC from this catalog
+ --with-mssdk=<dir> use MS SDK from this catalog
+ --with-extra-cxxflags=<options>
+ pass extra options to C++ compiler
+ --with-extra-cflags=<options>
+ pass extra options to C compiler
+ --with-extra-ldflags=<options>
+ pass extra options to linker (via C/C++)
+ --use-static-gcc use static gcc libs instead of shared libgcc_s (useful for gcc compiler,
+ that was builded with --enable-shared [default]; if compiler was builded
+ with --disable-shared, static libraries will be used in any case)
+ --clean remove custom settings (file ${configmak})
+ and use default values
+ --with-cxx=<name> use <name> as C++ compiler (use --target= for cross-compilation)
+ --with-cc=<name> use <name> as C compiler (use --target= for cross-compilation)
+ --use-compiler-family=<name> use compiler family; one of:
+ gcc GNU compilers (default)
+ icc Intel compilers
+ aCC HP's aCC compilers
+ CC SunPro's CC compilers
+ bcc Borland's compilers
+ --without-debug don't build debug variant
+ --without-stldebug don't build STLport's STLP_DEBUG mode
+ --enable-static build static
+ --disable-shared don't build shared
+ --with-lib-motif=<motif>
+ Use this option to customize the generated library name.
+ The motif will be used in the last place before version information,
+ separated by an underscore, ex:
+ stlportd_MOTIF.5.0.lib
+ stlportstld_static_MOTIF.5.1.lib
+ --without-thread Per default STLport libraries are built in order to be usable
+ in a multithreaded context. If you don't need this you can ask
+ for a not thread safe version with this option.
+ --without-rtti Disable RTTI when building libraries.
+ --with-static-rtl
+ --with-dynamic-rtl
+ Enables usage of static (libc.lib family) or dynamic (msvcrt.lib family)
+ C/C++ runtime library when linking with STLport. If you want your appli/dll
+ to link statically with STLport but using the dynamic C runtime use
+ --with-dynamic-rtl; if you want to link dynamicaly with STLport but using the
+ static C runtime use --with-static-rtl. See README.options for details.
+ Don't forget to signal the link method when building your appli or dll, in
+ stlport/stl/config/host.h set the following macro depending on the configure
+ option:
+ --with-static-rtl -> _STLP_USE_DYNAMIC_LIB"
+ --with-dynamic-rtl -> _STLP_USE_STATIC_LIB"
+ --windows-platform=<name>
+ Targetted OS when building for Windows; one of:
+ win95 Windows 95
+ win98 Windows 98
+ winxp Windows XP and later (default)
+
+Environment variables:
+
+ \$CXX C++ compiler name (use --target= for cross-compilation)
+ \$CC C compiler name (use --target= for cross-compilation)
+ \$CXXFLAGS pass extra options to C++ compiler
+ \$CFLAGS pass extra options to C compiler
+ \$LDFLAGS pass extra options to linker (via C/C++)
+
+ Options has preference over environment variables.
+
+EOF
+}
+
+default_settings () {
+ # if [ "$boost_set" = "" ]; then
+ # write_option "${PWD}/external/boost" BOOST_DIR
+ # fi
+
+ # if [ -z "${stlport_set}" ]; then
+ # write_over_option "$base" STLPORT_DIR
+ # fi
+
+ # Set in Makefiles/gmake/top.mak
+ if [ -z "${compiler_family_set}" ]; then
+ # write_option gcc COMPILER_NAME
+ echo include gcc.mak > ${base}/build/lib/Makefile
+ echo include gcc.mak > ${base}/build/test/unit/Makefile
+ echo include gcc.mak > ${base}/build/test/eh/Makefile
+ fi
+
+ # Set in Makefiles/gmake/targetdirs.mak
+ # if [ -z "${prefix_set}" ]; then
+ # write_option "/usr/local" BASE_INSTALL_DIR '${DESTDIR}'
+ # fi
+}
+
+[ $# -eq 0 ] && { >${configmak}; default_settings; exit 0; }
+
+for a in $@ ; do
+ case $a in
+ --help)
+ print_help
+ exit 0
+ ;;
+ --clean)
+ rm -f ${configmak}
+ exit 0
+ ;;
+ esac
+done
+
+>${configmak}
+
+while :
+do
+ case $# in
+ 0)
+ break
+ ;;
+ esac
+ option="$1"
+ shift
+ case $option in
+ --target=*)
+ write_option "$option" TARGET_OS
+ target_set=y
+ ;;
+ --with-stlport=*)
+ write_option "$option" STLPORT_DIR
+ stlport_set=y
+ ;;
+ --without-stlport)
+ write_option 1 WITHOUT_STLPORT
+ stlport_set=y
+ ;;
+ --with-boost=*)
+ write_option "$option" BOOST_DIR
+ ;;
+ --with-system-boost)
+ write_option 1 USE_SYSTEM_BOOST
+ ;;
+ --with-msvc=*)
+ write_option "$option" MSVC_DIR
+ ;;
+ --with-mssdk=*)
+ write_option "$option" MSSDK_DIR
+ ;;
+ --with-extra-cxxflags=*)
+ write_option "$option" EXTRA_CXXFLAGS
+ cxxflags_set=y
+ ;;
+ --with-extra-cflags=*)
+ write_option "$option" EXTRA_CFLAGS
+ cflags_set=y
+ ;;
+ --with-extra-ldflags=*)
+ write_option "$option" EXTRA_LDFLAGS
+ ldflags_set=y
+ ;;
+ --with-lib-motif=*)
+ echo "Using $option in generated library names"
+ write_option "$option" LIB_MOTIF
+ ;;
+ --without-thread)
+ write_option 1 WITHOUT_THREAD
+ ;;
+ --without-rtti)
+ write_option 1 WITHOUT_RTTI
+ ;;
+ --with-dynamic-rtl)
+ write_option 1 WITH_DYNAMIC_RTL
+ ;;
+ --with-static-rtl)
+ write_option 1 WITH_STATIC_RTL
+ ;;
+ --use-static-gcc)
+ write_option 1 USE_STATIC_LIBGCC
+ ;;
+ --without-debug)
+ write_option 1 _NO_DBG_BUILD
+ ;;
+ --without-stldebug)
+ write_option 1 _NO_STLDBG_BUILD
+ ;;
+ --enable-static)
+ write_option 1 _STATIC_BUILD
+ ;;
+ --disable-shared)
+ write_option 1 _NO_SHARED_BUILD
+ ;;
+ --with-cxx=*)
+ write_option "$option" _FORCE_CXX
+ cxx_set=y
+ ;;
+ --with-cc=*)
+ write_option "$option" _FORCE_CC
+ cc_set=y
+ ;;
+ --use-compiler-family=*)
+ case `echo $option | sed -e 's/^[^=]*=//'` in
+ gcc|icc|aCC|CC|bcc|dmc)
+ target=`echo $option | sed -e 's/^[^=]*=//'`
+ echo COMPILER_NAME := $target >> ${configmak}
+ echo include $target.mak > ${base}/build/lib/Makefile
+ echo include $target.mak > ${base}/build/test/unit/Makefile
+ echo include $target.mak > ${base}/build/test/eh/Makefile
+ ;;
+ *)
+ echo "Not supported compilers family"
+ exit -1
+ ;;
+ esac
+ compiler_family_set=y
+ ;;
+ --prefix=*)
+ write_option "$option" BASE_INSTALL_DIR '${DESTDIR}'
+ prefix_set=y
+ ;;
+ --bindir=*)
+ write_option "$option" INSTALL_BIN_DIR '${DESTDIR}'
+ ;;
+ --libdir=*)
+ write_option "$option" INSTALL_LIB_DIR '${DESTDIR}'
+ ;;
+ --includedir=*)
+ write_option "$option" INSTALL_HDR_DIR '${DESTDIR}'
+ ;;
+ --windows-platform=*)
+ case `echo $option | sed -e 's/^[^=]*=//'` in
+ win95)
+ write_option 0x0400 WINVER
+ ;;
+ win98)
+ write_option 0x0410 WINVER
+ ;;
+ winxp)
+ write_option 0x0501 WINVER
+ ;;
+ *)
+ echo "Not supported windows platform"
+ exit -1
+ ;;
+ esac
+ ;;
+ *)
+ echo "Unknown configuration option '$option'"
+ exit -1
+ ;;
+ esac
+done
+
+if [ -n "${CXX}" ]; then
+ if [ -n "${cxx_set}" ]; then
+ echo "Both --with-cxx and \$CXX set, using the first"
+ elif [ -z "${target_set}" ]; then
+ write_option "${CXX}" _FORCE_CXX
+ else
+ echo "For cross-compilation with gcc use --target option only"
+ fi
+ if [ -z "${CC}" -a -z "${cc_set}" ]; then
+ echo "\$CXX set, but I don't see \$CC!"
+ fi
+fi
+
+if [ -n "${CC}" ]; then
+ if [ -n "${cxx_set}" ]; then
+ echo "Both --with-cc and \$CC set, using the first"
+ else
+ write_option "${CC}" _FORCE_CC
+ fi
+fi
+
+if [ -n "${CXXFLAGS}" ]; then
+ if [ -z "${cxxflags_set}" ]; then
+ write_option "${CXXFLAGS}" EXTRA_CXXFLAGS
+ else
+ echo "Both --with-extra-cxxflags and \$CXXFLAGS set, using the first"
+ fi
+fi
+
+if [ -n "${CFLAGS}" ]; then
+ if [ -z "${cflags_set}" ]; then
+ write_option "${CFLAGS}" EXTRA_CFLAGS
+ else
+ echo "Both --with-extra-cflags and \$CFLAGS set, using the first"
+ fi
+fi
+
+if [ -n "${LDFLAGS}" ]; then
+ if [ -z "${ldflags_set}" ]; then
+ write_option "${LDFLAGS}" EXTRA_LDFLAGS
+ else
+ echo "Both --with-extra-ldflags and \$LDFLAGS set, using the first"
+ fi
+fi
+
+# default settings
+
+default_settings
diff --git a/stlport/stlport/algorithm b/stlport/stlport/algorithm
new file mode 100644
index 0000000..c653d8c
--- /dev/null
+++ b/stlport/stlport/algorithm
@@ -0,0 +1,62 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_ALGORITHM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1
+# include <stl/_prolog.h>
+# define _STLP_ALGORITHM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1)
+# ifndef _STLP_INTERNAL_CSTDIO
+// remove() conflicts, <cstdio> should always go first
+# include <stl/_cstdio.h>
+# endif
+
+# ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <algorithm>
+# else
+# include _STLP_NATIVE_HEADER(algorithm)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ALGORITHM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/bitset b/stlport/stlport/bitset
new file mode 100644
index 0000000..1d7fcf3
--- /dev/null
+++ b/stlport/stlport/bitset
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_BITSET
+
+// This implementation of bitset<> has a second template parameter,
+// _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE
+// THIS FEATURE*. It is experimental, and it may be removed in
+// future releases.
+
+// A bitset of size N, using words of type _WordT, will have
+// N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high-
+// order bits in the highest word.) It is a class invariant
+// of class bitset<> that those unused bits are always zero.
+
+// Most of the actual code isn't contained in bitset<> itself, but in the
+// base class _Base_bitset. The base class works with whole words, not with
+// individual bits. This allows us to specialize _Base_bitset for the
+// important special case where the bitset is only a single word.
+
+// The C++ standard does not define the precise semantics of operator[].
+// In this implementation the const version of operator[] is equivalent
+// to test(), except that it does no range checking. The non-const version
+// returns a reference to a bit, again without doing any range checking.
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2
+# include <stl/_prolog.h>
+# define _STLP_BITSET
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2)
+# ifndef _STLP_INTERNAL_BITSET
+# include <stl/_bitset.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x2) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <bitset>
+# else
+# include _STLP_NATIVE_HEADER(bitset)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_BITSET */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/cctype b/stlport/stlport/cctype
new file mode 100644
index 0000000..513512e
--- /dev/null
+++ b/stlport/stlport/cctype
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CCTYPE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x104
+# define _STLP_CCTYPE
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x104 )
+# ifndef _STLP_INTERNAL_CCTYPE
+# include <stl/_cctype.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x104) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cctype>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cctype)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x104 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CCTYPE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/cfloat b/stlport/stlport/cfloat
new file mode 100644
index 0000000..cb2e0cd
--- /dev/null
+++ b/stlport/stlport/cfloat
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CFLOAT
+#define _STLP_CFLOAT
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x106
+# include <stl/_prolog.h>
+#endif
+
+// Borland defines some implementation constants in std:: namespace,
+// we do not want to import them.
+#if defined (_STLP_USE_NEW_C_HEADERS) && !defined (__BORLANDC__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cfloat>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cfloat)
+# endif
+#else
+# include <float.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x106 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CFLOAT */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/cstdio b/stlport/stlport/cstdio
new file mode 100644
index 0000000..e20c8ff
--- /dev/null
+++ b/stlport/stlport/cstdio
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTDIO
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x15
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x15) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_CSTDIO
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x15) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x15) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdio>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdio)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x15)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/cstring b/stlport/stlport/cstring
new file mode 100644
index 0000000..d5cf58d
--- /dev/null
+++ b/stlport/stlport/cstring
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTRING
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x117
+# define _STLP_CSTRING
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x117)
+# ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x117) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstring>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstring)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x117)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTRING */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/deque b/stlport/stlport/deque
new file mode 100644
index 0000000..448f159
--- /dev/null
+++ b/stlport/stlport/deque
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_DEQUE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x22
+# include <stl/_prolog.h>
+# define _STLP_DEQUE
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x22)
+# ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x22) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <deque>
+# else
+# include _STLP_NATIVE_HEADER(deque)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x22)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_DEQUE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/exception b/stlport/stlport/exception
new file mode 100644
index 0000000..47822e9
--- /dev/null
+++ b/stlport/stlport/exception
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+// This header exists solely for portability. Normally it just includes
+// the native header <exception>.
+
+#ifndef _STLP_EXCEPTION
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x423
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x423)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_EXCEPTION
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x423) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x423) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+/* If we are here it means that we are in an include called
+ * from the native lib which means that we can simply forward this
+ * call to the native exception header:
+ */
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <exception>
+# else
+# if defined (__DMC__) && (_STLP_OUTERMOST_HEADER_ID == 0x874)
+// Workaround to DMC harcoded typeinfo.h inclusion.
+# include <../include/exception>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
+# endif
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x423)
+# if !defined(_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_EXCEPTION */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/float.h b/stlport/stlport/float.h
new file mode 100644
index 0000000..70fe3ad
--- /dev/null
+++ b/stlport/stlport/float.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x203
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x203) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x203)
+# error This header is only reentrant once, it should be modified if it has to be included more.
+#endif
+
+#if defined (_STLP_WCE_EVC3)
+struct _exception;
+#endif
+
+#if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <float.h>
+#else
+# include _STLP_NATIVE_C_HEADER(float.h)
+#endif
+
+#if !defined (__linux__)
+# if defined(__BORLANDC__) && defined (__cplusplus) && (__BORLANDC__ >= 0x560)
+_STLP_BEGIN_NAMESPACE
+using ::_max_dble;
+using ::_max_flt;
+using ::_max_ldble;
+using ::_tiny_ldble;
+_STLP_END_NAMESPACE
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x203)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
diff --git a/stlport/stlport/hash_map b/stlport/stlport/hash_map
new file mode 100644
index 0000000..0e2422d
--- /dev/null
+++ b/stlport/stlport/hash_map
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_HASH_MAP
+#define _STLP_HASH_MAP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x4028
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#if defined (_STLP_NO_EXTENSIONS)
+/* Comment following if you want to use hash constainers even if you ask for
+ * no extension.
+ */
+# error The hash_map and hash_multimap class are STLport extensions.
+#endif
+
+#include <stl/_hash_map.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x4028)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_HASH_MAP */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/hash_set b/stlport/stlport/hash_set
new file mode 100644
index 0000000..0fc89ec
--- /dev/null
+++ b/stlport/stlport/hash_set
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_HASH_SET
+#define _STLP_HASH_SET
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x4029
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#if defined (_STLP_NO_EXTENSIONS)
+/* Comment following if you want to use hash constainers even if you ask for
+ * no extension.
+ */
+# error The hash_set and hash_multiset class are STLport extensions.
+#endif
+
+#include <stl/_hash_set.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x4029)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_HASH_SET */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/limits b/stlport/stlport/limits
new file mode 100644
index 0000000..5333b14
--- /dev/null
+++ b/stlport/stlport/limits
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_LIMITS
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x39
+# include <stl/_prolog.h>
+# define _STLP_LIMITS
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x39)
+# ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x39) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <limits>
+# else
+# include _STLP_NATIVE_HEADER(limits)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x39)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_LIMITS */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/memory b/stlport/stlport/memory
new file mode 100644
index 0000000..3c0ceb3
--- /dev/null
+++ b/stlport/stlport/memory
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_MEMORY
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x46
+# include <stl/_prolog.h>
+# define _STLP_MEMORY
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x46)
+# ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+# endif
+
+# ifndef _STLP_INTERNAL_TEMPBUF_H
+# include <stl/_tempbuf.h>
+# endif
+
+# ifndef _STLP_INTERNAL_RAW_STORAGE_ITER_H
+# include <stl/_raw_storage_iter.h>
+# endif
+
+# include <stl/_auto_ptr.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x46) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (__MSL__)
+# include _STLP_NATIVE_HEADER(limits)
+# endif
+
+# if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+# define BOOST_TR1_MEMORY_INCLUDED
+# define BOOST_TR1_FULL_MEMORY_INCLUDED
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <memory>
+# else
+# include _STLP_NATIVE_HEADER(memory)
+# endif
+
+# if defined (__MSL__) && (__MSL__ >= 0x2405 && __MSL__ < 0x5201)
+/* 980401 vss MSL 2.4 Pro 3 Release */
+# include <new_mem.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x46)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+
+namespace boost {
+
+class bad_weak_ptr;
+template<class T> class shared_ptr;
+template<class T> class weak_ptr;
+template<class T> class enable_shared_from_this;
+template<class D, class T> D * get_deleter(shared_ptr<T> const & p);
+template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r);
+template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r);
+template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r);
+template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b);
+template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b);
+
+namespace detail{
+class shared_count;
+class weak_count;
+}
+
+} // namespace boost
+
+# ifndef BOOST_SHARED_PTR_HPP_INCLUDED
+# include <boost/shared_ptr.hpp>
+# endif
+# ifndef BOOST_WEAK_PTR_HPP_INCLUDED
+# include <boost/weak_ptr.hpp>
+# endif
+# ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
+# include <boost/enable_shared_from_this.hpp>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+namespace tr1 {
+
+using ::boost::bad_weak_ptr;
+using ::boost::shared_ptr;
+using ::boost::swap;
+using ::boost::static_pointer_cast;
+using ::boost::dynamic_pointer_cast;
+using ::boost::const_pointer_cast;
+using ::boost::get_deleter;
+using ::boost::weak_ptr;
+using ::boost::enable_shared_from_this;
+
+// shared_ptr IO
+// weak_ptr IO
+
+} // namespace tr1
+
+_STLP_END_NAMESPACE
+
+#endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */
+
+#endif /* _STLP_MEMORY */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stlport/queue b/stlport/stlport/queue
new file mode 100644
index 0000000..6acd63f
--- /dev/null
+++ b/stlport/stlport/queue
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_QUEUE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x53
+# include <stl/_prolog.h>
+# define _STLP_QUEUE
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x53)
+# ifndef _STLP_INTERNAL_QUEUE_H
+# include <stl/_queue.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x53) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <queue>
+# else
+# include _STLP_NATIVE_HEADER(queue)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x53)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_QUEUE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/slist b/stlport/stlport/slist
new file mode 100644
index 0000000..c1930e4
--- /dev/null
+++ b/stlport/stlport/slist
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+#ifndef _STLP_SLIST
+#define _STLP_SLIST
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x58
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#if defined (_STLP_NO_EXTENSIONS)
+/* Comment following if you want to use the slist constainer even if you ask for
+ * no extension.
+ */
+# error The slist class is an STLport extension.
+#endif
+
+#ifndef _STLP_INTERNAL_SLIST_H
+# include <stl/_slist.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+//This is not a Standard header, it might failed for most of
+//the compilers so we comment it for the moment. Should be uncommented
+//on a compiler basis.
+//# include _STLP_NATIVE_HEADER(slist)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x58)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_SLIST */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stack b/stlport/stlport/stack
new file mode 100644
index 0000000..253b31d
--- /dev/null
+++ b/stlport/stlport/stack
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STACK
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x60
+# include <stl/_prolog.h>
+# define _STLP_STACK
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x60)
+# ifndef _STLP_INTERNAL_STACK_H
+# include <stl/_stack.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x60) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stack>
+# else
+# include _STLP_NATIVE_HEADER(stack)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x60)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STACK */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_algo.c b/stlport/stlport/stl/_algo.c
new file mode 100644
index 0000000..b58b92d
--- /dev/null
+++ b/stlport/stlport/stl/_algo.c
@@ -0,0 +1,2028 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_ALGO_C
+#define _STLP_ALGO_C
+
+#if !defined (_STLP_INTERNAL_ALGO_H)
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_INTERNAL_TEMPBUF_H
+# include <stl/_tempbuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Distance, class _Compare>
+void __merge_without_buffer(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance __len1, _Distance __len2,
+ _Compare __comp);
+
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _BidirectionalIter3, class _Compare>
+_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1,
+ _BidirectionalIter1 __last1,
+ _BidirectionalIter2 __first2,
+ _BidirectionalIter2 __last2,
+ _BidirectionalIter3 __result,
+ _Compare __comp);
+
+template <class _Tp>
+#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 ))
+inline
+#endif
+const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) {
+ if (__a < __b)
+ if (__b < __c)
+ return __b;
+ else if (__a < __c)
+ return __c;
+ else
+ return __a;
+ else if (__a < __c)
+ return __a;
+ else if (__b < __c)
+ return __c;
+ else
+ return __b;
+}
+
+template <class _Tp, class _Compare>
+#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 ))
+inline
+#endif
+const _Tp&
+__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) {
+ if (__comp(__a, __b)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__b, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ if (__comp(__b, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __b;
+ }
+ else if (__comp(__a, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __c;
+ }
+ else
+ return __a;
+ }
+ else if (__comp(__a, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __a;
+ }
+ else if (__comp(__b, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __c;
+ }
+ else
+ return __b;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ // Test for empty ranges
+ if (__first1 == __last1 || __first2 == __last2)
+ return __first1;
+
+ // Test for a pattern of length 1.
+ _ForwardIter2 __p1(__first2);
+
+ if ( ++__p1 == __last2 )
+ return find(__first1, __last1, *__first2);
+
+ // General case.
+
+ for ( ; ; ) { // __first1 != __last1 will be checked in find below
+ __first1 = find(__first1, __last1, *__first2);
+ if (__first1 == __last1)
+ return __last1;
+
+ _ForwardIter2 __p = __p1;
+ _ForwardIter1 __current = __first1;
+ if (++__current == __last1)
+ return __last1;
+
+ while (*__current == *__p) {
+ if (++__p == __last2)
+ return __first1;
+ if (++__current == __last1)
+ return __last1;
+ }
+
+ ++__first1;
+ }
+ return __first1;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Integer, class _Tp,
+ class _BinaryPred, class _Distance>
+_RandomAccessIter __search_n(_RandomAccessIter __first, _RandomAccessIter __last,
+ _Integer __count, const _Tp& __val, _BinaryPred __pred,
+ _Distance*, const random_access_iterator_tag &)
+{
+ _Distance __tailSize = __last - __first;
+ const _Distance __pattSize = __count;
+ const _Distance __skipOffset = __pattSize - 1;
+ _RandomAccessIter __backTrack;
+ _Distance __remainder, __prevRemainder;
+
+ for ( _RandomAccessIter __lookAhead = __first + __skipOffset; __tailSize >= __pattSize; __lookAhead += __pattSize ) { // the main loop...
+ //__lookAhead here is always pointing to the last element of next possible match.
+ __tailSize -= __pattSize;
+
+ while ( !__pred(*__lookAhead, __val) ) { // the skip loop...
+ if (__tailSize < __pattSize)
+ return __last;
+
+ __lookAhead += __pattSize;
+ __tailSize -= __pattSize;
+ }
+
+ if ( __skipOffset == 0 ) {
+ return (__lookAhead - __skipOffset); //Success
+ }
+
+ __remainder = __skipOffset;
+
+ for (__backTrack = __lookAhead; __pred(*--__backTrack, __val); ) {
+ if (--__remainder == 0)
+ return (__lookAhead - __skipOffset); //Success
+ }
+
+ if (__remainder > __tailSize)
+ return __last; //failure
+
+ __lookAhead += __remainder;
+ __tailSize -= __remainder;
+
+ while ( __pred(*__lookAhead, __val) ) {
+ __prevRemainder = __remainder;
+ __backTrack = __lookAhead;
+
+ do {
+ if (--__remainder == 0)
+ return (__lookAhead - __skipOffset); //Success
+ } while (__pred(*--__backTrack, __val));
+
+ //adjust remainder for next comparison
+ __remainder += __pattSize - __prevRemainder;
+
+ if (__remainder > __tailSize)
+ return __last; //failure
+
+ __lookAhead += __remainder;
+ __tailSize -= __remainder;
+ }
+
+ //__lookAhead here is always pointing to the element of the last mismatch.
+ }
+
+ return __last; //failure
+}
+
+template <class _ForwardIter, class _Integer, class _Tp,
+ class _Distance, class _BinaryPred>
+_ForwardIter __search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val, _BinaryPred __pred,
+ _Distance*, const forward_iterator_tag &) {
+ for (; (__first != __last) && !__pred(*__first, __val); ++__first) {}
+ while (__first != __last) {
+ _Integer __n = __count - 1;
+ _ForwardIter __i = __first;
+ ++__i;
+ while (__i != __last && __n != 0 && __pred(*__i, __val)) {
+ ++__i;
+ --__n;
+ }
+ if (__n == 0)
+ return __first;
+ else if (__i != __last)
+ for (__first = ++__i; (__first != __last) && !__pred(*__first, __val); ++__first) {}
+ else
+ break;
+ }
+ return __last;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// search_n. Search for __count consecutive copies of __val.
+template <class _ForwardIter, class _Integer, class _Tp>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__count <= 0)
+ return __first;
+ if (__count == 1)
+ //We use find when __count == 1 to use potential find overload.
+ return find(__first, __last, __val);
+ return _STLP_PRIV __search_n(__first, __last, __count, __val, equal_to<_Tp>(),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter),
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val,
+ _BinaryPred __binary_pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__count <= 0)
+ return __first;
+ return _STLP_PRIV __search_n(__first, __last, __count, __val, __binary_pred,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter),
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2,
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ _STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1),
+ _STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2),
+#else
+ forward_iterator_tag(),
+ forward_iterator_tag(),
+#endif
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _ForwardIter1))
+ );
+}
+
+// unique and unique_copy
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator, class _BinaryPredicate,
+ class _Tp>
+_STLP_INLINE_LOOP _OutputIterator
+__unique_copy(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result,
+ _BinaryPredicate __binary_pred, _Tp*) {
+ _Tp __val = *__first;
+ *__result = __val;
+ while (++__first != __last)
+ if (!__binary_pred(__val, *__first)) {
+ __val = *__first;
+ *++__result = __val;
+ }
+ return ++__result;
+}
+
+template <class _InputIter, class _OutputIter, class _BinaryPredicate>
+inline _OutputIter
+__unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ _BinaryPredicate __binary_pred, const output_iterator_tag &) {
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred,
+ _STLP_VALUE_TYPE(__first, _InputIter));
+}
+
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+_STLP_INLINE_LOOP _ForwardIter
+__unique_copy(_InputIter __first, _InputIter __last, _ForwardIter __result,
+ _BinaryPredicate __binary_pred, const forward_iterator_tag &) {
+ *__result = *__first;
+ while (++__first != __last)
+ if (!__binary_pred(*__result, *__first)) *++__result = *__first;
+ return ++__result;
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIterator, class _BidirectionalIterator, class _BinaryPredicate>
+inline _BidirectionalIterator
+__unique_copy(_InputIterator __first, _InputIterator __last,
+ _BidirectionalIterator __result, _BinaryPredicate __binary_pred,
+ const bidirectional_iterator_tag &) {
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag());
+}
+
+template <class _InputIterator, class _RandomAccessIterator, class _BinaryPredicate>
+inline _RandomAccessIterator
+__unique_copy(_InputIterator __first, _InputIterator __last,
+ _RandomAccessIterator __result, _BinaryPredicate __binary_pred,
+ const random_access_iterator_tag &) {
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag());
+}
+#endif /* _STLP_NONTEMPL_BASE_MATCH_BUG */
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+_OutputIter
+unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __result;
+ return _STLP_PRIV __unique_copy(__first, __last, __result,
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _InputIter)),
+ _STLP_ITERATOR_CATEGORY(__result, _OutputIter));
+}
+
+template <class _InputIter, class _OutputIter, class _BinaryPredicate>
+_OutputIter
+unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ _BinaryPredicate __binary_pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __result;
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred,
+ _STLP_ITERATOR_CATEGORY(__result, _OutputIter));
+}
+
+// rotate and rotate_copy, and their auxiliary functions
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Distance>
+_ForwardIter __rotate_aux(_ForwardIter __first,
+ _ForwardIter __middle,
+ _ForwardIter __last,
+ _Distance*,
+ const forward_iterator_tag &) {
+ if (__first == __middle)
+ return __last;
+ if (__last == __middle)
+ return __first;
+
+ _ForwardIter __first2 = __middle;
+ do {
+ _STLP_STD::swap(*__first++, *__first2++);
+ if (__first == __middle)
+ __middle = __first2;
+ } while (__first2 != __last);
+
+ _ForwardIter __new_middle = __first;
+
+ __first2 = __middle;
+
+ while (__first2 != __last) {
+ _STLP_STD::swap (*__first++, *__first2++);
+ if (__first == __middle)
+ __middle = __first2;
+ else if (__first2 == __last)
+ __first2 = __middle;
+ }
+
+ return __new_middle;
+}
+
+template <class _BidirectionalIter, class _Distance>
+_BidirectionalIter __rotate_aux(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance*,
+ const bidirectional_iterator_tag &) {
+ if (__first == __middle)
+ return __last;
+ if (__last == __middle)
+ return __first;
+
+ _STLP_PRIV __reverse(__first, __middle, bidirectional_iterator_tag());
+ _STLP_PRIV __reverse(__middle, __last, bidirectional_iterator_tag());
+
+ while (__first != __middle && __middle != __last)
+ _STLP_STD::swap(*__first++, *--__last);
+
+ if (__first == __middle) {
+ _STLP_PRIV __reverse(__middle, __last, bidirectional_iterator_tag());
+ return __last;
+ }
+ else {
+ _STLP_PRIV __reverse(__first, __middle, bidirectional_iterator_tag());
+ return __first;
+ }
+}
+
+// rotate and rotate_copy, and their auxiliary functions
+template <class _EuclideanRingElement>
+_STLP_INLINE_LOOP
+_EuclideanRingElement __gcd(_EuclideanRingElement __m,
+ _EuclideanRingElement __n) {
+ while (__n != 0) {
+ _EuclideanRingElement __t = __m % __n;
+ __m = __n;
+ __n = __t;
+ }
+ return __m;
+}
+
+template <class _RandomAccessIter, class _Distance, class _Tp>
+_RandomAccessIter __rotate_aux(_RandomAccessIter __first,
+ _RandomAccessIter __middle,
+ _RandomAccessIter __last,
+ _Distance *, _Tp *) {
+
+ _Distance __n = __last - __first;
+ _Distance __k = __middle - __first;
+ _Distance __l = __n - __k;
+ _RandomAccessIter __result = __first + (__last - __middle);
+
+ if (__k == 0) /* __first == middle */
+ return __last;
+
+ if (__k == __l) {
+ _STLP_STD::swap_ranges(__first, __middle, __middle);
+ return __result;
+ }
+
+ _Distance __d = _STLP_PRIV __gcd(__n, __k);
+
+ for (_Distance __i = 0; __i < __d; __i++) {
+ _Tp __tmp = *__first;
+ _RandomAccessIter __p = __first;
+
+ if (__k < __l) {
+ for (_Distance __j = 0; __j < __l/__d; __j++) {
+ if (__p > __first + __l) {
+ *__p = *(__p - __l);
+ __p -= __l;
+ }
+
+ *__p = *(__p + __k);
+ __p += __k;
+ }
+ }
+
+ else {
+ for (_Distance __j = 0; __j < __k/__d - 1; __j ++) {
+ if (__p < __last - __k) {
+ *__p = *(__p + __k);
+ __p += __k;
+ }
+
+ *__p = * (__p - __l);
+ __p -= __l;
+ }
+ }
+
+ *__p = __tmp;
+ ++__first;
+ }
+
+ return __result;
+}
+
+template <class _RandomAccessIter, class _Distance>
+inline _RandomAccessIter
+__rotate_aux(_RandomAccessIter __first, _RandomAccessIter __middle, _RandomAccessIter __last,
+ _Distance * __dis, const random_access_iterator_tag &) {
+ return _STLP_PRIV __rotate_aux(__first, __middle, __last,
+ __dis, _STLP_VALUE_TYPE(__first, _RandomAccessIter));
+}
+
+template <class _ForwardIter>
+_ForwardIter
+__rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(__check_range(__middle, __last))
+ return __rotate_aux(__first, __middle, __last,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter),
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter>
+void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) {
+ _STLP_PRIV __rotate(__first, __middle, __last);
+}
+
+// Return a random number in the range [0, __n). This function encapsulates
+// whether we're using rand (part of the standard C library) or lrand48
+// (not standard, but a much better choice whenever it's available).
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Distance>
+inline _Distance __random_number(_Distance __n) {
+#ifdef _STLP_NO_DRAND48
+ return rand() % __n;
+#else
+ return lrand48() % __n;
+#endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void random_shuffle(_RandomAccessIter __first,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return;
+ for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
+ iter_swap(__i, __first + _STLP_PRIV __random_number((__i - __first) + 1));
+}
+
+template <class _RandomAccessIter, class _RandomNumberGenerator>
+void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last,
+ _RandomNumberGenerator &__rand) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return;
+ for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
+ iter_swap(__i, __first + __rand((__i - __first) + 1));
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// random_sample and random_sample_n (extensions, not part of the standard).
+template <class _ForwardIter, class _OutputIter, class _Distance>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Distance __remaining = _STLP_STD::distance(__first, __last);
+ _Distance __m = (min) (__n, __remaining);
+
+ while (__m > 0) {
+ if (_STLP_PRIV __random_number(__remaining) < __m) {
+ *__out_ite = *__first;
+ ++__out_ite;
+ --__m;
+ }
+
+ --__remaining;
+ ++__first;
+ }
+ return __out_ite;
+}
+
+
+template <class _ForwardIter, class _OutputIter, class _Distance,
+ class _RandomNumberGenerator>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n,
+ _RandomNumberGenerator& __rand) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Distance __remaining = _STLP_STD::distance(__first, __last);
+ _Distance __m = (min) (__n, __remaining);
+
+ while (__m > 0) {
+ if (__rand(__remaining) < __m) {
+ *__out_ite = *__first;
+ ++__out_ite;
+ --__m;
+ }
+
+ --__remaining;
+ ++__first;
+ }
+ return __out_ite;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter, class _Distance>
+_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_ite,
+ const _Distance __n) {
+ _Distance __m = 0;
+ _Distance __t = __n;
+ for ( ; __first != __last && __m < __n; ++__m, ++__first)
+ __out_ite[__m] = *__first;
+
+ while (__first != __last) {
+ ++__t;
+ _Distance __M = __random_number(__t);
+ if (__M < __n)
+ __out_ite[__M] = *__first;
+ ++__first;
+ }
+
+ return __out_ite + __m;
+}
+
+template <class _InputIter, class _RandomAccessIter,
+ class _RandomNumberGenerator, class _Distance>
+_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_ite,
+ _RandomNumberGenerator& __rand,
+ const _Distance __n) {
+ _Distance __m = 0;
+ _Distance __t = __n;
+ for ( ; __first != __last && __m < __n; ++__m, ++__first)
+ __out_ite[__m] = *__first;
+
+ while (__first != __last) {
+ ++__t;
+ _Distance __M = __rand(__t);
+ if (__M < __n)
+ __out_ite[__M] = *__first;
+ ++__first;
+ }
+
+ return __out_ite + __m;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last))
+ return _STLP_PRIV __random_sample(__first, __last,
+ __out_first, __out_last - __out_first);
+}
+
+template <class _InputIter, class _RandomAccessIter, class _RandomNumberGenerator>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last,
+ _RandomNumberGenerator& __rand) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last))
+ return _STLP_PRIV __random_sample(__first, __last,
+ __out_first, __rand,
+ __out_last - __out_first);
+}
+
+#endif /* _STLP_NO_EXTENSIONS */
+
+// partition, stable_partition, and their auxiliary functions
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Predicate>
+_STLP_INLINE_LOOP _ForwardIter __partition(_ForwardIter __first,
+ _ForwardIter __last,
+ _Predicate __pred,
+ const forward_iterator_tag &) {
+ if (__first == __last) return __first;
+
+ while (__pred(*__first))
+ if (++__first == __last) return __first;
+
+ _ForwardIter __next = __first;
+
+ while (++__next != __last) {
+ if (__pred(*__next)) {
+ _STLP_STD::swap(*__first, *__next);
+ ++__first;
+ }
+ }
+ return __first;
+}
+
+template <class _BidirectionalIter, class _Predicate>
+_STLP_INLINE_LOOP _BidirectionalIter __partition(_BidirectionalIter __first,
+ _BidirectionalIter __last,
+ _Predicate __pred,
+ const bidirectional_iterator_tag &) {
+ for (;;) {
+ for (;;) {
+ if (__first == __last)
+ return __first;
+ else if (__pred(*__first))
+ ++__first;
+ else
+ break;
+ }
+ --__last;
+ for (;;) {
+ if (__first == __last)
+ return __first;
+ else if (!__pred(*__last))
+ --__last;
+ else
+ break;
+ }
+ iter_swap(__first, __last);
+ ++__first;
+ }
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _BidirectionalIter, class _Predicate>
+inline
+_BidirectionalIter __partition(_BidirectionalIter __first,
+ _BidirectionalIter __last,
+ _Predicate __pred,
+ const random_access_iterator_tag &) {
+ return __partition(__first, __last, __pred, bidirectional_iterator_tag());
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __partition(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+
+/* __pred_of_first: false if we know that __pred(*__first) is false,
+ * true when we don't know the result of __pred(*__first).
+ * __not_pred_of_before_last: true if we know that __pred(*--__last) is true,
+ * false when we don't know the result of __pred(*--__last).
+ */
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Predicate, class _Distance>
+_ForwardIter __inplace_stable_partition(_ForwardIter __first,
+ _ForwardIter __last,
+ _Predicate __pred, _Distance __len,
+ bool __pred_of_first, bool __pred_of_before_last) {
+ if (__len == 1)
+ return (__pred_of_first && (__pred_of_before_last || __pred(*__first))) ? __last : __first;
+ _ForwardIter __middle = __first;
+ _Distance __half_len = __len / 2;
+ _STLP_STD::advance(__middle, __half_len);
+ return _STLP_PRIV __rotate(_STLP_PRIV __inplace_stable_partition(__first, __middle, __pred, __half_len, __pred_of_first, false),
+ __middle,
+ _STLP_PRIV __inplace_stable_partition(__middle, __last, __pred, __len - __half_len, true, __pred_of_before_last));
+}
+
+template <class _ForwardIter, class _Pointer, class _Predicate,
+ class _Distance>
+_ForwardIter __stable_partition_adaptive(_ForwardIter __first,
+ _ForwardIter __last,
+ _Predicate __pred, _Distance __len,
+ _Pointer __buffer, _Distance __buffer_size,
+ bool __pred_of_first, bool __pred_of_before_last) {
+ if (__len <= __buffer_size) {
+ _ForwardIter __result1 = __first;
+ _Pointer __result2 = __buffer;
+ if ((__first != __last) && (!__pred_of_first || __pred(*__first))) {
+ *__result2 = *__first;
+ ++__result2; ++__first; --__len;
+ }
+ for (; __first != __last ; ++__first, --__len) {
+ if (((__len == 1) && (__pred_of_before_last || __pred(*__first))) ||
+ ((__len != 1) && __pred(*__first))){
+ *__result1 = *__first;
+ ++__result1;
+ }
+ else {
+ *__result2 = *__first;
+ ++__result2;
+ }
+ }
+ _STLP_STD::copy(__buffer, __result2, __result1);
+ return __result1;
+ }
+ else {
+ _ForwardIter __middle = __first;
+ _Distance __half_len = __len / 2;
+ _STLP_STD::advance(__middle, __half_len);
+ return _STLP_PRIV __rotate(_STLP_PRIV __stable_partition_adaptive(__first, __middle, __pred,
+ __half_len, __buffer, __buffer_size,
+ __pred_of_first, false),
+ __middle,
+ _STLP_PRIV __stable_partition_adaptive(__middle, __last, __pred,
+ __len - __half_len, __buffer, __buffer_size,
+ true, __pred_of_before_last));
+ }
+}
+
+template <class _ForwardIter, class _Predicate, class _Tp, class _Distance>
+inline _ForwardIter
+__stable_partition_aux_aux(_ForwardIter __first, _ForwardIter __last,
+ _Predicate __pred, _Tp*, _Distance*, bool __pred_of_before_last) {
+ _Temporary_buffer<_ForwardIter, _Tp> __buf(__first, __last);
+ _STLP_MPWFIX_TRY //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present
+ return (__buf.size() > 0) ?
+ __stable_partition_adaptive(__first, __last, __pred,
+ _Distance(__buf.requested_size()),
+ __buf.begin(), __buf.size(),
+ false, __pred_of_before_last) :
+ __inplace_stable_partition(__first, __last, __pred,
+ _Distance(__buf.requested_size()),
+ false, __pred_of_before_last);
+ _STLP_MPWFIX_CATCH //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present
+}
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter
+__stable_partition_aux(_ForwardIter __first, _ForwardIter __last, _Predicate __pred,
+ const forward_iterator_tag &) {
+ return __stable_partition_aux_aux(__first, __last, __pred,
+ _STLP_VALUE_TYPE(__first, _ForwardIter),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter), false);
+}
+
+template <class _BidirectIter, class _Predicate>
+_BidirectIter
+__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred,
+ const bidirectional_iterator_tag &) {
+ for (--__last;;) {
+ if (__first == __last)
+ return __first;
+ else if (!__pred(*__last))
+ --__last;
+ else
+ break;
+ }
+ ++__last;
+ //Here we know that __pred(*--__last) is true
+ return __stable_partition_aux_aux(__first, __last, __pred,
+ _STLP_VALUE_TYPE(__first, _BidirectIter),
+ _STLP_DISTANCE_TYPE(__first, _BidirectIter), true);
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _BidirectIter, class _Predicate>
+_BidirectIter
+__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred,
+ const random_access_iterator_tag &) {
+ return __stable_partition_aux(__first, __last, __pred, bidirectional_iterator_tag());
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter
+stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for (;;) {
+ if (__first == __last)
+ return __first;
+ else if (__pred(*__first))
+ ++__first;
+ else
+ break;
+ }
+ return _STLP_PRIV __stable_partition_aux(__first, __last, __pred,
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+_RandomAccessIter __unguarded_partition(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Tp __pivot, _Compare __comp) {
+ for (;;) {
+ while (__comp(*__first, __pivot)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__pivot, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ ++__first;
+ }
+ --__last;
+ while (__comp(__pivot, *__last)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__last, __pivot), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ --__last;
+ }
+ if (!(__first < __last))
+ return __first;
+ iter_swap(__first, __last);
+ ++__first;
+ }
+}
+
+// sort() and its auxiliary functions.
+#define __stl_threshold 16
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val,
+ _Compare __comp) {
+ _RandomAccessIter __next = __last;
+ --__next;
+ while (__comp(__val, *__next)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__next, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__last = *__next;
+ __last = __next;
+ --__next;
+ }
+ *__last = __val;
+}
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+inline void __linear_insert(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Tp __val, _Compare __comp) {
+ //*TY 12/26/1998 - added __val as a paramter
+ // _Tp __val = *__last; //*TY 12/26/1998 - __val supplied by caller
+ if (__comp(__val, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ copy_backward(__first, __last, __last + 1);
+ *__first = __val;
+ }
+ else
+ __unguarded_linear_insert(__last, __val, __comp);
+}
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Tp *, _Compare __comp) {
+ if (__first == __last) return;
+ for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
+ __linear_insert<_RandomAccessIter, _Tp, _Compare>(__first, __i, *__i, __comp); //*TY 12/26/1998 - supply *__i as __val
+}
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __unguarded_insertion_sort_aux(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Tp*, _Compare __comp) {
+ for (_RandomAccessIter __i = __first; __i != __last; ++__i)
+ __unguarded_linear_insert<_RandomAccessIter, _Tp, _Compare>(__i, *__i, __comp);
+}
+
+template <class _RandomAccessIter, class _Compare>
+inline void __unguarded_insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Compare __comp) {
+ __unguarded_insertion_sort_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
+}
+
+template <class _RandomAccessIter, class _Compare>
+void __final_insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp) {
+ if (__last - __first > __stl_threshold) {
+ __insertion_sort(__first, __first + __stl_threshold, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+ __unguarded_insertion_sort(__first + __stl_threshold, __last, __comp);
+ }
+ else
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+}
+
+template <class _RandomAccessIter, class _Tp, class _Size, class _Compare>
+void __introsort_loop(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Tp*,
+ _Size __depth_limit, _Compare __comp) {
+ while (__last - __first > __stl_threshold) {
+ if (__depth_limit == 0) {
+ partial_sort(__first, __last, __last, __comp);
+ return;
+ }
+ --__depth_limit;
+ _RandomAccessIter __cut =
+ __unguarded_partition(__first, __last,
+ _Tp(__median(*__first,
+ *(__first + (__last - __first)/2),
+ *(__last - 1), __comp)),
+ __comp);
+ __introsort_loop(__cut, __last, (_Tp*) 0, __depth_limit, __comp);
+ __last = __cut;
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first != __last) {
+ _STLP_PRIV __introsort_loop(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __lg(__last - __first) * 2,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+ _STLP_PRIV __final_insertion_sort(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+ }
+}
+
+template <class _RandomAccessIter, class _Compare>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first != __last) {
+ _STLP_PRIV __introsort_loop(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __lg(__last - __first) * 2, __comp);
+ _STLP_PRIV __final_insertion_sort(__first, __last, __comp);
+ }
+}
+
+// stable_sort() and its auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Compare>
+void __inplace_stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp) {
+ if (__last - __first < 15) {
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+ return;
+ }
+ _RandomAccessIter __middle = __first + (__last - __first) / 2;
+ __inplace_stable_sort(__first, __middle, __comp);
+ __inplace_stable_sort(__middle, __last, __comp);
+ __merge_without_buffer(__first, __middle, __last,
+ __middle - __first,
+ __last - __middle,
+ __comp);
+}
+
+template <class _RandomAccessIter1, class _RandomAccessIter2,
+ class _Distance, class _Compare>
+void __merge_sort_loop(_RandomAccessIter1 __first,
+ _RandomAccessIter1 __last,
+ _RandomAccessIter2 __result, _Distance __step_size,
+ _Compare __comp) {
+ _Distance __two_step = 2 * __step_size;
+
+ while (__last - __first >= __two_step) {
+ __result = merge(__first, __first + __step_size,
+ __first + __step_size, __first + __two_step,
+ __result,
+ __comp);
+ __first += __two_step;
+ }
+ __step_size = (min) (_Distance(__last - __first), __step_size);
+
+ merge(__first, __first + __step_size,
+ __first + __step_size, __last,
+ __result,
+ __comp);
+}
+
+const int __stl_chunk_size = 7;
+
+template <class _RandomAccessIter, class _Distance, class _Compare>
+void __chunk_insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Distance __chunk_size, _Compare __comp) {
+ while (__last - __first >= __chunk_size) {
+ __insertion_sort(__first, __first + __chunk_size,
+ _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+ __first += __chunk_size;
+ }
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+}
+
+template <class _RandomAccessIter, class _Pointer, class _Distance,
+ class _Compare>
+void __merge_sort_with_buffer(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Pointer __buffer,
+ _Distance*, _Compare __comp) {
+ _Distance __len = __last - __first;
+ _Pointer __buffer_last = __buffer + __len;
+
+ _Distance __step_size = __stl_chunk_size;
+ __chunk_insertion_sort(__first, __last, __step_size, __comp);
+
+ while (__step_size < __len) {
+ __merge_sort_loop(__first, __last, __buffer, __step_size, __comp);
+ __step_size *= 2;
+ __merge_sort_loop(__buffer, __buffer_last, __first, __step_size, __comp);
+ __step_size *= 2;
+ }
+}
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _Distance>
+_BidirectionalIter1 __rotate_adaptive(_BidirectionalIter1 __first,
+ _BidirectionalIter1 __middle,
+ _BidirectionalIter1 __last,
+ _Distance __len1, _Distance __len2,
+ _BidirectionalIter2 __buffer,
+ _Distance __buffer_size) {
+ if (__len1 > __len2 && __len2 <= __buffer_size) {
+ _BidirectionalIter2 __buffer_end = _STLP_STD::copy(__middle, __last, __buffer);
+ _STLP_STD::copy_backward(__first, __middle, __last);
+ return _STLP_STD::copy(__buffer, __buffer_end, __first);
+ }
+ else if (__len1 <= __buffer_size) {
+ _BidirectionalIter2 __buffer_end = _STLP_STD::copy(__first, __middle, __buffer);
+ _STLP_STD::copy(__middle, __last, __first);
+ return _STLP_STD::copy_backward(__buffer, __buffer_end, __last);
+ }
+ else
+ return _STLP_PRIV __rotate(__first, __middle, __last);
+}
+
+template <class _BidirectionalIter, class _Distance, class _Pointer,
+ class _Compare>
+void __merge_adaptive(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance __len1, _Distance __len2,
+ _Pointer __buffer, _Distance __buffer_size,
+ _Compare __comp) {
+ if (__len1 <= __len2 && __len1 <= __buffer_size) {
+ _Pointer __buffer_end = _STLP_STD::copy(__first, __middle, __buffer);
+ _STLP_STD::merge(__buffer, __buffer_end, __middle, __last, __first, __comp);
+ }
+ else if (__len2 <= __buffer_size) {
+ _Pointer __buffer_end = _STLP_STD::copy(__middle, __last, __buffer);
+ _STLP_PRIV __merge_backward(__first, __middle, __buffer, __buffer_end, __last,
+ __comp);
+ }
+ else {
+ _BidirectionalIter __first_cut = __first;
+ _BidirectionalIter __second_cut = __middle;
+ _Distance __len11 = 0;
+ _Distance __len22 = 0;
+ if (__len1 > __len2) {
+ __len11 = __len1 / 2;
+ _STLP_STD::advance(__first_cut, __len11);
+ __second_cut = _STLP_STD::lower_bound(__middle, __last, *__first_cut, __comp);
+ __len22 += _STLP_STD::distance(__middle, __second_cut);
+ }
+ else {
+ __len22 = __len2 / 2;
+ _STLP_STD::advance(__second_cut, __len22);
+ __first_cut = _STLP_STD::upper_bound(__first, __middle, *__second_cut, __comp);
+ __len11 += _STLP_STD::distance(__first, __first_cut);
+ }
+ _BidirectionalIter __new_middle =
+ __rotate_adaptive(__first_cut, __middle, __second_cut, __len1 - __len11,
+ __len22, __buffer, __buffer_size);
+ __merge_adaptive(__first, __first_cut, __new_middle, __len11,
+ __len22, __buffer, __buffer_size, __comp);
+ __merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11,
+ __len2 - __len22, __buffer, __buffer_size, __comp);
+ }
+}
+
+template <class _RandomAccessIter, class _Pointer, class _Distance,
+ class _Compare>
+void __stable_sort_adaptive(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Pointer __buffer,
+ _Distance __buffer_size, _Compare __comp) {
+ _Distance __len = (__last - __first + 1) / 2;
+ _RandomAccessIter __middle = __first + __len;
+ if (__len > __buffer_size) {
+ __stable_sort_adaptive(__first, __middle, __buffer, __buffer_size,
+ __comp);
+ __stable_sort_adaptive(__middle, __last, __buffer, __buffer_size,
+ __comp);
+ }
+ else {
+ __merge_sort_with_buffer(__first, __middle, __buffer, (_Distance*)0,
+ __comp);
+ __merge_sort_with_buffer(__middle, __last, __buffer, (_Distance*)0,
+ __comp);
+ }
+ __merge_adaptive(__first, __middle, __last, _Distance(__middle - __first),
+ _Distance(__last - __middle), __buffer, __buffer_size,
+ __comp);
+}
+
+template <class _RandomAccessIter, class _Tp, class _Distance, class _Compare>
+void __stable_sort_aux(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Tp*, _Distance*,
+ _Compare __comp) {
+ _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last);
+ if (buf.begin() == 0)
+ __inplace_stable_sort(__first, __last, __comp);
+ else
+ __stable_sort_adaptive(__first, __last, buf.begin(),
+ _Distance(buf.size()),
+ __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_PRIV __stable_sort_aux(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+}
+
+template <class _RandomAccessIter, class _Compare>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_PRIV __stable_sort_aux(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIter),
+ __comp);
+}
+
+// partial_sort, partial_sort_copy, and auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle,
+ _RandomAccessIter __last, _Tp*, _Compare __comp) {
+ make_heap(__first, __middle, __comp);
+ for (_RandomAccessIter __i = __middle; __i < __last; ++__i) {
+ if (__comp(*__i, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __pop_heap(__first, __middle, __i, _Tp(*__i), __comp,
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIter));
+ }
+ }
+ sort_heap(__first, __middle, __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+}
+
+template <class _RandomAccessIter, class _Compare>
+void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
+ _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter, class _Compare,
+ class _Distance, class _Tp>
+_RandomAccessIter __partial_sort_copy(_InputIter __first,
+ _InputIter __last,
+ _RandomAccessIter __result_first,
+ _RandomAccessIter __result_last,
+ _Compare __comp, _Distance*, _Tp*) {
+ if (__result_first == __result_last) return __result_last;
+ _RandomAccessIter __result_real_last = __result_first;
+ while(__first != __last && __result_real_last != __result_last) {
+ *__result_real_last = *__first;
+ ++__result_real_last;
+ ++__first;
+ }
+ make_heap(__result_first, __result_real_last, __comp);
+ while (__first != __last) {
+ if (__comp(*__first, *__result_first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__result_first, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __adjust_heap(__result_first, _Distance(0),
+ _Distance(__result_real_last - __result_first),
+ _Tp(*__first),
+ __comp);
+ }
+ ++__first;
+ }
+ sort_heap(__result_first, __result_real_last, __comp);
+ return __result_real_last;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first, _RandomAccessIter __result_last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last))
+ return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _InputIter)),
+ _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter),
+ _STLP_VALUE_TYPE(__first, _InputIter));
+}
+
+template <class _InputIter, class _RandomAccessIter, class _Compare>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first,
+ _RandomAccessIter __result_last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last))
+ return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last,
+ __comp,
+ _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter),
+ _STLP_VALUE_TYPE(__first, _InputIter));
+}
+
+// nth_element() and its auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last, _Tp*, _Compare __comp) {
+ while (__last - __first > 3) {
+ _RandomAccessIter __cut =
+ __unguarded_partition(__first, __last,
+ _Tp(__median(*__first,
+ *(__first + (__last - __first)/2),
+ *(__last - 1),
+ __comp)),
+ __comp);
+ if (__cut <= __nth)
+ __first = __cut;
+ else
+ __last = __cut;
+ }
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last))
+ _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+}
+
+template <class _RandomAccessIter, class _Compare>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last))
+ _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
+}
+
+// Binary search (lower_bound, upper_bound, equal_range, binary_search).
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp,
+ class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*) {
+ _Distance __len = _STLP_STD::distance(__first, __last);
+ _Distance __half;
+
+ while (__len > 0) {
+ __half = __len >> 1;
+ _ForwardIter __middle = __first;
+ _STLP_STD::advance(__middle, __half);
+ if (__comp2(__val, *__middle)) {
+ _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __len = __half;
+ }
+ else {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ }
+ return __first;
+}
+
+template <class _ForwardIter, class _Tp,
+ class _Compare1, class _Compare2, class _Distance>
+pair<_ForwardIter, _ForwardIter>
+__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance* __dist) {
+ _Distance __len = _STLP_STD::distance(__first, __last);
+ _Distance __half;
+
+ while (__len > 0) {
+ __half = __len >> 1;
+ _ForwardIter __middle = __first;
+ _STLP_STD::advance(__middle, __half);
+ if (__comp1(*__middle, __val)) {
+ _STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else if (__comp2(__val, *__middle)) {
+ _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __len = __half;
+ }
+ else {
+ _ForwardIter __left = _STLP_PRIV __lower_bound(__first, __middle, __val, __comp1, __comp2, __dist);
+ //Small optim: If lower_bound haven't found an equivalent value
+ //there is no need to call upper_bound.
+ if (__comp1(*__left, __val)) {
+ _STLP_VERBOSE_ASSERT(!__comp2(__val, *__left), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return pair<_ForwardIter, _ForwardIter>(__left, __left);
+ }
+ _STLP_STD::advance(__first, __len);
+ _ForwardIter __right = _STLP_PRIV __upper_bound(++__middle, __first, __val, __comp1, __comp2, __dist);
+ return pair<_ForwardIter, _ForwardIter>(__left, __right);
+ }
+ }
+ return pair<_ForwardIter, _ForwardIter>(__first, __first);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (*__first2 < *__first1) {
+ *__result = *__first2;
+ ++__first2;
+ }
+ else {
+ *__result = *__first1;
+ ++__first1;
+ }
+ ++__result;
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first2;
+ ++__first2;
+ }
+ else {
+ *__result = *__first1;
+ ++__first1;
+ }
+ ++__result;
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Distance, class _Compare>
+void __merge_without_buffer(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance __len1, _Distance __len2,
+ _Compare __comp) {
+ if (__len1 == 0 || __len2 == 0)
+ return;
+ if (__len1 + __len2 == 2) {
+ if (__comp(*__middle, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ iter_swap(__first, __middle);
+ }
+ return;
+ }
+ _BidirectionalIter __first_cut = __first;
+ _BidirectionalIter __second_cut = __middle;
+ _Distance __len11 = 0;
+ _Distance __len22 = 0;
+ if (__len1 > __len2) {
+ __len11 = __len1 / 2;
+ _STLP_STD::advance(__first_cut, __len11);
+ __second_cut = _STLP_STD::lower_bound(__middle, __last, *__first_cut, __comp);
+ __len22 += _STLP_STD::distance(__middle, __second_cut);
+ }
+ else {
+ __len22 = __len2 / 2;
+ _STLP_STD::advance(__second_cut, __len22);
+ __first_cut = _STLP_STD::upper_bound(__first, __middle, *__second_cut, __comp);
+ __len11 += _STLP_STD::distance(__first, __first_cut);
+ }
+ _BidirectionalIter __new_middle
+ = _STLP_PRIV __rotate(__first_cut, __middle, __second_cut);
+ __merge_without_buffer(__first, __first_cut, __new_middle, __len11, __len22,
+ __comp);
+ __merge_without_buffer(__new_middle, __second_cut, __last, __len1 - __len11,
+ __len2 - __len22, __comp);
+}
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _BidirectionalIter3, class _Compare>
+_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1,
+ _BidirectionalIter1 __last1,
+ _BidirectionalIter2 __first2,
+ _BidirectionalIter2 __last2,
+ _BidirectionalIter3 __result,
+ _Compare __comp) {
+ if (__first1 == __last1)
+ return copy_backward(__first2, __last2, __result);
+ if (__first2 == __last2)
+ return copy_backward(__first1, __last1, __result);
+ --__last1;
+ --__last2;
+ for (;;) {
+ if (__comp(*__last2, *__last1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__last1, *__last2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *--__result = *__last1;
+ if (__first1 == __last1)
+ return copy_backward(__first2, ++__last2, __result);
+ --__last1;
+ }
+ else {
+ *--__result = *__last2;
+ if (__first2 == __last2)
+ return copy_backward(__first1, ++__last1, __result);
+ --__last2;
+ }
+ }
+}
+
+template <class _BidirectionalIter, class _Tp,
+ class _Distance, class _Compare>
+inline void __inplace_merge_aux(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last, _Tp*, _Distance*,
+ _Compare __comp) {
+ _Distance __len1 = _STLP_STD::distance(__first, __middle);
+ _Distance __len2 = _STLP_STD::distance(__middle, __last);
+
+ _Temporary_buffer<_BidirectionalIter, _Tp> __buf(__first, __last);
+ if (__buf.begin() == 0)
+ __merge_without_buffer(__first, __middle, __last, __len1, __len2, __comp);
+ else
+ __merge_adaptive(__first, __middle, __last, __len1, __len2,
+ __buf.begin(), _Distance(__buf.size()),
+ __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ if (__first == __middle || __middle == __last)
+ return;
+ _STLP_PRIV __inplace_merge_aux(__first, __middle, __last,
+ _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
+}
+
+template <class _BidirectionalIter, class _Compare>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ if (__first == __middle || __middle == __last)
+ return;
+ _STLP_PRIV __inplace_merge_aux(__first, __middle, __last,
+ _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter),
+ __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool __includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return false;
+ }
+ else if (__comp(*__first1, *__first2))
+ ++__first1;
+ else
+ ++__first1, ++__first2;
+
+ return __first2 == __last2;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) {
+ return _STLP_PRIV __includes(__first1, __last1, __first2, __last2, __comp);
+}
+
+template <class _InputIter1, class _InputIter2>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ return _STLP_PRIV __includes(__first1, __last1, __first2, __last2,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter __set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first1;
+ ++__first1;
+ }
+ else if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first2;
+ ++__first2;
+ }
+ else {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ }
+ ++__result;
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter __set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ ++__first1;
+ }
+ else if (__comp(*__first2, *__first1))
+ ++__first2;
+ else {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ ++__result;
+ }
+ return __result;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter __set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first1;
+ ++__first1;
+ ++__result;
+ }
+ else if (__comp(*__first2, *__first1))
+ ++__first2;
+ else {
+ ++__first1;
+ ++__first2;
+ }
+ return _STLP_STD::copy(__first1, __last1, __result);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare>
+_OutputIter
+__set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first1;
+ ++__first1;
+ ++__result;
+ }
+ else if (__comp(*__first2, *__first1)) {
+ *__result = *__first2;
+ ++__first2;
+ ++__result;
+ }
+ else {
+ ++__first1;
+ ++__first2;
+ }
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result,
+ _Compare __comp) {
+ return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+// min_element and max_element, with and without an explicitly supplied
+// comparison function.
+
+template <class _ForwardIter>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last)
+ if (*__result < *__first) {
+ _STLP_VERBOSE_ASSERT(!(*__first < *__result), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ return __result;
+}
+
+template <class _ForwardIter, class _Compare>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last) {
+ if (__comp(*__result, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__result), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ }
+ return __result;
+}
+
+template <class _ForwardIter>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last)
+ if (*__first < *__result) {
+ _STLP_VERBOSE_ASSERT(!(*__result < *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ return __result;
+}
+
+template <class _ForwardIter, class _Compare>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last) {
+ if (__comp(*__first, *__result)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__result, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ }
+ return __result;
+}
+
+// next_permutation and prev_permutation, with and without an explicitly
+// supplied comparison function.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Compare>
+bool __next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last)
+ return false;
+ _BidirectionalIter __i = __first;
+ ++__i;
+ if (__i == __last)
+ return false;
+ __i = __last;
+ --__i;
+
+ for(;;) {
+ _BidirectionalIter __ii = __i;
+ --__i;
+ if (__comp(*__i, *__ii)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__ii, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ _BidirectionalIter __j = __last;
+ while (!__comp(*__i, *--__j)) {}
+ iter_swap(__i, __j);
+ reverse(__ii, __last);
+ return true;
+ }
+ if (__i == __first) {
+ reverse(__first, __last);
+ return false;
+ }
+ }
+#if defined (_STLP_NEED_UNREACHABLE_RETURN)
+ return false;
+#endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __next_permutation(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
+}
+
+template <class _BidirectionalIter, class _Compare>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __next_permutation(__first, __last, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Compare>
+bool __prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ if (__first == __last)
+ return false;
+ _BidirectionalIter __i = __first;
+ ++__i;
+ if (__i == __last)
+ return false;
+ __i = __last;
+ --__i;
+
+ for(;;) {
+ _BidirectionalIter __ii = __i;
+ --__i;
+ if (__comp(*__ii, *__i)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__i, *__ii), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ _BidirectionalIter __j = __last;
+ while (!__comp(*--__j, *__i)) {}
+ iter_swap(__i, __j);
+ reverse(__ii, __last);
+ return true;
+ }
+ if (__i == __first) {
+ reverse(__first, __last);
+ return false;
+ }
+ }
+#if defined (_STLP_NEED_UNREACHABLE_RETURN)
+ return false;
+#endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __prev_permutation(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
+}
+
+template <class _BidirectionalIter, class _Compare>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __prev_permutation(__first, __last, __comp);
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+
+// is_heap, a predicate testing whether or not a range is
+// a heap. This function is an extension, not part of the C++
+// standard.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Distance, class _StrictWeakOrdering>
+bool __is_heap(_RandomAccessIter __first, _StrictWeakOrdering __comp,
+ _Distance __n) {
+ _Distance __parent = 0;
+ for (_Distance __child = 1; __child < __n; ++__child) {
+ if (__comp(__first[__parent], __first[__child])) {
+ _STLP_VERBOSE_ASSERT(!__comp(__first[__child], __first[__parent]), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return false;
+ }
+ if ((__child & 1) == 0)
+ ++__parent;
+ }
+ return true;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __is_heap(__first, _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)), __last - __first);
+}
+
+template <class _RandomAccessIter, class _StrictWeakOrdering>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last,
+ _StrictWeakOrdering __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __is_heap(__first, __comp, __last - __first);
+}
+
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _StrictWeakOrdering>
+bool __is_sorted(_ForwardIter __first, _ForwardIter __last,
+ _StrictWeakOrdering __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last)
+ return true;
+
+ _ForwardIter __next = __first;
+ for (++__next; __next != __last; __first = __next, ++__next) {
+ if (__comp(*__next, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__next), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return false;
+ }
+ }
+
+ return true;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif /* _STLP_NO_EXTENSIONS */
+
+_STLP_END_NAMESPACE
+
+#undef __stl_threshold
+
+#endif /* _STLP_ALGO_C */
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_algo.h b/stlport/stlport/stl/_algo.h
new file mode 100644
index 0000000..01e5f93
--- /dev/null
+++ b/stlport/stlport/stl/_algo.h
@@ -0,0 +1,745 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ALGO_H
+#define _STLP_INTERNAL_ALGO_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_HEAP_H
+# include <stl/_heap.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#if defined (__SUNPRO_CC) && !defined (_STLP_INTERNAL_CSTDIO)
+// remove() conflict
+# include <stl/_cstdio.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// for_each. Apply a function to every element of a range.
+template <class _InputIter, class _Function>
+_STLP_INLINE_LOOP _Function
+for_each(_InputIter __first, _InputIter __last, _Function __f) {
+ for ( ; __first != __last; ++__first)
+ __f(*__first);
+ return __f;
+}
+
+// count_if
+template <class _InputIter, class _Predicate>
+_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter)
+count_if(_InputIter __first, _InputIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0;
+ for ( ; __first != __last; ++__first) {
+ if (__pred(*__first))
+ ++__n;
+ }
+ return __n;
+}
+
+// adjacent_find.
+
+template <class _ForwardIter, class _BinaryPredicate>
+_STLP_INLINE_LOOP _ForwardIter
+adjacent_find(_ForwardIter __first, _ForwardIter __last,
+ _BinaryPredicate __binary_pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last)
+ return __last;
+ _ForwardIter __next = __first;
+ while(++__next != __last) {
+ if (__binary_pred(*__first, *__next))
+ return __first;
+ __first = __next;
+ }
+ return __last;
+}
+
+template <class _ForwardIter>
+_STLP_INLINE_LOOP _ForwardIter
+adjacent_find(_ForwardIter __first, _ForwardIter __last) {
+ return adjacent_find(__first, __last,
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _ForwardIter)));
+}
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+template <class _InputIter, class _Tp, class _Size>
+_STLP_INLINE_LOOP void
+count(_InputIter __first, _InputIter __last, const _Tp& __val, _Size& __n) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (*__first == __val)
+ ++__n;
+}
+
+template <class _InputIter, class _Predicate, class _Size>
+_STLP_INLINE_LOOP void
+count_if(_InputIter __first, _InputIter __last, _Predicate __pred, _Size& __n) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (__pred(*__first))
+ ++__n;
+}
+#endif
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2);
+
+// search_n. Search for __count consecutive copies of __val.
+template <class _ForwardIter, class _Integer, class _Tp>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val);
+template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val, _BinaryPred __binary_pred);
+
+template <class _InputIter, class _ForwardIter>
+inline _InputIter find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2);
+}
+
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+inline _InputIter
+find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2, _BinaryPredicate __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2, __comp);
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2);
+
+// swap_ranges
+template <class _ForwardIter1, class _ForwardIter2>
+_STLP_INLINE_LOOP _ForwardIter2
+swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ iter_swap(__first1, __first2);
+ return __first2;
+}
+
+// transform
+template <class _InputIter, class _OutputIter, class _UnaryOperation>
+_STLP_INLINE_LOOP _OutputIter
+transform(_InputIter __first, _InputIter __last, _OutputIter __result, _UnaryOperation __opr) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first, ++__result)
+ *__result = __opr(*__first);
+ return __result;
+}
+template <class _InputIter1, class _InputIter2, class _OutputIter, class _BinaryOperation>
+_STLP_INLINE_LOOP _OutputIter
+transform(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _OutputIter __result,_BinaryOperation __binary_op) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result)
+ *__result = __binary_op(*__first1, *__first2);
+ return __result;
+}
+
+// replace_if, replace_copy, replace_copy_if
+
+template <class _ForwardIter, class _Predicate, class _Tp>
+_STLP_INLINE_LOOP void
+replace_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (__pred(*__first))
+ *__first = __new_value;
+}
+
+template <class _InputIter, class _OutputIter, class _Tp>
+_STLP_INLINE_LOOP _OutputIter
+replace_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ const _Tp& __old_value, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first, ++__result)
+ *__result = *__first == __old_value ? __new_value : *__first;
+ return __result;
+}
+
+template <class _Iterator, class _OutputIter, class _Predicate, class _Tp>
+_STLP_INLINE_LOOP _OutputIter
+replace_copy_if(_Iterator __first, _Iterator __last,
+ _OutputIter __result,
+ _Predicate __pred, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first, ++__result)
+ *__result = __pred(*__first) ? __new_value : *__first;
+ return __result;
+}
+
+// generate and generate_n
+
+template <class _ForwardIter, class _Generator>
+_STLP_INLINE_LOOP void
+generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ *__first = __gen();
+}
+
+template <class _OutputIter, class _Size, class _Generator>
+_STLP_INLINE_LOOP void
+generate_n(_OutputIter __first, _Size __n, _Generator __gen) {
+ for ( ; __n > 0; --__n, ++__first)
+ *__first = __gen();
+}
+
+// remove, remove_if, remove_copy, remove_copy_if
+
+template <class _InputIter, class _OutputIter, class _Tp>
+_STLP_INLINE_LOOP _OutputIter
+remove_copy(_InputIter __first, _InputIter __last,_OutputIter __result, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first) {
+ if (!(*__first == __val)) {
+ *__result = *__first;
+ ++__result;
+ }
+ }
+ return __result;
+}
+
+template <class _InputIter, class _OutputIter, class _Predicate>
+_STLP_INLINE_LOOP _OutputIter
+remove_copy_if(_InputIter __first, _InputIter __last, _OutputIter __result, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first) {
+ if (!__pred(*__first)) {
+ *__result = *__first;
+ ++__result;
+ }
+ }
+ return __result;
+}
+
+template <class _ForwardIter, class _Tp>
+_STLP_INLINE_LOOP _ForwardIter
+remove(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ __first = find(__first, __last, __val);
+ if (__first == __last)
+ return __first;
+ else {
+ _ForwardIter __next = __first;
+ return remove_copy(++__next, __last, __first, __val);
+ }
+}
+
+template <class _ForwardIter, class _Predicate>
+_STLP_INLINE_LOOP _ForwardIter
+remove_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ __first = find_if(__first, __last, __pred);
+ if ( __first == __last )
+ return __first;
+ else {
+ _ForwardIter __next = __first;
+ return remove_copy_if(++__next, __last, __first, __pred);
+ }
+}
+
+// unique and unique_copy
+template <class _InputIter, class _OutputIter>
+_OutputIter unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result);
+
+template <class _InputIter, class _OutputIter, class _BinaryPredicate>
+_OutputIter unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ _BinaryPredicate __binary_pred);
+
+template <class _ForwardIter>
+inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last) {
+ __first = adjacent_find(__first, __last);
+ return unique_copy(__first, __last, __first);
+}
+
+template <class _ForwardIter, class _BinaryPredicate>
+inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last,
+ _BinaryPredicate __binary_pred) {
+ __first = adjacent_find(__first, __last, __binary_pred);
+ return unique_copy(__first, __last, __first, __binary_pred);
+}
+
+// reverse and reverse_copy, and their auxiliary functions
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter>
+_STLP_INLINE_LOOP void
+__reverse(_BidirectionalIter __first, _BidirectionalIter __last, const bidirectional_iterator_tag &) {
+ for (; __first != __last && __first != --__last; ++__first)
+ _STLP_STD::iter_swap(__first,__last);
+}
+
+template <class _RandomAccessIter>
+_STLP_INLINE_LOOP void
+__reverse(_RandomAccessIter __first, _RandomAccessIter __last, const random_access_iterator_tag &) {
+ for (; __first < __last; ++__first)
+ _STLP_STD::iter_swap(__first, --__last);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+inline void
+reverse(_BidirectionalIter __first, _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_PRIV __reverse(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _BidirectionalIter));
+}
+
+template <class _BidirectionalIter, class _OutputIter>
+_STLP_INLINE_LOOP
+_OutputIter reverse_copy(_BidirectionalIter __first,
+ _BidirectionalIter __last,
+ _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ while (__first != __last) {
+ --__last;
+ *__result = *__last;
+ ++__result;
+ }
+ return __result;
+}
+
+template <class _ForwardIter>
+void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last);
+
+template <class _ForwardIter, class _OutputIter>
+inline _OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle,
+ _ForwardIter __last, _OutputIter __result) {
+ return _STLP_STD::copy(__first, __middle, copy(__middle, __last, __result));
+}
+
+// random_shuffle
+
+template <class _RandomAccessIter>
+void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _RandomNumberGenerator>
+void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last,
+ _RandomNumberGenerator& __rand);
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// random_sample and random_sample_n (extensions, not part of the standard).
+
+template <class _ForwardIter, class _OutputIter, class _Distance>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n);
+
+template <class _ForwardIter, class _OutputIter, class _Distance,
+ class _RandomNumberGenerator>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n,
+ _RandomNumberGenerator& __rand);
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last);
+
+template <class _InputIter, class _RandomAccessIter,
+ class _RandomNumberGenerator>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last,
+ _RandomNumberGenerator& __rand);
+
+#endif /* _STLP_NO_EXTENSIONS */
+
+// partition, stable_partition, and their auxiliary functions
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred);
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter
+stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred);
+
+// sort() and its auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Size>
+inline _Size __lg(_Size __n) {
+ _Size __k;
+ for (__k = 0; __n != 1; __n >>= 1) ++__k;
+ return __k;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last);
+template <class _RandomAccessIter, class _Compare>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp);
+
+// stable_sort() and its auxiliary functions.
+template <class _RandomAccessIter>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _Compare>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp);
+
+// partial_sort, partial_sort_copy, and auxiliary functions.
+
+template <class _RandomAccessIter>
+void partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle,
+ _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _Compare>
+void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
+ _RandomAccessIter __last, _Compare __comp);
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first, _RandomAccessIter __result_last);
+
+template <class _InputIter, class _RandomAccessIter, class _Compare>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first,
+ _RandomAccessIter __result_last, _Compare __comp);
+
+// nth_element() and its auxiliary functions.
+template <class _RandomAccessIter>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _Compare>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last, _Compare __comp);
+
+// auxiliary class for lower_bound, etc.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _T1, class _T2>
+struct __less_2 {
+ bool operator() (const _T1& __x, const _T2& __y) const { return __x < __y ; }
+};
+
+template <class _T1, class _T2>
+__less_2<_T1,_T2> __less2(_T1*, _T2* ) { return __less_2<_T1, _T2>(); }
+
+#if defined (_STLP_FUNCTION_PARTIAL_ORDER)
+template <class _Tp>
+less<_Tp> __less2(_Tp*, _Tp* ) { return less<_Tp>(); }
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Binary search (lower_bound, upper_bound, equal_range, binary_search).
+template <class _ForwardIter, class _Tp>
+inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __lower_bound(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __upper_bound(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __upper_bound(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+pair<_ForwardIter, _ForwardIter>
+__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+inline pair<_ForwardIter, _ForwardIter>
+equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __equal_range(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline pair<_ForwardIter, _ForwardIter>
+equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __equal_range(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp>
+inline bool binary_search(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+ return __i != __last && !(__val < *__i);
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline bool binary_search(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+ return __i != __last && !__comp(__val, *__i);
+}
+
+// merge, with and without an explicitly supplied comparison function.
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+
+// inplace_merge and its auxiliary functions.
+
+
+template <class _BidirectionalIter>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last) ;
+
+template <class _BidirectionalIter, class _Compare>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last, _Compare __comp);
+
+// Set algorithms: includes, set_union, set_intersection, set_difference,
+// set_symmetric_difference. All of these algorithms have the precondition
+// that their input ranges are sorted and the postcondition that their output
+// ranges are sorted.
+
+template <class _InputIter1, class _InputIter2>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2, _Compare __comp);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result,
+ _Compare __comp);
+
+
+// min_element and max_element, with and without an explicitly supplied
+// comparison function.
+
+template <class _ForwardIter>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last);
+template <class _ForwardIter, class _Compare>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp);
+
+template <class _ForwardIter>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last);
+
+template <class _ForwardIter, class _Compare>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp);
+
+// next_permutation and prev_permutation, with and without an explicitly
+// supplied comparison function.
+
+template <class _BidirectionalIter>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last);
+
+template <class _BidirectionalIter, class _Compare>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp);
+
+
+template <class _BidirectionalIter>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last);
+
+
+template <class _BidirectionalIter, class _Compare>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp);
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// is_heap, a predicate testing whether or not a range is
+// a heap. This function is an extension, not part of the C++
+// standard.
+
+template <class _RandomAccessIter>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _StrictWeakOrdering>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last,
+ _StrictWeakOrdering __comp);
+
+// is_sorted, a predicated testing whether a range is sorted in
+// nondescending order. This is an extension, not part of the C++
+// standard.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _StrictWeakOrdering>
+bool __is_sorted(_ForwardIter __first, _ForwardIter __last,
+ _StrictWeakOrdering __comp);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _ForwardIter>
+inline bool is_sorted(_ForwardIter __first, _ForwardIter __last) {
+ return _STLP_PRIV __is_sorted(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _ForwardIter)));
+}
+
+template <class _ForwardIter, class _StrictWeakOrdering>
+inline bool is_sorted(_ForwardIter __first, _ForwardIter __last,
+ _StrictWeakOrdering __comp) {
+ return _STLP_PRIV __is_sorted(__first, __last, __comp);
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_algo.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ALGO_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stlport/stl/_auto_ptr.h b/stlport/stlport/stl/_auto_ptr.h
new file mode 100644
index 0000000..c750534
--- /dev/null
+++ b/stlport/stlport/stl/_auto_ptr.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_AUTO_PTR_H
+#define _STLP_AUTO_PTR_H
+
+_STLP_BEGIN_NAMESPACE
+// implementation primitive
+class __ptr_base {
+public:
+ void* _M_p;
+ void __set(const volatile void* p) { _M_p = __CONST_CAST(void*,p); }
+ void __set(void* p) { _M_p = p; }
+};
+
+template <class _Tp>
+class auto_ptr_ref {
+public:
+ __ptr_base& _M_r;
+ _Tp* const _M_p;
+
+ auto_ptr_ref(__ptr_base& __r, _Tp* __p) : _M_r(__r), _M_p(__p) { }
+
+ _Tp* release() const { _M_r.__set(__STATIC_CAST(void*, 0)); return _M_p; }
+
+private:
+ //explicitely defined as private to avoid warnings:
+ typedef auto_ptr_ref<_Tp> _Self;
+ _Self& operator = (_Self const&);
+};
+
+template<class _Tp>
+class auto_ptr : public __ptr_base {
+public:
+ typedef _Tp element_type;
+ typedef auto_ptr<_Tp> _Self;
+
+ _Tp* release() _STLP_NOTHROW {
+ _Tp* __px = this->get();
+ this->_M_p = 0;
+ return __px;
+ }
+
+ void reset(_Tp* __px = 0) _STLP_NOTHROW {
+ _Tp* __pt = this->get();
+ if (__px != __pt)
+ delete __pt;
+ this->__set(__px);
+ }
+
+ _Tp* get() const _STLP_NOTHROW
+#if !defined (__GNUC__) || (__GNUC__ > 2)
+ { return __STATIC_CAST(_Tp*, _M_p); }
+#else
+ { return __REINTERPRET_CAST(_Tp*, _M_p); }
+#endif
+
+#if !defined (_STLP_NO_ARROW_OPERATOR)
+ _Tp* operator->() const _STLP_NOTHROW {
+ _STLP_VERBOSE_ASSERT(get() != 0, _StlMsg_AUTO_PTR_NULL)
+ return get();
+ }
+#endif
+ _Tp& operator*() const _STLP_NOTHROW {
+ _STLP_VERBOSE_ASSERT(get() != 0, _StlMsg_AUTO_PTR_NULL)
+ return *get();
+ }
+
+ explicit auto_ptr(_Tp* __px = 0) _STLP_NOTHROW { this->__set(__px); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if !defined (_STLP_NO_TEMPLATE_CONVERSIONS)
+ template<class _Tp1> auto_ptr(auto_ptr<_Tp1>& __r) _STLP_NOTHROW {
+ _Tp* __conversionCheck = __r.release();
+ this->__set(__conversionCheck);
+ }
+# endif
+ template<class _Tp1> auto_ptr<_Tp>& operator=(auto_ptr<_Tp1>& __r) _STLP_NOTHROW {
+ _Tp* __conversionCheck = __r.release();
+ reset(__conversionCheck);
+ return *this;
+ }
+#endif
+
+ auto_ptr(_Self& __r) _STLP_NOTHROW { this->__set(__r.release()); }
+
+ _Self& operator=(_Self& __r) _STLP_NOTHROW {
+ reset(__r.release());
+ return *this;
+ }
+
+ ~auto_ptr() _STLP_NOTHROW { /* boris : reset(0) might be better */ delete this->get(); }
+
+ auto_ptr(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW
+ { this->__set(__r.release()); }
+
+ _Self& operator=(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW {
+ reset(__r.release());
+ return *this;
+ }
+
+#if defined(_STLP_MEMBER_TEMPLATES) && !defined(_STLP_NO_TEMPLATE_CONVERSIONS)
+ template<class _Tp1> operator auto_ptr_ref<_Tp1>() _STLP_NOTHROW
+ { return auto_ptr_ref<_Tp1>(*this, this->get()); }
+ template<class _Tp1> operator auto_ptr<_Tp1>() _STLP_NOTHROW
+ { return auto_ptr<_Tp1>(release()); }
+#else
+ operator auto_ptr_ref<_Tp>() _STLP_NOTHROW
+ { return auto_ptr_ref<_Tp>(*this, this->get()); }
+#endif
+};
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_AUTO_PTR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_bitset.c b/stlport/stlport/stl/_bitset.c
new file mode 100644
index 0000000..82b9312
--- /dev/null
+++ b/stlport/stlport/stl/_bitset.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_BITSET_C
+#define _STLP_BITSET_C
+
+#ifndef _STLP_BITSET_H
+# include <stl/_bitset.h>
+#endif
+
+#define __BITS_PER_WORD (CHAR_BIT * sizeof(unsigned long))
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+//
+// Definitions of non-inline functions from _Base_bitset.
+//
+template<size_t _Nw>
+void _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) {
+ if (__shift != 0) {
+ const size_t __wshift = __shift / __BITS_PER_WORD;
+ const size_t __offset = __shift % __BITS_PER_WORD;
+
+ if (__offset == 0)
+ for (size_t __n = _Nw - 1; __n >= __wshift; --__n)
+ _M_w[__n] = _M_w[__n - __wshift];
+
+ else {
+ const size_t __sub_offset = __BITS_PER_WORD - __offset;
+ for (size_t __n = _Nw - 1; __n > __wshift; --__n)
+ _M_w[__n] = (_M_w[__n - __wshift] << __offset) |
+ (_M_w[__n - __wshift - 1] >> __sub_offset);
+ _M_w[__wshift] = _M_w[0] << __offset;
+ }
+
+ fill(_M_w + 0, _M_w + __wshift, __STATIC_CAST(_WordT,0));
+ }
+}
+
+template<size_t _Nw>
+void _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) {
+ if (__shift != 0) {
+ const size_t __wshift = __shift / __BITS_PER_WORD;
+ const size_t __offset = __shift % __BITS_PER_WORD;
+ const size_t __limit = _Nw - __wshift - 1;
+
+ if (__offset == 0)
+ for (size_t __n = 0; __n <= __limit; ++__n)
+ _M_w[__n] = _M_w[__n + __wshift];
+
+ else {
+ const size_t __sub_offset = __BITS_PER_WORD - __offset;
+ for (size_t __n = 0; __n < __limit; ++__n)
+ _M_w[__n] = (_M_w[__n + __wshift] >> __offset) |
+ (_M_w[__n + __wshift + 1] << __sub_offset);
+ _M_w[__limit] = _M_w[_Nw-1] >> __offset;
+ }
+
+ fill(_M_w + __limit + 1, _M_w + _Nw, __STATIC_CAST(_WordT,0));
+ }
+}
+
+template<size_t _Nw>
+unsigned long _Base_bitset<_Nw>::_M_do_to_ulong() const {
+ for (size_t __i = 1; __i < _Nw; ++__i)
+ if (_M_w[__i])
+ __stl_throw_overflow_error("bitset");
+ return _M_w[0];
+} // End _M_do_to_ulong
+
+template<size_t _Nw>
+size_t _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _WordT __thisword = _M_w[__i];
+ if ( __thisword != __STATIC_CAST(_WordT,0) ) {
+ // find byte within word
+ for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) {
+ unsigned char __this_byte
+ = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
+ if ( __this_byte )
+ return __i*__BITS_PER_WORD + __j*CHAR_BIT +
+ _Bs_G::_S_first_one(__this_byte);
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+ }
+ // not found, so return an indication of failure.
+ return __not_found;
+}
+
+template<size_t _Nw>
+size_t
+_Base_bitset<_Nw>::_M_do_find_next(size_t __prev,
+ size_t __not_found) const {
+ // make bound inclusive
+ ++__prev;
+
+ // check out of bounds
+ if ( __prev >= _Nw * __BITS_PER_WORD )
+ return __not_found;
+
+ // search first word
+ size_t __i = _S_whichword(__prev);
+ _WordT __thisword = _M_w[__i];
+
+ // mask off bits below bound
+ __thisword &= (~__STATIC_CAST(_WordT,0)) << _S_whichbit(__prev);
+
+ if ( __thisword != __STATIC_CAST(_WordT,0) ) {
+ // find byte within word
+ // get first byte into place
+ __thisword >>= _S_whichbyte(__prev) * CHAR_BIT;
+ for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); ++__j ) {
+ unsigned char __this_byte
+ = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
+ if ( __this_byte )
+ return __i*__BITS_PER_WORD + __j*CHAR_BIT +
+ _Bs_G::_S_first_one(__this_byte);
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+
+ // check subsequent words
+ ++__i;
+ for ( ; __i < _Nw; ++__i ) {
+ /* _WordT */ __thisword = _M_w[__i];
+ if ( __thisword != __STATIC_CAST(_WordT,0) ) {
+ // find byte within word
+ for ( size_t __j = 0; __j < sizeof(_WordT); ++__j ) {
+ unsigned char __this_byte
+ = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
+ if ( __this_byte )
+ return __i*__BITS_PER_WORD + __j*CHAR_BIT +
+ _Bs_G::_S_first_one(__this_byte);
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+ }
+
+ // not found, so return an indication of failure.
+ return __not_found;
+} // end _M_do_find_next
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if !defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
+
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+
+_STLP_END_NAMESPACE
+
+#ifndef _STLP_STRING_IO_H
+# include <stl/_string_io.h> //includes _istream.h and _ostream.h
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _Traits, size_t _Nb>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) {
+ basic_string<_CharT, _Traits> __tmp;
+ __tmp.reserve(_Nb);
+
+ // Skip whitespace
+ typename basic_istream<_CharT, _Traits>::sentry __sentry(__is);
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ static typename _Traits::int_type __eof = _Traits::eof();
+
+ typename _Traits::int_type __c1 = __buf->sbumpc();
+ if (_Traits::eq_int_type(__c1, __eof)) {
+ __is.setstate(ios_base::eofbit);
+ break;
+ }
+ else {
+ typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
+ char __c = __is.narrow(__c2, '*');
+
+ if (__c == '0' || __c == '1')
+ __tmp.push_back(__c);
+ else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
+ __is.setstate(ios_base::failbit);
+ break;
+ }
+ }
+ }
+
+ if (__tmp.empty())
+ __is.setstate(ios_base::failbit);
+ else
+ __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb);
+ }
+
+ return __is;
+}
+
+template <class _CharT, class _Traits, size_t _Nb>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const bitset<_Nb>& __x) {
+ basic_string<_CharT, _Traits> __tmp;
+ __x._M_copy_to_string(__tmp);
+ return __os << __tmp;
+}
+
+# endif /* !_STLP_USE_NO_IOSTREAMS */
+
+#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+
+_STLP_END_NAMESPACE
+
+#undef __BITS_PER_WORD
+#undef bitset
+
+#endif /* _STLP_BITSET_C */
diff --git a/stlport/stlport/stl/_bitset.h b/stlport/stlport/stl/_bitset.h
new file mode 100644
index 0000000..f894346
--- /dev/null
+++ b/stlport/stlport/stl/_bitset.h
@@ -0,0 +1,880 @@
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_BITSET_H
+#define _STLP_BITSET_H
+
+// A bitset of size N has N % (sizeof(unsigned long) * CHAR_BIT) unused
+// bits. (They are the high- order bits in the highest word.) It is
+// a class invariant of class bitset<> that those unused bits are
+// always zero.
+
+// Most of the actual code isn't contained in bitset<> itself, but in the
+// base class _Base_bitset. The base class works with whole words, not with
+// individual bits. This allows us to specialize _Base_bitset for the
+// important special case where the bitset is only a single word.
+
+// The C++ standard does not define the precise semantics of operator[].
+// In this implementation the const version of operator[] is equivalent
+// to test(), except that it does no range checking. The non-const version
+// returns a reference to a bit, again without doing any range checking.
+
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+#ifndef _STLP_RANGE_ERRORS_H
+# include <stl/_range_errors.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+#define __BITS_PER_WORD (CHAR_BIT*sizeof(unsigned long))
+#define __BITSET_WORDS(__n) ((__n + __BITS_PER_WORD - 1)/__BITS_PER_WORD)
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// structure to aid in counting bits
+class _STLP_CLASS_DECLSPEC _Bs_G
+{
+ public:
+ //returns the number of bit set within the buffer between __beg and __end.
+ static size_t _S_count(const unsigned char *__beg, const unsigned char *__end)
+#if defined (_STLP_USE_NO_IOSTREAMS)
+ {
+ size_t __result = 0;
+ for (; __beg != __end; ++__beg) {
+ for (size_t i = 0; i < (sizeof(unsigned char) * 8); ++i) {
+ if ((*__beg & (1 << i)) != 0) { ++__result; }
+ }
+ }
+ return __result;
+ }
+#else
+ ;
+#endif
+ // Mapping from 8 bit unsigned integers to the index of the first one bit set:
+ static unsigned char _S_first_one(unsigned char __x)
+#if defined (_STLP_USE_NO_IOSTREAMS)
+ {
+ for (unsigned char i = 0; i < (sizeof(unsigned char) * 8); ++i) {
+ if ((__x & (1 << i)) != 0) { return i; }
+ }
+ return 0;
+ }
+#else
+ ;
+#endif
+};
+
+//
+// Base class: general case.
+//
+
+template<size_t _Nw>
+struct _Base_bitset {
+ typedef unsigned long _WordT;
+
+ _WordT _M_w[_Nw]; // 0 is the least significant word.
+
+ _Base_bitset() { _M_do_reset(); }
+
+ _Base_bitset(unsigned long __val) {
+ _M_do_reset();
+ _M_w[0] = __val;
+ }
+
+ static size_t _STLP_CALL _S_whichword( size_t __pos ) {
+ return __pos / __BITS_PER_WORD;
+ }
+ static size_t _STLP_CALL _S_whichbyte( size_t __pos ) {
+ return (__pos % __BITS_PER_WORD) / CHAR_BIT;
+ }
+ static size_t _STLP_CALL _S_whichbit( size_t __pos ) {
+ return __pos % __BITS_PER_WORD;
+ }
+ static _WordT _STLP_CALL _S_maskbit( size_t __pos ) {
+ return __STATIC_CAST(_WordT,1) << _S_whichbit(__pos);
+ }
+
+ _WordT& _M_getword(size_t __pos) { return _M_w[_S_whichword(__pos)]; }
+ _WordT _M_getword(size_t __pos) const { return _M_w[_S_whichword(__pos)]; }
+
+ _WordT& _M_hiword() { return _M_w[_Nw - 1]; }
+ _WordT _M_hiword() const { return _M_w[_Nw - 1]; }
+
+ void _M_do_and(const _Base_bitset<_Nw>& __x) {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _M_w[__i] &= __x._M_w[__i];
+ }
+ }
+
+ void _M_do_or(const _Base_bitset<_Nw>& __x) {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _M_w[__i] |= __x._M_w[__i];
+ }
+ }
+
+ void _M_do_xor(const _Base_bitset<_Nw>& __x) {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _M_w[__i] ^= __x._M_w[__i];
+ }
+ }
+
+ void _M_do_left_shift(size_t __shift);
+
+ void _M_do_right_shift(size_t __shift);
+
+ void _M_do_flip() {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _M_w[__i] = ~_M_w[__i];
+ }
+ }
+
+ void _M_do_set() {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _M_w[__i] = ~__STATIC_CAST(_WordT,0);
+ }
+ }
+
+ void _M_do_reset() { memset(_M_w, 0, _Nw * sizeof(_WordT)); }
+
+ bool _M_is_equal(const _Base_bitset<_Nw>& __x) const {
+ for (size_t __i = 0; __i < _Nw; ++__i) {
+ if (_M_w[__i] != __x._M_w[__i])
+ return false;
+ }
+ return true;
+ }
+
+ bool _M_is_any() const {
+ for ( size_t __i = 0; __i < _Nw ; __i++ ) {
+ if ( _M_w[__i] != __STATIC_CAST(_WordT,0) )
+ return true;
+ }
+ return false;
+ }
+
+ size_t _M_do_count() const {
+ const unsigned char* __byte_ptr = (const unsigned char*)_M_w;
+ const unsigned char* __end_ptr = (const unsigned char*)(_M_w+_Nw);
+
+ return _Bs_G::_S_count(__byte_ptr, __end_ptr);
+ }
+
+ unsigned long _M_do_to_ulong() const;
+
+ // find first "on" bit
+ size_t _M_do_find_first(size_t __not_found) const;
+
+ // find the next "on" bit that follows "prev"
+ size_t _M_do_find_next(size_t __prev, size_t __not_found) const;
+};
+
+//
+// Base class: specialization for a single word.
+//
+_STLP_TEMPLATE_NULL
+struct _Base_bitset<1UL> {
+ typedef unsigned long _WordT;
+ typedef _Base_bitset<1UL> _Self;
+
+ _WordT _M_w;
+
+ _Base_bitset( void ) : _M_w(0) {}
+ _Base_bitset(unsigned long __val) : _M_w(__val) {}
+
+ static size_t _STLP_CALL _S_whichword( size_t __pos ) {
+ return __pos / __BITS_PER_WORD ;
+ }
+ static size_t _STLP_CALL _S_whichbyte( size_t __pos ) {
+ return (__pos % __BITS_PER_WORD) / CHAR_BIT;
+ }
+ static size_t _STLP_CALL _S_whichbit( size_t __pos ) {
+ return __pos % __BITS_PER_WORD;
+ }
+ static _WordT _STLP_CALL _S_maskbit( size_t __pos ) {
+ return (__STATIC_CAST(_WordT,1)) << _S_whichbit(__pos);
+ }
+
+ _WordT& _M_getword(size_t) { return _M_w; }
+ _WordT _M_getword(size_t) const { return _M_w; }
+
+ _WordT& _M_hiword() { return _M_w; }
+ _WordT _M_hiword() const { return _M_w; }
+
+ void _M_do_and(const _Self& __x) { _M_w &= __x._M_w; }
+ void _M_do_or(const _Self& __x) { _M_w |= __x._M_w; }
+ void _M_do_xor(const _Self& __x) { _M_w ^= __x._M_w; }
+ void _M_do_left_shift(size_t __shift) { _M_w <<= __shift; }
+ void _M_do_right_shift(size_t __shift) { _M_w >>= __shift; }
+ void _M_do_flip() { _M_w = ~_M_w; }
+ void _M_do_set() { _M_w = ~__STATIC_CAST(_WordT,0); }
+ void _M_do_reset() { _M_w = 0; }
+
+ bool _M_is_equal(const _Self& __x) const {
+ return _M_w == __x._M_w;
+ }
+ bool _M_is_any() const {
+ return _M_w != 0;
+ }
+
+ size_t _M_do_count() const {
+ const unsigned char* __byte_ptr = (const unsigned char*)&_M_w;
+ const unsigned char* __end_ptr = ((const unsigned char*)&_M_w)+sizeof(_M_w);
+ return _Bs_G::_S_count(__byte_ptr, __end_ptr);
+ }
+
+ unsigned long _M_do_to_ulong() const { return _M_w; }
+
+ inline size_t _M_do_find_first(size_t __not_found) const;
+
+ // find the next "on" bit that follows "prev"
+ inline size_t _M_do_find_next(size_t __prev, size_t __not_found) const;
+};
+
+
+// ------------------------------------------------------------
+//
+// Definitions of should-be-non-inline functions from the single-word version of
+// _Base_bitset.
+//
+inline size_t
+_Base_bitset<1UL>::_M_do_find_first(size_t __not_found) const {
+ // typedef unsigned long _WordT;
+ _WordT __thisword = _M_w;
+
+ if ( __thisword != __STATIC_CAST(_WordT,0) ) {
+ // find byte within word
+ for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) {
+ unsigned char __this_byte
+ = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
+ if ( __this_byte )
+ return __j*CHAR_BIT + _Bs_G::_S_first_one(__this_byte);
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+ // not found, so return a value that indicates failure.
+ return __not_found;
+}
+
+inline size_t
+_Base_bitset<1UL>::_M_do_find_next(size_t __prev,
+ size_t __not_found ) const {
+ // make bound inclusive
+ ++__prev;
+
+ // check out of bounds
+ if ( __prev >= __BITS_PER_WORD )
+ return __not_found;
+
+ // search first (and only) word
+ _WordT __thisword = _M_w;
+
+ // mask off bits below bound
+ __thisword &= (~__STATIC_CAST(_WordT,0)) << _S_whichbit(__prev);
+
+ if ( __thisword != __STATIC_CAST(_WordT,0) ) {
+ // find byte within word
+ // get first byte into place
+ __thisword >>= _S_whichbyte(__prev) * CHAR_BIT;
+ for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) {
+ unsigned char __this_byte
+ = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
+ if ( __this_byte )
+ return __j*CHAR_BIT + _Bs_G::_S_first_one(__this_byte);
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+
+ // not found, so return a value that indicates failure.
+ return __not_found;
+} // end _M_do_find_next
+
+
+// ------------------------------------------------------------
+// Helper class to zero out the unused high-order bits in the highest word.
+
+template <size_t _Extrabits> struct _Sanitize {
+ static void _STLP_CALL _M_do_sanitize(unsigned long& __val)
+ { __val &= ~((~__STATIC_CAST(unsigned long,0)) << _Extrabits); }
+};
+
+_STLP_TEMPLATE_NULL struct _Sanitize<0UL> {
+ static void _STLP_CALL _M_do_sanitize(unsigned long) {}
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// ------------------------------------------------------------
+// Class bitset.
+// _Nb may be any nonzero number of type size_t.
+template<size_t _Nb>
+class bitset : public _STLP_PRIV _Base_bitset<__BITSET_WORDS(_Nb) > {
+public:
+ enum { _Words = __BITSET_WORDS(_Nb) } ;
+
+private:
+ typedef _STLP_PRIV _Base_bitset< _Words > _Base;
+
+ void _M_do_sanitize() {
+ _STLP_PRIV _Sanitize<_Nb%__BITS_PER_WORD >::_M_do_sanitize(this->_M_hiword());
+ }
+public:
+ typedef unsigned long _WordT;
+ struct reference;
+ friend struct reference;
+
+ // bit reference:
+ struct reference {
+ typedef _STLP_PRIV _Base_bitset<_Words > _Bitset_base;
+ typedef bitset<_Nb> _Bitset;
+ // friend _Bitset;
+ _WordT *_M_wp;
+ size_t _M_bpos;
+
+ // should be left undefined
+ reference() {}
+
+ reference( _Bitset& __b, size_t __pos ) {
+ _M_wp = &__b._M_getword(__pos);
+ _M_bpos = _Bitset_base::_S_whichbit(__pos);
+ }
+
+ public:
+ ~reference() {}
+
+ // for b[i] = __x;
+ reference& operator=(bool __x) {
+ if ( __x )
+ *_M_wp |= _Bitset_base::_S_maskbit(_M_bpos);
+ else
+ *_M_wp &= ~_Bitset_base::_S_maskbit(_M_bpos);
+
+ return *this;
+ }
+
+ // for b[i] = b[__j];
+ reference& operator=(const reference& __j) {
+ if ( (*(__j._M_wp) & _Bitset_base::_S_maskbit(__j._M_bpos)) )
+ *_M_wp |= _Bitset_base::_S_maskbit(_M_bpos);
+ else
+ *_M_wp &= ~_Bitset_base::_S_maskbit(_M_bpos);
+
+ return *this;
+ }
+
+ // flips the bit
+ bool operator~() const { return (*(_M_wp) & _Bitset_base::_S_maskbit(_M_bpos)) == 0; }
+
+ // for __x = b[i];
+ operator bool() const { return (*(_M_wp) & _Bitset_base::_S_maskbit(_M_bpos)) != 0; }
+
+ // for b[i].flip();
+ reference& flip() {
+ *_M_wp ^= _Bitset_base::_S_maskbit(_M_bpos);
+ return *this;
+ }
+ };
+
+ // 23.3.5.1 constructors:
+ bitset() {}
+
+ bitset(unsigned long __val) : _STLP_PRIV _Base_bitset<_Words>(__val) { _M_do_sanitize(); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template<class _CharT, class _Traits, class _Alloc>
+ explicit bitset(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ size_t __pos = 0)
+ : _STLP_PRIV _Base_bitset<_Words >() {
+ if (__pos > __s.size())
+ __stl_throw_out_of_range("bitset");
+ _M_copy_from_string(__s, __pos,
+ basic_string<_CharT, _Traits, _Alloc>::npos);
+ }
+ template<class _CharT, class _Traits, class _Alloc>
+ bitset(const basic_string<_CharT, _Traits, _Alloc>& __s,
+ size_t __pos,
+ size_t __n)
+ : _STLP_PRIV _Base_bitset<_Words >() {
+ if (__pos > __s.size())
+ __stl_throw_out_of_range("bitset");
+ _M_copy_from_string(__s, __pos, __n);
+ }
+#else /* _STLP_MEMBER_TEMPLATES */
+ explicit bitset(const string& __s,
+ size_t __pos = 0,
+ size_t __n = (size_t)-1)
+ : _STLP_PRIV _Base_bitset<_Words >() {
+ if (__pos > __s.size())
+ __stl_throw_out_of_range("bitset");
+ _M_copy_from_string(__s, __pos, __n);
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ // 23.3.5.2 bitset operations:
+ bitset<_Nb>& operator&=(const bitset<_Nb>& __rhs) {
+ this->_M_do_and(__rhs);
+ return *this;
+ }
+
+ bitset<_Nb>& operator|=(const bitset<_Nb>& __rhs) {
+ this->_M_do_or(__rhs);
+ return *this;
+ }
+
+ bitset<_Nb>& operator^=(const bitset<_Nb>& __rhs) {
+ this->_M_do_xor(__rhs);
+ return *this;
+ }
+
+ bitset<_Nb>& operator<<=(size_t __pos) {
+ this->_M_do_left_shift(__pos);
+ this->_M_do_sanitize();
+ return *this;
+ }
+
+ bitset<_Nb>& operator>>=(size_t __pos) {
+ this->_M_do_right_shift(__pos);
+ this->_M_do_sanitize();
+ return *this;
+ }
+
+ //
+ // Extension:
+ // Versions of single-bit set, reset, flip, test with no range checking.
+ //
+
+ bitset<_Nb>& _Unchecked_set(size_t __pos) {
+ this->_M_getword(__pos) |= _STLP_PRIV _Base_bitset<_Words > ::_S_maskbit(__pos);
+ return *this;
+ }
+
+ bitset<_Nb>& _Unchecked_set(size_t __pos, int __val) {
+ if (__val)
+ this->_M_getword(__pos) |= this->_S_maskbit(__pos);
+ else
+ this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos);
+
+ return *this;
+ }
+
+ bitset<_Nb>& _Unchecked_reset(size_t __pos) {
+ this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos);
+ return *this;
+ }
+
+ bitset<_Nb>& _Unchecked_flip(size_t __pos) {
+ this->_M_getword(__pos) ^= this->_S_maskbit(__pos);
+ return *this;
+ }
+
+ bool _Unchecked_test(size_t __pos) const {
+ return (this->_M_getword(__pos) & this->_S_maskbit(__pos)) != __STATIC_CAST(_WordT,0);
+ }
+
+ // Set, reset, and flip.
+
+ bitset<_Nb>& set() {
+ this->_M_do_set();
+ this->_M_do_sanitize();
+ return *this;
+ }
+
+ bitset<_Nb>& set(size_t __pos) {
+ if (__pos >= _Nb)
+ __stl_throw_out_of_range("bitset");
+ return _Unchecked_set(__pos);
+ }
+
+ bitset<_Nb>& set(size_t __pos, int __val) {
+ if (__pos >= _Nb)
+ __stl_throw_out_of_range("bitset");
+ return _Unchecked_set(__pos, __val);
+ }
+
+ bitset<_Nb>& reset() {
+ this->_M_do_reset();
+ return *this;
+ }
+
+ bitset<_Nb>& reset(size_t __pos) {
+ if (__pos >= _Nb)
+ __stl_throw_out_of_range("bitset");
+
+ return _Unchecked_reset(__pos);
+ }
+
+ bitset<_Nb>& flip() {
+ this->_M_do_flip();
+ this->_M_do_sanitize();
+ return *this;
+ }
+
+ bitset<_Nb>& flip(size_t __pos) {
+ if (__pos >= _Nb)
+ __stl_throw_out_of_range("bitset");
+
+ return _Unchecked_flip(__pos);
+ }
+
+ bitset<_Nb> operator~() const {
+ return bitset<_Nb>(*this).flip();
+ }
+
+ // element access:
+ //for b[i];
+ reference operator[](size_t __pos) { return reference(*this,__pos); }
+ bool operator[](size_t __pos) const { return _Unchecked_test(__pos); }
+
+ unsigned long to_ulong() const { return this->_M_do_to_ulong(); }
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)
+ template <class _CharT, class _Traits, class _Alloc>
+ basic_string<_CharT, _Traits, _Alloc> to_string() const {
+ basic_string<_CharT, _Traits, _Alloc> __result;
+ _M_copy_to_string(__result);
+ return __result;
+ }
+#else
+ string to_string() const {
+ string __result;
+ _M_copy_to_string(__result);
+ return __result;
+ }
+#endif /* _STLP_EXPLICIT_FUNCTION_TMPL_ARGS */
+
+ size_t count() const { return this->_M_do_count(); }
+
+ size_t size() const { return _Nb; }
+
+ bool operator==(const bitset<_Nb>& __rhs) const {
+ return this->_M_is_equal(__rhs);
+ }
+ bool operator!=(const bitset<_Nb>& __rhs) const {
+ return !this->_M_is_equal(__rhs);
+ }
+
+ bool test(size_t __pos) const {
+ if (__pos >= _Nb)
+ __stl_throw_out_of_range("bitset");
+
+ return _Unchecked_test(__pos);
+ }
+
+ bool any() const { return this->_M_is_any(); }
+ bool none() const { return !this->_M_is_any(); }
+
+ bitset<_Nb> operator<<(size_t __pos) const {
+ bitset<_Nb> __result(*this);
+ __result <<= __pos ; return __result;
+ }
+ bitset<_Nb> operator>>(size_t __pos) const {
+ bitset<_Nb> __result(*this);
+ __result >>= __pos ; return __result;
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ //
+ // EXTENSIONS: bit-find operations. These operations are
+ // experimental, and are subject to change or removal in future
+ // versions.
+ //
+
+ // find the index of the first "on" bit
+ size_t _Find_first() const
+ { return this->_M_do_find_first(_Nb); }
+
+ // find the index of the next "on" bit after prev
+ size_t _Find_next( size_t __prev ) const
+ { return this->_M_do_find_next(__prev, _Nb); }
+#endif
+
+//
+// Definitions of should-be non-inline member functions.
+//
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template<class _CharT, class _Traits, class _Alloc>
+ void _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ size_t __pos, size_t __n) {
+#else
+ void _M_copy_from_string(const string& __s,
+ size_t __pos, size_t __n) {
+ typedef typename string::traits_type _Traits;
+#endif
+ reset();
+ size_t __tmp = _Nb;
+ const size_t __Nbits = (min) (__tmp, (min) (__n, __s.size() - __pos));
+ for ( size_t __i= 0; __i < __Nbits; ++__i) {
+ typename _Traits::int_type __k = _Traits::to_int_type(__s[__pos + __Nbits - __i - 1]);
+ // boris : widen() ?
+ if (__k == '1')
+ set(__i);
+ else if (__k != '0')
+ __stl_throw_invalid_argument("bitset");
+ }
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _CharT, class _Traits, class _Alloc>
+ void _M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const
+#else
+ void _M_copy_to_string(string& __s) const
+#endif
+ {
+ __s.assign(_Nb, '0');
+
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ if (_Unchecked_test(__i))
+ __s[_Nb - 1 - __i] = '1';
+ }
+ }
+
+#if !defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_WCHAR_T)
+ void _M_copy_to_string(wstring& __s) const {
+ __s.assign(_Nb, '0');
+
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ if (_Unchecked_test(__i))
+ __s[_Nb - 1 - __i] = '1';
+ }
+ }
+#endif
+
+#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
+ bitset<_Nb> operator&(const bitset<_Nb>& __y) const {
+ bitset<_Nb> __result(*this);
+ __result &= __y;
+ return __result;
+ }
+ bitset<_Nb> operator|(const bitset<_Nb>& __y) const {
+ bitset<_Nb> __result(*this);
+ __result |= __y;
+ return __result;
+ }
+ bitset<_Nb> operator^(const bitset<_Nb>& __y) const {
+ bitset<_Nb> __result(*this);
+ __result ^= __y;
+ return __result;
+ }
+#endif
+};
+
+// ------------------------------------------------------------
+//
+// 23.3.5.3 bitset operations:
+//
+#if ! defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
+template <size_t _Nb>
+inline bitset<_Nb> _STLP_CALL
+operator&(const bitset<_Nb>& __x,
+ const bitset<_Nb>& __y) {
+ bitset<_Nb> __result(__x);
+ __result &= __y;
+ return __result;
+}
+
+
+template <size_t _Nb>
+inline bitset<_Nb> _STLP_CALL
+operator|(const bitset<_Nb>& __x,
+ const bitset<_Nb>& __y) {
+ bitset<_Nb> __result(__x);
+ __result |= __y;
+ return __result;
+}
+
+template <size_t _Nb>
+inline bitset<_Nb> _STLP_CALL
+operator^(const bitset<_Nb>& __x,
+ const bitset<_Nb>& __y) {
+ bitset<_Nb> __result(__x);
+ __result ^= __y;
+ return __result;
+}
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+
+_STLP_END_NAMESPACE
+
+# if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) && \
+ !(defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x500))
+
+#ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _Traits, size_t _Nb>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x);
+
+template <class _CharT, class _Traits, size_t _Nb>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x);
+
+# else
+
+#ifndef _STLP_STRING_IO_H
+# include <stl/_string_io.h> //includes _istream.h and _ostream.h
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <size_t _Nb>
+istream& _STLP_CALL
+operator>>(istream& __is, bitset<_Nb>& __x) {
+ typedef typename string::traits_type _Traits;
+ string __tmp;
+ __tmp.reserve(_Nb);
+
+ // Skip whitespace
+ typename istream::sentry __sentry(__is);
+ if (__sentry) {
+ streambuf* __buf = __is.rdbuf();
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ static typename _Traits::int_type __eof = _Traits::eof();
+
+ typename _Traits::int_type __c1 = __buf->sbumpc();
+ if (_Traits::eq_int_type(__c1, __eof)) {
+ __is.setstate(ios_base::eofbit);
+ break;
+ }
+ else {
+ typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
+ char __c = __is.narrow(__c2, '*');
+
+ if (__c == '0' || __c == '1')
+ __tmp.push_back(__c);
+ else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
+ __is.setstate(ios_base::failbit);
+ break;
+ }
+ }
+ }
+
+ if (__tmp.empty())
+ __is.setstate(ios_base::failbit);
+ else
+ __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb);
+ }
+
+ return __is;
+}
+
+template <size_t _Nb>
+ostream& _STLP_CALL
+operator<<(ostream& __os, const bitset<_Nb>& __x) {
+ string __tmp;
+ __x._M_copy_to_string(__tmp);
+ return __os << __tmp;
+}
+
+# if !defined (_STLP_NO_WCHAR_T)
+
+template <size_t _Nb>
+wistream& _STLP_CALL
+operator>>(wistream& __is, bitset<_Nb>& __x) {
+ typedef typename wstring::traits_type _Traits;
+ wstring __tmp;
+ __tmp.reserve(_Nb);
+
+ // Skip whitespace
+ typename wistream::sentry __sentry(__is);
+ if (__sentry) {
+ wstreambuf* __buf = __is.rdbuf();
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ static typename _Traits::int_type __eof = _Traits::eof();
+
+ typename _Traits::int_type __c1 = __buf->sbumpc();
+ if (_Traits::eq_int_type(__c1, __eof)) {
+ __is.setstate(ios_base::eofbit);
+ break;
+ }
+ else {
+ typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
+ char __c = __is.narrow(__c2, '*');
+
+ if (__c == '0' || __c == '1')
+ __tmp.push_back(__c);
+ else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
+ __is.setstate(ios_base::failbit);
+ break;
+ }
+ }
+ }
+
+ if (__tmp.empty())
+ __is.setstate(ios_base::failbit);
+ else
+ __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb);
+ }
+
+ return __is;
+}
+
+template <size_t _Nb>
+wostream& _STLP_CALL
+operator<<(wostream& __os, const bitset<_Nb>& __x) {
+ wstring __tmp;
+ __x._M_copy_to_string(__tmp);
+ return __os << __tmp;
+}
+
+# endif /* _STLP_NO_WCHAR_T */
+# endif
+#endif
+
+#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+
+#undef bitset
+
+_STLP_END_NAMESPACE
+
+#undef __BITS_PER_WORD
+#undef __BITSET_WORDS
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_bitset.c>
+#endif
+
+#endif /* _STLP_BITSET_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_cctype.h b/stlport/stlport/stl/_cctype.h
new file mode 100644
index 0000000..cf82524
--- /dev/null
+++ b/stlport/stlport/stl/_cctype.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CCTYPE
+#define _STLP_INTERNAL_CCTYPE
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cctype>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cctype)
+# endif
+#else
+# include <ctype.h>
+#endif /* _STLP_USE_NEW_C_HEADERS */
+
+#if ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if defined ( _STLP_IMPORT_VENDOR_CSTD )
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::isalnum;
+using _STLP_VENDOR_CSTD::isalpha;
+using _STLP_VENDOR_CSTD::iscntrl;
+using _STLP_VENDOR_CSTD::isdigit;
+using _STLP_VENDOR_CSTD::isgraph;
+using _STLP_VENDOR_CSTD::islower;
+using _STLP_VENDOR_CSTD::isprint;
+using _STLP_VENDOR_CSTD::ispunct;
+using _STLP_VENDOR_CSTD::isspace;
+using _STLP_VENDOR_CSTD::isupper;
+using _STLP_VENDOR_CSTD::isxdigit;
+using _STLP_VENDOR_CSTD::tolower;
+using _STLP_VENDOR_CSTD::toupper;
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD*/
+#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+
+#endif
diff --git a/stlport/stlport/stl/_ctraits_fns.h b/stlport/stlport/stl/_ctraits_fns.h
new file mode 100644
index 0000000..e4a4af1
--- /dev/null
+++ b/stlport/stlport/stl/_ctraits_fns.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
+#define _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+// This file contains a few small adapters that allow a character
+// traits class to be used as a function object.
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Traits>
+struct _Eq_traits
+ : public binary_function<typename _Traits::char_type,
+ typename _Traits::char_type,
+ bool> {
+ bool operator()(const typename _Traits::char_type& __x,
+ const typename _Traits::char_type& __y) const
+ { return _Traits::eq(__x, __y); }
+};
+
+template <class _Traits>
+struct _Eq_char_bound
+ : public unary_function<typename _Traits::char_type, bool> {
+ typename _Traits::char_type __val;
+ _Eq_char_bound(typename _Traits::char_type __c) : __val(__c) {}
+ bool operator()(const typename _Traits::char_type& __x) const
+ { return _Traits::eq(__x, __val); }
+};
+
+template <class _Traits>
+struct _Neq_char_bound
+ : public unary_function<typename _Traits::char_type, bool>
+{
+ typename _Traits::char_type __val;
+ _Neq_char_bound(typename _Traits::char_type __c) : __val(__c) {}
+ bool operator()(const typename _Traits::char_type& __x) const
+ { return !_Traits::eq(__x, __val); }
+};
+
+template <class _Traits>
+struct _Eq_int_bound
+ : public unary_function<typename _Traits::char_type, bool> {
+ typename _Traits::int_type __val;
+
+ _Eq_int_bound(typename _Traits::int_type __c) : __val(__c) {}
+ bool operator()(const typename _Traits::char_type& __x) const
+ { return _Traits::eq_int_type(_Traits::to_int_type(__x), __val); }
+};
+
+#if 0
+template <class _Traits>
+struct _Lt_traits
+ : public binary_function<typename _Traits::char_type,
+ typename _Traits::char_type,
+ bool> {
+ bool operator()(const typename _Traits::char_type& __x,
+ const typename _Traits::char_type& __y) const
+ { return _Traits::lt(__x, __y); }
+};
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_CTRAITS_FUNCTIONS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_cwchar.h b/stlport/stlport/stl/_cwchar.h
new file mode 100644
index 0000000..87cb82b
--- /dev/null
+++ b/stlport/stlport/stl/_cwchar.h
@@ -0,0 +1,342 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CWCHAR
+#define _STLP_INTERNAL_CWCHAR
+
+#if defined (_STLP_WCE_EVC3)
+# ifndef _STLP_INTERNAL_MBSTATE_T
+# include <stl/_mbstate_t.h>
+# endif
+#else
+# if defined (__GNUC__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstddef>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
+# endif
+# endif
+
+# if !defined (_STLP_NO_CWCHAR) && defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cwchar>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
+# endif
+# if defined (__OpenBSD__)
+typedef _BSD_WINT_T_ wint_t;
+# endif /* __OpenBSD__ */
+
+# if defined (__DMC__)
+# define __STDC_LIMIT_MACROS
+# include <stdint.h> // WCHAR_MIN, WCHAR_MAX
+# endif
+# elif defined (_STLP_NO_WCHAR_T) || \
+ (defined (__BORLANDC__) && (__BORLANDC__ < 0x570)) || \
+ defined (__OpenBSD__) || defined (__FreeBSD__) || \
+ (defined (__GNUC__) && (defined (__APPLE__) || defined ( __Lynx__ )))
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stddef.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+# endif
+# if defined (__Lynx__)
+# ifndef _WINT_T
+typedef long int wint_t;
+# define _WINT_T
+# endif /* _WINT_T */
+# endif
+# if defined(__OpenBSD__)
+typedef _BSD_WINT_T_ wint_t;
+# endif /* __OpenBSD__ */
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <wchar.h>
+# else
+# include _STLP_NATIVE_C_HEADER(wchar.h)
+# endif
+
+# if defined (__sun) && (defined (_XOPEN_SOURCE) || (_XOPEN_VERSION - 0 == 4))
+extern wint_t btowc();
+extern int fwprintf();
+extern int fwscanf();
+extern int fwide();
+extern int mbsinit();
+extern size_t mbrlen();
+extern size_t mbrtowc();
+extern size_t mbsrtowcs();
+extern int swprintf();
+extern int swscanf();
+extern int vfwprintf();
+extern int vwprintf();
+extern int vswprintf();
+extern size_t wcrtomb();
+extern size_t wcsrtombs();
+extern wchar_t *wcsstr();
+extern int wctob();
+extern wchar_t *wmemchr();
+extern int wmemcmp();
+extern wchar_t *wmemcpy();
+extern wchar_t *wmemmove();
+extern wchar_t *wmemset();
+extern int wprintf();
+extern int wscanf();
+# endif
+# endif
+
+# if defined (__MSL__) && (__MSL__ <= 0x51FF) /* dwa 2/28/99 - not yet implemented by MSL */
+# define _STLP_WCHAR_MSL_EXCLUDE 1
+namespace std {
+ extern "C" size_t wcsftime(wchar_t * str, size_t max_size, const wchar_t * format_str, const struct tm * timeptr);
+}
+# define _STLP_NO_NATIVE_MBSTATE_T 1
+# elif defined (__BORLANDC__)
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+# define _STLP_NO_NATIVE_MBSTATE_T
+# endif
+# define _STLP_WCHAR_BORLAND_EXCLUDE 1
+# endif
+
+# ifndef _STLP_INTERNAL_MBSTATE_T
+# include <stl/_mbstate_t.h>
+# endif
+
+# if !defined (_STLP_NO_WCHAR_T)
+# ifndef WCHAR_MIN
+# define WCHAR_MIN 0
+/* SUNpro has some bugs with casts. wchar_t is size of int there anyway. */
+# if defined (__SUNPRO_CC) || defined (__DJGPP)
+# define WCHAR_MAX (~0)
+# else
+# define WCHAR_MAX ((wchar_t)~0)
+# endif
+# endif
+# if defined (__DMC__) || (defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400)) || defined(_WIN32_WCE)
+/* Compilers that do not define WCHAR_MIN and WCHAR_MAX to be testable at
+ * preprocessing time. */
+# undef WCHAR_MIN
+# define WCHAR_MIN 0
+# undef WCHAR_MAX
+# define WCHAR_MAX 0xffff
+# endif
+# if defined (__GNUC__) && defined (__alpha__)
+/* Definition of WCHAR_MIN and MAX are wrong for alpha platform
+ * as gcc consider wchar_t as an unsigned type but WCHAR_MIN is defined as
+ * a negative value. Static assertion is here to check that a future alpha
+ * SDK or a future gcc won't change the situation making this workaround
+ * useless.
+ */
+/* Check that gcc still consider wchar_t as unsigned */
+_STLP_STATIC_ASSERT(((wchar_t)-1 > 0))
+/* Check that WCHAR_MIN value hasn't been fixed */
+_STLP_STATIC_ASSERT((WCHAR_MIN < 0))
+# undef WCHAR_MIN
+# define WCHAR_MIN 0
+# undef WCHAR_MAX
+# define WCHAR_MAX 0xffffffff
+# endif
+# if defined(__HP_aCC) && (__HP_aCC >= 60000)
+/* Starting with B.11.31, HP-UX/ia64 provides C99-compliant definitions
+ * of WCHAR_MIN/MAX macros without having to define
+ * _INCLUDE_STDC__SOURCE_199901 macro (which aCC compiler does not
+ * predefine). Let STLport provide B.11.31 definitions on any version of
+ * HP-UX/ia64.
+ */
+# undef WCHAR_MIN
+# define WCHAR_MIN 0
+# undef WCHAR_MAX
+# define WCHAR_MAX UINT_MAX
+# endif
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+
+# if defined (__SUNPRO_CC) && !defined (_STLP_HAS_NO_NEW_C_HEADERS)
+using _STLP_VENDOR_CSTD::wint_t;
+# endif
+
+_STLP_BEGIN_NAMESPACE
+# if defined (_STLP_NO_WCHAR_T)
+typedef int wint_t;
+# else
+// gcc 3.0 has a glitch : wint_t only sucked into the global namespace if _GLIBCPP_USE_WCHAR_T is defined
+// __MWERKS__ has definition in wchar_t.h (MSL C++), but ones differ from definition
+// in stdio.h; I prefer settings from last file.
+# if (defined (__GNUC__) && ! defined (_GLIBCPP_USE_WCHAR_T))
+using ::wint_t;
+# else
+using _STLP_VENDOR_CSTD::wint_t;
+# endif
+# endif
+
+using _STLP_VENDOR_CSTD::size_t;
+
+# if !defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_USE_OWN_MBSTATE_T)
+using _STLP_VENDOR_MB_NAMESPACE::mbstate_t;
+
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && \
+ (!defined(__MSL__) || __MSL__ > 0x6001)
+# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
+ !(defined (__KCC) || defined (__GNUC__)) && !defined(_STLP_WCE_NET)
+using _STLP_VENDOR_MB_NAMESPACE::btowc;
+# if (!defined(__MSL__) || __MSL__ > 0x7001)
+using _STLP_VENDOR_MB_NAMESPACE::mbsinit;
+# endif
+# endif
+# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
+ !defined (__GNUC__) && !defined(_STLP_WCE_NET)
+using _STLP_VENDOR_MB_NAMESPACE::mbrlen;
+using _STLP_VENDOR_MB_NAMESPACE::mbrtowc;
+using _STLP_VENDOR_MB_NAMESPACE::mbsrtowcs;
+using _STLP_VENDOR_MB_NAMESPACE::wcrtomb;
+using _STLP_VENDOR_MB_NAMESPACE::wcsrtombs;
+# endif
+# endif /* BORLAND && !__MSL__ || __MSL__ > 0x6001 */
+
+# endif /* _STLP_NO_NATIVE_MBSTATE_T */
+
+# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+
+# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::fgetwc;
+using _STLP_VENDOR_CSTD::fgetws;
+using _STLP_VENDOR_CSTD::fputwc;
+using _STLP_VENDOR_CSTD::fputws;
+# endif
+
+# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
+ defined(_STLP_WCHAR_HPACC_EXCLUDE) )
+# if !defined (__DECCXX)
+using _STLP_VENDOR_CSTD::fwide;
+# endif
+using _STLP_VENDOR_CSTD::fwprintf;
+using _STLP_VENDOR_CSTD::fwscanf;
+using _STLP_VENDOR_CSTD::getwchar;
+# endif
+
+# if !defined(_STLP_WCHAR_BORLAND_EXCLUDE)
+# ifndef _STLP_WCE_NET
+using _STLP_VENDOR_CSTD::getwc;
+# endif
+using _STLP_VENDOR_CSTD::ungetwc;
+# ifndef _STLP_WCE_NET
+using _STLP_VENDOR_CSTD::putwc;
+# endif
+using _STLP_VENDOR_CSTD::putwchar;
+# endif
+
+# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
+ defined (_STLP_WCHAR_HPACC_EXCLUDE) )
+# if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB <= 1300) || \
+ defined (__MINGW32__)
+# undef swprintf
+# define swprintf _snwprintf
+# undef vswprintf
+# define vswprintf _vsnwprintf
+using ::swprintf;
+using ::vswprintf;
+# else
+using _STLP_VENDOR_CSTD::swprintf;
+using _STLP_VENDOR_CSTD::vswprintf;
+# endif
+using _STLP_VENDOR_CSTD::swscanf;
+using _STLP_VENDOR_CSTD::vfwprintf;
+using _STLP_VENDOR_CSTD::vwprintf;
+
+# if (!defined(__MSL__) || __MSL__ > 0x7001 ) && !defined(_STLP_WCE_NET) && \
+ !defined(_STLP_USE_UCLIBC) /* at least in uClibc 0.9.26 */
+
+using _STLP_VENDOR_CSTD::wcsftime;
+# endif
+using _STLP_VENDOR_CSTD::wcstok;
+
+# endif
+
+# if !defined (_STLP_WCE_NET)
+using _STLP_VENDOR_CSTD::wcscoll;
+using _STLP_VENDOR_CSTD::wcsxfrm;
+# endif
+using _STLP_VENDOR_CSTD::wcscat;
+using _STLP_VENDOR_CSTD::wcsrchr;
+using _STLP_VENDOR_CSTD::wcscmp;
+
+using _STLP_VENDOR_CSTD::wcscpy;
+using _STLP_VENDOR_CSTD::wcscspn;
+
+using _STLP_VENDOR_CSTD::wcslen;
+using _STLP_VENDOR_CSTD::wcsncat;
+using _STLP_VENDOR_CSTD::wcsncmp;
+using _STLP_VENDOR_CSTD::wcsncpy;
+using _STLP_VENDOR_CSTD::wcspbrk;
+using _STLP_VENDOR_CSTD::wcschr;
+
+using _STLP_VENDOR_CSTD::wcsspn;
+
+# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE)
+using _STLP_VENDOR_CSTD::wcstod;
+using _STLP_VENDOR_CSTD::wcstol;
+# endif
+
+# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_HPACC_EXCLUDE) )
+using _STLP_VENDOR_CSTD::wcsstr;
+using _STLP_VENDOR_CSTD::wmemchr;
+
+# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE)
+# if !defined (_STLP_WCE_NET)
+using _STLP_VENDOR_CSTD::wctob;
+# endif
+# if !defined (__DMC__)
+using _STLP_VENDOR_CSTD::wmemcmp;
+using _STLP_VENDOR_CSTD::wmemmove;
+# endif
+using _STLP_VENDOR_CSTD::wprintf;
+using _STLP_VENDOR_CSTD::wscanf;
+# endif
+
+# if defined (__BORLANDC__) && !defined (__linux__)
+inline wchar_t* _STLP_wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::wmemcpy(__wdst, __wsrc, __n)); }
+inline wchar_t* _STLP_wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::memset(__wdst, __wc, __n)); }
+# undef wmemcpy
+# undef wmemset
+inline wchar_t* wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
+{ return _STLP_wmemcpy(__wdst, __wsrc, __n); }
+inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
+{ return _STLP_wmemset(__wdst, __wc, __n); }
+# elif defined (__DMC__)
+inline wchar_t* wmemcpy(wchar_t* __RESTRICT __wdst, const wchar_t* __RESTRICT __wsrc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, memcpy(__wdst, __wsrc, __n * sizeof(wchar_t))); }
+inline wchar_t* wmemmove(wchar_t* __RESTRICT __wdst, const wchar_t * __RESTRICT __wc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, memmove(__wdst, __wc, __n * sizeof(wchar_t))); }
+inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
+{ for (size_t i = 0; i < __n; i++) __wdst[i] = __wc; return __wdst; }
+# else
+using _STLP_VENDOR_CSTD::wmemcpy;
+using _STLP_VENDOR_CSTD::wmemset;
+# endif
+# endif
+
+# endif /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+# undef _STLP_WCHAR_SUNPRO_EXCLUDE
+# undef _STLP_WCHAR_MSL_EXCLUDE
+
+# endif /* !defined(_STLP_WCE_EVC3) */
+
+#endif /* _STLP_INTERNAL_CWCHAR */
diff --git a/stlport/stlport/stl/_deque.c b/stlport/stlport/stl/_deque.c
new file mode 100644
index 0000000..74e9ef6
--- /dev/null
+++ b/stlport/stlport/stl/_deque.c
@@ -0,0 +1,823 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_DEQUE_C
+#define _STLP_DEQUE_C
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Non-inline member functions from _Deque_base.
+
+template <class _Tp, class _Alloc >
+_Deque_base<_Tp,_Alloc >::~_Deque_base() {
+ if (_M_map._M_data) {
+ _M_destroy_nodes(_M_start._M_node, this->_M_finish._M_node + 1);
+ _M_map.deallocate(_M_map._M_data, _M_map_size._M_data);
+ }
+}
+
+template <class _Tp, class _Alloc >
+void _Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements) {
+ size_t __num_nodes = __num_elements / this->buffer_size() + 1 ;
+
+ _M_map_size._M_data = (max)((size_t) _S_initial_map_size, __num_nodes + 2);
+ _M_map._M_data = _M_map.allocate(_M_map_size._M_data);
+
+ _Tp** __nstart = _M_map._M_data + (_M_map_size._M_data - __num_nodes) / 2;
+ _Tp** __nfinish = __nstart + __num_nodes;
+
+ _STLP_TRY {
+ _M_create_nodes(__nstart, __nfinish);
+ }
+ _STLP_UNWIND((_M_map.deallocate(_M_map._M_data, _M_map_size._M_data),
+ _M_map._M_data = 0, _M_map_size._M_data = 0))
+ _M_start._M_set_node(__nstart);
+ this->_M_finish._M_set_node(__nfinish - 1);
+ _M_start._M_cur = _M_start._M_first;
+ this->_M_finish._M_cur = this->_M_finish._M_first + __num_elements % this->buffer_size();
+}
+
+template <class _Tp, class _Alloc >
+void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart,
+ _Tp** __nfinish) {
+ _Tp** __cur = __nstart;
+ _STLP_TRY {
+ for (; __cur < __nfinish; ++__cur)
+ *__cur = _M_map_size.allocate(this->buffer_size());
+ }
+ _STLP_UNWIND(_M_destroy_nodes(__nstart, __cur))
+}
+
+template <class _Tp, class _Alloc >
+void _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart,
+ _Tp** __nfinish) {
+ for (_Tp** __n = __nstart; __n < __nfinish; ++__n)
+ _M_map_size.deallocate(*__n, this->buffer_size());
+}
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define deque _STLP_PTR_IMPL_NAME(deque)
+#elif defined (_STLP_DEBUG)
+# define deque _STLP_NON_DBG_NAME(deque)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+// qualified references
+# define __iterator__ _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >
+# define const_iterator _Deque_iterator<_Tp, _Const_traits<_Tp> >
+# define iterator __iterator__
+# define size_type size_t
+# define value_type _Tp
+#else
+# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE deque<_Tp, _Alloc>::iterator
+#endif
+
+template <class _Tp, class _Alloc >
+deque<_Tp, _Alloc >&
+deque<_Tp, _Alloc >::operator= (const deque<_Tp, _Alloc >& __x) {
+ const size_type __len = size();
+ if (&__x != this) {
+ if (__len >= __x.size())
+ erase(_STLP_STD::copy(__x.begin(), __x.end(), this->_M_start), this->_M_finish);
+ else {
+ const_iterator __mid = __x.begin() + difference_type(__len);
+ _STLP_STD::copy(__x.begin(), __mid, this->_M_start);
+ insert(this->_M_finish, __mid, __x.end());
+ }
+ }
+ return *this;
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp, _Alloc >::_M_fill_insert(iterator __pos,
+ size_type __n, const value_type& __x) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ uninitialized_fill(__new_start, this->_M_start, __x);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ this->_M_start = __new_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ uninitialized_fill(this->_M_finish, __new_finish, __x);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node+1, __new_finish._M_node+1))
+ this->_M_finish = __new_finish;
+ }
+ else
+ _M_fill_insert_aux(__pos, __n, __x, _Movable());
+}
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+
+template <class _Tp, class _Alloc >
+void deque<_Tp, _Alloc>::insert(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __n = __last - __first;
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, __new_start);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ this->_M_start = __new_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, this->_M_finish);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1,
+ __new_finish._M_node + 1))
+ this->_M_finish = __new_finish;
+ }
+ else
+ _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __n = __last - __first;
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, __new_start);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ this->_M_start = __new_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, this->_M_finish);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1,
+ __new_finish._M_node + 1))
+ this->_M_finish = __new_finish;
+ }
+ else
+ _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
+}
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos,
+ const __true_type& /*_Movable*/) {
+ difference_type __index = __pos - this->_M_start;
+ if (size_type(__index) < this->size() >> 1) {
+ //We move the start of the deque one position to the right
+ //starting from the rightmost element to move.
+ iterator __src = __pos, __dst = __pos;
+ _STLP_STD::_Destroy(&(*__dst));
+ if (__src != this->_M_start) {
+ for (--__src; __dst != this->_M_start; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ }
+ _M_pop_front_aux();
+ }
+ else {
+ iterator __src = __pos, __dst = __pos;
+ _STLP_STD::_Destroy(&(*__dst));
+ for (++__src; __src != this->_M_finish; ++__src, ++__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ //Duplication of the pop_back code without the destroy which has already been done:
+ if (this->_M_finish._M_cur != this->_M_finish._M_first) {
+ --this->_M_finish._M_cur;
+ }
+ else {
+ _M_pop_back_aux();
+ }
+ }
+ return this->_M_start + __index;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos,
+ const __false_type& /*_Movable*/) {
+ iterator __next = __pos;
+ ++__next;
+ difference_type __index = __pos - this->_M_start;
+ if (size_type(__index) < this->size() >> 1) {
+ copy_backward(this->_M_start, __pos, __next);
+ pop_front();
+ }
+ else {
+ _STLP_STD::copy(__next, this->_M_finish, __pos);
+ pop_back();
+ }
+ return this->_M_start + __index;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last,
+ const __true_type& /*_Movable*/) {
+ difference_type __n = __last - __first;
+ difference_type __elems_before = __first - this->_M_start;
+ if (__elems_before <= difference_type(this->size() - __n) / 2) {
+ iterator __src = __first, __dst = __last;
+ if (__src != this->_M_start) {
+ for (--__src, --__dst; (__src >= this->_M_start) && (__dst >= __first); --__src, --__dst) {
+ _STLP_STD::_Destroy(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ if (__dst >= __first) {
+ //There are more elements to erase than elements to move
+ _STLP_STD::_Destroy_Range(__first, ++__dst);
+ _STLP_STD::_Destroy_Moved_Range(this->_M_start, __first);
+ }
+ else {
+ //There are more elements to move than elements to erase
+ for (; __src >= this->_M_start; --__src, --__dst) {
+ _STLP_STD::_Destroy_Moved(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ _STLP_STD::_Destroy_Moved_Range(this->_M_start, ++__dst);
+ }
+ }
+ else {
+ _STLP_STD::_Destroy_Range(this->_M_start, __last);
+ }
+ iterator __new_start = this->_M_start + __n;
+ this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node);
+ this->_M_start = __new_start;
+ }
+ else {
+ if (__last != this->_M_finish) {
+ iterator __src = __last, __dst = __first;
+ for (; (__src != this->_M_finish) && (__dst != __last); ++__src, ++__dst) {
+ _STLP_STD::_Destroy(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ if (__dst != __last) {
+ //There are more elements to erase than elements to move
+ _STLP_STD::_Destroy_Range(__dst, __last);
+ _STLP_STD::_Destroy_Moved_Range(__last, this->_M_finish);
+ }
+ else {
+ //There are more elements to move than elements to erase
+ for (; __src != this->_M_finish; ++__src, ++__dst) {
+ _STLP_STD::_Destroy_Moved(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ _STLP_STD::_Destroy_Moved_Range(__dst, this->_M_finish);
+ }
+ }
+ else {
+ _STLP_STD::_Destroy_Range(__first, this->_M_finish);
+ }
+ iterator __new_finish = this->_M_finish - __n;
+ this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1);
+ this->_M_finish = __new_finish;
+ }
+ return this->_M_start + __elems_before;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last,
+ const __false_type& /*_Movable*/) {
+ difference_type __n = __last - __first;
+ difference_type __elems_before = __first - this->_M_start;
+ if (__elems_before <= difference_type(this->size() - __n) / 2) {
+ copy_backward(this->_M_start, __first, __last);
+ iterator __new_start = this->_M_start + __n;
+ _STLP_STD::_Destroy_Range(this->_M_start, __new_start);
+ this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node);
+ this->_M_start = __new_start;
+ }
+ else {
+ _STLP_STD::copy(__last, this->_M_finish, __first);
+ iterator __new_finish = this->_M_finish - __n;
+ _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish);
+ this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1);
+ this->_M_finish = __new_finish;
+ }
+ return this->_M_start + __elems_before;
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::clear() {
+ for (_Map_pointer __node = this->_M_start._M_node + 1;
+ __node < this->_M_finish._M_node;
+ ++__node) {
+ _STLP_STD::_Destroy_Range(*__node, *__node + this->buffer_size());
+ this->_M_map_size.deallocate(*__node, this->buffer_size());
+ }
+
+ if (this->_M_start._M_node != this->_M_finish._M_node) {
+ _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_start._M_last);
+ _STLP_STD::_Destroy_Range(this->_M_finish._M_first, this->_M_finish._M_cur);
+ this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size());
+ }
+ else
+ _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_finish._M_cur);
+
+ this->_M_finish = this->_M_start;
+}
+
+// Precondition: this->_M_start and this->_M_finish have already been initialized,
+// but none of the deque's elements have yet been constructed.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_fill_initialize(const value_type& __val,
+ const __false_type& /*_TrivialInit*/) {
+ _Map_pointer __cur = this->_M_start._M_node;
+ _STLP_TRY {
+ for (; __cur < this->_M_finish._M_node; ++__cur)
+ uninitialized_fill(*__cur, *__cur + this->buffer_size(), __val);
+ uninitialized_fill(this->_M_finish._M_first, this->_M_finish._M_cur, __val);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur, __cur)))
+}
+
+
+// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_back_aux_v(const value_type& __t) {
+ _M_reserve_map_at_back();
+ *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ _Copy_Construct(this->_M_finish._M_cur, __t);
+ this->_M_finish._M_set_node(this->_M_finish._M_node + 1);
+ this->_M_finish._M_cur = this->_M_finish._M_first;
+ }
+ _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1),
+ this->buffer_size()))
+}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_back_aux() {
+ _M_reserve_map_at_back();
+ *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ _STLP_STD::_Construct(this->_M_finish._M_cur);
+ this->_M_finish._M_set_node(this->_M_finish._M_node + 1);
+ this->_M_finish._M_cur = this->_M_finish._M_first;
+ }
+ _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1),
+ this->buffer_size()))
+}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+// Called only if this->_M_start._M_cur == this->_M_start._M_first.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_front_aux_v(const value_type& __t) {
+ _M_reserve_map_at_front();
+ *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ this->_M_start._M_set_node(this->_M_start._M_node - 1);
+ this->_M_start._M_cur = this->_M_start._M_last - 1;
+ _Copy_Construct(this->_M_start._M_cur, __t);
+ }
+ _STLP_UNWIND((++this->_M_start,
+ this->_M_map_size.deallocate(*(this->_M_start._M_node - 1), this->buffer_size())))
+}
+
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+// Called only if this->_M_start._M_cur == this->_M_start._M_first.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_front_aux() {
+ _M_reserve_map_at_front();
+ *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ this->_M_start._M_set_node(this->_M_start._M_node - 1);
+ this->_M_start._M_cur = this->_M_start._M_last - 1;
+ _STLP_STD::_Construct(this->_M_start._M_cur);
+ }
+ _STLP_UNWIND((++this->_M_start, this->_M_map_size.deallocate(*(this->_M_start._M_node - 1),
+ this->buffer_size())))
+}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+// Called only if this->_M_finish._M_cur == this->_M_finish._M_first.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_pop_back_aux() {
+ this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size());
+ this->_M_finish._M_set_node(this->_M_finish._M_node - 1);
+ this->_M_finish._M_cur = this->_M_finish._M_last - 1;
+}
+
+// Note that if the deque has at least one element (a precondition for this member
+// function), and if this->_M_start._M_cur == this->_M_start._M_last, then the deque
+// must have at least two nodes.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_pop_front_aux() {
+ if (this->_M_start._M_cur != this->_M_start._M_last - 1)
+ ++this->_M_start._M_cur;
+ else {
+ this->_M_map_size.deallocate(this->_M_start._M_first, this->buffer_size());
+ this->_M_start._M_set_node(this->_M_start._M_node + 1);
+ this->_M_start._M_cur = this->_M_start._M_first;
+ }
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
+ const value_type& __x,
+ const __true_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = this->size();
+ value_type __x_copy = __x;
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ uninitialized_fill(__dst, __src, __x_copy);
+ __pos = __dst;
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elems_after = difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ uninitialized_fill(__pos, __pos + __n, __x_copy);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ return __pos;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
+ const value_type& __x,
+ const __false_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = this->size();
+ value_type __x_copy = __x;
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ if (__elems_before >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + difference_type(__n);
+ _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::fill(__pos - difference_type(__n), __pos, __x_copy);
+ __pos -= difference_type(__n);
+ }
+ else {
+ _STLP_PRIV __uninitialized_copy_fill(this->_M_start, __pos, __new_start,
+ this->_M_start, __x_copy);
+ this->_M_start = __new_start;
+ fill(__old_start, __pos, __x_copy);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elems_after =
+ difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ if (__elems_after > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ copy_backward(__pos, __finish_n, __old_finish);
+ fill(__pos, __pos + difference_type(__n), __x_copy);
+ }
+ else {
+ _STLP_PRIV __uninitialized_fill_copy(this->_M_finish, __pos + difference_type(__n),
+ __x_copy, __pos, this->_M_finish);
+ this->_M_finish = __new_finish;
+ fill(__pos, __old_finish, __x_copy);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ return __pos;
+}
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __true_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ _STLP_PRIV __ucopy(__first, __last, __dst);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elems_after = difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ _STLP_PRIV __ucopy(__first, __last, __pos);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __false_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ if (__elems_before >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + difference_type(__n);
+ _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ const value_type* __mid = __first + (difference_type(__n) - __elems_before);
+ _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__mid, __last, __old_start);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elems_after =
+ difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+
+ if (__elems_after > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy_backward(__pos, __finish_n, __old_finish);
+ _STLP_STD::copy(__first, __last, __pos);
+ }
+ else {
+ const value_type* __mid = __first + __elems_after;
+ _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy(__first, __mid, __pos);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __true_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ _STLP_PRIV __ucopy(__first, __last, __dst);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elems_after = difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ _STLP_PRIV __ucopy(__first, __last, __pos);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __false_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before < difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ if (__elems_before >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + __n;
+ _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ const_iterator __mid = __first + (__n - __elems_before);
+ _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__mid, __last, __old_start);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elems_after = __length - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ if (__elems_after > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy_backward(__pos, __finish_n, __old_finish);
+ _STLP_STD::copy(__first, __last, __pos);
+ }
+ else {
+ const_iterator __mid = __first + __elems_after;
+ _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy(__first, __mid, __pos);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_new_elements_at_front(size_type __new_elems) {
+ size_type __new_nodes
+ = (__new_elems + this->buffer_size() - 1) / this->buffer_size();
+ _M_reserve_map_at_front(__new_nodes);
+ size_type __i = 1;
+ _STLP_TRY {
+ for (; __i <= __new_nodes; ++__i)
+ *(this->_M_start._M_node - __i) = this->_M_map_size.allocate(this->buffer_size());
+ }
+ _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j)
+ this->_M_map_size.deallocate(*(this->_M_start._M_node - __j), this->buffer_size()))
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_new_elements_at_back(size_type __new_elems) {
+ size_type __new_nodes
+ = (__new_elems + this->buffer_size() - 1) / this->buffer_size();
+ _M_reserve_map_at_back(__new_nodes);
+ size_type __i = 1;
+ _STLP_TRY {
+ for (; __i <= __new_nodes; ++__i)
+ *(this->_M_finish._M_node + __i) = this->_M_map_size.allocate(this->buffer_size());
+ }
+ _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j)
+ this->_M_map_size.deallocate(*(this->_M_finish._M_node + __j), this->buffer_size()))
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_reallocate_map(size_type __nodes_to_add,
+ bool __add_at_front) {
+ size_type __old_num_nodes = this->_M_finish._M_node - this->_M_start._M_node + 1;
+ size_type __new_num_nodes = __old_num_nodes + __nodes_to_add;
+
+ _Map_pointer __new_nstart;
+ if (this->_M_map_size._M_data > 2 * __new_num_nodes) {
+ __new_nstart = this->_M_map._M_data + (this->_M_map_size._M_data - __new_num_nodes) / 2
+ + (__add_at_front ? __nodes_to_add : 0);
+ if (__new_nstart < this->_M_start._M_node)
+ _STLP_STD::copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart);
+ else
+ _STLP_STD::copy_backward(this->_M_start._M_node, this->_M_finish._M_node + 1,
+ __new_nstart + __old_num_nodes);
+ }
+ else {
+ size_type __new_map_size =
+ this->_M_map_size._M_data + (max)((size_t)this->_M_map_size._M_data, __nodes_to_add) + 2;
+
+ _Map_pointer __new_map = this->_M_map.allocate(__new_map_size);
+ __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
+ + (__add_at_front ? __nodes_to_add : 0);
+ _STLP_STD::copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart);
+ this->_M_map.deallocate(this->_M_map._M_data, this->_M_map_size._M_data);
+
+ this->_M_map._M_data = __new_map;
+ this->_M_map_size._M_data = __new_map_size;
+ }
+
+ this->_M_start._M_set_node(__new_nstart);
+ this->_M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);
+}
+
+#if defined (deque)
+# undef deque
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef __iterator__
+#undef iterator
+#undef const_iterator
+#undef size_type
+#undef value_type
+
+#endif /* _STLP_DEQUE_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_deque.h b/stlport/stlport/stl/_deque.h
new file mode 100644
index 0000000..a8faeef
--- /dev/null
+++ b/stlport/stlport/stl/_deque.h
@@ -0,0 +1,1115 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+#define _STLP_INTERNAL_DEQUE_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+#ifndef _STLP_RANGE_ERRORS_H
+# include <stl/_range_errors.h>
+#endif
+
+/* Class invariants:
+ * For any nonsingular iterator i:
+ * i.node is the address of an element in the map array. The
+ * contents of i.node is a pointer to the beginning of a node.
+ * i.first == *(i.node)
+ * i.last == i.first + node_size
+ * i.cur is a pointer in the range [i.first, i.last). NOTE:
+ * the implication of this is that i.cur is always a dereferenceable
+ * pointer, even if i is a past-the-end iterator.
+ * Start and Finish are always nonsingular iterators. NOTE: this means
+ * that an empty deque must have one node, and that a deque
+ * with N elements, where N is the buffer size, must have two nodes.
+ * For every node other than start.node and finish.node, every element
+ * in the node is an initialized object. If start.node == finish.node,
+ * then [start.cur, finish.cur) are initialized objects, and
+ * the elements outside that range are uninitialized storage. Otherwise,
+ * [start.cur, start.last) and [finish.first, finish.cur) are initialized
+ * objects, and [start.first, start.cur) and [finish.cur, finish.last)
+ * are uninitialized storage.
+ * [map, map + map_size) is a valid, non-empty range.
+ * [start.node, finish.node] is a valid range contained within
+ * [map, map + map_size).
+ * A pointer in the range [map, map + map_size) points to an allocated node
+ * if and only if the pointer is in the range [start.node, finish.node].
+ */
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct _Deque_iterator_base {
+
+ static size_t _S_buffer_size() {
+ const size_t blocksize = _MAX_BYTES;
+ return (sizeof(_Tp) < blocksize ? (blocksize / sizeof(_Tp)) : 1);
+ }
+
+ typedef random_access_iterator_tag iterator_category;
+
+ typedef _Tp value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef value_type** _Map_pointer;
+
+ typedef _Deque_iterator_base< _Tp > _Self;
+
+ value_type* _M_cur;
+ value_type* _M_first;
+ value_type* _M_last;
+ _Map_pointer _M_node;
+
+ _Deque_iterator_base(value_type* __x, _Map_pointer __y)
+ : _M_cur(__x), _M_first(*__y),
+ _M_last(*__y + _S_buffer_size()), _M_node(__y) {}
+
+ _Deque_iterator_base() : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) {}
+
+// see comment in doc/README.evc4 and doc/README.evc8
+#if defined (_STLP_MSVC) && (_STLP_MSVC <= 1401) && defined (MIPS) && defined (NDEBUG)
+ _Deque_iterator_base(_Deque_iterator_base const& __other)
+ : _M_cur(__other._M_cur), _M_first(__other._M_first),
+ _M_last(__other._M_last), _M_node(__other._M_node) {}
+#endif
+
+ difference_type _M_subtract(const _Self& __x) const {
+ return difference_type(_S_buffer_size()) * (_M_node - __x._M_node - 1) +
+ (_M_cur - _M_first) + (__x._M_last - __x._M_cur);
+ }
+
+ void _M_increment() {
+ if (++_M_cur == _M_last) {
+ _M_set_node(_M_node + 1);
+ _M_cur = _M_first;
+ }
+ }
+
+ void _M_decrement() {
+ if (_M_cur == _M_first) {
+ _M_set_node(_M_node - 1);
+ _M_cur = _M_last;
+ }
+ --_M_cur;
+ }
+
+ void _M_advance(difference_type __n) {
+ const size_t buffersize = _S_buffer_size();
+ difference_type __offset = __n + (_M_cur - _M_first);
+ if (__offset >= 0 && __offset < difference_type(buffersize))
+ _M_cur += __n;
+ else {
+ difference_type __node_offset =
+ __offset > 0 ? __offset / buffersize
+ : -difference_type((-__offset - 1) / buffersize) - 1;
+ _M_set_node(_M_node + __node_offset);
+ _M_cur = _M_first +
+
+ (__offset - __node_offset * difference_type(buffersize));
+ }
+ }
+
+ void _M_set_node(_Map_pointer __new_node) {
+ _M_last = (_M_first = *(_M_node = __new_node)) + difference_type(_S_buffer_size());
+ }
+};
+
+
+template <class _Tp, class _Traits>
+struct _Deque_iterator : public _Deque_iterator_base< _Tp> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef typename _Traits::reference reference;
+ typedef typename _Traits::pointer pointer;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef value_type** _Map_pointer;
+
+ typedef _Deque_iterator_base< _Tp > _Base;
+ typedef _Deque_iterator<_Tp, _Traits> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _Deque_iterator<_Tp, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Deque_iterator<_Tp, _ConstTraits> const_iterator;
+
+ _Deque_iterator(value_type* __x, _Map_pointer __y) :
+ _Deque_iterator_base<value_type>(__x,__y) {}
+
+ _Deque_iterator() {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Deque_iterator(const iterator& __x) :
+ _Deque_iterator_base<value_type>(__x) {}
+
+ reference operator*() const {
+ return *this->_M_cur;
+ }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ difference_type operator-(const const_iterator& __x) const { return this->_M_subtract(__x); }
+
+ _Self& operator++() { this->_M_increment(); return *this; }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ _Self& operator--() { this->_M_decrement(); return *this; }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ --*this;
+ return __tmp;
+ }
+
+ _Self& operator+=(difference_type __n) { this->_M_advance(__n); return *this; }
+ _Self operator+(difference_type __n) const {
+ _Self __tmp = *this;
+ return __tmp += __n;
+ }
+
+ _Self& operator-=(difference_type __n) { return *this += -__n; }
+ _Self operator-(difference_type __n) const {
+ _Self __tmp = *this;
+ return __tmp -= __n;
+ }
+
+ reference operator[](difference_type __n) const { return *(*this + __n); }
+};
+
+
+template <class _Tp, class _Traits>
+inline _Deque_iterator<_Tp, _Traits> _STLP_CALL
+operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Traits>& __x)
+{ return __x + __n; }
+
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _Tp>
+inline bool _STLP_CALL
+operator==(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return __x._M_cur == __y._M_cur; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator < (const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y) {
+ return (__x._M_node == __y._M_node) ?
+ (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
+}
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator!=(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return __x._M_cur != __y._M_cur; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator>(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return __y < __x; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator>=(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return !(__x < __y); }
+
+template <class _Tp>
+inline bool _STLP_CALL operator<=(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return !(__y < __x); }
+
+#else /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _Tp, class _Traits1, class _Traits2>
+inline bool _STLP_CALL
+operator==(const _Deque_iterator<_Tp, _Traits1 >& __x,
+ const _Deque_iterator<_Tp, _Traits2 >& __y)
+{ return __x._M_cur == __y._M_cur; }
+
+template <class _Tp, class _Traits1, class _Traits2>
+inline bool _STLP_CALL
+operator < (const _Deque_iterator<_Tp, _Traits1 >& __x,
+ const _Deque_iterator<_Tp, _Traits2 >& __y) {
+ return (__x._M_node == __y._M_node) ?
+ (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
+}
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator!=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return __x._M_cur != __y._M_cur; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator>(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return __y < __x; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator>=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return !(__x < __y); }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator<=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return !(__y < __x); }
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+struct __type_traits<_STLP_PRIV _Deque_iterator<_Tp, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits> inline _Tp* _STLP_CALL
+value_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return (_Tp*)0; }
+template <class _Tp, class _Traits> inline random_access_iterator_tag _STLP_CALL
+iterator_category(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return random_access_iterator_tag(); }
+template <class _Tp, class _Traits> inline ptrdiff_t* _STLP_CALL
+distance_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return 0; }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+/* Deque base class. It has two purposes. First, its constructor
+ * and destructor allocate (but don't initialize) storage. This makes
+ * exception safety easier. Second, the base class encapsulates all of
+ * the differences between SGI-style allocators and standard-conforming
+ * allocators.
+ */
+
+template <class _Tp, class _Alloc>
+class _Deque_base {
+ typedef _Deque_base<_Tp, _Alloc> _Self;
+public:
+ typedef _Tp value_type;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _Alloc allocator_type;
+ typedef _STLP_alloc_proxy<size_t, value_type, allocator_type> _Alloc_proxy;
+
+ typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type _Map_alloc_type;
+ typedef _STLP_alloc_proxy<value_type**, value_type*, _Map_alloc_type> _Map_alloc_proxy;
+
+ typedef _Deque_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
+ typedef _Deque_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
+
+ static size_t _STLP_CALL buffer_size() { return _Deque_iterator_base<_Tp>::_S_buffer_size(); }
+
+ _Deque_base(const allocator_type& __a, size_t __num_elements)
+ : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0),
+ _M_map_size(__a, (size_t)0)
+ { _M_initialize_map(__num_elements); }
+
+ _Deque_base(const allocator_type& __a)
+ : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0),
+ _M_map_size(__a, (size_t)0) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Deque_base(__move_source<_Self> src)
+ : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
+ _M_map(__move_source<_Map_alloc_proxy>(src.get()._M_map)),
+ _M_map_size(__move_source<_Alloc_proxy>(src.get()._M_map_size)) {
+ src.get()._M_map._M_data = 0;
+ src.get()._M_map_size._M_data = 0;
+ src.get()._M_finish = src.get()._M_start;
+ }
+#endif
+
+ ~_Deque_base();
+
+protected:
+ void _M_initialize_map(size_t);
+ void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);
+ void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);
+ enum { _S_initial_map_size = 8 };
+
+protected:
+ iterator _M_start;
+ iterator _M_finish;
+ _Map_alloc_proxy _M_map;
+ _Alloc_proxy _M_map_size;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define deque _STLP_PTR_IMPL_NAME(deque)
+#elif defined (_STLP_DEBUG)
+# define deque _STLP_NON_DBG_NAME(deque)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class deque : protected _STLP_PRIV _Deque_base<_Tp, _Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque)
+ , public __stlport_class<deque<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_PRIV _Deque_base<_Tp, _Alloc> _Base;
+ typedef deque<_Tp, _Alloc> _Self;
+public: // Basic types
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+
+public: // Iterators
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+protected: // Internal typedefs
+ typedef pointer* _Map_pointer;
+#if defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef __false_type _Movable;
+#endif
+
+public: // Basic accessors
+ iterator begin() { return this->_M_start; }
+ iterator end() { return this->_M_finish; }
+ const_iterator begin() const { return const_iterator(this->_M_start); }
+ const_iterator end() const { return const_iterator(this->_M_finish); }
+
+ reverse_iterator rbegin() { return reverse_iterator(this->_M_finish); }
+ reverse_iterator rend() { return reverse_iterator(this->_M_start); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(this->_M_finish); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(this->_M_start); }
+
+ reference operator[](size_type __n)
+ { return this->_M_start[difference_type(__n)]; }
+ const_reference operator[](size_type __n) const
+ { return this->_M_start[difference_type(__n)]; }
+
+ void _M_range_check(size_type __n) const {
+ if (__n >= this->size())
+ __stl_throw_out_of_range("deque");
+ }
+ reference at(size_type __n)
+ { _M_range_check(__n); return (*this)[__n]; }
+ const_reference at(size_type __n) const
+ { _M_range_check(__n); return (*this)[__n]; }
+
+ reference front() { return *this->_M_start; }
+ reference back() {
+ iterator __tmp = this->_M_finish;
+ --__tmp;
+ return *__tmp;
+ }
+ const_reference front() const { return *this->_M_start; }
+ const_reference back() const {
+ const_iterator __tmp = this->_M_finish;
+ --__tmp;
+ return *__tmp;
+ }
+
+ size_type size() const { return this->_M_finish - this->_M_start; }
+ size_type max_size() const { return size_type(-1); }
+ bool empty() const { return this->_M_finish == this->_M_start; }
+ allocator_type get_allocator() const { return this->_M_map_size; }
+
+public: // Constructor, destructor.
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(const allocator_type& __a = allocator_type())
+#else
+ deque()
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), 0) {}
+ deque(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, 0) {}
+
+ deque(const _Self& __x)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__x.get_allocator(), __x.size())
+ { _STLP_PRIV __ucopy(__x.begin(), __x.end(), this->_M_start); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+private:
+ void _M_initialize(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+ typedef typename _TrivialInit<_Tp>::_Ret _TrivialInit;
+ _M_fill_initialize(__val, _TrivialInit());
+ }
+public:
+ explicit deque(size_type __n)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n)
+ { _M_initialize(__n); }
+ deque(size_type __n, const value_type& __val, const allocator_type& __a = allocator_type())
+#else
+ explicit deque(size_type __n)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n) {
+ typedef typename _TrivialInit<_Tp>::_Ret _TrivialInit;
+ _M_fill_initialize(_STLP_DEFAULT_CONSTRUCTED(_Tp), _TrivialInit());
+ }
+ deque(size_type __n, const value_type& __val)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n)
+ { _M_fill_initialize(__val, __false_type()); }
+ deque(size_type __n, const value_type& __val, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __n)
+ { _M_fill_initialize(__val, __false_type()); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+protected:
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) {
+ this->_M_initialize_map(__n);
+ _M_fill_initialize(__x, __false_type());
+ }
+
+ template <class _InputIter>
+ void _M_initialize_dispatch(_InputIter __first, _InputIter __last,
+ const __false_type&) {
+ _M_range_initialize(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+ }
+
+public:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+# endif
+
+#else
+ deque(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type() )
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first)
+ { _STLP_PRIV __ucopy(__first, __last, this->_M_start); }
+
+ deque(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first)
+ { _STLP_PRIV __ucopy(__first, __last, this->_M_start); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ deque(__move_source<_Self> src)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__move_source<_Base>(src.get()))
+ {}
+#endif
+
+ ~deque()
+ { _STLP_STD::_Destroy_Range(this->_M_start, this->_M_finish); }
+
+ _Self& operator= (const _Self& __x);
+
+ void swap(_Self& __x) {
+ _STLP_STD::swap(this->_M_start, __x._M_start);
+ _STLP_STD::swap(this->_M_finish, __x._M_finish);
+ this->_M_map.swap(__x._M_map);
+ this->_M_map_size.swap(__x._M_map_size);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public:
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void _M_fill_assign(size_type __n, const _Tp& __val) {
+ if (__n > size()) {
+ _STLP_STD::fill(begin(), end(), __val);
+ insert(end(), __n - size(), __val);
+ }
+ else {
+ erase(begin() + __n, end());
+ _STLP_STD::fill(begin(), end(), __val);
+ }
+ }
+
+ void assign(size_type __n, const _Tp& __val) {
+ _M_fill_assign(__n, __val);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+private: // helper functions for assign()
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/)
+ { _M_fill_assign((size_type) __n, (_Tp) __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type& /*_IsIntegral*/) {
+ _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+
+ template <class _InputIter>
+ void _M_assign_aux(_InputIter __first, _InputIter __last, const input_iterator_tag &) {
+ iterator __cur = begin();
+ for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
+ *__cur = *__first;
+ if (__first == __last)
+ erase(__cur, end());
+ else
+ insert(end(), __first, __last);
+ }
+
+ template <class _ForwardIterator>
+ void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+#else
+ void assign(const value_type *__first, const value_type *__last) {
+ size_type __size = size();
+ size_type __len = __last - __first;
+ if (__len > __size) {
+ const value_type *__mid = __first + __size;
+ _STLP_STD::copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ else {
+ erase(_STLP_STD::copy(__first, __last, begin()), end());
+ }
+ }
+ void assign(const_iterator __first, const_iterator __last) {
+ typedef const_iterator _ForwardIterator;
+#endif /* _STLP_MEMBER_TEMPLATES */
+ size_type __len = _STLP_STD::distance(__first, __last);
+ if (__len > size()) {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, size());
+ _STLP_STD::copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ else {
+ erase(_STLP_STD::copy(__first, __last, begin()), end());
+ }
+ }
+
+
+public: // push_* and pop_*
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void push_back(const value_type& __t) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) {
+ _Copy_Construct(this->_M_finish._M_cur, __t);
+ ++this->_M_finish._M_cur;
+ }
+ else
+ _M_push_back_aux_v(__t);
+ }
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void push_front(const value_type& __t) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ if (this->_M_start._M_cur != this->_M_start._M_first) {
+ _Copy_Construct(this->_M_start._M_cur - 1, __t);
+ --this->_M_start._M_cur;
+ }
+ else
+ _M_push_front_aux_v(__t);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back() {
+ if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) {
+ _STLP_STD::_Construct(this->_M_finish._M_cur);
+ ++this->_M_finish._M_cur;
+ }
+ else
+ _M_push_back_aux();
+ }
+ void push_front() {
+ if (this->_M_start._M_cur != this->_M_start._M_first) {
+ _STLP_STD::_Construct(this->_M_start._M_cur - 1);
+ --this->_M_start._M_cur;
+ }
+ else
+ _M_push_front_aux();
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_back() {
+ if (this->_M_finish._M_cur != this->_M_finish._M_first) {
+ --this->_M_finish._M_cur;
+ _STLP_STD::_Destroy(this->_M_finish._M_cur);
+ }
+ else {
+ _M_pop_back_aux();
+ _STLP_STD::_Destroy(this->_M_finish._M_cur);
+ }
+ }
+
+ void pop_front() {
+ _STLP_STD::_Destroy(this->_M_start._M_cur);
+ _M_pop_front_aux();
+ }
+
+public: // Insert
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ iterator insert(iterator __pos, const value_type& __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ push_front(__x);
+ return this->_M_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ push_back(__x);
+ iterator __tmp = this->_M_finish;
+ --__tmp;
+ return __tmp;
+ }
+ else {
+ return _M_fill_insert_aux(__pos, 1, __x, _Movable());
+ }
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos)
+ { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_fill_insert(__pos, __n, __x); }
+
+protected:
+ iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __true_type& /*_Movable*/);
+ iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __false_type& /*_Movable*/);
+
+ void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_insert(__pos, (size_type) __n, (value_type) __x);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type& /*_IsIntegral*/) {
+ _M_insert(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+
+public:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __true_type& /*_Movable*/);
+ void _M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __false_type& /*_Movable*/);
+ void _M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __true_type& /*_Movable*/);
+ void _M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __false_type& /*_Movable*/);
+public:
+ void insert(iterator __pos,
+ const value_type* __first, const value_type* __last);
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last);
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+public:
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size,
+ const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void resize(size_type __new_size, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const size_type __len = size();
+ if (__new_size < __len)
+ erase(this->_M_start + __new_size, this->_M_finish);
+ else
+ insert(this->_M_finish, __new_size - __len, __x);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size)
+ { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+protected:
+ iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/);
+ iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/);
+
+ iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/);
+ iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/);
+public: // Erase
+ iterator erase(iterator __pos) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ return _M_erase(__pos, _Movable());
+ }
+ iterator erase(iterator __first, iterator __last) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__first == this->_M_start && __last == this->_M_finish) {
+ clear();
+ return this->_M_finish;
+ }
+ else {
+ if (__first == __last)
+ return __first;
+ return _M_erase(__first, __last, _Movable());
+ }
+ }
+ void clear();
+
+protected: // Internal construction/destruction
+
+ void _M_fill_initialize(const value_type& __val, const __true_type& /*_TrivialInit*/)
+ {}
+ void _M_fill_initialize(const value_type& __val, const __false_type& /*_TrivialInit*/);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_range_initialize(_InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ this->_M_initialize_map(0);
+ _STLP_TRY {
+ for ( ; __first != __last; ++__first)
+ push_back(*__first);
+ }
+ _STLP_UNWIND(clear())
+ }
+ template <class _ForwardIterator>
+ void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ this->_M_initialize_map(__n);
+ _Map_pointer __cur_node = this->_M_start._M_node;
+ _STLP_TRY {
+ for (; __cur_node < this->_M_finish._M_node; ++__cur_node) {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, this->buffer_size());
+ _STLP_STD::uninitialized_copy(__first, __mid, *__cur_node);
+ __first = __mid;
+ }
+ _STLP_STD::uninitialized_copy(__first, __last, this->_M_finish._M_first);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur_node, __cur_node)))
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+protected: // Internal push_* and pop_*
+
+ void _M_push_back_aux_v(const value_type&);
+ void _M_push_front_aux_v(const value_type&);
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void _M_push_back_aux();
+ void _M_push_front_aux();
+#endif /*_STLP_DONT_SUP_DFLT_PARAM !_STLP_NO_ANACHRONISMS*/
+ void _M_pop_back_aux();
+ void _M_pop_front_aux();
+
+protected: // Internal insert functions
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+
+ template <class _InputIterator>
+ void _M_insert(iterator __pos,
+ _InputIterator __first,
+ _InputIterator __last,
+ const input_iterator_tag &) {
+ _STLP_STD::copy(__first, __last, inserter(*this, __pos));
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ uninitialized_copy(__first, __last, __new_start);
+ this->_M_start = __new_start;
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ uninitialized_copy(__first, __last, this->_M_finish);
+ this->_M_finish = __new_finish;
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ else
+ _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert_range_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ size_type __n, const __true_type& /*_Movable*/) {
+ const difference_type __elemsbefore = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elemsbefore <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elemsbefore;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ uninitialized_copy(__first, __last, __dst);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elemsafter = difference_type(__length) - __elemsbefore;
+ __pos = this->_M_finish - __elemsafter;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ uninitialized_copy(__first, __last, __pos);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert_range_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ size_type __n, const __false_type& /*_Movable*/) {
+ const difference_type __elemsbefore = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elemsbefore <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elemsbefore;
+ _STLP_TRY {
+ if (__elemsbefore >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + difference_type(__n);
+ _STLP_STD::uninitialized_copy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, difference_type(__n) - __elemsbefore);
+ _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__mid, __last, __old_start);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elemsafter = difference_type(__length) - __elemsbefore;
+ __pos = this->_M_finish - __elemsafter;
+ _STLP_TRY {
+ if (__elemsafter > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_STD::uninitialized_copy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy_backward(__pos, __finish_n, __old_finish);
+ _STLP_STD::copy(__first, __last, __pos);
+ }
+ else {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, __elemsafter);
+ _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy(__first, __mid, __pos);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator _M_reserve_elements_at_front(size_type __n) {
+ size_type __vacancies = this->_M_start._M_cur - this->_M_start._M_first;
+ if (__n > __vacancies)
+ _M_new_elements_at_front(__n - __vacancies);
+ return this->_M_start - difference_type(__n);
+ }
+
+ iterator _M_reserve_elements_at_back(size_type __n) {
+ size_type __vacancies = (this->_M_finish._M_last - this->_M_finish._M_cur) - 1;
+ if (__n > __vacancies)
+ _M_new_elements_at_back(__n - __vacancies);
+ return this->_M_finish + difference_type(__n);
+ }
+
+ void _M_new_elements_at_front(size_type __new_elements);
+ void _M_new_elements_at_back(size_type __new_elements);
+
+protected: // Allocation of _M_map and nodes
+
+ // Makes sure the _M_map has space for new nodes. Does not actually
+ // add the nodes. Can invalidate _M_map pointers. (And consequently,
+ // deque iterators.)
+
+ void _M_reserve_map_at_back (size_type __nodes_to_add = 1) {
+ if (__nodes_to_add + 1 > this->_M_map_size._M_data - (this->_M_finish._M_node - this->_M_map._M_data))
+ _M_reallocate_map(__nodes_to_add, false);
+ }
+
+ void _M_reserve_map_at_front (size_type __nodes_to_add = 1) {
+ if (__nodes_to_add > size_type(this->_M_start._M_node - this->_M_map._M_data))
+ _M_reallocate_map(__nodes_to_add, true);
+ }
+
+ void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front);
+};
+
+#if defined (deque)
+# undef deque
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_deque.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_deque.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_deque.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_TEMPLATE_CONTAINER deque<_Tp, _Alloc>
+#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Alloc>
+struct __move_traits<deque<_Tp, _Alloc> > {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_DEQUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stlport/stl/_exception.h b/stlport/stlport/stl/_exception.h
new file mode 100644
index 0000000..a0bf4ad
--- /dev/null
+++ b/stlport/stlport/stl/_exception.h
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+// The header <exception> contains low-level functions that interact
+// with a compiler's exception-handling mechanism. It is assumed to
+// be supplied with the compiler, rather than with the library, because
+// it is inherently tied very closely to the compiler itself.
+
+// On platforms where <exception> does not exist, this header defines
+// an exception base class. This is *not* a substitute for everything
+// in <exception>, but it suffices to support a bare minimum of STL
+// functionality.
+
+#ifndef _STLP_INTERNAL_EXCEPTION
+#define _STLP_INTERNAL_EXCEPTION
+
+#if !defined (_STLP_NO_EXCEPTION_HEADER)
+
+# if defined ( _UNCAUGHT_EXCEPTION )
+# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+# endif
+
+# if defined (_STLP_BROKEN_EXCEPTION_CLASS)
+# define exception _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS
+# define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS
+# if defined (_STLP_NO_NEW_NEW_HEADER)
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h)
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception)
+# endif
+# undef exception
+# undef bad_exception
+# else
+# if defined (_STLP_NO_NEW_NEW_HEADER)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <exception.h>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
+# endif
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <exception>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
+# endif
+# endif
+# endif
+
+# if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) && defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1300)
+// dwa 02/04/00
+// The header <yvals.h> which ships with vc6 and is included by its native <exception>
+// actually turns on warnings, so we have to turn them back off.
+# include <stl/config/_warnings_off.h>
+# endif
+
+# if defined (_STLP_USE_OWN_NAMESPACE)
+
+_STLP_BEGIN_NAMESPACE
+# if !defined (_STLP_BROKEN_EXCEPTION_CLASS)
+# if !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64)
+using _STLP_VENDOR_EXCEPT_STD::exception;
+# else
+using ::exception;
+# endif
+using _STLP_VENDOR_EXCEPT_STD::bad_exception;
+# endif
+
+# if !defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS)
+// fbp : many platforms present strange mix of
+// those in various namespaces
+# if !defined (_STLP_VENDOR_UNEXPECTED_STD)
+# define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD
+# else
+/* The following definitions are for backward compatibility as _STLP_VENDOR_TERMINATE_STD
+ * and _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD has been introduce after _STLP_VENDOR_UNEXPECTED_STD
+ * and _STLP_VENDOR_UNEXPECTED_STD was the macro used in their place before that introduction.
+ */
+# if !defined (_STLP_VENDOR_TERMINATE_STD)
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_UNEXPECTED_STD
+# endif
+# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_UNEXPECTED_STD
+# endif
+# endif
+# if !defined (_STLP_VENDOR_TERMINATE_STD)
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+# if !defined (_STLP_VENDOR_TERMINATE_STD)
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+// weird errors
+# if !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
+# if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
+//See config/_intel.h for reason about this workaround
+using std::unexpected;
+# else
+using _STLP_VENDOR_UNEXPECTED_STD::unexpected;
+# endif
+using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler;
+using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected;
+# endif
+using _STLP_VENDOR_TERMINATE_STD::terminate;
+using _STLP_VENDOR_TERMINATE_STD::terminate_handler;
+using _STLP_VENDOR_TERMINATE_STD::set_terminate;
+
+# if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
+using _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD::uncaught_exception;
+# endif
+# endif /* !_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS */
+_STLP_END_NAMESPACE
+# endif /* _STLP_OWN_NAMESPACE */
+#else /* _STLP_NO_EXCEPTION_HEADER */
+
+/* fbp : absence of <exception> usually means that those
+ * functions are not going to be called by compiler.
+ * Still, define them for the user.
+ * dums: Policy modification, if the function do not behave like the Standard
+ * defined it we do not grant it in the STLport namespace. We will have
+ * compile time error rather than runtime error.
+ */
+#if 0
+/*
+typedef void (*unexpected_handler)();
+unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY;
+void unexpected();
+
+typedef void (*terminate_handler)();
+terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY;
+void terminate();
+
+bool uncaught_exception(); // not implemented under mpw as of Jan/1999
+*/
+#endif
+
+#endif /* _STLP_NO_EXCEPTION_HEADER */
+
+#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
+_STLP_BEGIN_NAMESPACE
+
+// section 18.6.1
+class _STLP_CLASS_DECLSPEC exception {
+public:
+# ifndef _STLP_USE_NO_IOSTREAMS
+ exception() _STLP_NOTHROW;
+ virtual ~exception() _STLP_NOTHROW;
+ virtual const char* what() const _STLP_NOTHROW;
+# else
+ exception() _STLP_NOTHROW {}
+ virtual ~exception() _STLP_NOTHROW {}
+ virtual const char* what() const _STLP_NOTHROW {return "class exception";}
+# endif
+};
+
+// section 18.6.2.1
+class _STLP_CLASS_DECLSPEC bad_exception : public exception {
+public:
+# ifndef _STLP_USE_NO_IOSTREAMS
+ bad_exception() _STLP_NOTHROW;
+ ~bad_exception() _STLP_NOTHROW;
+ const char* what() const _STLP_NOTHROW;
+# else
+ bad_exception() _STLP_NOTHROW {}
+ ~bad_exception() _STLP_NOTHROW {}
+ const char* what() const _STLP_NOTHROW {return "class bad_exception";}
+# endif
+};
+
+// forward declaration
+class __Named_exception;
+_STLP_END_NAMESPACE
+#endif
+
+#endif /* _STLP_INTERNAL_EXCEPTION */
diff --git a/stlport/stlport/stl/_function.h b/stlport/stlport/stl/_function.h
new file mode 100644
index 0000000..bf4ad3e
--- /dev/null
+++ b/stlport/stlport/stl/_function.h
@@ -0,0 +1,433 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_FUNCTION_H
+#define _STLP_INTERNAL_FUNCTION_H
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+struct not_equal_to : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; }
+};
+
+template <class _Tp>
+struct greater : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; }
+};
+
+template <class _Tp>
+struct greater_equal : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; }
+};
+
+template <class _Tp>
+struct less_equal : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; }
+};
+
+template <class _Tp>
+struct divides : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; }
+};
+
+template <class _Tp>
+struct modulus : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; }
+};
+
+template <class _Tp>
+struct negate : public unary_function<_Tp, _Tp> {
+ _Tp operator()(const _Tp& __x) const { return -__x; }
+};
+
+template <class _Tp>
+struct logical_and : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; }
+};
+
+template <class _Tp>
+struct logical_or : public binary_function<_Tp, _Tp,bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; }
+};
+
+template <class _Tp>
+struct logical_not : public unary_function<_Tp, bool> {
+ bool operator()(const _Tp& __x) const { return !__x; }
+};
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// identity_element (not part of the C++ standard).
+template <class _Tp> inline _Tp identity_element(plus<_Tp>) { return _Tp(0); }
+template <class _Tp> inline _Tp identity_element(multiplies<_Tp>) { return _Tp(1); }
+#endif
+
+#if defined (_STLP_BASE_TYPEDEF_BUG)
+// this workaround is needed for SunPro 4.0.1
+// suggested by "Martin Abernethy" <gma@paston.co.uk>:
+
+// We have to introduce the XXary_predicate_aux structures in order to
+// access the argument and return types of predicate functions supplied
+// as type parameters. SUN C++ 4.0.1 compiler gives errors for template type parameters
+// of the form 'name1::name2', where name1 is itself a type parameter.
+template <class _Pair>
+struct __pair_aux : private _Pair {
+ typedef typename _Pair::first_type first_type;
+ typedef typename _Pair::second_type second_type;
+};
+
+template <class _Operation>
+struct __unary_fun_aux : private _Operation {
+ typedef typename _Operation::argument_type argument_type;
+ typedef typename _Operation::result_type result_type;
+};
+
+template <class _Operation>
+struct __binary_fun_aux : private _Operation {
+ typedef typename _Operation::first_argument_type first_argument_type;
+ typedef typename _Operation::second_argument_type second_argument_type;
+ typedef typename _Operation::result_type result_type;
+};
+
+# define __UNARY_ARG(__Operation,__type) __unary_fun_aux<__Operation>::__type
+# define __BINARY_ARG(__Operation,__type) __binary_fun_aux<__Operation>::__type
+# define __PAIR_ARG(__Pair,__type) __pair_aux<__Pair>::__type
+#else
+# define __UNARY_ARG(__Operation,__type) __Operation::__type
+# define __BINARY_ARG(__Operation,__type) __Operation::__type
+# define __PAIR_ARG(__Pair,__type) __Pair::__type
+#endif
+
+template <class _Predicate>
+class unary_negate
+ : public unary_function<typename __UNARY_ARG(_Predicate, argument_type), bool> {
+ typedef unary_function<typename __UNARY_ARG(_Predicate, argument_type), bool> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+private:
+ typedef typename __call_traits<argument_type>::const_param_type _ArgParamType;
+protected:
+ _Predicate _M_pred;
+public:
+ explicit unary_negate(const _Predicate& __x) : _M_pred(__x) {}
+ bool operator()(_ArgParamType __x) const {
+ return !_M_pred(__x);
+ }
+};
+
+template <class _Predicate>
+inline unary_negate<_Predicate>
+not1(const _Predicate& __pred) {
+ return unary_negate<_Predicate>(__pred);
+}
+
+template <class _Predicate>
+class binary_negate
+ : public binary_function<typename __BINARY_ARG(_Predicate, first_argument_type),
+ typename __BINARY_ARG(_Predicate, second_argument_type),
+ bool> {
+ typedef binary_function<typename __BINARY_ARG(_Predicate, first_argument_type),
+ typename __BINARY_ARG(_Predicate, second_argument_type),
+ bool> _Base;
+public:
+ typedef typename _Base::first_argument_type first_argument_type;
+ typedef typename _Base::second_argument_type second_argument_type;
+private:
+ typedef typename __call_traits<first_argument_type>::const_param_type _FstArgParamType;
+ typedef typename __call_traits<second_argument_type>::const_param_type _SndArgParamType;
+protected:
+ _Predicate _M_pred;
+public:
+ explicit binary_negate(const _Predicate& __x) : _M_pred(__x) {}
+ bool operator()(_FstArgParamType __x, _SndArgParamType __y) const {
+ return !_M_pred(__x, __y);
+ }
+};
+
+template <class _Predicate>
+inline binary_negate<_Predicate>
+not2(const _Predicate& __pred) {
+ return binary_negate<_Predicate>(__pred);
+}
+
+template <class _Operation>
+class binder1st :
+ public unary_function<typename __BINARY_ARG(_Operation, second_argument_type),
+ typename __BINARY_ARG(_Operation, result_type) > {
+ typedef unary_function<typename __BINARY_ARG(_Operation, second_argument_type),
+ typename __BINARY_ARG(_Operation, result_type) > _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::param_type _ArgParamType;
+ typedef typename __call_traits<argument_type>::const_param_type _ConstArgParamType;
+ typedef typename __call_traits<typename _Operation::first_argument_type>::const_param_type _ValueParamType;
+protected:
+ //op is a Standard name (20.3.6.1), do no make it STLport naming convention compliant.
+ _Operation op;
+ typename _Operation::first_argument_type _M_value;
+public:
+ binder1st(const _Operation& __x, _ValueParamType __y)
+ : op(__x), _M_value(__y) {}
+
+ result_type operator()(_ConstArgParamType __x) const
+ { return op(_M_value, __x); }
+ // DR 109 Missing binders for non-const sequence elements
+ result_type operator()(_ArgParamType __x) const
+ { return op(_M_value, __x); }
+};
+
+template <class _Operation, class _Tp>
+inline binder1st<_Operation>
+bind1st(const _Operation& __fn, const _Tp& __x) {
+ typedef typename _Operation::first_argument_type _Arg1_type;
+ return binder1st<_Operation>(__fn, _Arg1_type(__x));
+}
+
+template <class _Operation>
+class binder2nd
+ : public unary_function<typename __BINARY_ARG(_Operation, first_argument_type),
+ typename __BINARY_ARG(_Operation, result_type)> {
+ typedef unary_function<typename __BINARY_ARG(_Operation, first_argument_type),
+ typename __BINARY_ARG(_Operation, result_type)> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::param_type _ArgParamType;
+ typedef typename __call_traits<argument_type>::const_param_type _ConstArgParamType;
+ typedef typename __call_traits<typename _Operation::second_argument_type>::const_param_type _ValueParamType;
+protected:
+ //op is a Standard name (20.3.6.3), do no make it STLport naming convention compliant.
+ _Operation op;
+ typename _Operation::second_argument_type value;
+public:
+ binder2nd(const _Operation& __x, _ValueParamType __y)
+ : op(__x), value(__y) {}
+
+ result_type operator()(_ConstArgParamType __x) const
+ { return op(__x, value); }
+ // DR 109 Missing binders for non-const sequence elements
+ result_type operator()(_ArgParamType __x) const
+ { return op(__x, value); }
+};
+
+template <class _Operation, class _Tp>
+inline binder2nd<_Operation>
+bind2nd(const _Operation& __fn, const _Tp& __x) {
+ typedef typename _Operation::second_argument_type _Arg2_type;
+ return binder2nd<_Operation>(__fn, _Arg2_type(__x));
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// unary_compose and binary_compose (extensions, not part of the standard).
+
+template <class _Operation1, class _Operation2>
+class unary_compose :
+ public unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __UNARY_ARG(_Operation1, result_type)> {
+ typedef unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __UNARY_ARG(_Operation1, result_type)> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::const_param_type _ArgParamType;
+protected:
+ _Operation1 _M_fn1;
+ _Operation2 _M_fn2;
+public:
+ unary_compose(const _Operation1& __x, const _Operation2& __y)
+ : _M_fn1(__x), _M_fn2(__y) {}
+
+ result_type operator()(_ArgParamType __x) const {
+ return _M_fn1(_M_fn2(__x));
+ }
+};
+
+template <class _Operation1, class _Operation2>
+inline unary_compose<_Operation1,_Operation2>
+compose1(const _Operation1& __fn1, const _Operation2& __fn2) {
+ return unary_compose<_Operation1,_Operation2>(__fn1, __fn2);
+}
+
+template <class _Operation1, class _Operation2, class _Operation3>
+class binary_compose :
+ public unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __BINARY_ARG(_Operation1, result_type)> {
+ typedef unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __BINARY_ARG(_Operation1, result_type)> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::const_param_type _ArgParamType;
+protected:
+ _Operation1 _M_fn1;
+ _Operation2 _M_fn2;
+ _Operation3 _M_fn3;
+public:
+ binary_compose(const _Operation1& __x, const _Operation2& __y,
+ const _Operation3& __z)
+ : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
+
+ result_type operator()(_ArgParamType __x) const {
+ return _M_fn1(_M_fn2(__x), _M_fn3(__x));
+ }
+};
+
+template <class _Operation1, class _Operation2, class _Operation3>
+inline binary_compose<_Operation1, _Operation2, _Operation3>
+compose2(const _Operation1& __fn1, const _Operation2& __fn2,
+ const _Operation3& __fn3) {
+ return binary_compose<_Operation1,_Operation2,_Operation3>(__fn1, __fn2, __fn3);
+}
+
+// identity is an extension: it is not part of the standard.
+template <class _Tp> struct identity : public _STLP_PRIV _Identity<_Tp> {};
+// select1st and select2nd are extensions: they are not part of the standard.
+template <class _Pair> struct select1st : public _STLP_PRIV _Select1st<_Pair> {};
+template <class _Pair> struct select2nd : public _STLP_PRIV _Select2nd<_Pair> {};
+
+template <class _Arg1, class _Arg2>
+struct project1st : public _STLP_PRIV _Project1st<_Arg1, _Arg2> {};
+
+template <class _Arg1, class _Arg2>
+struct project2nd : public _STLP_PRIV _Project2nd<_Arg1, _Arg2> {};
+
+
+// constant_void_fun, constant_unary_fun, and constant_binary_fun are
+// extensions: they are not part of the standard. (The same, of course,
+// is true of the helper functions constant0, constant1, and constant2.)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Result>
+struct _Constant_void_fun {
+ typedef _Result result_type;
+ result_type _M_val;
+
+ _Constant_void_fun(const result_type& __v) : _M_val(__v) {}
+ const result_type& operator()() const { return _M_val; }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Result>
+struct constant_void_fun : public _STLP_PRIV _Constant_void_fun<_Result> {
+ constant_void_fun(const _Result& __v)
+ : _STLP_PRIV _Constant_void_fun<_Result>(__v) {}
+};
+
+template <class _Result, _STLP_DFL_TMPL_PARAM( _Argument , _Result) >
+struct constant_unary_fun : public _STLP_PRIV _Constant_unary_fun<_Result, _Argument> {
+ constant_unary_fun(const _Result& __v)
+ : _STLP_PRIV _Constant_unary_fun<_Result, _Argument>(__v) {}
+};
+
+template <class _Result, _STLP_DFL_TMPL_PARAM( _Arg1 , _Result), _STLP_DFL_TMPL_PARAM( _Arg2 , _Arg1) >
+struct constant_binary_fun
+ : public _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2> {
+ constant_binary_fun(const _Result& __v)
+ : _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
+};
+
+template <class _Result>
+inline constant_void_fun<_Result> constant0(const _Result& __val) {
+ return constant_void_fun<_Result>(__val);
+}
+
+template <class _Result>
+inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val) {
+ return constant_unary_fun<_Result,_Result>(__val);
+}
+
+template <class _Result>
+inline constant_binary_fun<_Result,_Result,_Result>
+constant2(const _Result& __val) {
+ return constant_binary_fun<_Result,_Result,_Result>(__val);
+}
+
+// subtractive_rng is an extension: it is not part of the standard.
+// Note: this code assumes that int is 32 bits.
+class subtractive_rng : public unary_function<_STLP_UINT32_T, _STLP_UINT32_T> {
+private:
+ _STLP_UINT32_T _M_table[55];
+ _STLP_UINT32_T _M_index1;
+ _STLP_UINT32_T _M_index2;
+public:
+ _STLP_UINT32_T operator()(_STLP_UINT32_T __limit) {
+ _M_index1 = (_M_index1 + 1) % 55;
+ _M_index2 = (_M_index2 + 1) % 55;
+ _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
+ return _M_table[_M_index1] % __limit;
+ }
+
+ void _M_initialize(_STLP_UINT32_T __seed) {
+ _STLP_UINT32_T __k = 1;
+ _M_table[54] = __seed;
+ _STLP_UINT32_T __i;
+ for (__i = 0; __i < 54; __i++) {
+ _STLP_UINT32_T __ii = (21 * (__i + 1) % 55) - 1;
+ _M_table[__ii] = __k;
+ __k = __seed - __k;
+ __seed = _M_table[__ii];
+ }
+ for (int __loop = 0; __loop < 4; __loop++) {
+ for (__i = 0; __i < 55; __i++)
+ _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
+ }
+ _M_index1 = 0;
+ _M_index2 = 31;
+ }
+
+ subtractive_rng(unsigned int __seed) { _M_initialize(__seed); }
+ subtractive_rng() { _M_initialize(161803398ul); }
+};
+
+#endif /* _STLP_NO_EXTENSIONS */
+
+_STLP_END_NAMESPACE
+
+#include <stl/_function_adaptors.h>
+
+#endif /* _STLP_INTERNAL_FUNCTION_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_function_adaptors.h b/stlport/stlport/stl/_function_adaptors.h
new file mode 100644
index 0000000..0da419b
--- /dev/null
+++ b/stlport/stlport/stl/_function_adaptors.h
@@ -0,0 +1,783 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * Copyright (c) 2000
+ * Pavel Kuznetsov
+ *
+ * Copyright (c) 2001
+ * Meridian'93
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+// This file has noo macro protection as it is meant to be included several times
+// from other header.
+// Adaptor function objects: pointers to member functions.
+
+// There are a total of 16 = 2^4 function objects in this family.
+// (1) Member functions taking no arguments vs member functions taking
+// one argument.
+// (2) Call through pointer vs call through reference.
+// (3) Member function with void return type vs member function with
+// non-void return type.
+// (4) Const vs non-const member function.
+
+// Note that choice (3) is nothing more than a workaround: according
+// to the draft, compilers should handle void and non-void the same way.
+// This feature is not yet widely implemented, though. You can only use
+// member functions returning void if your compiler supports partial
+// specialization.
+
+// All of this complexity is in the function objects themselves. You can
+// ignore it by using the helper function mem_fun and mem_fun_ref,
+// which create whichever type of adaptor is appropriate.
+
+_STLP_BEGIN_NAMESPACE
+
+//This implementation will only be used if needed, that is to say when there is the return void bug
+//and when there is no partial template specialization
+#if defined (_STLP_DONT_RETURN_VOID) && defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+
+template<class _Result, class _Tp>
+class _Mem_fun0_ptr : public unary_function<_Tp*, _Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) ();
+ explicit _Mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp* __p) const { return (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Mem_fun1_ptr : public binary_function<_Tp*,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg);
+ explicit _Mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp>
+class _Const_mem_fun0_ptr : public unary_function<const _Tp*,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) () const;
+ explicit _Const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp* __p) const { return (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg) const;
+ explicit _Const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp* __p, _Arg __x) const {
+ return (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp>
+class _Mem_fun0_ref : public unary_function<_Tp,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) ();
+ explicit _Mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp& __p) const { return (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Mem_fun1_ref : public binary_function<_Tp,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg);
+ explicit _Mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp>
+class _Const_mem_fun0_ref : public unary_function<_Tp,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) () const;
+ explicit _Const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp& __p) const { return (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Const_mem_fun1_ref : public binary_function<_Tp,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg) const;
+ explicit _Const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result>
+struct _Mem_fun_traits {
+ template<class _Tp>
+ struct _Args0 {
+ typedef _Mem_fun0_ptr<_Result,_Tp> _Ptr;
+ typedef _Const_mem_fun0_ptr<_Result,_Tp> _Ptr_const;
+ typedef _Mem_fun0_ref<_Result,_Tp> _Ref;
+ typedef _Const_mem_fun0_ref<_Result,_Tp> _Ref_const;
+ };
+
+ template<class _Tp, class _Arg>
+ struct _Args1 {
+ typedef _Mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr;
+ typedef _Const_mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr_const;
+ typedef _Mem_fun1_ref<_Result,_Tp,_Arg> _Ref;
+ typedef _Const_mem_fun1_ref<_Result,_Tp,_Arg> _Ref_const;
+ };
+};
+
+template<class _Arg, class _Result>
+class _Ptr_fun1_base : public unary_function<_Arg, _Result> {
+protected:
+ typedef _Result (*__fun_type) (_Arg);
+ explicit _Ptr_fun1_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator()(_Arg __x) const { return _M_f(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+class _Ptr_fun2_base : public binary_function<_Arg1,_Arg2,_Result> {
+protected:
+ typedef _Result (*__fun_type) (_Arg1, _Arg2);
+ explicit _Ptr_fun2_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_f(__x, __y); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result>
+struct _Ptr_fun_traits {
+ template<class _Arg> struct _Args1 {
+ typedef _Ptr_fun1_base<_Arg,_Result> _Fun;
+ };
+
+ template<class _Arg1, class _Arg2> struct _Args2 {
+ typedef _Ptr_fun2_base<_Arg1,_Arg2,_Result> _Fun;
+ };
+};
+
+/* Specializations for void return type */
+template<class _Tp>
+class _Void_mem_fun0_ptr : public unary_function<_Tp*,void> {
+protected:
+ typedef void (_Tp::*__fun_type) ();
+ explicit _Void_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp* __p) const { (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_mem_fun1_ptr : public binary_function<_Tp*,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg);
+ explicit _Void_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp>
+class _Void_const_mem_fun0_ptr : public unary_function<const _Tp*,void> {
+protected:
+ typedef void (_Tp::*__fun_type) () const;
+ explicit _Void_const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp* __p) const { (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg) const;
+ explicit _Void_const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp>
+class _Void_mem_fun0_ref : public unary_function<_Tp,void> {
+protected:
+ typedef void (_Tp::*__fun_type) ();
+ explicit _Void_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp& __p) const { (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_mem_fun1_ref : public binary_function<_Tp,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg);
+ explicit _Void_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp>
+class _Void_const_mem_fun0_ref : public unary_function<_Tp,void> {
+protected:
+ typedef void (_Tp::*__fun_type) () const;
+ explicit _Void_const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp& __p) const { (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_const_mem_fun1_ref : public binary_function<_Tp,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg) const;
+ explicit _Void_const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Mem_fun_traits<void> {
+ template<class _Tp> struct _Args0 {
+ typedef _Void_mem_fun0_ptr<_Tp> _Ptr;
+ typedef _Void_const_mem_fun0_ptr<_Tp> _Ptr_const;
+ typedef _Void_mem_fun0_ref<_Tp> _Ref;
+ typedef _Void_const_mem_fun0_ref<_Tp> _Ref_const;
+ };
+
+ template<class _Tp, class _Arg> struct _Args1 {
+ typedef _Void_mem_fun1_ptr<_Tp,_Arg> _Ptr;
+ typedef _Void_const_mem_fun1_ptr<_Tp,_Arg> _Ptr_const;
+ typedef _Void_mem_fun1_ref<_Tp,_Arg> _Ref;
+ typedef _Void_const_mem_fun1_ref<_Tp,_Arg> _Ref_const;
+ };
+};
+
+template<class _Arg>
+class _Ptr_void_fun1_base : public unary_function<_Arg, void> {
+protected:
+ typedef void (*__fun_type) (_Arg);
+ explicit _Ptr_void_fun1_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator()(_Arg __x) const { _M_f(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg1, class _Arg2>
+class _Ptr_void_fun2_base : public binary_function<_Arg1,_Arg2,void> {
+protected:
+ typedef void (*__fun_type) (_Arg1, _Arg2);
+ explicit _Ptr_void_fun2_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator()(_Arg1 __x, _Arg2 __y) const { _M_f(__x, __y); }
+
+private:
+ __fun_type _M_f;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Ptr_fun_traits<void> {
+ template<class _Arg> struct _Args1 {
+ typedef _Ptr_void_fun1_base<_Arg> _Fun;
+ };
+
+ template<class _Arg1, class _Arg2> struct _Args2 {
+ typedef _Ptr_void_fun2_base<_Arg1,_Arg2> _Fun;
+ };
+};
+
+// pavel: need extra level of inheritance here since MSVC++ does not
+// accept traits-based fake partial specialization for template
+// arguments other than first
+
+template<class _Result, class _Arg>
+class _Ptr_fun1 :
+ public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun {
+protected:
+ typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun _Base;
+ explicit _Ptr_fun1(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template<class _Result, class _Arg1, class _Arg2>
+class _Ptr_fun2 :
+ public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun {
+protected:
+ typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun _Base;
+ explicit _Ptr_fun2(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class mem_fun_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr _Base;
+public:
+ explicit mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class const_mem_fun_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const _Base;
+public:
+ explicit const_mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class mem_fun_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref _Base;
+public:
+ explicit mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class const_mem_fun_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const _Base;
+public:
+ explicit const_mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class mem_fun1_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr _Base;
+public:
+ explicit mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class const_mem_fun1_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const _Base;
+public:
+ explicit const_mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class mem_fun1_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref _Base;
+public:
+ explicit mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class const_mem_fun1_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const _Base;
+public:
+ explicit const_mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Arg, class _Result>
+class pointer_to_unary_function :
+ public _Ptr_fun1<_Result,_Arg> {
+ typedef typename
+ _Ptr_fun1<_Result,_Arg>::__fun_type __fun_type;
+public:
+ explicit pointer_to_unary_function(__fun_type __f)
+ : _Ptr_fun1<_Result,_Arg>(__f) {}
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+class pointer_to_binary_function :
+ public _Ptr_fun2<_Result,_Arg1,_Arg2> {
+ typedef typename
+ _Ptr_fun2<_Result,_Arg1,_Arg2>::__fun_type __fun_type;
+public:
+ explicit pointer_to_binary_function(__fun_type __f)
+ : _Ptr_fun2<_Result,_Arg1,_Arg2>(__f) {}
+};
+
+#else
+
+template <class _Ret, class _Tp>
+class mem_fun_t : public unary_function<_Tp*,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp>
+class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp>
+class mem_fun_ref_t : public unary_function<_Tp,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp>
+class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp* __p, _Arg __x) const
+ { return (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg, class _Result>
+class pointer_to_unary_function : public unary_function<_Arg, _Result> {
+protected:
+ _Result (*_M_ptr)(_Arg);
+public:
+ pointer_to_unary_function() {}
+ explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {}
+ _Result operator()(_Arg __x) const { return _M_ptr(__x); }
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+class pointer_to_binary_function :
+ public binary_function<_Arg1,_Arg2,_Result> {
+protected:
+ _Result (*_M_ptr)(_Arg1, _Arg2);
+public:
+ pointer_to_binary_function() {}
+ explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))
+ : _M_ptr(__x) {}
+ _Result operator()(_Arg1 __x, _Arg2 __y) const {
+ return _M_ptr(__x, __y);
+ }
+};
+
+# if defined (_STLP_DONT_RETURN_VOID) && !defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION)
+//Partial specializations for the void type
+template <class _Tp>
+class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
+ typedef void (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp* __p) const { (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp>
+class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {
+ typedef void (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp* __p) const { (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp>
+class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
+ typedef void (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp& __r) const { (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp>
+class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
+ typedef void (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp& __r) const { (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class const_mem_fun1_t<void, _Tp, _Arg>
+ : public binary_function<const _Tp*,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class mem_fun1_ref_t<void, _Tp, _Arg>
+ : public binary_function<_Tp,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class const_mem_fun1_ref_t<void, _Tp, _Arg>
+ : public binary_function<_Tp,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg>
+class pointer_to_unary_function<_Arg, void> : public unary_function<_Arg, void> {
+ typedef void (*__fun_type)(_Arg);
+ __fun_type _M_ptr;
+public:
+ pointer_to_unary_function() {}
+ explicit pointer_to_unary_function(__fun_type __x) : _M_ptr(__x) {}
+ void operator()(_Arg __x) const { _M_ptr(__x); }
+};
+
+template <class _Arg1, class _Arg2>
+class pointer_to_binary_function<_Arg1, _Arg2, void> : public binary_function<_Arg1,_Arg2,void> {
+ typedef void (*__fun_type)(_Arg1, _Arg2);
+ __fun_type _M_ptr;
+public:
+ pointer_to_binary_function() {}
+ explicit pointer_to_binary_function(__fun_type __x) : _M_ptr(__x) {}
+ void operator()(_Arg1 __x, _Arg2 __y) const { _M_ptr(__x, __y); }
+};
+
+# endif
+
+#endif
+
+#if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
+// Mem_fun adaptor helper functions. There are only two:
+// mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref
+// are provided for backward compatibility, but they are no longer
+// part of the C++ standard.)
+
+template <class _Result, class _Tp>
+inline mem_fun_t<_Result,_Tp>
+mem_fun(_Result (_Tp::*__f)()) { return mem_fun_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp>
+inline const_mem_fun_t<_Result,_Tp>
+mem_fun(_Result (_Tp::*__f)() const) { return const_mem_fun_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp>
+inline mem_fun_ref_t<_Result,_Tp>
+mem_fun_ref(_Result (_Tp::*__f)()) { return mem_fun_ref_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp>
+inline const_mem_fun_ref_t<_Result,_Tp>
+mem_fun_ref(_Result (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+# if !(defined (_STLP_NO_EXTENSIONS) || defined (_STLP_NO_ANACHRONISMS))
+// mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
+// but they are provided for backward compatibility.
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun1(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun1(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun1_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun1_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+# endif
+
+#endif
+
+template <class _Arg, class _Result>
+inline pointer_to_unary_function<_Arg, _Result>
+ptr_fun(_Result (*__f)(_Arg))
+{ return pointer_to_unary_function<_Arg, _Result>(__f); }
+
+template <class _Arg1, class _Arg2, class _Result>
+inline pointer_to_binary_function<_Arg1,_Arg2,_Result>
+ptr_fun(_Result (*__f)(_Arg1, _Arg2))
+{ return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f); }
+
+_STLP_END_NAMESPACE
diff --git a/stlport/stlport/stl/_hash_fun.h b/stlport/stlport/stl/_hash_fun.h
new file mode 100644
index 0000000..6197d7b
--- /dev/null
+++ b/stlport/stlport/stl/_hash_fun.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_HASH_FUN_H
+#define _STLP_HASH_FUN_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Key> struct hash { };
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+inline size_t __stl_hash_string(const char* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ unsigned long __h = 0;
+ for ( ; *__s; ++__s)
+ __h = 5*__h + *__s;
+
+ return size_t(__h);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_TEMPLATE_NULL
+struct hash<char*> {
+ size_t operator()(const char* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _STLP_PRIV __stl_hash_string(__s);
+ }
+};
+
+_STLP_TEMPLATE_NULL
+struct hash<const char*> {
+ size_t operator()(const char* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _STLP_PRIV __stl_hash_string(__s);
+ }
+};
+
+_STLP_TEMPLATE_NULL struct hash<char> {
+ size_t operator()(char __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned char> {
+ size_t operator()(unsigned char __x) const { return __x; }
+};
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+_STLP_TEMPLATE_NULL struct hash<signed char> {
+ size_t operator()(unsigned char __x) const { return __x; }
+};
+#endif
+_STLP_TEMPLATE_NULL struct hash<short> {
+ size_t operator()(short __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned short> {
+ size_t operator()(unsigned short __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<int> {
+ size_t operator()(int __x) const { return __x; }
+};
+
+#if !defined (_STLP_MSVC) || (_STLP_MSVC < 1300) || defined (_WIN64)
+_STLP_TEMPLATE_NULL struct hash<unsigned int> {
+ size_t operator()(unsigned int __x) const { return __x; }
+};
+#else
+/* MSVC .Net since 2002 has a 64 bits portability warning feature. typedef
+ * like size_t are tagged as potential 64 bits variables making them different from
+ * unsigned int. To avoid the warning when a hash container is instanciated with
+ * the size_t key we prefer to grant the size_t specialization rather than the
+ * unsigned int one.
+ */
+_STLP_TEMPLATE_NULL struct hash<size_t> {
+ size_t operator()(size_t __x) const { return __x; }
+};
+#endif
+
+_STLP_TEMPLATE_NULL struct hash<long> {
+ size_t operator()(long __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned long> {
+ size_t operator()(unsigned long __x) const { return __x; }
+};
+
+#if defined (_STLP_LONG_LONG)
+_STLP_TEMPLATE_NULL struct hash<_STLP_LONG_LONG> {
+ size_t operator()(_STLP_LONG_LONG x) const { return (size_t)x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned _STLP_LONG_LONG> {
+ size_t operator()(unsigned _STLP_LONG_LONG x) const { return (size_t)x; }
+};
+#endif
+
+_STLP_TEMPLATE_NULL
+struct hash<void *>
+{
+ union __vp {
+ size_t s;
+ void *p;
+ };
+
+ size_t operator()(void *__x) const
+ {
+ __vp vp;
+ vp.p = __x;
+ return vp.s;
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_HASH_FUN_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_hash_map.h b/stlport/stlport/stl/_hash_map.h
new file mode 100644
index 0000000..cd46603
--- /dev/null
+++ b/stlport/stlport/stl/_hash_map.h
@@ -0,0 +1,500 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_HASH_MAP_H
+#define _STLP_INTERNAL_HASH_MAP_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class hash_map
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST key_type, data_type> value_type;
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashMapTraitsT<value_type> _HashMapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _HashMapTraits,
+ _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
+
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+public:
+ hash_map() : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_map(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_map(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+ hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_map(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {
+ }
+#endif
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+# endif
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+#else
+ hash_map(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ hash_map(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ pair<iterator,bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_unique(__f,__l); }
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_unique(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+ pair<iterator,bool> insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_unique_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Tp& operator[](const _KT& __key) {
+ iterator __it = _M_ht.find(__key);
+ return (__it == _M_ht.end() ?
+ _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second :
+ (*__it).second );
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultimapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class hash_multimap
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST key_type, data_type> value_type;
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashMultimapTraitsT<value_type> _HashMultimapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _HashMultimapTraits,
+ _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
+
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+public:
+ hash_multimap() : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_multimap(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_multimap(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+ hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_multimap(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {
+ }
+#endif
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+# endif
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+#else
+ hash_multimap(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ hash_multimap(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ iterator insert(const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_equal(__f,__l); }
+#else
+ void insert(const value_type* __f, const value_type* __l) {
+ _M_ht.insert_equal(__f,__l);
+ }
+ void insert(const_iterator __f, const_iterator __l)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+ iterator insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_equal_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator>
+ equal_range(const _KT& __key) { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator>
+ equal_range(const _KT& __key) const { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+public:
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
+#include <stl/_relops_hash_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
+#include <stl/_relops_hash_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+# endif
+
+// Specialization of insert_iterator so that it will work for hash_map
+// and hash_multimap.
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _Container* container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_HASH_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_hash_set.h b/stlport/stlport/stl/_hash_set.h
new file mode 100644
index 0000000..29b168b
--- /dev/null
+++ b/stlport/stlport/stl/_hash_set.h
@@ -0,0 +1,495 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_HASH_SET_H
+#define _STLP_INTERNAL_HASH_SET_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashSetTraitsT, Const_traits)
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class hash_set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashSetTraitsT<_Value> _HashSetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _HashSetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
+public:
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ hash_set()
+ : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_set(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_set(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+#else
+ hash_set(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type()) {}
+ hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a)
+#endif
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_set(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+# endif
+#else
+ hash_set(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ hash_set(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ pair<iterator, bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+#else
+ void insert(const_iterator __f, const_iterator __l)
+ {_M_ht.insert_unique(__f, __l); }
+ void insert(const value_type* __f, const value_type* __l)
+#endif
+ { _M_ht.insert_unique(__f,__l); }
+
+ pair<iterator, bool> insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_unique_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+public:
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultisetTraitsT, Const_traits)
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class hash_multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashMultisetTraitsT<_Value> _HashMultisetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _HashMultisetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
+
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ hash_multiset()
+ : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_multiset(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_multiset(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+ hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type()) {}
+ hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a)
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_multiset(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+# endif
+#else
+ hash_multiset(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ hash_multiset(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& hs) { _M_ht.swap(hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_equal(__f,__l); }
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_equal(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+ iterator insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_equal_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+public:
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER hash_set<_Value,_HashFcn,_EqualKey,_Alloc>
+
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc>
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+// Specialization of insert_iterator so that it will work for hash_set
+// and hash_multiset.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename hash_set<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+# endif
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _Container* container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_HASH_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_hashtable.c b/stlport/stlport/stl/_hashtable.c
new file mode 100644
index 0000000..ddc21bb
--- /dev/null
+++ b/stlport/stlport/stl/_hashtable.c
@@ -0,0 +1,553 @@
+/*
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_HASHTABLE_C
+#define _STLP_HASHTABLE_C
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+# define __PRIME_LIST_BODY { \
+ 7ul, 23ul, \
+ 53ul, 97ul, 193ul, 389ul, 769ul, \
+ 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, \
+ 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, \
+ 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, \
+ 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,\
+ 1610612741ul, 3221225473ul, 4294967291ul \
+}
+
+template <class _Dummy>
+const size_t* _STLP_CALL
+_Stl_prime<_Dummy>::_S_primes(size_t &__size) {
+ static const size_t _list[] = __PRIME_LIST_BODY;
+# ifndef __MWERKS__
+ __size = sizeof(_list) / sizeof(_list[0]);
+# else
+ __size = 30;
+# endif
+ return _list;
+}
+
+template <class _Dummy>
+size_t _STLP_CALL
+_Stl_prime<_Dummy>::_S_max_nb_buckets() {
+ size_t __size;
+ const size_t* __first = _S_primes(__size);
+ return *(__first + __size - 1);
+}
+
+template <class _Dummy>
+size_t _STLP_CALL
+_Stl_prime<_Dummy>::_S_next_size(size_t __n) {
+ size_t __size;
+ const size_t* __first = _S_primes(__size);
+ const size_t* __last = __first + __size;
+ const size_t* pos = __lower_bound(__first, __last, __n,
+ __less((size_t*)0), __less((size_t*)0), (ptrdiff_t*)0);
+ return (pos == __last ? *(__last - 1) : *pos);
+}
+
+template <class _Dummy>
+void _STLP_CALL
+_Stl_prime<_Dummy>::_S_prev_sizes(size_t __n, size_t const*&__begin, size_t const*&__pos) {
+ size_t __size;
+ __begin = _S_primes(__size);
+ const size_t* __last = __begin + __size;
+ __pos = __lower_bound(__begin, __last, __n,
+ __less((size_t*)0), __less((size_t*)0), (ptrdiff_t*)0);
+
+ if (__pos== __last)
+ --__pos;
+ else if (*__pos == __n) {
+ if (__pos != __begin)
+ --__pos;
+ }
+}
+
+# undef __PRIME_LIST_BODY
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif
+
+#if defined (_STLP_DEBUG)
+# define hashtable _STLP_NON_DBG_NAME(hashtable)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// fbp: these defines are for outline methods definitions.
+// needed to definitions to be portable. Should not be used in method bodies.
+
+#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+# define __size_type__ size_t
+# define size_type size_t
+# define value_type _Val
+# define key_type _Key
+# define __reference__ _Val&
+
+# define __iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_NonConstTraits, \
+ _Key, _HF, _ExK, _EqK, _All>
+# define __const_iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_ConstTraits, \
+ _Key, _HF, _ExK, _EqK, _All>
+#else
+# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::size_type
+# define __reference__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference
+# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::iterator
+# define __const_iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::const_iterator
+#endif
+
+/*
+ * This method is too difficult to implement for hashtable that do not
+ * require a sorted operation on the stored type.
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+bool hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_equal(
+ const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht1,
+ const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht2) {
+ return __ht1._M_buckets == __ht2._M_buckets &&
+ __ht1._M_elems == __ht2._M_elems;
+}
+*/
+
+/* Returns the iterator before the first iterator of the bucket __n and set
+ * __n to the first previous bucket having the same first iterator as bucket
+ * __n.
+ */
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_before_begin(size_type &__n) const {
+ return _S_before_begin(_M_elems, _M_buckets, __n);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets,
+ size_type &__n) {
+ _ElemsCont &__mutable_elems = __CONST_CAST(_ElemsCont&, __elems);
+ typename _BucketVector::const_iterator __bpos(__buckets.begin() + __n);
+
+ _ElemsIte __pos(*__bpos);
+ if (__pos == __mutable_elems.begin()) {
+ __n = 0;
+ return __mutable_elems.before_begin();
+ }
+
+ typename _BucketVector::const_iterator __bcur(__bpos);
+ _BucketType *__pos_node = __pos._M_node;
+ for (--__bcur; __pos_node == *__bcur; --__bcur) ;
+
+ __n = __bcur - __buckets.begin() + 1;
+ _ElemsIte __cur(*__bcur);
+ _ElemsIte __prev = __cur++;
+ for (; __cur != __pos; ++__prev, ++__cur) ;
+ return __prev;
+}
+
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_insert_noresize(size_type __n, const value_type& __obj) {
+ //We always insert this element as 1st in the bucket to not break
+ //the elements order as equal elements must be kept next to each other.
+ size_type __prev = __n;
+ _ElemsIte __pos = _M_before_begin(__prev)._M_ite;
+
+ fill(_M_buckets.begin() + __prev, _M_buckets.begin() + __n + 1,
+ _M_elems.insert_after(__pos, __obj)._M_node);
+ ++_M_num_elements;
+ return iterator(_ElemsIte(_M_buckets[__n]));
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+pair<__iterator__, bool>
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::insert_unique_noresize(const value_type& __obj) {
+ const size_type __n = _M_bkt_num(__obj);
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+
+ if (__cur != __last) {
+ for (; __cur != __last; ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) {
+ //We check that equivalent keys have equals hash code as otherwise, on resize,
+ //equivalent value might not be in the same bucket
+ _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj)))
+ return pair<iterator, bool>(iterator(__cur), false);
+ }
+ }
+ /* Here we do not rely on the _M_insert_noresize method as we know
+ * that we cannot break element orders, elements are unique, and
+ * insertion after the first bucket element is faster than what is
+ * done in _M_insert_noresize.
+ */
+ __cur = _M_elems.insert_after(_ElemsIte(_M_buckets[__n]), __obj);
+ ++_M_num_elements;
+ return pair<iterator, bool>(iterator(__cur), true);
+ }
+
+ return pair<iterator, bool>(_M_insert_noresize(__n, __obj), true);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::insert_equal_noresize(const value_type& __obj) {
+ const size_type __n = _M_bkt_num(__obj);
+ {
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+
+ for (; __cur != __last; ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) {
+ //We check that equivalent keys have equals hash code as otherwise, on resize,
+ //equivalent value might not be in the same bucket
+ _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj)))
+ ++_M_num_elements;
+ return _M_elems.insert_after(__cur, __obj);
+ }
+ }
+ }
+
+ return _M_insert_noresize(__n, __obj);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__reference__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_insert(const value_type& __obj) {
+ _M_enlarge(_M_num_elements + 1);
+ return *insert_unique_noresize(__obj).first;
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__size_type__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::erase(const key_type& __key) {
+ const size_type __n = _M_bkt_num_key(__key);
+
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ if (__cur == __last)
+ return 0;
+
+ size_type __erased = 0;
+ if (_M_equals(_M_get_key(*__cur), __key)) {
+ //We look for the pos before __cur:
+ size_type __prev_b = __n;
+ _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite;
+ do {
+ __cur = _M_elems.erase_after(__prev);
+ ++__erased;
+ } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key));
+ fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1, __cur._M_node);
+ }
+ else {
+ _ElemsIte __prev = __cur++;
+ for (; __cur != __last; ++__prev, ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), __key)) {
+ do {
+ __cur = _M_elems.erase_after(__prev);
+ ++__erased;
+ } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key));
+ break;
+ }
+ }
+ }
+
+ _M_num_elements -= __erased;
+ _M_reduce();
+ return __erased;
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::erase(const_iterator __it) {
+ const size_type __n = _M_bkt_num(*__it);
+ _ElemsIte __cur(_M_buckets[__n]);
+
+ size_type __erased = 0;
+ if (__cur == __it._M_ite) {
+ size_type __prev_b = __n;
+ _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite;
+ fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1,
+ _M_elems.erase_after(__prev)._M_node);
+ ++__erased;
+ }
+ else {
+ _ElemsIte __prev = __cur++;
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ for (; __cur != __last; ++__prev, ++__cur) {
+ if (__cur == __it._M_ite) {
+ _M_elems.erase_after(__prev);
+ ++__erased;
+ break;
+ }
+ }
+ }
+
+ _M_num_elements -= __erased;
+ _M_reduce();
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::erase(const_iterator __first, const_iterator __last) {
+ if (__first == __last)
+ return;
+ size_type __f_bucket = _M_bkt_num(*__first);
+ size_type __l_bucket = __last != end() ? _M_bkt_num(*__last) : (_M_buckets.size() - 1);
+
+ _ElemsIte __cur(_M_buckets[__f_bucket]);
+ _ElemsIte __prev;
+ if (__cur == __first._M_ite) {
+ __prev = _M_before_begin(__f_bucket)._M_ite;
+ }
+ else {
+ _ElemsIte __last(_M_buckets[++__f_bucket]);
+ __prev = __cur++;
+ for (; (__cur != __last) && (__cur != __first._M_ite); ++__prev, ++__cur) ;
+ }
+ size_type __erased = 0;
+ //We do not use the slist::erase_after method taking a range to count the
+ //number of erased elements:
+ while (__cur != __last._M_ite) {
+ __cur = _M_elems.erase_after(__prev);
+ ++__erased;
+ }
+ fill(_M_buckets.begin() + __f_bucket, _M_buckets.begin() + __l_bucket + 1, __cur._M_node);
+ _M_num_elements -= __erased;
+ _M_reduce();
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::rehash(size_type __num_buckets_hint) {
+ if (bucket_count() >= __num_buckets_hint) {
+ // We are trying to reduce number of buckets, we have to validate it:
+ size_type __limit_num_buckets = (size_type)((float)size() / max_load_factor());
+ if (__num_buckets_hint < __limit_num_buckets) {
+ // Targetted number of buckets __num_buckets_hint would break
+ // load_factor() <= max_load_factor() rule.
+ return;
+ }
+ }
+
+ _M_rehash(__num_buckets_hint);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_enlarge(size_type __to_size) {
+ size_type __num_buckets = bucket_count();
+ size_type __num_buckets_hint = (size_type)((float)__to_size / max_load_factor());
+ if (__num_buckets_hint <= __num_buckets) {
+ return;
+ }
+ __num_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__num_buckets_hint);
+
+ _M_rehash(__num_buckets);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_reduce() {
+ size_type __num_buckets = bucket_count();
+ // We only try to reduce the hashtable if the theorical load factor
+ // is lower than a fraction of the max load factor:
+ // 4 factor is coming from the fact that prime number list is almost a
+ // geometrical suite with reason 2, as we try to jump 2 levels is means
+ // a 4 factor.
+ if ((float)size() / (float)__num_buckets > max_load_factor() / 4.0f)
+ return;
+
+ const size_type *__first;
+ const size_type *__prev;
+ _STLP_PRIV _Stl_prime_type::_S_prev_sizes(__num_buckets, __first, __prev);
+
+ /* We are only going to reduce number of buckets if moving to yet the previous number
+ * of buckets in the prime numbers would respect the load rule. Otherwise algorithm
+ * successively removing and adding an element would each time perform an expensive
+ * rehash operation. */
+ const size_type *__prev_prev = __prev;
+ if (__prev_prev != __first) {
+ --__prev_prev;
+ if ((float)size() / (float)*__prev_prev > max_load_factor())
+ return;
+ }
+ else {
+ if (*__prev >= __num_buckets)
+ return;
+ }
+
+ // Can we reduce further:
+ while (__prev_prev != __first) {
+ --__prev_prev;
+ if ((float)size() / (float)*__prev_prev > max_load_factor())
+ // We cannot reduce further.
+ break;
+ --__prev;
+ }
+
+ _M_rehash(*__prev);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_resize() {
+ if (load_factor() > max_load_factor()) {
+ // We have to enlarge
+ _M_enlarge(size());
+ }
+ else {
+ // We can try to reduce size:
+ _M_reduce();
+ }
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_rehash(size_type __num_buckets) {
+#if defined (_STLP_DEBUG)
+ _M_check();
+#endif
+ _ElemsCont __tmp_elems(_M_elems.get_allocator());
+ _BucketVector __tmp(__num_buckets + 1, __STATIC_CAST(_BucketType*, 0), _M_buckets.get_allocator());
+ _ElemsIte __cur, __last(_M_elems.end());
+ while (!_M_elems.empty()) {
+ __cur = _M_elems.begin();
+ size_type __new_bucket = _M_bkt_num(*__cur, __num_buckets);
+ _ElemsIte __ite(__cur), __before_ite(__cur);
+ for (++__ite;
+ __ite != __last && _M_equals(_M_get_key(*__cur), _M_get_key(*__ite));
+ ++__ite, ++__before_ite) ;
+ size_type __prev_bucket = __new_bucket;
+ _ElemsIte __prev = _S_before_begin(__tmp_elems, __tmp, __prev_bucket)._M_ite;
+ __tmp_elems.splice_after(__prev, _M_elems, _M_elems.before_begin(), __before_ite);
+ fill(__tmp.begin() + __prev_bucket, __tmp.begin() + __new_bucket + 1, __cur._M_node);
+ }
+ _M_elems.swap(__tmp_elems);
+ _M_buckets.swap(__tmp);
+}
+
+#if defined (_STLP_DEBUG)
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_check() const {
+ //We check that hash code of stored keys haven't change and also that equivalent
+ //relation hasn't been modified
+ size_t __num_buckets = bucket_count();
+ for (size_t __b = 0; __b < __num_buckets; ++__b) {
+ _ElemsIte __cur(_M_buckets[__b]), __last(_M_buckets[__b + 1]);
+ _ElemsIte __fst(__cur), __snd(__cur);
+ for (; __cur != __last; ++__cur) {
+ _STLP_ASSERT( _M_bkt_num(*__cur, __num_buckets) == __b )
+ _STLP_ASSERT( !_M_equals(_M_get_key(*__fst), _M_get_key(*__cur)) || _M_equals(_M_get_key(*__snd), _M_get_key(*__cur)) )
+ if (__fst != __snd)
+ ++__fst;
+ if (__snd != __cur)
+ ++__snd;
+ }
+ }
+}
+#endif
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::clear() {
+ _M_elems.clear();
+ _M_buckets.assign(_M_buckets.size(), __STATIC_CAST(_BucketType*, 0));
+ _M_num_elements = 0;
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_copy_from(const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht) {
+ _M_elems.clear();
+ _M_elems.insert(_M_elems.end(), __ht._M_elems.begin(), __ht._M_elems.end());
+ _M_buckets.resize(__ht._M_buckets.size());
+ _ElemsConstIte __src(__ht._M_elems.begin()), __src_end(__ht._M_elems.end());
+ _ElemsIte __dst(_M_elems.begin());
+ typename _BucketVector::const_iterator __src_b(__ht._M_buckets.begin()),
+ __src_end_b(__ht._M_buckets.end());
+ typename _BucketVector::iterator __dst_b(_M_buckets.begin()), __dst_end_b(_M_buckets.end());
+ for (; __src != __src_end; ++__src, ++__dst) {
+ for (; __src_b != __src_end_b; ++__src_b, ++__dst_b) {
+ if (*__src_b == __src._M_node) {
+ *__dst_b = __dst._M_node;
+ }
+ else
+ break;
+ }
+ }
+ fill(__dst_b, __dst_end_b, __STATIC_CAST(_BucketType*, 0));
+ _M_num_elements = __ht._M_num_elements;
+ _M_max_load_factor = __ht._M_max_load_factor;
+}
+
+#undef __iterator__
+#undef const_iterator
+#undef __size_type__
+#undef __reference__
+#undef size_type
+#undef value_type
+#undef key_type
+#undef __stl_num_primes
+
+#if defined (_STLP_DEBUG)
+# undef hashtable
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_HASHTABLE_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_hashtable.h b/stlport/stlport/stl/_hashtable.h
new file mode 100644
index 0000000..0d2bda6
--- /dev/null
+++ b/stlport/stlport/stl/_hashtable.h
@@ -0,0 +1,658 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+#define _STLP_INTERNAL_HASHTABLE_H
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+#endif
+
+#ifndef _STLP_INTERNAL_SLIST_H
+# include <stl/_slist.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_HASH_FUN_H
+# include <stl/_hash_fun.h>
+#endif
+
+/*
+ * Hashtable class, used to implement the hashed associative containers
+ * hash_set, hash_map, hash_multiset, hash_multimap,
+ * unordered_set, unordered_map, unordered_multiset, unordered_multimap.
+ */
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+//Export of the classes used to represent buckets in the hashtable implementation.
+# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+//If pointer specialization is enabled vector<_Slist_node_base*> will use the void*
+//storage type for which internal classes have already been exported.
+_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _Slist_node_base*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Vector_base<_Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+# if defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
+_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> > >;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> >;
+# undef _STLP_NON_DBG_VECTOR
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+_STLP_EXPORT_TEMPLATE_CLASS vector<_STLP_PRIV _Slist_node_base*,
+ allocator<_STLP_PRIV _Slist_node_base*> >;
+#endif
+
+#if defined (_STLP_DEBUG)
+# define hashtable _STLP_NON_DBG_NAME(hashtable)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// some compilers require the names of template parameters to be the same
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+class hashtable;
+
+#if !defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _BaseIte, class _Traits>
+struct _Ht_iterator {
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+
+ typedef _Ht_iterator<_BaseIte,_Traits> _Self;
+
+ typedef typename _Traits::value_type value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef typename _Traits::reference reference;
+ typedef forward_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+
+ typedef _Ht_iterator<_BaseIte, _NonConstTraits> iterator;
+ typedef _Ht_iterator<_BaseIte, _ConstTraits> const_iterator;
+
+ _Ht_iterator() {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Ht_iterator(const iterator& __it) : _M_ite(__it._M_ite) {}
+ _Ht_iterator(_BaseIte __it) : _M_ite(__it) {}
+
+ reference operator*() const {
+ return *_M_ite;
+ }
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ ++_M_ite;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ bool operator == (const_iterator __rhs) const {
+ return _M_ite == __rhs._M_ite;
+ }
+ bool operator != (const_iterator __rhs) const {
+ return _M_ite != __rhs._M_ite;
+ }
+
+ _BaseIte _M_ite;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _BaseIte, class _Traits>
+struct __type_traits<_STLP_PRIV _Ht_iterator<_BaseIte, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+template <class _BaseIte, class _Traits>
+inline
+# if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+_STLP_TYPENAME_ON_RETURN_TYPE _Traits::value_type *
+# else
+_STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type *
+# endif
+value_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&) {
+ typedef _STLP_TYPENAME _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type _Val;
+ return (_Val*) 0;
+}
+template <class _BaseIte, class _Traits>
+inline forward_iterator_tag iterator_category(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&)
+{ return forward_iterator_tag(); }
+template <class _BaseIte, class _Traits>
+inline ptrdiff_t* distance_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&)
+{ return (ptrdiff_t*) 0; }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Dummy>
+class _Stl_prime {
+ // Returns begining of primes list and size by reference.
+ static const size_t* _S_primes(size_t&);
+public:
+ //Returns the maximum number of buckets handled by the hashtable implementation
+ static size_t _STLP_CALL _S_max_nb_buckets();
+
+ //Returns the bucket size next to a required size
+ static size_t _STLP_CALL _S_next_size(size_t);
+
+ // Returns the bucket range containing sorted list of prime numbers <= __hint.
+ static void _STLP_CALL _S_prev_sizes(size_t __hint, const size_t *&__begin, const size_t *&__end);
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _Stl_prime<bool>;
+#endif
+
+typedef _Stl_prime<bool> _Stl_prime_type;
+
+#if !defined (_STLP_DEBUG)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+/*
+ * Hashtables handle allocators a bit differently than other containers
+ * do. If we're using standard-conforming allocators, then a hashtable
+ * unconditionally has a member variable to hold its allocator, even if
+ * it so happens that all instances of the allocator type are identical.
+ * This is because, for hashtables, this extra storage is negligible.
+ * Additionally, a base class wouldn't serve any other purposes; it
+ * wouldn't, for example, simplify the exception-handling code.
+ */
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+class hashtable {
+ typedef hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits;
+ typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits;
+
+public:
+ typedef _Key key_type;
+ typedef _Val value_type;
+ typedef _HF hasher;
+ typedef _EqK key_equal;
+
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef typename _NonConstTraits::pointer pointer;
+ typedef const value_type* const_pointer;
+ typedef typename _NonConstTraits::reference reference;
+ typedef const value_type& const_reference;
+ typedef forward_iterator_tag _Iterator_category;
+
+ hasher hash_funct() const { return _M_hash; }
+ key_equal key_eq() const { return _M_equals; }
+
+private:
+ _STLP_FORCE_ALLOCATORS(_Val, _All)
+#if defined (_STLP_DEBUG)
+ typedef _STLP_PRIV _STLP_NON_DBG_NAME(slist)<value_type, _All> _ElemsCont;
+#else
+ typedef slist<value_type, _All> _ElemsCont;
+#endif
+ typedef typename _ElemsCont::iterator _ElemsIte;
+ typedef typename _ElemsCont::const_iterator _ElemsConstIte;
+ typedef _STLP_PRIV _Slist_node_base _BucketType;
+ typedef typename _Alloc_traits<_BucketType*, _All>::allocator_type _BucketAllocType;
+ /*
+ * We are going to use vector of _Slist_node_base pointers for 2 reasons:
+ * - limit code bloat, all hashtable instanciation use the same buckets representation.
+ * - avoid _STLP_DEBUG performance trouble: with a vector of iterator on slist the resize
+ * method would be too slow because the slist::splice_after method become linear on
+ * the number of iterators in the buckets rather than constant in time as the iterator
+ * has to be move from a slist to the other.
+ */
+#if defined (_STLP_DEBUG)
+ typedef _STLP_PRIV _STLP_NON_DBG_NAME(vector)<_BucketType*, _BucketAllocType> _BucketVector;
+#else
+ typedef vector<_BucketType*, _BucketAllocType> _BucketVector;
+#endif
+
+ hasher _M_hash;
+ key_equal _M_equals;
+ _ElemsCont _M_elems;
+ _BucketVector _M_buckets;
+ size_type _M_num_elements;
+ float _M_max_load_factor;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+ static const key_type& _M_get_key(const value_type& __val) {
+ _ExK k;
+ return k(__val);
+ }
+public:
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstTraits> iterator;
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstTraits> const_iterator;
+ //TODO: Avoids this debug check and make the local_iterator different from
+ //iterator in debug mode too.
+#if !defined (_STLP_DEBUG)
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstLocalTraits> local_iterator;
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstLocalTraits> const_local_iterator;
+#else
+ typedef iterator local_iterator;
+ typedef const_iterator const_local_iterator;
+#endif
+
+ typedef _All allocator_type;
+ allocator_type get_allocator() const { return _M_elems.get_allocator(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const allocator_type& __a = allocator_type())
+#else
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql)
+ : _M_hash(__hf),
+ _M_equals(__eql),
+ _M_elems(allocator_type()),
+ _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)),
+ _M_num_elements(0),
+ _M_max_load_factor(1.0f)
+ { _M_initialize_buckets(__n); }
+
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const allocator_type& __a)
+#endif
+ : _M_hash(__hf),
+ _M_equals(__eql),
+ _M_elems(__a),
+ _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)),
+ _M_num_elements(0),
+ _M_max_load_factor(1.0f)
+ { _M_initialize_buckets(__n); }
+
+ hashtable(const _Self& __ht)
+ : _M_hash(__ht._M_hash),
+ _M_equals(__ht._M_equals),
+ _M_elems(__ht.get_allocator()),
+ _M_buckets(_STLP_CONVERT_ALLOCATOR(__ht.get_allocator(), _BucketType*)),
+ _M_num_elements(0),
+ _M_max_load_factor(1.0f)
+ { _M_copy_from(__ht); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hashtable(__move_source<_Self> src)
+ : _M_hash(_STLP_PRIV _AsMoveSource(src.get()._M_hash)),
+ _M_equals(_STLP_PRIV _AsMoveSource(src.get()._M_equals)),
+ _M_elems(__move_source<_ElemsCont>(src.get()._M_elems)),
+ _M_buckets(__move_source<_BucketVector>(src.get()._M_buckets)),
+ _M_num_elements(src.get()._M_num_elements),
+ _M_max_load_factor(src.get()._M_max_load_factor) {}
+#endif
+
+ _Self& operator= (const _Self& __ht) {
+ if (&__ht != this) {
+ clear();
+ _M_hash = __ht._M_hash;
+ _M_equals = __ht._M_equals;
+ _M_copy_from(__ht);
+ }
+ return *this;
+ }
+
+ ~hashtable() { clear(); }
+
+ size_type size() const { return _M_num_elements; }
+ size_type max_size() const { return size_type(-1); }
+ bool empty() const { return size() == 0; }
+
+ void swap(_Self& __ht) {
+ _STLP_STD::swap(_M_hash, __ht._M_hash);
+ _STLP_STD::swap(_M_equals, __ht._M_equals);
+ _M_elems.swap(__ht._M_elems);
+ _M_buckets.swap(__ht._M_buckets);
+ _STLP_STD::swap(_M_num_elements, __ht._M_num_elements);
+ _STLP_STD::swap(_M_max_load_factor, __ht._M_max_load_factor);
+ }
+
+ iterator begin() { return _M_elems.begin(); }
+ iterator end() { return _M_elems.end(); }
+ local_iterator begin(size_type __n) { return _ElemsIte(_M_buckets[__n]); }
+ local_iterator end(size_type __n) { return _ElemsIte(_M_buckets[__n + 1]); }
+
+ const_iterator begin() const { return __CONST_CAST(_ElemsCont&, _M_elems).begin(); }
+ const_iterator end() const { return __CONST_CAST(_ElemsCont&, _M_elems).end(); }
+ const_local_iterator begin(size_type __n) const { return _ElemsIte(_M_buckets[__n]); }
+ const_local_iterator end(size_type __n) const { return _ElemsIte(_M_buckets[__n + 1]); }
+
+ //static bool _STLP_CALL _M_equal (const _Self&, const _Self&);
+
+public:
+ //The number of buckets is size() - 1 because the last bucket always contains
+ //_M_elems.end() to make algo easier to implement.
+ size_type bucket_count() const { return _M_buckets.size() - 1; }
+ size_type max_bucket_count() const { return _STLP_PRIV _Stl_prime_type::_S_max_nb_buckets(); }
+ size_type elems_in_bucket(size_type __bucket) const
+ { return _STLP_STD::distance(_ElemsIte(_M_buckets[__bucket]), _ElemsIte(_M_buckets[__bucket + 1])); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_bkt_num_key(__k); }
+
+ // hash policy
+ float load_factor() const { return (float)size() / (float)bucket_count(); }
+ float max_load_factor() const { return _M_max_load_factor; }
+ void max_load_factor(float __z) {
+ _M_max_load_factor = __z;
+ _M_resize();
+ }
+
+ pair<iterator, bool> insert_unique(const value_type& __obj) {
+ _M_enlarge(_M_num_elements + 1);
+ return insert_unique_noresize(__obj);
+ }
+
+ iterator insert_equal(const value_type& __obj) {
+ _M_enlarge(_M_num_elements + 1);
+ return insert_equal_noresize(__obj);
+ }
+
+protected:
+ iterator _M_insert_noresize(size_type __n, const value_type& __obj);
+public:
+ pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
+ iterator insert_equal_noresize(const value_type& __obj);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert_unique(_InputIterator __f, _InputIterator __l)
+ { insert_unique(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); }
+
+ template <class _InputIterator>
+ void insert_equal(_InputIterator __f, _InputIterator __l)
+ { insert_equal(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); }
+
+ template <class _InputIterator>
+ void insert_unique(_InputIterator __f, _InputIterator __l,
+ const input_iterator_tag &) {
+ for ( ; __f != __l; ++__f)
+ insert_unique(*__f);
+ }
+
+ template <class _InputIterator>
+ void insert_equal(_InputIterator __f, _InputIterator __l,
+ const input_iterator_tag &) {
+ for ( ; __f != __l; ++__f)
+ insert_equal(*__f);
+ }
+
+ template <class _ForwardIterator>
+ void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_unique_noresize(*__f);
+ }
+
+ template <class _ForwardIterator>
+ void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_equal_noresize(*__f);
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert_unique(const value_type* __f, const value_type* __l) {
+ size_type __n = __l - __f;
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_unique_noresize(*__f);
+ }
+
+ void insert_equal(const value_type* __f, const value_type* __l) {
+ size_type __n = __l - __f;
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_equal_noresize(*__f);
+ }
+
+ void insert_unique(const_iterator __f, const_iterator __l) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_unique_noresize(*__f);
+ }
+
+ void insert_equal(const_iterator __f, const_iterator __l) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_equal_noresize(*__f);
+ }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ //reference find_or_insert(const value_type& __obj);
+
+private:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _ElemsIte _M_find(const _KT& __key) const {
+ size_type __n = _M_bkt_num_key(__key);
+ _ElemsIte __first(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ for ( ; (__first != __last) && !_M_equals(_M_get_key(*__first), __key); ++__first) ;
+ if (__first != __last)
+ return __first;
+ else
+ return __CONST_CAST(_ElemsCont&, _M_elems).end();
+ }
+
+public:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const {
+ const size_type __n = _M_bkt_num_key(__key);
+
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ for (; __cur != __last; ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), __key)) {
+ size_type __result = 1;
+ for (++__cur;
+ __cur != __last && _M_equals(_M_get_key(*__cur), __key);
+ ++__result, ++__cur) ;
+ return __result;
+ }
+ }
+ return 0;
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key) {
+ typedef pair<iterator, iterator> _Pii;
+ const size_type __n = _M_bkt_num_key(__key);
+
+ for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]);
+ __first != __last; ++__first) {
+ if (_M_equals(_M_get_key(*__first), __key)) {
+ _ElemsIte __cur(__first);
+ for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur) ;
+ return _Pii(__first, __cur);
+ }
+ }
+ return _Pii(end(), end());
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const {
+ typedef pair<const_iterator, const_iterator> _Pii;
+ const size_type __n = _M_bkt_num_key(__key);
+
+ for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]);
+ __first != __last; ++__first) {
+ if (_M_equals(_M_get_key(*__first), __key)) {
+ _ElemsIte __cur(__first);
+ for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur) ;
+ return _Pii(__first, __cur);
+ }
+ }
+ return _Pii(end(), end());
+ }
+
+ size_type erase(const key_type& __key);
+ void erase(const_iterator __it);
+ void erase(const_iterator __first, const_iterator __last);
+
+private:
+ void _M_enlarge(size_type __n);
+ void _M_reduce();
+ void _M_resize();
+ void _M_rehash(size_type __num_buckets);
+#if defined (_STLP_DEBUG)
+ void _M_check() const;
+#endif
+
+public:
+ void rehash(size_type __num_buckets_hint);
+ void resize(size_type __num_buckets_hint)
+ { rehash(__num_buckets_hint); }
+ void clear();
+
+ // this is for hash_map::operator[]
+ reference _M_insert(const value_type& __obj);
+
+private:
+ //__n is set to the first bucket that has to be modified if any
+ //erase/insert operation is done after the returned iterator.
+ iterator _M_before_begin(size_type &__n) const;
+
+ static iterator _S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets,
+ size_type &__n);
+
+ void _M_initialize_buckets(size_type __n) {
+ const size_type __n_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__n) + 1;
+ _M_buckets.reserve(__n_buckets);
+ _M_buckets.assign(__n_buckets, __STATIC_CAST(_BucketType*, 0));
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type _M_bkt_num_key(const _KT& __key) const
+ { return _M_bkt_num_key(__key, bucket_count()); }
+
+ size_type _M_bkt_num(const value_type& __obj) const
+ { return _M_bkt_num_key(_M_get_key(__obj)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type _M_bkt_num_key(const _KT& __key, size_type __n) const
+ { return _M_hash(__key) % __n; }
+
+ size_type _M_bkt_num(const value_type& __obj, size_t __n) const
+ { return _M_bkt_num_key(_M_get_key(__obj), __n); }
+
+ void _M_copy_from(const _Self& __ht);
+};
+
+#if defined (_STLP_DEBUG)
+# undef hashtable
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_hashtable.c>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_TEMPLATE_HEADER template <class _Val, class _Key, class _HF, class _Traits, class _ExK, class _EqK, class _All>
+#define _STLP_TEMPLATE_CONTAINER hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+#include <stl/_relops_hash_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Val, class _Key, class _HF, class _Traits, class _ExK, class _EqK, class _All>
+struct __move_traits<hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> > {
+ //Hashtables are movable:
+ typedef __true_type implemented;
+
+ //Completeness depends on many template parameters, for the moment we consider it not complete:
+ typedef __false_type complete;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_HASHTABLE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_heap.c b/stlport/stlport/stl/_heap.c
new file mode 100644
index 0000000..a4ab049
--- /dev/null
+++ b/stlport/stlport/stl/_heap.c
@@ -0,0 +1,246 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_HEAP_C
+#define _STLP_HEAP_C
+
+#ifndef _STLP_INTERNAL_HEAP_H
+# include <stl/_heap.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _RandomAccessIterator, class _Distance, class _Tp>
+_STLP_INLINE_LOOP
+void
+__push_heap(_RandomAccessIterator __first,
+ _Distance __holeIndex, _Distance __topIndex, _Tp __val)
+{
+ _Distance __parent = (__holeIndex - 1) / 2;
+ while (__holeIndex > __topIndex && *(__first + __parent) < __val) {
+ *(__first + __holeIndex) = *(__first + __parent);
+ __holeIndex = __parent;
+ __parent = (__holeIndex - 1) / 2;
+ }
+ *(__first + __holeIndex) = __val;
+}
+
+template <class _RandomAccessIterator, class _Distance, class _Tp>
+inline void
+__push_heap_aux(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Distance*, _Tp*)
+{
+ __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
+ _Tp(*(__last - 1)));
+}
+
+template <class _RandomAccessIterator>
+void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+ __push_heap_aux(__first, __last,
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator), _STLP_VALUE_TYPE(__first, _RandomAccessIterator));
+}
+
+
+template <class _RandomAccessIterator, class _Distance, class _Tp,
+ class _Compare>
+_STLP_INLINE_LOOP
+void
+__push_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __topIndex, _Tp __val, _Compare __comp)
+{
+ _Distance __parent = (__holeIndex - 1) / 2;
+ while (__holeIndex > __topIndex && __comp(*(__first + __parent), __val)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__val, *(__first + __parent)), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *(__first + __holeIndex) = *(__first + __parent);
+ __holeIndex = __parent;
+ __parent = (__holeIndex - 1) / 2;
+ }
+ *(__first + __holeIndex) = __val;
+}
+
+template <class _RandomAccessIterator, class _Compare,
+ class _Distance, class _Tp>
+inline void
+__push_heap_aux(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp,
+ _Distance*, _Tp*)
+{
+ __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
+ _Tp(*(__last - 1)), __comp);
+}
+
+template <class _RandomAccessIterator, class _Compare>
+void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+{
+ __push_heap_aux(__first, __last, __comp,
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator), _STLP_VALUE_TYPE(__first, _RandomAccessIterator));
+}
+
+template <class _RandomAccessIterator, class _Distance, class _Tp>
+void
+__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __len, _Tp __val) {
+ _Distance __topIndex = __holeIndex;
+ _Distance __secondChild = 2 * __holeIndex + 2;
+ while (__secondChild < __len) {
+ if (*(__first + __secondChild) < *(__first + (__secondChild - 1)))
+ __secondChild--;
+ *(__first + __holeIndex) = *(__first + __secondChild);
+ __holeIndex = __secondChild;
+ __secondChild = 2 * (__secondChild + 1);
+ }
+ if (__secondChild == __len) {
+ *(__first + __holeIndex) = *(__first + (__secondChild - 1));
+ __holeIndex = __secondChild - 1;
+ }
+ __push_heap(__first, __holeIndex, __topIndex, __val);
+}
+
+
+template <class _RandomAccessIterator, class _Tp>
+inline void
+__pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last, _Tp*) {
+ __pop_heap(__first, __last - 1, __last - 1,
+ _Tp(*(__last - 1)), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator));
+}
+
+template <class _RandomAccessIterator>
+void pop_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last) {
+ __pop_heap_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIterator));
+}
+
+template <class _RandomAccessIterator, class _Distance,
+ class _Tp, class _Compare>
+void
+__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __len, _Tp __val, _Compare __comp)
+{
+ _Distance __topIndex = __holeIndex;
+ _Distance __secondChild = 2 * __holeIndex + 2;
+ while (__secondChild < __len) {
+ if (__comp(*(__first + __secondChild), *(__first + (__secondChild - 1)))) {
+ _STLP_VERBOSE_ASSERT(!__comp(*(__first + (__secondChild - 1)), *(__first + __secondChild)),
+ _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __secondChild--;
+ }
+ *(__first + __holeIndex) = *(__first + __secondChild);
+ __holeIndex = __secondChild;
+ __secondChild = 2 * (__secondChild + 1);
+ }
+ if (__secondChild == __len) {
+ *(__first + __holeIndex) = *(__first + (__secondChild - 1));
+ __holeIndex = __secondChild - 1;
+ }
+ __push_heap(__first, __holeIndex, __topIndex, __val, __comp);
+}
+
+
+template <class _RandomAccessIterator, class _Tp, class _Compare>
+inline void
+__pop_heap_aux(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Tp*, _Compare __comp)
+{
+ __pop_heap(__first, __last - 1, __last - 1, _Tp(*(__last - 1)), __comp,
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator));
+}
+
+
+template <class _RandomAccessIterator, class _Compare>
+void
+pop_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp)
+{
+ __pop_heap_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIterator), __comp);
+}
+
+template <class _RandomAccessIterator, class _Tp, class _Distance>
+_STLP_INLINE_LOOP
+void
+__make_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Tp*, _Distance*)
+{
+ if (__last - __first < 2) return;
+ _Distance __len = __last - __first;
+ _Distance __parent = (__len - 2)/2;
+
+ for (;;) {
+ __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)));
+ if (__parent == 0) return;
+ __parent--;
+ }
+}
+
+template <class _RandomAccessIterator>
+void
+make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+ __make_heap(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIterator), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator));
+}
+
+template <class _RandomAccessIterator, class _Compare,
+ class _Tp, class _Distance>
+_STLP_INLINE_LOOP
+void
+__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp, _Tp*, _Distance*)
+{
+ if (__last - __first < 2) return;
+ _Distance __len = __last - __first;
+ _Distance __parent = (__len - 2)/2;
+
+ for (;;) {
+ __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)),
+ __comp);
+ if (__parent == 0) return;
+ __parent--;
+ }
+}
+
+template <class _RandomAccessIterator, class _Compare>
+void
+make_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp)
+{
+ __make_heap(__first, __last, __comp,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIterator), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator));
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_HEAP_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_heap.h b/stlport/stlport/stl/_heap.h
new file mode 100644
index 0000000..016dc49
--- /dev/null
+++ b/stlport/stlport/stl/_heap.h
@@ -0,0 +1,125 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_HEAP_H
+#define _STLP_INTERNAL_HEAP_H
+
+_STLP_BEGIN_NAMESPACE
+
+// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap.
+
+template <class _RandomAccessIterator>
+void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last);
+
+
+template <class _RandomAccessIterator, class _Compare>
+void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp);
+
+template <class _RandomAccessIterator, class _Distance, class _Tp>
+void
+__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __len, _Tp __val);
+
+template <class _RandomAccessIterator, class _Tp, class _Distance>
+inline void
+__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _RandomAccessIterator __result, _Tp __val, _Distance*)
+{
+ *__result = *__first;
+ __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __val);
+}
+
+template <class _RandomAccessIterator>
+void pop_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last);
+
+template <class _RandomAccessIterator, class _Distance,
+ class _Tp, class _Compare>
+void
+__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __len, _Tp __val, _Compare __comp);
+
+template <class _RandomAccessIterator, class _Tp, class _Compare,
+ class _Distance>
+inline void
+__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _RandomAccessIterator __result, _Tp __val, _Compare __comp,
+ _Distance*)
+{
+ *__result = *__first;
+ __adjust_heap(__first, _Distance(0), _Distance(__last - __first),
+ __val, __comp);
+}
+
+template <class _RandomAccessIterator, class _Compare>
+void
+pop_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp);
+
+template <class _RandomAccessIterator>
+void
+make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last);
+
+template <class _RandomAccessIterator, class _Compare>
+void
+make_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp);
+
+template <class _RandomAccessIterator>
+_STLP_INLINE_LOOP
+void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+ while (__last - __first > 1)
+ pop_heap(__first, __last--);
+}
+
+template <class _RandomAccessIterator, class _Compare>
+_STLP_INLINE_LOOP
+void
+sort_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp)
+{
+ while (__last - __first > 1)
+ pop_heap(__first, __last--, __comp);
+}
+
+_STLP_END_NAMESPACE
+
+# if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_heap.c>
+# endif
+
+#endif /* _STLP_INTERNAL_HEAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_iosfwd.h b/stlport/stlport/stl/_iosfwd.h
new file mode 100644
index 0000000..e31db31
--- /dev/null
+++ b/stlport/stlport/stl/_iosfwd.h
@@ -0,0 +1,159 @@
+#ifndef _STLP_INTERNAL_IOSFWD
+#define _STLP_INTERNAL_IOSFWD
+
+#if defined (__sgi) && !defined (__GNUC__) && !defined (_STANDARD_C_PLUS_PLUS)
+# error This header file requires the -LANG:std option
+#endif
+
+// This file provides forward declarations of the most important I/O
+// classes. Note that almost all of those classes are class templates,
+// with default template arguments. According to the C++ standard,
+// if a class template is declared more than once in the same scope
+// then only one of those declarations may have default arguments.
+
+// <iosfwd> contains the same declarations as other headers, and including
+// both <iosfwd> and (say) <iostream> is permitted. This means that only
+// one header may contain those default template arguments.
+
+// In this implementation, the declarations in <iosfwd> contain default
+// template arguments. All of the other I/O headers include <iosfwd>.
+
+#ifndef _STLP_CHAR_TRAITS_H
+# include <stl/char_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class ios_base;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ios;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_streambuf;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_istream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ostream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_iostream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM( _Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_stringbuf;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_istringstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_ostringstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_stringstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_filebuf;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ifstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ofstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_fstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class istreambuf_iterator;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class ostreambuf_iterator;
+
+typedef basic_ios<char, char_traits<char> > ios;
+
+#if !defined (_STLP_NO_WCHAR_T)
+typedef basic_ios<wchar_t, char_traits<wchar_t> > wios;
+#endif
+
+// Forward declaration of class locale, and of the most important facets.
+class locale;
+template <class _Facet>
+#if defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)
+struct _Use_facet {
+ const locale& __loc;
+ _Use_facet(const locale& __p_loc) : __loc(__p_loc) {}
+ inline const _Facet& operator *() const;
+};
+# define use_facet *_Use_facet
+#else
+inline const _Facet& use_facet(const locale&);
+#endif
+
+template <class _CharT> class ctype;
+template <class _CharT> class ctype_byname;
+template <class _CharT> class collate;
+template <class _CharT> class collate_byname;
+
+_STLP_TEMPLATE_NULL class ctype<char>;
+_STLP_TEMPLATE_NULL class ctype_byname<char>;
+_STLP_TEMPLATE_NULL class collate<char>;
+_STLP_TEMPLATE_NULL class collate_byname<char>;
+
+#if !defined (_STLP_NO_WCHAR_T)
+_STLP_TEMPLATE_NULL class ctype<wchar_t>;
+_STLP_TEMPLATE_NULL class ctype_byname<wchar_t>;
+_STLP_TEMPLATE_NULL class collate<wchar_t>;
+_STLP_TEMPLATE_NULL class collate_byname<wchar_t>;
+#endif
+
+#if !(defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500 )
+// Typedefs for ordinary (narrow-character) streams.
+//_STLP_TEMPLATE_NULL class basic_streambuf<char, char_traits<char> >;
+#endif
+
+typedef basic_istream<char, char_traits<char> > istream;
+typedef basic_ostream<char, char_traits<char> > ostream;
+typedef basic_iostream<char, char_traits<char> > iostream;
+typedef basic_streambuf<char,char_traits<char> > streambuf;
+
+typedef basic_stringbuf<char, char_traits<char>, allocator<char> > stringbuf;
+typedef basic_istringstream<char, char_traits<char>, allocator<char> > istringstream;
+typedef basic_ostringstream<char, char_traits<char>, allocator<char> > ostringstream;
+typedef basic_stringstream<char, char_traits<char>, allocator<char> > stringstream;
+
+typedef basic_filebuf<char, char_traits<char> > filebuf;
+typedef basic_ifstream<char, char_traits<char> > ifstream;
+typedef basic_ofstream<char, char_traits<char> > ofstream;
+typedef basic_fstream<char, char_traits<char> > fstream;
+
+#if !defined (_STLP_NO_WCHAR_T)
+// Typedefs for wide-character streams.
+typedef basic_streambuf<wchar_t, char_traits<wchar_t> > wstreambuf;
+typedef basic_istream<wchar_t, char_traits<wchar_t> > wistream;
+typedef basic_ostream<wchar_t, char_traits<wchar_t> > wostream;
+typedef basic_iostream<wchar_t, char_traits<wchar_t> > wiostream;
+
+typedef basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstringbuf;
+typedef basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wistringstream;
+typedef basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wostringstream;
+typedef basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstringstream;
+
+typedef basic_filebuf<wchar_t, char_traits<wchar_t> > wfilebuf;
+typedef basic_ifstream<wchar_t, char_traits<wchar_t> > wifstream;
+typedef basic_ofstream<wchar_t, char_traits<wchar_t> > wofstream;
+typedef basic_fstream<wchar_t, char_traits<wchar_t> > wfstream;
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_limits.c b/stlport/stlport/stl/_limits.c
new file mode 100644
index 0000000..3938024
--- /dev/null
+++ b/stlport/stlport/stl/_limits.c
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) 1998,1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_LIMITS_C
+#define _STLP_LIMITS_C
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+//==========================================================
+// numeric_limits static members
+//==========================================================
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+
+# define __declare_numeric_base_member(__type, __mem) \
+template <class __number> \
+ const __type _Numeric_limits_base<__number>:: __mem
+
+__declare_numeric_base_member(bool, is_specialized);
+__declare_numeric_base_member(int, digits);
+__declare_numeric_base_member(int, digits10);
+__declare_numeric_base_member(bool, is_signed);
+__declare_numeric_base_member(bool, is_integer);
+__declare_numeric_base_member(bool, is_exact);
+__declare_numeric_base_member(int, radix);
+__declare_numeric_base_member(int, min_exponent);
+__declare_numeric_base_member(int, max_exponent);
+__declare_numeric_base_member(int, min_exponent10);
+__declare_numeric_base_member(int, max_exponent10);
+__declare_numeric_base_member(bool, has_infinity);
+__declare_numeric_base_member(bool, has_quiet_NaN);
+__declare_numeric_base_member(bool, has_signaling_NaN);
+__declare_numeric_base_member(float_denorm_style, has_denorm);
+__declare_numeric_base_member(bool, has_denorm_loss);
+__declare_numeric_base_member(bool, is_iec559);
+__declare_numeric_base_member(bool, is_bounded);
+__declare_numeric_base_member(bool, is_modulo);
+__declare_numeric_base_member(bool, traps);
+__declare_numeric_base_member(bool, tinyness_before);
+__declare_numeric_base_member(float_round_style, round_style);
+
+# undef __declare_numeric_base_member
+
+# define __declare_integer_limits_member(__type, __mem) \
+template <class _Int, _STLP_LIMITS_MIN_TYPE __imin, _STLP_LIMITS_MAX_TYPE __imax, int __idigits, bool __ismod> \
+ const __type _Integer_limits<_Int, __imin, __imax, __idigits, __ismod>:: __mem
+
+__declare_integer_limits_member(bool, is_specialized);
+__declare_integer_limits_member(int, digits);
+__declare_integer_limits_member(int, digits10);
+__declare_integer_limits_member(bool, is_signed);
+__declare_integer_limits_member(bool, is_integer);
+__declare_integer_limits_member(bool, is_exact);
+__declare_integer_limits_member(int, radix);
+__declare_integer_limits_member(bool, is_bounded);
+__declare_integer_limits_member(bool, is_modulo);
+# undef __declare_integer_limits_member
+
+# if defined (__GNUC__) && (__GNUC__ != 2 || __GNUC_MINOR__ > 96) && (__GNUC__ != 3 || __GNUC_MINOR__ == 0) && (__GNUC__ <= 3)
+_STLP_MOVE_TO_STD_NAMESPACE
+
+# define __declare_numeric_limits_member(__integer) \
+ _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::digits; \
+ _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::digits10; \
+ _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::radix; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_specialized; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_signed; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_integer; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_exact; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_bounded; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_modulo
+
+__declare_numeric_limits_member(_STLP_LONG_LONG);
+__declare_numeric_limits_member(unsigned _STLP_LONG_LONG);
+
+# undef __declare_numeric_limits_member
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+# endif
+
+# define __declare_float_limits_member(__type, __mem) \
+template <class __number, \
+ int __Digits, int __Digits10, \
+ int __MinExp, int __MaxExp, \
+ int __MinExp10, int __MaxExp10, \
+ bool __IsIEC559, \
+ float_denorm_style __DenormStyle, \
+ float_round_style __RoundStyle> \
+const __type _Floating_limits< __number, __Digits, __Digits10, \
+ __MinExp, __MaxExp, __MinExp10, __MaxExp10, \
+ __IsIEC559, __DenormStyle, __RoundStyle>::\
+ __mem
+
+__declare_float_limits_member(bool, is_specialized);
+__declare_float_limits_member(int, digits);
+__declare_float_limits_member(int, digits10);
+__declare_float_limits_member(bool, is_signed);
+__declare_float_limits_member(int, radix);
+__declare_float_limits_member(int, min_exponent);
+__declare_float_limits_member(int, max_exponent);
+__declare_float_limits_member(int, min_exponent10);
+__declare_float_limits_member(int, max_exponent10);
+__declare_float_limits_member(bool, has_infinity);
+__declare_float_limits_member(bool, has_quiet_NaN);
+__declare_float_limits_member(bool, has_signaling_NaN);
+__declare_float_limits_member(float_denorm_style, has_denorm);
+__declare_float_limits_member(bool, has_denorm_loss);
+__declare_float_limits_member(bool, is_iec559);
+__declare_float_limits_member(bool, is_bounded);
+__declare_float_limits_member(bool, traps);
+__declare_float_limits_member(bool, tinyness_before);
+__declare_float_limits_member(float_round_style, round_style);
+# undef __declare_float_limits_member
+
+#endif
+
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+# if defined (__GNUC__) || defined (__BORLANDC__)
+# define _STLP_ADDITIONAL_OPEN_BRACKET {
+# define _STLP_ADDITIONAL_CLOSE_BRACKET }
+# else
+# define _STLP_ADDITIONAL_OPEN_BRACKET
+# define _STLP_ADDITIONAL_CLOSE_BRACKET
+# endif
+
+/* The following code has been extracted from the boost libraries (www.boost.org) and
+ * adapted with the STLport portability macros. Advantage on previous technique is that
+ * computation of infinity and NaN values is only based on big/little endianess, compiler
+ * float, double or long double representation is taken into account thanks to the sizeof
+ * operator. */
+template<class _Number, unsigned short _Word>
+struct float_helper {
+ union _WordsNumber {
+ unsigned short _Words[8];
+ _Number _num;
+ };
+ static _Number get_word_higher() _STLP_NOTHROW {
+ _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET _Word, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ return __tmp._num;
+ }
+ static _Number get_word_lower() _STLP_NOTHROW {
+ _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET 0, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 1] = _Word;
+ return __tmp._num;
+ }
+ static _Number get_from_last_word() _STLP_NOTHROW {
+# if defined (_STLP_BIG_ENDIAN)
+ return get_word_higher();
+# else /* _STLP_LITTLE_ENDIAN */
+ return get_word_lower();
+# endif
+ }
+ static _Number get_from_first_word() _STLP_NOTHROW {
+# if defined (_STLP_BIG_ENDIAN)
+ return get_word_lower();
+# else /* _STLP_LITTLE_ENDIAN */
+ return get_word_higher();
+# endif
+ }
+};
+
+# if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_BIG_ENDIAN)
+template<class _Number, unsigned short _Word1, unsigned short _Word2>
+struct float_helper2 {
+ union _WordsNumber {
+ unsigned short _Words[8];
+ _Number _num;
+ };
+ //static _Number get_word_higher() _STLP_NOTHROW {
+ // _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET _Word1, _Word2, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ // return __tmp._num;
+ //}
+ static _Number get_word_lower() _STLP_NOTHROW {
+ _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET 0, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 2] = _Word1;
+ __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 1] = _Word2;
+ return __tmp._num;
+ }
+ static _Number get_from_last_word() _STLP_NOTHROW {
+//# if defined (_STLP_BIG_ENDIAN)
+// return get_word_higher();
+//# else /* _STLP_LITTLE_ENDIAN */
+ return get_word_lower();
+//# endif
+ }
+};
+# endif
+
+/* Former values kept in case moving to boost code has introduce a regression on
+ * some platform. */
+#if 0
+# if defined (_STLP_BIG_ENDIAN)
+# if defined (__OS400__)
+# define _STLP_FLOAT_INF_REP { 0x7f80, 0 }
+# define _STLP_FLOAT_QNAN_REP { 0xffc0, 0 }
+# define _STLP_FLOAT_SNAN_REP { 0xff80, 0 }
+# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 }
+# define _STLP_DOUBLE_QNAN_REP { 0xfff8, 0, 0, 0 }
+# define _STLP_DOUBLE_SNAN_REP { 0xfff0, 0, 0, 0 }
+# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0xfff8, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0xfff0, 0, 0, 0, 0, 0, 0, 0 }
+# else /* __OS400__ */
+# define _STLP_FLOAT_INF_REP { 0x7f80, 0 }
+# define _STLP_FLOAT_QNAN_REP { 0x7fc1, 0 }
+# define _STLP_FLOAT_SNAN_REP { 0x7f81, 0 }
+# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 }
+# define _STLP_DOUBLE_QNAN_REP { 0x7ff9, 0, 0, 0 }
+# define _STLP_DOUBLE_SNAN_REP { 0x7ff1, 0, 0, 0 }
+# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0x7ff1, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0x7ff9, 0, 0, 0, 0, 0, 0, 0 }
+# endif /* __OS400__ */
+# else /* _STLP_LITTLE_ENDIAN */
+# if defined(__DECCXX)
+# define _STLP_FLOAT_INF_REP { 0, 0x7f80 }
+# define _STLP_FLOAT_QNAN_REP { 0, 0xffc0 }
+# define _STLP_FLOAT_SNAN_REP { 0x5555, 0x7f85 }
+# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
+# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 }
+# define _STLP_DOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x7ff5 }
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0, 0, 0, 0, 0x7fff }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0, 0, 0, 0x8000, 0xffff }
+# define _STLP_LDOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x7fff}
+# else
+# define _STLP_FLOAT_INF_REP { 0, 0x7f80 }
+# define _STLP_FLOAT_QNAN_REP { 0, 0x7fc0 }
+# define _STLP_FLOAT_SNAN_REP { 0, 0x7fa0 }
+# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
+# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0x7ff8 }
+# define _STLP_DOUBLE_SNAN_REP { 0, 0, 0, 0x7ff4 }
+# if defined (_STLP_MSVC) || defined (__ICL)
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x7FF0, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xFFF8, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xFFF8, 0 }
+# elif defined (__BORLANDC__)
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xc000, 0x7fff }
+# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xa000, 0x7fff }
+# else
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xa000, 0x7fff, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xc000, 0x7fff, 0 }
+# endif
+# endif
+# endif
+
+union _F_rep {
+ unsigned short rep[2];
+ float val;
+};
+union _D_rep {
+ unsigned short rep[4];
+ double val;
+};
+
+# ifndef _STLP_NO_LONG_DOUBLE
+union _LD_rep {
+ unsigned short rep[8];
+ long double val;
+};
+# endif
+#endif
+
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_inf() {
+ typedef float_helper<float, 0x7f80u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+}
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_qNaN() {
+ typedef float_helper<float, 0x7f81u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+}
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_sNaN() {
+ typedef float_helper<float, 0x7fc1u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+}
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_denormMin() {
+ typedef float_helper<float, 0x0001u> _FloatHelper;
+ return _FloatHelper::get_from_first_word();
+}
+
+template <int __use_double_limits>
+class _NumericLimitsAccess;
+
+_STLP_TEMPLATE_NULL
+class _NumericLimitsAccess<1> {
+public:
+ static double get_inf() {
+ typedef float_helper<double, 0x7ff0u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+ }
+ static double get_qNaN() {
+ typedef float_helper<double, 0x7ff1u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+ }
+ static double get_sNaN() {
+ typedef float_helper<double, 0x7ff9u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+ }
+};
+
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_inf()
+{ return _NumericLimitsAccess<1>::get_inf(); }
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_qNaN()
+{ return _NumericLimitsAccess<1>::get_qNaN(); }
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_sNaN()
+{ return _NumericLimitsAccess<1>::get_sNaN(); }
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_denormMin() {
+ typedef float_helper<double, 0x0001u> _FloatHelper;
+ return _FloatHelper::get_from_first_word();
+}
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+class _NumericLimitsAccess<0> {
+public:
+ static long double get_inf() {
+# if defined (_STLP_BIG_ENDIAN)
+ typedef float_helper<long double, 0x7ff0u> _FloatHelper;
+# else
+ typedef float_helper2<long double, 0x8000u, 0x7fffu> _FloatHelper;
+# endif
+ return _FloatHelper::get_from_last_word();
+ }
+ static long double get_qNaN() {
+# if defined (_STLP_BIG_ENDIAN)
+ typedef float_helper<long double, 0x7ff1u> _FloatHelper;
+# else
+ typedef float_helper2<long double, 0xc000u, 0x7fffu> _FloatHelper;
+# endif
+ return _FloatHelper::get_from_last_word();
+ }
+ static long double get_sNaN() {
+# if defined (_STLP_BIG_ENDIAN)
+ typedef float_helper<long double, 0x7ff9u> _FloatHelper;
+# else
+ typedef float_helper2<long double, 0x9000u, 0x7fffu> _FloatHelper;
+# endif
+ return _FloatHelper::get_from_last_word();
+ }
+};
+
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_inf() {
+ const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0;
+ return _NumericLimitsAccess<__use_double_limits>::get_inf();
+}
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_qNaN() {
+ const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0;
+ return _NumericLimitsAccess<__use_double_limits>::get_qNaN();
+}
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_sNaN() {
+ const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0;
+ return _NumericLimitsAccess<__use_double_limits>::get_sNaN();
+}
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_denormMin() {
+ typedef float_helper<long double, 0x0001u> _FloatHelper;
+ return _FloatHelper::get_from_first_word();
+}
+# endif
+
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+
+#undef _STLP_LIMITS_MIN_TYPE
+#undef _STLP_LIMITS_MAX_TYPE
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_LIMITS_C_INCLUDED */
diff --git a/stlport/stlport/stl/_limits.h b/stlport/stlport/stl/_limits.h
new file mode 100644
index 0000000..c0091f6
--- /dev/null
+++ b/stlport/stlport/stl/_limits.h
@@ -0,0 +1,519 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This may be not portable code. Parts of numeric_limits<> are
+ * inherently machine-dependent. At present this file is suitable
+ * for the MIPS, SPARC, Alpha and ia32 architectures.
+ */
+
+#ifndef _STLP_INTERNAL_LIMITS
+#define _STLP_INTERNAL_LIMITS
+
+#ifndef _STLP_CLIMITS
+# include <climits>
+#endif
+
+#ifndef _STLP_CFLOAT
+# include <cfloat>
+#endif
+
+#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR)
+# include <stl/_cwchar.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+enum float_round_style {
+ round_indeterminate = -1,
+ round_toward_zero = 0,
+ round_to_nearest = 1,
+ round_toward_infinity = 2,
+ round_toward_neg_infinity = 3
+};
+
+enum float_denorm_style {
+ denorm_indeterminate = -1,
+ denorm_absent = 0,
+ denorm_present = 1
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Base class for all specializations of numeric_limits.
+template <class __number>
+class _Numeric_limits_base {
+public:
+
+ static __number (_STLP_CALL min)() _STLP_NOTHROW { return __number(); }
+ static __number (_STLP_CALL max)() _STLP_NOTHROW { return __number(); }
+
+ _STLP_STATIC_CONSTANT(int, digits = 0);
+ _STLP_STATIC_CONSTANT(int, digits10 = 0);
+ _STLP_STATIC_CONSTANT(int, radix = 0);
+ _STLP_STATIC_CONSTANT(int, min_exponent = 0);
+ _STLP_STATIC_CONSTANT(int, min_exponent10 = 0);
+ _STLP_STATIC_CONSTANT(int, max_exponent = 0);
+ _STLP_STATIC_CONSTANT(int, max_exponent10 = 0);
+
+ _STLP_STATIC_CONSTANT(float_denorm_style, has_denorm = denorm_absent);
+ _STLP_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
+
+ _STLP_STATIC_CONSTANT(bool, is_specialized = false);
+ _STLP_STATIC_CONSTANT(bool, is_signed = false);
+ _STLP_STATIC_CONSTANT(bool, is_integer = false);
+ _STLP_STATIC_CONSTANT(bool, is_exact = false);
+ _STLP_STATIC_CONSTANT(bool, has_infinity = false);
+ _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = false);
+ _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = false);
+ _STLP_STATIC_CONSTANT(bool, has_denorm_loss = false);
+ _STLP_STATIC_CONSTANT(bool, is_iec559 = false);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = false);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = false);
+ _STLP_STATIC_CONSTANT(bool, traps = false);
+ _STLP_STATIC_CONSTANT(bool, tinyness_before = false);
+
+ static __number _STLP_CALL epsilon() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL round_error() _STLP_NOTHROW { return __number(); }
+
+ static __number _STLP_CALL infinity() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL quiet_NaN() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL signaling_NaN() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL denorm_min() _STLP_NOTHROW { return __number(); }
+};
+
+// Base class for integers.
+
+#ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
+# ifdef _STLP_LONG_LONG
+# define _STLP_LIMITS_MIN_TYPE _STLP_LONG_LONG
+# define _STLP_LIMITS_MAX_TYPE unsigned _STLP_LONG_LONG
+# else
+# define _STLP_LIMITS_MIN_TYPE long
+# define _STLP_LIMITS_MAX_TYPE unsigned long
+# endif
+#else
+# define _STLP_LIMITS_MIN_TYPE _Int
+# define _STLP_LIMITS_MAX_TYPE _Int
+#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
+
+template <class _Int,
+ _STLP_LIMITS_MIN_TYPE __imin,
+ _STLP_LIMITS_MAX_TYPE __imax,
+ int __idigits, bool __ismod>
+class _Integer_limits : public _Numeric_limits_base<_Int> {
+public:
+
+ static _Int (_STLP_CALL min) () _STLP_NOTHROW { return (_Int)__imin; }
+ static _Int (_STLP_CALL max) () _STLP_NOTHROW { return (_Int)__imax; }
+
+ _STLP_STATIC_CONSTANT(int, digits = (__idigits < 0) ? ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1)) : (__idigits));
+ _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000);
+ _STLP_STATIC_CONSTANT(int, radix = 2);
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = (__imin != 0));
+ _STLP_STATIC_CONSTANT(bool, is_integer = true);
+ _STLP_STATIC_CONSTANT(bool, is_exact = true);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = __ismod);
+};
+
+// Base class for floating-point numbers.
+template <class __number,
+ int __Digits, int __Digits10,
+ int __MinExp, int __MaxExp,
+ int __MinExp10, int __MaxExp10,
+ bool __IsIEC559,
+ float_denorm_style __DenormStyle,
+ float_round_style __RoundStyle>
+class _Floating_limits : public _Numeric_limits_base<__number> {
+public:
+
+ _STLP_STATIC_CONSTANT(int, digits = __Digits);
+ _STLP_STATIC_CONSTANT(int, digits10 = __Digits10);
+ _STLP_STATIC_CONSTANT(int, radix = FLT_RADIX);
+ _STLP_STATIC_CONSTANT(int, min_exponent = __MinExp);
+ _STLP_STATIC_CONSTANT(int, max_exponent = __MaxExp);
+ _STLP_STATIC_CONSTANT(int, min_exponent10 = __MinExp10);
+ _STLP_STATIC_CONSTANT(int, max_exponent10 = __MaxExp10);
+
+ _STLP_STATIC_CONSTANT(float_denorm_style, has_denorm = __DenormStyle);
+ _STLP_STATIC_CONSTANT(float_round_style, round_style = __RoundStyle);
+
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = true);
+
+ _STLP_STATIC_CONSTANT(bool, has_infinity = true);
+#if (!defined (_STLP_MSVC) || (_STLP_MSVC > 1300)) && \
+ (!defined (__BORLANDC__) || (__BORLANDC__ >= 0x590)) && \
+ (!defined (_CRAY) || defined (_CRAYIEEE))
+ _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = true);
+ _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = true);
+#else
+ _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = false);
+ _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = false);
+#endif
+
+ _STLP_STATIC_CONSTANT(bool, is_iec559 = __IsIEC559 && has_infinity && has_quiet_NaN && has_signaling_NaN && (has_denorm == denorm_present));
+ _STLP_STATIC_CONSTANT(bool, has_denorm_loss = false);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, traps = true);
+ _STLP_STATIC_CONSTANT(bool, tinyness_before = false);
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Class numeric_limits
+
+// The unspecialized class.
+
+template<class _Tp>
+class numeric_limits : public _STLP_PRIV _Numeric_limits_base<_Tp> {};
+
+// Specializations for all built-in integral types.
+
+#if !defined (_STLP_NO_BOOL)
+_STLP_TEMPLATE_NULL
+class numeric_limits<bool>
+ : public _STLP_PRIV _Integer_limits<bool, false, true, 1, false>
+{};
+#endif /* _STLP_NO_BOOL */
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<char>
+ : public _STLP_PRIV _Integer_limits<char, CHAR_MIN, CHAR_MAX, -1, true>
+{};
+
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+_STLP_TEMPLATE_NULL
+class numeric_limits<signed char>
+ : public _STLP_PRIV _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX, -1, true>
+{};
+#endif
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned char>
+ : public _STLP_PRIV _Integer_limits<unsigned char, 0, UCHAR_MAX, -1, true>
+{};
+
+#if !(defined (_STLP_NO_WCHAR_T) || defined (_STLP_WCHAR_T_IS_USHORT))
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<wchar_t>
+ : public _STLP_PRIV _Integer_limits<wchar_t, WCHAR_MIN, WCHAR_MAX, -1, true>
+{};
+
+#endif
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<short>
+ : public _STLP_PRIV _Integer_limits<short, SHRT_MIN, SHRT_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned short>
+ : public _STLP_PRIV _Integer_limits<unsigned short, 0, USHRT_MAX, -1, true>
+{};
+
+#if defined (__xlC__) && (__xlC__ == 0x500)
+# undef INT_MIN
+# define INT_MIN -2147483648
+#endif
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<int>
+ : public _STLP_PRIV _Integer_limits<int, INT_MIN, INT_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned int>
+ : public _STLP_PRIV _Integer_limits<unsigned int, 0, UINT_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<long>
+ : public _STLP_PRIV _Integer_limits<long, LONG_MIN, LONG_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned long>
+ : public _STLP_PRIV _Integer_limits<unsigned long, 0, ULONG_MAX, -1, true>
+{};
+
+#if defined (_STLP_LONG_LONG)
+
+# if defined (_STLP_MSVC) || defined (__BORLANDC__)
+# define LONGLONG_MAX 0x7fffffffffffffffi64
+# define LONGLONG_MIN (-LONGLONG_MAX-1i64)
+# define ULONGLONG_MAX 0xffffffffffffffffUi64
+# else
+# ifndef LONGLONG_MAX
+# define LONGLONG_MAX 0x7fffffffffffffffLL
+# endif
+# ifndef LONGLONG_MIN
+# define LONGLONG_MIN (-LONGLONG_MAX-1LL)
+# endif
+# ifndef ULONGLONG_MAX
+# define ULONGLONG_MAX 0xffffffffffffffffULL
+# endif
+# endif
+
+# if !defined (__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ <= 96) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 3)
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<_STLP_LONG_LONG>
+ : public _STLP_PRIV _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned _STLP_LONG_LONG>
+ : public _STLP_PRIV _Integer_limits<unsigned _STLP_LONG_LONG, 0, ULONGLONG_MAX, -1, true>
+{};
+# else /* gcc 2.97 (after 2000-11-01), 2.98, 3.0 */
+/*
+ newest gcc has new mangling scheme, that has problem
+ with generating name [instantiated] of template specialization like
+ _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true>
+ ~~~~~~~~~~~~ ~~~~~~~~~~~~
+ Below is code that solve this problem.
+ - ptr
+ */
+_STLP_TEMPLATE_NULL
+class numeric_limits<_STLP_LONG_LONG>
+ : public _STLP_PRIV _Numeric_limits_base<_STLP_LONG_LONG> {
+public:
+
+ static _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return LONGLONG_MIN; }
+ static _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return LONGLONG_MAX; }
+
+ _STLP_STATIC_CONSTANT(int, digits = ((int)((sizeof(_STLP_LONG_LONG) * (CHAR_BIT))) - 1));
+ _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000);
+ _STLP_STATIC_CONSTANT(int, radix = 2);
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = true);
+ _STLP_STATIC_CONSTANT(bool, is_integer = true);
+ _STLP_STATIC_CONSTANT(bool, is_exact = true);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = true);
+};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned _STLP_LONG_LONG>
+ : public _STLP_PRIV _Numeric_limits_base<unsigned _STLP_LONG_LONG> {
+public:
+
+ static unsigned _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return 0ULL; }
+ static unsigned _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return ULONGLONG_MAX; }
+
+ _STLP_STATIC_CONSTANT(int, digits = ((int)((sizeof(unsigned _STLP_LONG_LONG) * (CHAR_BIT)))));
+ _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000);
+ _STLP_STATIC_CONSTANT(int, radix = 2);
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = false);
+ _STLP_STATIC_CONSTANT(bool, is_integer = true);
+ _STLP_STATIC_CONSTANT(bool, is_exact = true);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = true);
+};
+
+# endif /* __GNUC__ > 2000-11-01 */
+
+#endif /* _STLP_LONG_LONG */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Specializations for all built-in floating-point types.
+template <class __dummy>
+class _LimG {
+public:
+ static float _STLP_CALL get_F_inf();
+ static float _STLP_CALL get_F_qNaN();
+ static float _STLP_CALL get_F_sNaN();
+ static float _STLP_CALL get_F_denormMin();
+ static double _STLP_CALL get_D_inf();
+ static double _STLP_CALL get_D_qNaN();
+ static double _STLP_CALL get_D_sNaN();
+ static double _STLP_CALL get_D_denormMin();
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ static long double _STLP_CALL get_LD_inf();
+ static long double _STLP_CALL get_LD_qNaN();
+ static long double _STLP_CALL get_LD_sNaN();
+ static long double _STLP_CALL get_LD_denormMin();
+#endif
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _LimG<bool>;
+#endif
+
+#if defined (__GNUC__)
+# if defined (__FLT_DENORM_MIN__)
+# define _STLP_FLT_DENORM_MIN __FLT_DENORM_MIN__
+# else
+# define _STLP_FLT_DENORM_STYLE denorm_absent
+# endif
+# if defined (__DBL_DENORM_MIN__)
+# define _STLP_DBL_DENORM_MIN __DBL_DENORM_MIN__
+# else
+# define _STLP_DBL_DENORM_STYLE denorm_absent
+# endif
+# if defined (__LDBL_DENORM_MIN__)
+# define _STLP_LDBL_DENORM_MIN __LDBL_DENORM_MIN__
+# else
+# define _STLP_LDBL_DENORM_STYLE denorm_absent
+# endif
+#endif
+
+/* If compiler do not expose thanks to some macro its status regarding
+ * denormalized floating point numbers, we consider that denormalization
+ * is present. Unit tests will tell us if compiler do not support them. */
+#if !defined (_STLP_FLT_DENORM_STYLE)
+# define _STLP_FLT_DENORM_STYLE denorm_present
+#endif
+
+#if !defined (_STLP_DBL_DENORM_STYLE)
+# define _STLP_DBL_DENORM_STYLE denorm_present
+#endif
+
+#if !defined (_STLP_LDBL_DENORM_STYLE)
+# define _STLP_LDBL_DENORM_STYLE denorm_present
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<float>
+ : public _STLP_PRIV _Floating_limits<float,
+ FLT_MANT_DIG, // Binary digits of precision
+ FLT_DIG, // Decimal digits of precision
+ FLT_MIN_EXP, // Minimum exponent
+ FLT_MAX_EXP, // Maximum exponent
+ FLT_MIN_10_EXP, // Minimum base 10 exponent
+ FLT_MAX_10_EXP, // Maximum base 10 exponent
+ true,
+ _STLP_FLT_DENORM_STYLE,
+ round_to_nearest> {
+public:
+ static float (_STLP_CALL min) () _STLP_NOTHROW { return FLT_MIN; }
+ static float _STLP_CALL denorm_min() _STLP_NOTHROW
+#if defined (_STLP_FLT_DENORM_MIN)
+ { return _STLP_FLT_DENORM_MIN; }
+#else
+ { return _STLP_FLT_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_F_denormMin() : FLT_MIN; }
+#endif
+ static float (_STLP_CALL max) () _STLP_NOTHROW { return FLT_MAX; }
+ static float _STLP_CALL epsilon() _STLP_NOTHROW { return FLT_EPSILON; }
+ static float _STLP_CALL round_error() _STLP_NOTHROW { return 0.5f; } // Units: ulps.
+ static float _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_inf(); }
+ static float _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_qNaN(); }
+ static float _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_sNaN(); }
+};
+
+#undef _STLP_FLT_DENORM_MIN
+#undef _STLP_FLT_DNORM_STYLE
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<double>
+ : public _STLP_PRIV _Floating_limits<double,
+ DBL_MANT_DIG, // Binary digits of precision
+ DBL_DIG, // Decimal digits of precision
+ DBL_MIN_EXP, // Minimum exponent
+ DBL_MAX_EXP, // Maximum exponent
+ DBL_MIN_10_EXP, // Minimum base 10 exponent
+ DBL_MAX_10_EXP, // Maximum base 10 exponent
+ true,
+ _STLP_DBL_DENORM_STYLE,
+ round_to_nearest> {
+public:
+ static double (_STLP_CALL min)() _STLP_NOTHROW { return DBL_MIN; }
+ static double _STLP_CALL denorm_min() _STLP_NOTHROW
+#if defined (_STLP_DBL_DENORM_MIN)
+ { return _STLP_DBL_DENORM_MIN; }
+#else
+ { return _STLP_DBL_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_D_denormMin() : DBL_MIN; }
+#endif
+ static double (_STLP_CALL max)() _STLP_NOTHROW { return DBL_MAX; }
+ static double _STLP_CALL epsilon() _STLP_NOTHROW { return DBL_EPSILON; }
+ static double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5; } // Units: ulps.
+ static double _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_inf(); }
+ static double _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_qNaN(); }
+ static double _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_sNaN(); }
+};
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<long double>
+ : public _STLP_PRIV _Floating_limits<long double,
+ LDBL_MANT_DIG, // Binary digits of precision
+ LDBL_DIG, // Decimal digits of precision
+ LDBL_MIN_EXP, // Minimum exponent
+ LDBL_MAX_EXP, // Maximum exponent
+ LDBL_MIN_10_EXP,// Minimum base 10 exponent
+ LDBL_MAX_10_EXP,// Maximum base 10 exponent
+ false, // do not conform to iec559
+ _STLP_LDBL_DENORM_STYLE,
+ round_to_nearest> {
+public:
+ static long double (_STLP_CALL min) () _STLP_NOTHROW { return LDBL_MIN; }
+ static long double _STLP_CALL denorm_min() _STLP_NOTHROW
+#if defined (_STLP_LDBL_DENORM_MIN)
+ { return _STLP_LDBL_DENORM_MIN; }
+#else
+ { return _STLP_LDBL_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_LD_denormMin() : LDBL_MIN; }
+#endif
+ _STLP_STATIC_CONSTANT(bool, is_iec559 = false);
+ static long double (_STLP_CALL max) () _STLP_NOTHROW { return LDBL_MAX; }
+ static long double _STLP_CALL epsilon() _STLP_NOTHROW { return LDBL_EPSILON; }
+ static long double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5l; }
+ static long double _STLP_CALL infinity() _STLP_NOTHROW
+ //For MSVC, long double is nothing more than an alias for double.
+#if !defined (_STLP_MSVC)
+ { return _STLP_PRIV _LimG<bool>::get_LD_inf(); }
+#else
+ { return _STLP_PRIV _LimG<bool>::get_D_inf(); }
+#endif
+ static long double _STLP_CALL quiet_NaN() _STLP_NOTHROW
+#if !defined (_STLP_MSVC)
+ { return _STLP_PRIV _LimG<bool>::get_LD_qNaN(); }
+#else
+ { return _STLP_PRIV _LimG<bool>::get_D_qNaN(); }
+#endif
+ static long double _STLP_CALL signaling_NaN() _STLP_NOTHROW
+#if !defined (_STLP_MSVC)
+ { return _STLP_PRIV _LimG<bool>::get_LD_sNaN(); }
+#else
+ { return _STLP_PRIV _LimG<bool>::get_D_sNaN(); }
+#endif
+};
+
+#endif
+
+// We write special values (Inf and NaN) as bit patterns and
+// cast the the appropriate floating-point types.
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_limits.c>
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_mbstate_t.h b/stlport/stlport/stl/_mbstate_t.h
new file mode 100644
index 0000000..e6a3e75
--- /dev/null
+++ b/stlport/stlport/stl/_mbstate_t.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_MBSTATE_T
+#define _STLP_INTERNAL_MBSTATE_T
+
+#if (defined (__OpenBSD__) || defined (__FreeBSD__) || defined (__hpux)) && defined (__GNUC__) && !defined (_GLIBCPP_HAVE_MBSTATE_T)
+# define _STLP_CPP_MBSTATE_T /* mbstate_t defined in native <cwchar>, so not defined in C! */
+#endif
+
+#if defined (_STLP_NO_NATIVE_MBSTATE_T) || defined (_STLP_CPP_MBSTATE_T) && !defined (_MBSTATE_T)
+# define _STLP_USE_OWN_MBSTATE_T
+# define _MBSTATE_T
+#endif
+
+#if defined (_STLP_USE_OWN_MBSTATE_T)
+# if !defined (_STLP_CPP_MBSTATE_T) || !defined (__cplusplus) || !defined (_STLP_USE_NEW_C_HEADERS)
+typedef int mbstate_t;
+# endif
+
+# if !defined (_STLP_CPP_MBSTATE_T) && defined (__cplusplus) && defined (_STLP_USE_NAMESPACES)
+_STLP_BEGIN_NAMESPACE
+using ::mbstate_t;
+_STLP_END_NAMESPACE
+# endif
+
+#endif /* _STLP_USE_OWN_MBSTATE_T */
+
+#endif /* _STLP_INTERNAL_MBSTATE_T */
diff --git a/stlport/stlport/stl/_queue.h b/stlport/stlport/stl/_queue.h
new file mode 100644
index 0000000..5f3763c
--- /dev/null
+++ b/stlport/stlport/stl/_queue.h
@@ -0,0 +1,268 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_QUEUE_H
+#define _STLP_INTERNAL_QUEUE_H
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+#endif
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+#endif
+
+#ifndef _STLP_INTERNAL_HEAP_H
+# include <stl/_heap.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+# if ! defined ( _STLP_LIMITED_DEFAULT_TEMPLATES )
+template <class _Tp, class _Sequence = deque<_Tp> >
+# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
+# define _STLP_QUEUE_ARGS _Tp
+template <class _Tp>
+# else
+template <class _Tp, class _Sequence>
+# endif
+class queue
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+# if defined (_STLP_QUEUE_ARGS)
+ : public __stlport_class<queue<_Tp> >
+# else
+ : public __stlport_class<queue<_Tp, _Sequence> >
+# endif
+#endif
+{
+# if defined ( _STLP_QUEUE_ARGS )
+ typedef deque<_Tp> _Sequence;
+ typedef queue<_Tp> _Self;
+# else
+ typedef queue<_Tp, _Sequence> _Self;
+# endif
+public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+
+protected:
+ //c is a Standard name (23.2.3.1), do no make it STLport naming convention compliant.
+ _Sequence c;
+public:
+ queue() : c() {}
+ explicit queue(const _Sequence& __c) : c(__c) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ queue(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)) {}
+#endif
+
+ bool empty() const { return c.empty(); }
+ size_type size() const { return c.size(); }
+ reference front() { return c.front(); }
+ const_reference front() const { return c.front(); }
+ reference back() { return c.back(); }
+ const_reference back() const { return c.back(); }
+ void push(const value_type& __x) { c.push_back(__x); }
+ void pop() { c.pop_front(); }
+ const _Sequence& _Get_s() const { return c; }
+
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) {
+ _Sequence __tmp = c;
+ c = __x.c;
+ __x.c = __tmp;
+ }
+#endif
+};
+
+#ifndef _STLP_QUEUE_ARGS
+# define _STLP_QUEUE_ARGS _Tp, _Sequence
+# define _STLP_QUEUE_HEADER_ARGS class _Tp, class _Sequence
+#else
+# define _STLP_QUEUE_HEADER_ARGS class _Tp
+#endif
+
+template < _STLP_QUEUE_HEADER_ARGS >
+inline bool _STLP_CALL
+operator==(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) {
+ return __x._Get_s() == __y._Get_s();
+}
+
+template < _STLP_QUEUE_HEADER_ARGS >
+inline bool _STLP_CALL
+operator<(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) {
+ return __x._Get_s() < __y._Get_s();
+}
+
+_STLP_RELOPS_OPERATORS( template < _STLP_QUEUE_HEADER_ARGS >, queue<_STLP_QUEUE_ARGS > )
+
+# if !(defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) || defined ( _STLP_TEMPLATE_PARAM_SUBTYPE_BUG ))
+template <class _Tp, class _Sequence = vector<_Tp>,
+ class _Compare = less<_STLP_HEADER_TYPENAME _Sequence::value_type> >
+# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
+template <class _Tp>
+# else
+template <class _Tp, class _Sequence, class _Compare>
+# endif
+class priority_queue
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
+ : public __stlport_class<priority_queue<_Tp> >
+# else
+ : public __stlport_class<priority_queue<_Tp, _Sequence> >
+# endif
+#endif
+{
+# ifdef _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS
+ typedef vector<_Tp> _Sequence;
+ typedef less< typename vector<_Tp>::value_type> _Compare;
+ typedef priority_queue<_Tp> _Self;
+# else
+ typedef priority_queue<_Tp, _Sequence, _Compare> _Self;
+# endif
+public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+protected:
+ //c is a Standard name (23.2.3.2), do no make it STLport naming convention compliant.
+ _Sequence c;
+ _Compare comp;
+public:
+ priority_queue() : c() {}
+ explicit priority_queue(const _Compare& __x) : c(), comp(__x) {}
+ priority_queue(const _Compare& __x, const _Sequence& __s)
+ : c(__s), comp(__x)
+ { make_heap(c.begin(), c.end(), comp); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ priority_queue(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)),
+ comp(_STLP_PRIV _AsMoveSource(src.get().comp)) {}
+#endif
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ priority_queue(_InputIterator __first, _InputIterator __last)
+ : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
+
+ template <class _InputIterator>
+ priority_queue(_InputIterator __first,
+ _InputIterator __last, const _Compare& __x)
+ : c(__first, __last), comp(__x)
+ { make_heap(c.begin(), c.end(), comp); }
+
+ template <class _InputIterator>
+ priority_queue(_InputIterator __first, _InputIterator __last,
+ const _Compare& __x, const _Sequence& __s)
+ : c(__s), comp(__x)
+ {
+ c.insert(c.end(), __first, __last);
+ make_heap(c.begin(), c.end(), comp);
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ priority_queue(const value_type* __first, const value_type* __last)
+ : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
+
+ priority_queue(const value_type* __first, const value_type* __last,
+ const _Compare& __x)
+ : c(__first, __last), comp(__x)
+ { make_heap(c.begin(), c.end(), comp); }
+
+ priority_queue(const value_type* __first, const value_type* __last,
+ const _Compare& __x, const _Sequence& __c)
+ : c(__c), comp(__x)
+ {
+ c.insert(c.end(), __first, __last);
+ make_heap(c.begin(), c.end(), comp);
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ bool empty() const { return c.empty(); }
+ size_type size() const { return c.size(); }
+ const_reference top() const { return c.front(); }
+ void push(const value_type& __x) {
+ _STLP_TRY {
+ c.push_back(__x);
+ push_heap(c.begin(), c.end(), comp);
+ }
+ _STLP_UNWIND(c.clear())
+ }
+ void pop() {
+ _STLP_TRY {
+ pop_heap(c.begin(), c.end(), comp);
+ c.pop_back();
+ }
+ _STLP_UNWIND(c.clear())
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) {
+ _Sequence __tmp = c;
+ c = __x.c;
+ __x.c = __tmp;
+ }
+#endif
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Sequence>
+struct __move_traits<queue<_Tp, _Sequence> > :
+ _STLP_PRIV __move_traits_aux<_Sequence>
+{};
+
+template <class _Tp, class _Sequence, class _Compare>
+struct __move_traits<priority_queue<_Tp, _Sequence, _Compare> > :
+ _STLP_PRIV __move_traits_aux2<_Sequence, _Compare>
+{};
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_QUEUE_ARGS
+#undef _STLP_QUEUE_HEADER_ARGS
+#undef comp
+
+#endif /* _STLP_INTERNAL_QUEUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_raw_storage_iter.h b/stlport/stlport/stl/_raw_storage_iter.h
new file mode 100644
index 0000000..6e4bc2e
--- /dev/null
+++ b/stlport/stlport/stl/_raw_storage_iter.h
@@ -0,0 +1,80 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H
+#define _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _ForwardIterator, class _Tp>
+class raw_storage_iterator
+ : public iterator<output_iterator_tag,void,void,void,void>
+{
+protected:
+ _ForwardIterator _M_iter;
+public:
+ typedef output_iterator_tag iterator_category;
+# ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+# endif
+ explicit raw_storage_iterator(_ForwardIterator __x) : _M_iter(__x) {}
+ raw_storage_iterator<_ForwardIterator, _Tp>& operator*() { return *this; }
+ raw_storage_iterator<_ForwardIterator, _Tp>& operator=(const _Tp& __element) {
+ _Param_Construct(&*_M_iter, __element);
+ return *this;
+ }
+ raw_storage_iterator<_ForwardIterator, _Tp>& operator++() {
+ ++_M_iter;
+ return *this;
+ }
+ raw_storage_iterator<_ForwardIterator, _Tp> operator++(int) {
+ raw_storage_iterator<_ForwardIterator, _Tp> __tmp = *this;
+ ++_M_iter;
+ return __tmp;
+ }
+};
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _ForwardIterator, class _Tp>
+inline output_iterator_tag iterator_category(const raw_storage_iterator<_ForwardIterator, _Tp>&) { return output_iterator_tag(); }
+#endif
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_relops_hash_cont.h b/stlport/stlport/stl/_relops_hash_cont.h
new file mode 100644
index 0000000..421c805
--- /dev/null
+++ b/stlport/stlport/stl/_relops_hash_cont.h
@@ -0,0 +1,13 @@
+/* This is an implementation file which is intended to be included
+ * multiple times with different _STLP_TEMPLATE_CONTAINER settings.
+ */
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+
+_STLP_TEMPLATE_HEADER
+inline void _STLP_CALL
+swap(_STLP_TEMPLATE_CONTAINER& __hm1, _STLP_TEMPLATE_CONTAINER& __hm2) {
+ __hm1.swap(__hm2);
+}
+
+#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
diff --git a/stlport/stlport/stl/_slist.c b/stlport/stlport/stl/_slist.c
new file mode 100644
index 0000000..ba158d0
--- /dev/null
+++ b/stlport/stlport/stl/_slist.c
@@ -0,0 +1,231 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_SLIST_C
+#define _STLP_SLIST_C
+
+#ifndef _STLP_INTERNAL_SLIST_H
+# include <stl/_slist.h>
+#endif
+
+#ifndef _STLP_CARRAY_H
+# include <stl/_carray.h>
+#endif
+
+#ifndef _STLP_RANGE_ERRORS_H
+# include <stl/_range_errors.h>
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define size_type size_t
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Alloc>
+_Slist_node_base*
+_Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first,
+ _Slist_node_base* __last_node) {
+ _Slist_node_base* __cur = __before_first->_M_next;
+ while (__cur != __last_node) {
+ _Node* __tmp = __STATIC_CAST(_Node*, __cur);
+ __cur = __cur->_M_next;
+ _STLP_STD::_Destroy(&__tmp->_M_data);
+ _M_head.deallocate(__tmp,1);
+ }
+ __before_first->_M_next = __last_node;
+ return __last_node;
+}
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define slist _STLP_PTR_IMPL_NAME(slist)
+#elif defined (_STLP_DEBUG)
+# define slist _STLP_NON_DBG_NAME(slist)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+/* When building STLport lib Digital Mars Compiler complains on the _M_data assignment
+ * problem which would be perfertly right if we were using it. Hiding it during build
+ * fix this issue.
+ */
+template <class _Tp, class _Alloc>
+slist<_Tp,_Alloc>& slist<_Tp,_Alloc>::operator=(const slist<_Tp,_Alloc>& __x) {
+ if (&__x != this) {
+ _Node_base* __p1 = &this->_M_head._M_data;
+ _Node_base* __n1 = this->_M_head._M_data._M_next;
+ const _Node_base* __n2 = __x._M_head._M_data._M_next;
+ while (__n1 && __n2) {
+ __STATIC_CAST(_Node*, __n1)->_M_data = __STATIC_CAST(const _Node*, __n2)->_M_data;
+ __p1 = __n1;
+ __n1 = __n1->_M_next;
+ __n2 = __n2->_M_next;
+ }
+ if (__n2 == 0)
+ this->_M_erase_after(__p1, 0);
+ else
+ _M_insert_after_range(__p1, const_iterator(__CONST_CAST(_Node_base*, __n2)),
+ const_iterator(0));
+ }
+ return *this;
+}
+
+template <class _Tp, class _Alloc>
+void slist<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) {
+ _Node_base* __prev = &this->_M_head._M_data;
+ _Node_base* __node = this->_M_head._M_data._M_next;
+ for ( ; __node != 0 && __n > 0 ; --__n) {
+ __STATIC_CAST(_Node*, __node)->_M_data = __val;
+ __prev = __node;
+ __node = __node->_M_next;
+ }
+ if (__n > 0)
+ _M_insert_after_fill(__prev, __n, __val);
+ else
+ this->_M_erase_after(__prev, 0);
+}
+
+template <class _Tp, class _Alloc>
+void slist<_Tp,_Alloc>::resize(size_type __len, const _Tp& __x) {
+ _Node_base* __cur = &this->_M_head._M_data;
+ while (__cur->_M_next != 0 && __len > 0) {
+ --__len;
+ __cur = __cur->_M_next;
+ }
+ if (__cur->_M_next)
+ this->_M_erase_after(__cur, 0);
+ else
+ _M_insert_after_fill(__cur, __len, __x);
+}
+
+template <class _Tp, class _Alloc>
+void slist<_Tp,_Alloc>::remove(const _Tp& __val) {
+ _Node_base* __cur = &this->_M_head._M_data;
+ while (__cur && __cur->_M_next) {
+ if (__STATIC_CAST(_Node*, __cur->_M_next)->_M_data == __val)
+ this->_M_erase_after(__cur);
+ else
+ __cur = __cur->_M_next;
+ }
+}
+
+#if !defined (slist)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc, class _BinaryPredicate>
+void _Slist_unique(slist<_Tp, _Alloc>& __that, _BinaryPredicate __pred) {
+ typedef _Slist_node<_Tp> _Node;
+ typename slist<_Tp, _Alloc>::iterator __ite(__that.begin());
+ if (__ite != __that.end()) {
+ while (__ite._M_node->_M_next) {
+ if (__pred(*__ite, __STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data))
+ __that.erase_after(__ite);
+ else
+ ++__ite;
+ }
+ }
+}
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _Slist_merge(slist<_Tp, _Alloc>& __that, slist<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp) {
+ typedef _Slist_node<_Tp> _Node;
+ typedef _STLP_PRIV _Slist_node_base _Node_base;
+ if (__that.get_allocator() == __x.get_allocator()) {
+ typename slist<_Tp, _Alloc>::iterator __ite(__that.before_begin());
+ while (__ite._M_node->_M_next && !__x.empty()) {
+ if (__comp(__x.front(), __STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data, __x.front()),
+ _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __that.splice_after(__ite, __x, __x.before_begin());
+ }
+ ++__ite;
+ }
+ if (!__x.empty()) {
+ __that.splice_after(__ite, __x);
+ }
+ }
+ else {
+ typename slist<_Tp, _Alloc>::iterator __i1(__that.before_begin()), __i2(__x.begin());
+ while (__i1._M_node->_M_next && __i2._M_node) {
+ if (__comp(__STATIC_CAST(_Node*, __i1._M_node->_M_next)->_M_data, *__i2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__i2, __STATIC_CAST(_Node*, __i1._M_node->_M_next)->_M_data),
+ _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ ++__i1;
+ }
+ else {
+ __i1 = __that.insert_after(__i1, *(__i2++));
+ }
+ }
+ __that.insert_after(__i1, __i2, __x.end());
+ __x.clear();
+ }
+}
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _Slist_sort(slist<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp) {
+ if (!__that.begin()._M_node || !__that.begin()._M_node->_M_next)
+ return;
+
+ slist<_Tp, _Alloc> __carry(__that.get_allocator());
+ const int NB = 64;
+ _STLP_PRIV _CArray<slist<_Tp, _Alloc>, NB> __counter(__carry);
+ int __fill = 0;
+ while (!__that.empty()) {
+ __carry.splice_after(__carry.before_begin(), __that, __that.before_begin());
+ int __i = 0;
+ while (__i < __fill && !__counter[__i].empty()) {
+ _STLP_PRIV _Slist_merge(__counter[__i], __carry, __comp);
+ __carry.swap(__counter[__i]);
+ ++__i;
+ }
+ __carry.swap(__counter[__i]);
+ if (__i == __fill) {
+ ++__fill;
+ if (__fill >= NB) {
+ //Looks like the slist has too many elements to be sorted with this algorithm:
+ __stl_throw_overflow_error("slist::sort");
+ }
+ }
+ }
+
+ for (int __i = 1; __i < __fill; ++__i)
+ _STLP_PRIV _Slist_merge(__counter[__i], __counter[__i - 1], __comp);
+ __that.swap(__counter[__fill-1]);
+}
+
+#if defined (slist)
+# undef slist
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# undef size_type
+#endif
+
+#endif /* _STLP_SLIST_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_slist.h b/stlport/stlport/stl/_slist.h
new file mode 100644
index 0000000..924daa4
--- /dev/null
+++ b/stlport/stlport/stl/_slist.h
@@ -0,0 +1,914 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_SLIST_H
+#define _STLP_INTERNAL_SLIST_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_SLIST_BASE_H
+# include <stl/_slist_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+class _Slist_node : public _Slist_node_base {
+public:
+ _Tp _M_data;
+ __TRIVIAL_STUFF(_Slist_node)
+};
+
+struct _Slist_iterator_base {
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef forward_iterator_tag iterator_category;
+
+ _Slist_node_base *_M_node;
+
+ _Slist_iterator_base(_Slist_node_base *__x) : _M_node(__x) {}
+
+ void _M_incr() {
+ _M_node = _M_node->_M_next;
+ }
+};
+
+template <class _Tp, class _Traits>
+class _Slist_iterator : public _Slist_iterator_base {
+public:
+ typedef typename _Traits::value_type value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef typename _Traits::reference reference;
+ typedef forward_iterator_tag iterator_category;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef _Slist_iterator<_Tp, _Traits> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _Slist_iterator<_Tp, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Slist_iterator<_Tp, _ConstTraits> const_iterator;
+
+ typedef _Slist_node<value_type> _Node;
+
+ explicit _Slist_iterator(_Slist_node_base *__x) : _Slist_iterator_base(__x) {}
+ _Slist_iterator() : _Slist_iterator_base(0) {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Slist_iterator(const iterator& __x) : _Slist_iterator_base(__x._M_node) {}
+
+ reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ _M_incr();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ _M_incr();
+ return __tmp;
+ }
+
+ bool operator==(const_iterator __y ) const {
+ return this->_M_node == __y._M_node;
+ }
+ bool operator!=(const_iterator __y ) const {
+ return this->_M_node != __y._M_node;
+ }
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+struct __type_traits<_STLP_PRIV _Slist_iterator<_Tp, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+inline _Tp* _STLP_CALL value_type(const _STLP_PRIV _Slist_iterator<_Tp, _Traits>&) { return __STATIC_CAST(_Tp*, 0); }
+inline ptrdiff_t* _STLP_CALL distance_type(const _STLP_PRIV _Slist_iterator_base&) { return 0; }
+inline forward_iterator_tag _STLP_CALL iterator_category(const _STLP_PRIV _Slist_iterator_base&) { return forward_iterator_tag(); }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* OLD_QUERIES */
+
+// Base class that encapsulates details of allocators and simplifies EH
+template <class _Tp, class _Alloc>
+class _Slist_base {
+protected:
+ typedef _Slist_node<_Tp> _Node;
+ typedef typename _Alloc_traits<_Node,_Alloc>::allocator_type _M_node_allocator_type;
+ typedef _Slist_base<_Tp, _Alloc> _Self;
+
+public:
+ typedef _STLP_alloc_proxy<_Slist_node_base, _Node, _M_node_allocator_type> _AllocProxy;
+
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _Alloc allocator_type;
+
+ _Slist_base(const allocator_type& __a) :
+ _M_head(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Slist_node_base() )
+ { _M_head._M_data._M_next = 0; }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Slist_base(__move_source<_Self> src) :
+ _M_head(__move_source<_AllocProxy>(src.get()._M_head))
+ { src.get()._M_head._M_data._M_next = 0; }
+#endif
+
+ ~_Slist_base() { _M_erase_after(&_M_head._M_data, 0); }
+
+protected:
+ _Slist_node_base* _M_erase_after(_Slist_node_base* __pos) {
+ _Node* __next = __STATIC_CAST(_Node*, __pos->_M_next);
+ _Slist_node_base* __next_next = __next->_M_next;
+ __pos->_M_next = __next_next;
+ _STLP_STD::_Destroy(&__next->_M_data);
+ _M_head.deallocate(__next,1);
+ return __next_next;
+ }
+ _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
+
+public:
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const _M_node_allocator_type&)_M_head, _Tp); }
+ _AllocProxy _M_head;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define slist _STLP_PTR_IMPL_NAME(slist)
+#elif defined (_STLP_DEBUG)
+# define slist _STLP_NON_DBG_NAME(slist)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class slist;
+
+#if !defined (slist)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// helper functions to reduce code duplication
+template <class _Tp, class _Alloc, class _BinaryPredicate>
+void _Slist_unique(slist<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _Slist_merge(slist<_Tp, _Alloc>& __that, slist<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _Slist_sort(slist<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp);
+
+#if !defined (slist)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc>
+class slist : protected _STLP_PRIV _Slist_base<_Tp,_Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist)
+ , public __stlport_class<slist<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_PRIV _Slist_base<_Tp,_Alloc> _Base;
+ typedef slist<_Tp,_Alloc> _Self;
+public:
+ typedef _Tp value_type;
+
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef forward_iterator_tag _Iterator_category;
+
+ typedef _STLP_PRIV _Slist_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
+ typedef _STLP_PRIV _Slist_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
+
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+
+private:
+ typedef _STLP_PRIV _Slist_node<_Tp> _Node;
+ typedef _STLP_PRIV _Slist_node_base _Node_base;
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_create_node(const value_type& __x = _Tp()) {
+#else
+ _Node* _M_create_node(const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _Node* __node = this->_M_head.allocate(1);
+ _STLP_TRY {
+ _Copy_Construct(&__node->_M_data, __x);
+ __node->_M_next = 0;
+ }
+ _STLP_UNWIND(this->_M_head.deallocate(__node, 1))
+ return __node;
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_create_node() {
+ _Node* __node = this->_M_head.allocate(1);
+ _STLP_TRY {
+ _STLP_STD::_Construct(&__node->_M_data);
+ __node->_M_next = 0;
+ }
+ _STLP_UNWIND(this->_M_head.deallocate(__node, 1))
+ return __node;
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+public:
+
+ allocator_type get_allocator() const { return _Base::get_allocator(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(const allocator_type& __a = allocator_type())
+#else
+ slist()
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) {}
+ slist(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) {}
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp),
+ const allocator_type& __a = allocator_type())
+#else
+ explicit slist(size_type __n)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
+ { _M_insert_after_fill(&this->_M_head._M_data, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+ slist(size_type __n, const value_type& __x)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
+ { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); }
+ slist(size_type __n, const value_type& __x, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ // VC++ needs this crazyness
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+# endif
+#else /* _STLP_MEMBER_TEMPLATES */
+ slist(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+ slist(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ slist(const _Self& __x)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__x.get_allocator())
+ { _M_insert_after_range(&this->_M_head._M_data, __x.begin(), __x.end()); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ slist(__move_source<_Self> src)
+ : _STLP_PRIV _Slist_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {}
+#endif
+
+ _Self& operator= (const _Self& __x);
+
+ ~slist() {}
+
+public:
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); }
+
+private:
+ void _M_fill_assign(size_type __n, const _Tp& __val);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+public:
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_assign((size_type) __n, (_Tp) __val);
+ }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/) {
+#else
+public:
+ void assign(const_pointer __first, const_pointer __last) {
+ _Node_base* __prev = &this->_M_head._M_data;
+ _Node_base* __node = this->_M_head._M_data._M_next;
+ while (__node != 0 && __first != __last) {
+ __STATIC_CAST(_Node*, __node)->_M_data = *__first;
+ __prev = __node;
+ __node = __node->_M_next;
+ ++__first;
+ }
+ if (__first != __last)
+ _M_insert_after_range(__prev, __first, __last);
+ else
+ this->_M_erase_after(__prev, 0);
+ }
+ void assign(const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ _Node_base* __prev = &this->_M_head._M_data;
+ _Node_base* __node = this->_M_head._M_data._M_next;
+ while (__node != 0 && __first != __last) {
+ __STATIC_CAST(_Node*, __node)->_M_data = *__first;
+ __prev = __node;
+ __node = __node->_M_next;
+ ++__first;
+ }
+ if (__first != __last)
+ _M_insert_after_range(__prev, __first, __last);
+ else
+ this->_M_erase_after(__prev, 0);
+ }
+
+public:
+
+ // Experimental new feature: before_begin() returns a
+ // non-dereferenceable iterator that, when incremented, yields
+ // begin(). This iterator may be used as the argument to
+ // insert_after, erase_after, etc. Note that even for an empty
+ // slist, before_begin() is not the same iterator as end(). It
+ // is always necessary to increment before_begin() at least once to
+ // obtain end().
+ iterator before_begin() { return iterator(&this->_M_head._M_data); }
+ const_iterator before_begin() const
+ { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_head._M_data)); }
+
+ iterator begin() { return iterator(this->_M_head._M_data._M_next); }
+ const_iterator begin() const
+ { return const_iterator(this->_M_head._M_data._M_next);}
+
+ iterator end() { return iterator(); }
+ const_iterator end() const { return const_iterator(); }
+
+ size_type size() const
+ { return _STLP_PRIV _Sl_global_inst::size(this->_M_head._M_data._M_next); }
+
+ size_type max_size() const { return size_type(-1); }
+
+ bool empty() const { return this->_M_head._M_data._M_next == 0; }
+
+ void swap(_Self& __x)
+ { this->_M_head.swap(__x._M_head); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public:
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __x = _Tp()) {
+#else
+ void push_front(const value_type& __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node(__x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front() { _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node());}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_front() {
+ _Node* __node = __STATIC_CAST(_Node*, this->_M_head._M_data._M_next);
+ this->_M_head._M_data._M_next = __node->_M_next;
+ _STLP_STD::_Destroy(&__node->_M_data);
+ this->_M_head.deallocate(__node, 1);
+ }
+
+ iterator previous(const_iterator __pos) {
+ return iterator(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node));
+ }
+ const_iterator previous(const_iterator __pos) const {
+ return const_iterator(__CONST_CAST(_Node_base*,
+ _STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data,
+ __pos._M_node)));
+ }
+
+private:
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_insert_after(_Node_base* __pos, const value_type& __x = _Tp()) {
+#else
+ _Node* _M_insert_after(_Node_base* __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x)));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_insert_after(_Node_base* __pos) {
+ return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node()));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void _M_insert_after_fill(_Node_base* __pos,
+ size_type __n, const value_type& __x) {
+ for (size_type __i = 0; __i < __n; ++__i)
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InIter>
+ void _M_insert_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last) {
+ typedef typename _IsIntegral<_InIter>::_Ret _Integral;
+ _M_insert_after_range(__pos, __first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_insert_after_fill(__pos, __n, __x);
+ }
+
+ template <class _InIter>
+ void _M_insert_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last,
+ const __false_type&) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_insert_after_range(_Node_base* __pos,
+ const value_type* __first,
+ const value_type* __last) {
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+ void _M_insert_after_range(_Node_base* __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InIter>
+ void _M_splice_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last) {
+ typedef typename _IsIntegral<_InIter>::_Ret _Integral;
+ _M_splice_after_range(__pos, __first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_splice_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_insert_after_fill(__pos, __n, __x);
+ }
+
+ template <class _InIter>
+ void _M_splice_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last,
+ const __false_type&) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_splice_after_range(_Node_base* __pos,
+ const value_type* __first,
+ const value_type* __last) {
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+ void _M_splice_after_range(_Node_base* __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary slist to avoid the auto reference troubles (infinite loop)
+ _Self __tmp(__first, __last, this->get_allocator());
+ splice_after(iterator(__pos), __tmp);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InIter>
+ void _M_splice_range(_Node_base* __pos,
+ _InIter __first, _InIter __last) {
+ typedef typename _IsIntegral<_InIter>::_Ret _Integral;
+ _M_splice_range(__pos, __first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_splice_range(_Node_base* __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos),
+ __n, __x);
+ }
+
+ template <class _InIter>
+ void _M_splice_range(_Node_base* __pos,
+ _InIter __first, _InIter __last,
+ const __false_type&) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_splice_range(_Node_base* __pos,
+ const value_type* __first,
+ const value_type* __last) {
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+ void _M_splice_range(_Node_base* __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary slist to avoid the auto reference troubles (infinite loop)
+ _Self __tmp(__first, __last, this->get_allocator());
+ splice(iterator(__pos), __tmp);
+ }
+
+public:
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert_after(iterator __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ return iterator(_M_insert_after(__pos._M_node, __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos) {
+ return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert_after(iterator __pos, size_type __n, const value_type& __x) {
+ _M_insert_after_fill(__pos._M_node, __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InIter>
+ void insert_after(iterator __pos, _InIter __first, _InIter __last) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert_after(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _M_insert_after_range(__pos._M_node, __first, __last);
+ }
+ void insert_after(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ _M_splice_after_range(__pos._M_node, __first, __last);
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos) {
+ return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ _STLP_DEFAULT_CONSTRUCTED(_Tp)));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x) {
+ _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InIter>
+ void insert(iterator __pos, _InIter __first, _InIter __last) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const value_type* __first,
+ const value_type* __last) {
+ _M_insert_after_range(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ __first, __last);
+ }
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ _M_splice_range(__pos._M_node, __first, __last);
+ }
+
+public:
+ iterator erase_after(iterator __pos)
+ { return iterator(this->_M_erase_after(__pos._M_node)); }
+ iterator erase_after(iterator __before_first, iterator __last)
+ { return iterator(this->_M_erase_after(__before_first._M_node, __last._M_node)); }
+
+ iterator erase(iterator __pos)
+ { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node))); }
+ iterator erase(iterator __first, iterator __last)
+ { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __first._M_node), __last._M_node)); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type new_size, const value_type& __x = _Tp());
+#else
+ void resize(size_type new_size, const value_type& __x);
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type new_size) { resize(new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear()
+ { this->_M_erase_after(&this->_M_head._M_data, 0); }
+
+public:
+ // Moves the range [__before_first + 1, __before_last + 1) to *this,
+ // inserting it immediately after __pos. This is constant time.
+ void splice_after(iterator __pos, _Self& __x,
+ iterator __before_first, iterator __before_last) {
+ if (__before_first != __before_last) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node,
+ __before_first._M_node, __before_last._M_node);
+ }
+ else {
+ this->insert_after(__pos, iterator(__before_first._M_node->_M_next), iterator(__before_last._M_node->_M_next));
+ __x.erase_after(__before_first, ++__before_last);
+ }
+ }
+ }
+
+ // Moves the element that follows __prev to *this, inserting it immediately
+ // after __pos. This is constant time.
+ void splice_after(iterator __pos, _Self& __x, iterator __prev) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node,
+ __prev._M_node, __prev._M_node->_M_next);
+ }
+ else {
+ this->insert_after(__pos, __STATIC_CAST(_Node*, __prev._M_node->_M_next)->_M_data);
+ __x.erase_after(__prev);
+ }
+ }
+
+ // Removes all of the elements from the list __x to *this, inserting
+ // them immediately after __pos. __x must not be *this. Complexity:
+ // linear in __x.size().
+ void splice_after(iterator __pos, _Self& __x) {
+ if (this->get_allocator() == __x.get_allocator())
+ _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node, &__x._M_head._M_data);
+ else {
+ this->insert_after(__pos, __x.begin(), __x.end());
+ __x.clear();
+ }
+ }
+
+ // Linear in distance(begin(), __pos), and linear in __x.size().
+ void splice(iterator __pos, _Self& __x) {
+ if (__x._M_head._M_data._M_next) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ &__x._M_head._M_data,
+ _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, 0));
+ }
+ else {
+ insert(__pos, __x.begin(), __x.end());
+ __x.clear();
+ }
+ }
+ }
+
+ // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __i._M_node),
+ __i._M_node);
+ }
+ else {
+ insert(__pos, *__i);
+ __x.erase(__i);
+ }
+ }
+
+ // Linear in distance(begin(), __pos), in distance(__x.begin(), __first),
+ // and in distance(__first, __last).
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
+ if (__first != __last) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __first._M_node),
+ _STLP_PRIV _Sl_global_inst::__previous(__first._M_node, __last._M_node));
+ }
+ else {
+ insert(__pos, __first, __last);
+ __x.erase(__first, __last);
+ }
+ }
+ }
+
+public:
+ void reverse() {
+ if (this->_M_head._M_data._M_next)
+ this->_M_head._M_data._M_next = _STLP_PRIV _Sl_global_inst::__reverse(this->_M_head._M_data._M_next);
+ }
+
+ void remove(const _Tp& __val);
+
+ void unique() { _STLP_PRIV _Slist_unique(*this, equal_to<value_type>()); }
+ void merge(_Self& __x) { _STLP_PRIV _Slist_merge(*this, __x, less<value_type>()); }
+ void sort() { _STLP_PRIV _Slist_sort(*this, less<value_type>()); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred) {
+ _Node_base* __cur = &this->_M_head._M_data;
+ while (__cur->_M_next) {
+ if (__pred(__STATIC_CAST(_Node*, __cur->_M_next)->_M_data))
+ this->_M_erase_after(__cur);
+ else
+ __cur = __cur->_M_next;
+ }
+ }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __pred)
+ { _STLP_PRIV _Slist_unique(*this, __pred); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __comp)
+ { _STLP_PRIV _Slist_merge(*this, __x, __comp); }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _STLP_PRIV _Slist_sort(*this, __comp); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+};
+
+#if defined (slist)
+# undef slist
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_slist.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_slist.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_slist.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp, class _Alloc>
+inline bool _STLP_CALL
+operator == (const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) {
+ typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator;
+ const_iterator __end1 = _SL1.end();
+ const_iterator __end2 = _SL2.end();
+
+ const_iterator __i1 = _SL1.begin();
+ const_iterator __i2 = _SL2.begin();
+ while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
+ ++__i1;
+ ++__i2;
+ }
+ return __i1 == __end1 && __i2 == __end2;
+}
+
+#define _STLP_EQUAL_OPERATOR_SPECIALIZED
+#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER slist<_Tp, _Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+#undef _STLP_EQUAL_OPERATOR_SPECIALIZED
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Alloc>
+struct __move_traits<slist<_Tp, _Alloc> > {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+# endif
+
+// Specialization of insert_iterator so that insertions will be constant
+// time rather than linear time.
+template <class _Tp, class _Alloc>
+class insert_iterator<slist<_Tp, _Alloc> > {
+protected:
+ typedef slist<_Tp, _Alloc> _Container;
+ _Container* _M_container;
+ typename _Container::iterator _M_iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x, typename _Container::iterator __i)
+ : _M_container(&__x) {
+ if (__i == __x.begin())
+ _M_iter = __x.before_begin();
+ else
+ _M_iter = __x.previous(__i);
+ }
+
+ insert_iterator<_Container>&
+ operator = (const typename _Container::value_type& __val) {
+ _M_iter = _M_container->insert_after(_M_iter, __val);
+ return *this;
+ }
+
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_SLIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_slist_base.c b/stlport/stlport/stl/_slist_base.c
new file mode 100644
index 0000000..e0e68c9
--- /dev/null
+++ b/stlport/stlport/stl/_slist_base.c
@@ -0,0 +1,104 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_SLIST_BASE_C
+#define _STLP_SLIST_BASE_C
+
+#ifndef _STLP_INTERNAL_SLIST_BASE_H
+# include <stl/_slist_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Dummy>
+_Slist_node_base* _STLP_CALL
+_Sl_global<_Dummy>::__previous(_Slist_node_base* __head,
+ const _Slist_node_base* __node) {
+ while (__head && __head->_M_next != __node)
+ __head = __head->_M_next;
+ return __head;
+}
+
+template <class _Dummy>
+void _STLP_CALL
+_Sl_global<_Dummy>::__splice_after(_Slist_node_base* __pos, _Slist_node_base* __head) {
+ _Slist_node_base* __before_last = __previous(__head, 0);
+ if (__before_last != __head) {
+ _Slist_node_base* __after = __pos->_M_next;
+ __pos->_M_next = __head->_M_next;
+ __head->_M_next = 0;
+ __before_last->_M_next = __after;
+ }
+}
+
+template <class _Dummy>
+void _STLP_CALL
+_Sl_global<_Dummy>::__splice_after(_Slist_node_base* __pos,
+ _Slist_node_base* __before_first,
+ _Slist_node_base* __before_last) {
+ if (__pos != __before_first && __pos != __before_last) {
+ _Slist_node_base* __first = __before_first->_M_next;
+ _Slist_node_base* __after = __pos->_M_next;
+ __before_first->_M_next = __before_last->_M_next;
+ __pos->_M_next = __first;
+ __before_last->_M_next = __after;
+ }
+}
+
+template <class _Dummy>
+_Slist_node_base* _STLP_CALL
+_Sl_global<_Dummy>::__reverse(_Slist_node_base* __node) {
+ _Slist_node_base* __result = __node;
+ __node = __node->_M_next;
+ __result->_M_next = 0;
+ while(__node) {
+ _Slist_node_base* __next = __node->_M_next;
+ __node->_M_next = __result;
+ __result = __node;
+ __node = __next;
+ }
+ return __result;
+}
+
+template <class _Dummy>
+size_t _STLP_CALL
+_Sl_global<_Dummy>::size(_Slist_node_base* __node) {
+ size_t __result = 0;
+ for ( ; __node != 0; __node = __node->_M_next)
+ ++__result;
+ return __result;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_SLIST_BASE_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_slist_base.h b/stlport/stlport/stl/_slist_base.h
new file mode 100644
index 0000000..3afa18a
--- /dev/null
+++ b/stlport/stlport/stl/_slist_base.h
@@ -0,0 +1,90 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_SLIST_BASE_H
+#define _STLP_INTERNAL_SLIST_BASE_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _Slist_node_base {
+ _Slist_node_base* _M_next;
+};
+
+inline _Slist_node_base*
+__slist_make_link(_Slist_node_base* __prev_node,
+ _Slist_node_base* __new_node) {
+ __new_node->_M_next = __prev_node->_M_next;
+ __prev_node->_M_next = __new_node;
+ return __new_node;
+}
+
+
+template <class _Dummy>
+class _Sl_global {
+public:
+ // those used to be global functions
+ // moved here to reduce code bloat without templatizing _Slist_iterator_base
+ static size_t _STLP_CALL size(_Slist_node_base* __node);
+ static _Slist_node_base* _STLP_CALL __reverse(_Slist_node_base* __node);
+ static void _STLP_CALL __splice_after(_Slist_node_base* __pos,
+ _Slist_node_base* __before_first,
+ _Slist_node_base* __before_last);
+
+ static void _STLP_CALL __splice_after(_Slist_node_base* __pos, _Slist_node_base* __head);
+
+ static _Slist_node_base* _STLP_CALL __previous(_Slist_node_base* __head,
+ const _Slist_node_base* __node);
+ static const _Slist_node_base* _STLP_CALL __previous(const _Slist_node_base* __head,
+ const _Slist_node_base* __node) {
+ return _Sl_global<_Dummy>::__previous(__CONST_CAST(_Slist_node_base*, __head), __node);
+ }
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _Sl_global<bool>;
+#endif
+
+typedef _Sl_global<bool> _Sl_global_inst;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION) && defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+# include <stl/_slist_base.c>
+#endif
+
+#endif /* _STLP_INTERNAL_SLIST_BASE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_stack.h b/stlport/stlport/stl/_stack.h
new file mode 100644
index 0000000..7ea9d59
--- /dev/null
+++ b/stlport/stlport/stl/_stack.h
@@ -0,0 +1,133 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_STACK_H
+#define _STLP_INTERNAL_STACK_H
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined ( _STLP_LIMITED_DEFAULT_TEMPLATES )
+template <class _Tp, class _Sequence = deque<_Tp> >
+#elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
+# define _STLP_STACK_ARGS _Tp
+template <class _Tp>
+#else
+template <class _Tp, class _Sequence>
+#endif
+class stack
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+# if defined (_STLP_STACK_ARGS)
+ : public __stlport_class<stack<_Tp> >
+# else
+ : public __stlport_class<stack<_Tp, _Sequence> >
+# endif
+#endif
+{
+#ifdef _STLP_STACK_ARGS
+ typedef deque<_Tp> _Sequence;
+ typedef stack<_Tp> _Self;
+#else
+ typedef stack<_Tp, _Sequence> _Self;
+#endif
+
+public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+protected:
+ //c is a Standard name (23.2.3.3), do no make it STLport naming convention compliant.
+ _Sequence c;
+public:
+ stack() : c() {}
+ explicit stack(const _Sequence& __s) : c(__s) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ stack(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)) {}
+#endif
+
+ bool empty() const { return c.empty(); }
+ size_type size() const { return c.size(); }
+ reference top() { return c.back(); }
+ const_reference top() const { return c.back(); }
+ void push(const value_type& __x) { c.push_back(__x); }
+ void pop() { c.pop_back(); }
+ const _Sequence& _Get_s() const { return c; }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) {
+ _Sequence __tmp = c;
+ c = __x.c;
+ __x.c = __tmp;
+ }
+#endif
+};
+
+#ifndef _STLP_STACK_ARGS
+# define _STLP_STACK_ARGS _Tp, _Sequence
+# define _STLP_STACK_HEADER_ARGS class _Tp, class _Sequence
+#else
+# define _STLP_STACK_HEADER_ARGS class _Tp
+#endif
+
+template < _STLP_STACK_HEADER_ARGS >
+inline bool _STLP_CALL operator==(const stack< _STLP_STACK_ARGS >& __x,
+ const stack< _STLP_STACK_ARGS >& __y)
+{ return __x._Get_s() == __y._Get_s(); }
+
+template < _STLP_STACK_HEADER_ARGS >
+inline bool _STLP_CALL operator<(const stack< _STLP_STACK_ARGS >& __x,
+ const stack< _STLP_STACK_ARGS >& __y)
+{ return __x._Get_s() < __y._Get_s(); }
+
+_STLP_RELOPS_OPERATORS(template < _STLP_STACK_HEADER_ARGS >, stack< _STLP_STACK_ARGS >)
+
+#undef _STLP_STACK_ARGS
+#undef _STLP_STACK_HEADER_ARGS
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Sequence>
+struct __move_traits<stack<_Tp, _Sequence> > :
+ _STLP_PRIV __move_traits_aux<_Sequence>
+{};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_STACK_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_string.c b/stlport/stlport/stl/_string.c
new file mode 100644
index 0000000..4fa5ece
--- /dev/null
+++ b/stlport/stlport/stl/_string.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#ifndef _STLP_STRING_C
+#define _STLP_STRING_C
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
+# include <stl/_ctraits_fns.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_H
+# include <stl/_function.h>
+#endif
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NO_MEM_T_NAME(str)
+#elif defined (_STLP_DEBUG)
+# define basic_string _STLP_NON_DBG_NAME(str)
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define __size_type__ size_t
+# define size_type size_t
+# define iterator _CharT*
+#else
+# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_string<_CharT,_Traits,_Alloc>::size_type
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// A helper class to use a char_traits as a function object.
+template <class _Traits>
+struct _Not_within_traits : public unary_function<typename _Traits::char_type, bool> {
+ typedef typename _Traits::char_type _CharT;
+ const _CharT* _M_first;
+ const _CharT* _M_last;
+
+ _Not_within_traits(const _CharT* __f, const _CharT* __l)
+ : _M_first(__f), _M_last(__l) {}
+
+ bool operator()(const _CharT& __x) const {
+ return find_if(_M_first, _M_last,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__x)) == _M_last;
+ }
+};
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits*, const __true_type& /* _STLportTraits */)
+{ return __find_first_of(__first1, __last1, __first2, __last2); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits*, const __false_type& /* _STLportTraits */)
+{ return __find_first_of(__first1, __last1, __first2, __last2, _STLP_PRIV _Eq_traits<_Traits>()); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_of(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* __traits) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<_Traits>::_Ret _STLportTraits;
+#else
+ enum { _Is = _IsSTLportClass<_Traits>::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportTraits;
+#endif
+ return __str_find_first_of_aux(__first1, __last1, __first2, __last2, __traits, _STLportTraits());
+}
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* /* __traits */, const __true_type& __useStrcspnLikeAlgo)
+{ return __find_first_of_aux2(__first1, __last1, __first2, __last2, __first2, not1(_Identity<bool>()), __useStrcspnLikeAlgo); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* /* __traits */, const __false_type& /* _UseStrcspnLikeAlgo */)
+{ return _STLP_STD::find_if(__first1, __last1, _STLP_PRIV _Not_within_traits<_Traits>(__first2, __last2)); }
+
+template <class _InputIter, class _CharT, class _Tp, class _Traits>
+inline _InputIter __str_find_first_not_of_aux2(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Tp* __pt, _Traits* __traits) {
+ typedef typename _IsIntegral<_Tp>::_Ret _IsIntegral;
+ typedef typename _IsCharLikeType<_CharT>::_Ret _IsCharLike;
+ typedef typename _Land2<_IsIntegral, _IsCharLike>::_Ret _UseStrcspnLikeAlgo;
+ return __str_find_first_not_of_aux3(__first1, __last1, __first2, __last2, __traits, _UseStrcspnLikeAlgo());
+}
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* __traits, const __true_type& /* _STLportTraits */)
+{ return __str_find_first_not_of_aux2(__first1, __last1, __first2, __last2,
+ _STLP_VALUE_TYPE(__first1, _InputIter), __traits); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits*, const __false_type& /* _STLportTraits */)
+{ return _STLP_STD::find_if(__first1, __last1, _STLP_PRIV _Not_within_traits<_Traits>(__first2, __last2)); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* __traits) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<_Traits>::_Ret _STLportTraits;
+#else
+ enum { _Is = _IsSTLportClass<_Traits>::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportTraits;
+#endif
+ return __str_find_first_not_of_aux1(__first1, __last1, __first2, __last2, __traits, _STLportTraits());
+}
+
+// ------------------------------------------------------------
+// Non-inline declarations.
+
+#if !defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+// Change the string's capacity so that it is large enough to hold
+// at least __res_arg elements, plus the terminating _CharT(). Note that,
+// if __res_arg < capacity(), this member function may actually decrease
+// the string's capacity.
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::reserve(size_type __res_arg) {
+ if (__res_arg > max_size())
+ this->_M_throw_length_error();
+
+ size_type __n = (max)(__res_arg, size()) + 1;
+ if (__n < this->_M_capacity())
+ return;
+
+ _M_reserve(__n);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::_M_reserve(size_type __n) {
+ pointer __new_start = this->_M_start_of_storage.allocate(__n, __n);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __n);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc>::append(size_type __n, _CharT __c) {
+ if (__n > 0) {
+ if (__n > max_size() - size())
+ this->_M_throw_length_error();
+ if (__n >= this->_M_rest())
+ _M_reserve(_M_compute_next_size(__n));
+ _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - 1, __c);
+ _M_construct_null(this->_M_finish + __n);
+ _Traits::assign(*end(), __c);
+ this->_M_finish += __n;
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>&
+basic_string<_CharT, _Traits, _Alloc>::_M_append(const _CharT* __first, const _CharT* __last) {
+ if (__first != __last) {
+ size_type __n = __STATIC_CAST(size_type, __last - __first);
+ if (__n >= this->_M_rest()) {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ const _CharT* __f1 = __first;
+ ++__f1;
+ _STLP_PRIV __ucopy(__f1, __last, this->_M_finish + 1);
+ _M_construct_null(this->_M_finish + __n);
+ _Traits::assign(*end(), *__first);
+ this->_M_finish += __n;
+ }
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc>::assign(size_type __n, _CharT __c) {
+ if (__n <= size()) {
+ _Traits::assign(this->_M_Start(), __n, __c);
+ erase(begin() + __n, end());
+ }
+ else {
+ if (__n < capacity()) {
+ _Traits::assign(this->_M_Start(), size(), __c);
+ append(__n - size(), __c);
+ }
+ else {
+ _Self __str(__n, __c);
+ this->swap(__str);
+ }
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc>::_M_assign(const _CharT* __f, const _CharT* __l) {
+ ptrdiff_t __n = __l - __f;
+ if (__STATIC_CAST(size_type, __n) <= size()) {
+ _Traits::copy(this->_M_Start(), __f, __n);
+ erase(begin() + __n, end());
+ }
+ else {
+ _Traits::copy(this->_M_Start(), __f, size());
+ _M_append(__f + size(), __l);
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+_CharT* basic_string<_CharT,_Traits,_Alloc> ::_M_insert_aux(_CharT* __p,
+ _CharT __c) {
+ pointer __new_pos = __p;
+ if (this->_M_rest() > 1 ) {
+ _M_construct_null(this->_M_finish + 1);
+ _Traits::move(__p + 1, __p, this->_M_finish - __p);
+ _Traits::assign(*__p, __c);
+ ++this->_M_finish;
+ }
+ else {
+ size_type __len = _M_compute_next_size(1);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ __new_pos = _STLP_PRIV __ucopy(this->_M_Start(), __p, __new_start);
+ _Traits::assign(*__new_pos, __c);
+ pointer __new_finish = __new_pos + 1;
+ __new_finish = _STLP_PRIV __ucopy(__p, this->_M_finish, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ return __new_pos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::insert(iterator __pos,
+ size_t __n, _CharT __c) {
+ if (__n != 0) {
+ if (this->_M_rest() > __n) {
+ const size_type __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after >= __n) {
+ _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
+ this->_M_finish += __n;
+ _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
+ _Traits::assign(__pos, __n, __c);
+ }
+ else {
+ _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - __elems_after - 1, __c);
+ this->_M_finish += __n - __elems_after;
+ _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
+ this->_M_finish += __elems_after;
+ _Traits::assign(__pos, __elems_after + 1, __c);
+ }
+ }
+ else {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start);
+ __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __n, __c);
+ __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::_M_insert(iterator __pos,
+ const _CharT* __first, const _CharT* __last,
+ bool __self_ref) {
+ //this version has to take care about the auto referencing
+ if (__first != __last) {
+ const size_t __n = __last - __first;
+ if (this->_M_rest() > __n) {
+ const size_t __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after >= __n) {
+ _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
+ this->_M_finish += __n;
+ _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
+ if (!__self_ref || __last < __pos) {
+ _M_copy(__first, __last, __pos);
+ }
+ else {
+ //We have to check that the source buffer hasn't move
+ if (__first >= __pos) {
+ //The source buffer has move
+ __first += __n;
+ __last += __n;
+ _M_copy(__first, __last, __pos);
+ }
+ else {
+ //The source buffer hasn't move, it has been duplicated
+ _M_move(__first, __last, __pos);
+ }
+ }
+ }
+ else {
+ const_iterator __mid = __first;
+ __mid += __elems_after + 1;
+ _STLP_PRIV __ucopy(__mid, __last, this->_M_finish + 1);
+ this->_M_finish += __n - __elems_after;
+ _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
+ this->_M_finish += __elems_after;
+ if (!__self_ref)
+ _M_copy(__first, __mid, __pos);
+ else
+ _M_move(__first, __mid, __pos);
+ }
+ }
+ else {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start);
+ __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish);
+ __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc> ::replace(iterator __first, iterator __last,
+ size_type __n, _CharT __c) {
+ size_type __len = (size_type)(__last - __first);
+
+ if (__len >= __n) {
+ _Traits::assign(__first, __n, __c);
+ erase(__first + __n, __last);
+ }
+ else {
+ _Traits::assign(__first, __len, __c);
+ insert(__last, __n - __len, __c);
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc> ::_M_replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l,
+ bool __self_ref) {
+ const ptrdiff_t __n = __l - __f;
+ const difference_type __len = __last - __first;
+ if (__len >= __n) {
+ if (!__self_ref || __l < __first || __f >= __last)
+ _M_copy(__f, __l, __first);
+ else
+ _M_move(__f, __l, __first);
+ erase(__first + __n, __last);
+ } else if (!__self_ref || (__f >= __last) || (__l <= __first)) { // no overlap
+ const_iterator __m = __f + __len;
+ _M_copy(__f, __m, __first);
+ _M_insert(__last, __m, __l, __self_ref );
+ } else if (__f < __first) { // we have to take care of overlaping
+ const_iterator __m = __f + __len;
+ // We have to deal with possible reallocation because we do insert first.
+ const difference_type __off_dest = __first - this->begin();
+ const difference_type __off_src = __f - this->begin();
+ _M_insert(__last, __m, __l, true);
+ _Traits::move(begin() + __off_dest, begin() + __off_src, __len);
+ } else {
+ const_iterator __m = __f + __len;
+ _Traits::move(__first, __f, __len);
+ _M_insert(__last, __m, __l, true);
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::find( const _CharT* __s, size_type __pos,
+ size_type __n) const
+{
+ const size_t __len = size();
+ if (__pos >= __len || __pos + __n > __len) {
+ if ( __n == 0 && __pos <= __len ) { // marginal case
+ return __pos;
+ }
+ return npos;
+ }
+
+ const_pointer __result =
+ _STLP_STD::search(this->_M_Start() + __pos, this->_M_Finish(),
+ __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>());
+ return __result != this->_M_Finish() ? __result - this->_M_Start() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::find(_CharT __c, size_type __pos) const
+{
+ if (__pos >= size()) { /*__pos + 1 > size()*/
+ return npos;
+ }
+
+ const_pointer __result =
+ _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
+ _STLP_PRIV _Eq_char_bound<_Traits>(__c));
+ return __result != this->_M_Finish() ? __result - this->_M_Start() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::rfind(const _CharT* __s, size_type __pos,
+ size_type __n) const
+{
+ const size_type __len = size();
+ if ( __len < __n ) {
+ return npos;
+ }
+ const_pointer __last = this->_M_Start() + (min)( __len - __n, __pos) + __n;
+ if ( __n == 0 ) { // marginal case
+ return __last - this->_M_Start();
+ }
+ const_pointer __result = _STLP_STD::find_end(this->_M_Start(), __last,
+ __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>());
+ return __result != __last ? __result - this->_M_Start() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::rfind(_CharT __c, size_type __pos) const
+{
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const_reverse_iterator __rresult =
+ _STLP_STD::find_if(const_reverse_iterator(__last), rend(),
+ _STLP_PRIV _Eq_char_bound<_Traits>(__c));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc> __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_first_of(const _CharT* __s, size_type __pos,
+ size_type __n) const {
+ if (__pos >= size()) /*__pos + 1 > size()*/
+ return npos;
+ else {
+ const_iterator __result = _STLP_PRIV __str_find_first_of(begin() + __pos, end(),
+ __s, __s + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __result != end() ? __result - begin() : npos;
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+ __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_last_of(const _CharT* __s, size_type __pos,
+ size_type __n) const
+{
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const const_reverse_iterator __rresult =
+ _STLP_PRIV __str_find_first_of(const_reverse_iterator(__last), rend(),
+ __s, __s + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+
+template <class _CharT, class _Traits, class _Alloc> __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(const _CharT* __s, size_type __pos,
+ size_type __n) const {
+ typedef typename _Traits::char_type _CharType;
+ if (__pos >= size()) /*__pos + 1 >= size()*/
+ return npos;
+ else {
+ const_pointer __result = _STLP_PRIV __str_find_first_not_of(this->_M_Start() + __pos, this->_M_Finish(),
+ __STATIC_CAST(const _CharType*, __s),
+ __STATIC_CAST(const _CharType*, __s) + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __result != this->_M_finish ? __result - this->_M_Start() : npos;
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc> __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(_CharT __c, size_type __pos) const {
+ if (1 > size())
+ return npos;
+ else {
+ const_pointer __result = _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
+ _STLP_PRIV _Neq_char_bound<_Traits>(__c));
+ return __result != this->_M_finish ? __result - this->_M_Start() : npos;
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__
+basic_string<_CharT,_Traits,_Alloc>::find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+{
+ typedef typename _Traits::char_type _CharType;
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const_reverse_iterator __rlast = const_reverse_iterator(__last);
+ const_reverse_iterator __rresult =
+ _STLP_PRIV __str_find_first_not_of(__rlast, rend(),
+ __STATIC_CAST(const _CharType*, __s),
+ __STATIC_CAST(const _CharType*, __s) + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__
+basic_string<_CharT, _Traits, _Alloc>::find_last_not_of(_CharT __c, size_type __pos) const
+{
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const_reverse_iterator __rlast = const_reverse_iterator(__last);
+ const_reverse_iterator __rresult =
+ _STLP_STD::find_if(__rlast, rend(),
+ _STLP_PRIV _Neq_char_bound<_Traits>(__c));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+#if !defined (basic_string)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ _CharT* __buf, size_t __n) {
+ if (__n > 0) {
+ __n = (min) (__n - 1, __s.size());
+ _STLP_STD::copy(__s.begin(), __s.begin() + __n, __buf);
+ __buf[__n] = _CharT();
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#include <stl/_range_errors.h>
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// _String_base methods
+template <class _Tp, class _Alloc>
+void _String_base<_Tp,_Alloc>::_M_throw_length_error() const
+{ __stl_throw_length_error("basic_string"); }
+
+template <class _Tp, class _Alloc>
+void _String_base<_Tp, _Alloc>::_M_throw_out_of_range() const
+{ __stl_throw_out_of_range("basic_string"); }
+
+template <class _Tp, class _Alloc>
+void _String_base<_Tp, _Alloc>::_M_allocate_block(size_t __n) {
+ if ((__n <= (max_size() + 1)) && (__n > 0)) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (__n > _DEFAULT_SIZE) {
+ this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(__n, __n);
+ this->_M_finish = this->_M_start_of_storage._M_data;
+ this->_M_buffers._M_end_of_storage = this->_M_start_of_storage._M_data + __n;
+ }
+#else
+ this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(__n, __n);
+ this->_M_finish = this->_M_start_of_storage._M_data;
+ this->_M_end_of_storage = this->_M_start_of_storage._M_data + __n;
+#endif
+ } else {
+ this->_M_throw_length_error();
+ }
+}
+
+#if !defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + traits_type::length(__s));
+}
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s,
+ const allocator_type& __a)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + traits_type::length(__s));
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>::basic_string(const basic_string<_CharT, _Traits, _Alloc> & __s)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__s.get_allocator())
+{ _M_range_initialize(__s._M_Start(), __s._M_Finish()); }
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+#endif
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+template <class _CharT, class _Traits, class _Alloc>
+const size_t basic_string<_CharT, _Traits, _Alloc>::npos;
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef __size_type__
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# undef size_type
+# undef iterator
+#endif
+
+#endif /* _STLP_STRING_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_string.h b/stlport/stlport/stl/_string.h
new file mode 100644
index 0000000..540822b
--- /dev/null
+++ b/stlport/stlport/stl/_string.h
@@ -0,0 +1,1182 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_STRING_H
+#define _STLP_INTERNAL_STRING_H
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_STRING_FWD_H
+# include <stl/_string_fwd.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+# include <stl/_string_sum.h>
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+#if defined (__MWERKS__) && ! defined (_STLP_USE_OWN_NAMESPACE)
+
+// MSL implementation classes expect to see the definition of streampos
+// when this header is included. We expect this to be fixed in later MSL
+// implementations
+# if !defined( __MSL_CPP__ ) || __MSL_CPP__ < 0x4105
+# include <stl/msl_string.h>
+# endif
+#endif // __MWERKS__
+
+/*
+ * Standard C++ string class. This class has performance
+ * characteristics very much like vector<>, meaning, for example, that
+ * it does not perform reference-count or copy-on-write, and that
+ * concatenation of two strings is an O(N) operation.
+
+ * There are three reasons why basic_string is not identical to
+ * vector.
+ * First, basic_string always stores a null character at the end;
+ * this makes it possible for c_str to be a fast operation.
+ * Second, the C++ standard requires basic_string to copy elements
+ * using char_traits<>::assign, char_traits<>::copy, and
+ * char_traits<>::move. This means that all of vector<>'s low-level
+ * operations must be rewritten. Third, basic_string<> has a lot of
+ * extra functions in its interface that are convenient but, strictly
+ * speaking, redundant.
+ */
+
+#include <stl/_string_base.h>
+
+_STLP_BEGIN_NAMESPACE
+
+// ------------------------------------------------------------
+// Class basic_string.
+
+// Class invariants:
+// (1) [start, finish) is a valid range.
+// (2) Each iterator in [start, finish) points to a valid object
+// of type value_type.
+// (3) *finish is a valid object of type value_type; when
+// value_type is not a POD it is value_type().
+// (4) [finish + 1, end_of_storage) is a valid range.
+// (5) Each iterator in [finish + 1, end_of_storage) points to
+// unininitialized memory.
+
+// Note one important consequence: a string of length n must manage
+// a block of memory whose size is at least n + 1.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+struct _String_reserve_t {};
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NO_MEM_T_NAME(str)
+#elif defined (_STLP_DEBUG)
+# define basic_string _STLP_NON_DBG_NAME(str)
+#endif
+
+#if defined (basic_string)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+#if defined (__DMC__)
+# define _STLP_PRIVATE public
+#elif defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define _STLP_PRIVATE protected
+#else
+# define _STLP_PRIVATE private
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_string : _STLP_PRIVATE _STLP_PRIV _String_base<_CharT,_Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
+ , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
+#endif
+{
+_STLP_PRIVATE: // Private members inherited from base.
+ typedef _STLP_PRIV _String_base<_CharT,_Alloc> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _Self;
+
+public:
+ typedef _CharT value_type;
+ typedef _Traits traits_type;
+
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename _Base::size_type size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+
+ typedef const value_type* const_iterator;
+ typedef value_type* iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+#include <stl/_string_npos.h>
+
+ typedef _STLP_PRIV _String_reserve_t _Reserve_t;
+
+public: // Constructor, destructor, assignment.
+ typedef typename _Base::allocator_type allocator_type;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_start_of_storage, _CharT); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit basic_string(const allocator_type& __a = allocator_type())
+#else
+ basic_string()
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), _Base::_DEFAULT_SIZE)
+ { _M_terminate_string(); }
+ explicit basic_string(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, _Base::_DEFAULT_SIZE)
+ { _M_terminate_string(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(_Reserve_t, size_t __n,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(_Reserve_t, size_t __n)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1)
+ { _M_terminate_string(); }
+ basic_string(_Reserve_t, size_t __n, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1)
+ { _M_terminate_string(); }
+
+ basic_string(const _Self&);
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(const _Self& __s, size_type __pos)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ else
+ _M_range_initialize(__s._M_Start() + __pos, __s._M_Finish());
+ }
+ basic_string(const _Self& __s, size_type __pos, size_type __n)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ else
+ _M_range_initialize(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+ basic_string(const _Self& __s, size_type __pos, size_type __n,
+ const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ else
+ _M_range_initialize(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(const _CharT* __s, size_type __n,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(const _CharT* __s, size_type __n)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + __n);
+ }
+ basic_string(const _CharT* __s, size_type __n, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + __n);
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(const _CharT* __s,
+ const allocator_type& __a = allocator_type());
+#else
+ basic_string(const _CharT* __s);
+ basic_string(const _CharT* __s, const allocator_type& __a);
+#endif
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(size_type __n, _CharT __c,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(size_type __n, _CharT __c)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1) {
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c);
+ _M_terminate_string();
+ }
+ basic_string(size_type __n, _CharT __c, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1) {
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c);
+ _M_terminate_string();
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ basic_string(__move_source<_Self> src)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__move_source<_Base>(src.get())) {}
+#endif
+
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l,
+ const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__f, __l, _Integral());
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__f, __l, _Integral());
+ }
+# endif
+#else
+# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ basic_string(const _CharT* __f, const _CharT* __l,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _M_range_initialize(__f, __l);
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ basic_string(const _CharT* __f, const _CharT* __l)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _M_range_initialize(__f, __l);
+ }
+# endif
+# endif
+# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ /* We need an additionnal constructor to build an empty string without
+ * any allocation or termination char*/
+protected:
+ struct _CalledFromWorkaround_t {};
+ basic_string(_CalledFromWorkaround_t, const allocator_type &__a)
+ : _String_base<_CharT,_Alloc>(__a) {}
+# endif
+#endif
+
+_STLP_PRIVATE:
+ size_type _M_compute_next_size(size_type __n) {
+ const size_type __size = size();
+ if (__n > max_size() - __size)
+ this->_M_throw_length_error();
+ size_type __len = __size + (max)(__n, __size) + 1;
+ if (__len > max_size() || __len < __size)
+ __len = max_size(); // overflow
+ return __len;
+ }
+
+ template <class _InputIter>
+ void _M_range_initialize(_InputIter __f, _InputIter __l,
+ const input_iterator_tag &__tag) {
+ this->_M_allocate_block();
+ _M_construct_null(this->_M_Finish());
+ _M_appendT(__f, __l, __tag);
+ }
+
+ template <class _ForwardIter>
+ void _M_range_initialize(_ForwardIter __f, _ForwardIter __l,
+ const forward_iterator_tag &) {
+ difference_type __n = _STLP_STD::distance(__f, __l);
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
+ this->_M_terminate_string();
+ }
+
+ template <class _InputIter>
+ void _M_range_initializeT(_InputIter __f, _InputIter __l) {
+ _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ }
+
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) {
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __x);
+ this->_M_terminate_string();
+ }
+
+ template <class _InputIter>
+ void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
+ _M_range_initializeT(__f, __l);
+ }
+
+public:
+ _Self& operator=(const _Self& __s) {
+ if (&__s != this)
+ _M_assign(__s._M_Start(), __s._M_Finish());
+ return *this;
+ }
+
+ _Self& operator=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_assign(__s, __s + traits_type::length(__s));
+ }
+
+ _Self& operator=(_CharT __c)
+ { return assign(__STATIC_CAST(size_type,1), __c); }
+
+private:
+ static _CharT _STLP_CALL _M_null()
+ { return _STLP_DEFAULT_CONSTRUCTED(_CharT); }
+
+_STLP_PRIVATE: // Helper functions used by constructors
+ // and elsewhere.
+ void _M_construct_null(_CharT* __p) const
+ { _STLP_STD::_Construct(__p); }
+ void _M_terminate_string()
+ { _M_construct_null(this->_M_Finish()); }
+ bool _M_inside(const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return (__s >= this->_M_Start()) && (__s < this->_M_Finish());
+ }
+
+ void _M_range_initialize(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ ptrdiff_t __n = __l - __f;
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
+ _M_terminate_string();
+ }
+
+public: // Iterators.
+ iterator begin() { return this->_M_Start(); }
+ iterator end() { return this->_M_Finish(); }
+ const_iterator begin() const { return this->_M_Start(); }
+ const_iterator end() const { return this->_M_Finish(); }
+
+ reverse_iterator rbegin()
+ { return reverse_iterator(this->_M_Finish()); }
+ reverse_iterator rend()
+ { return reverse_iterator(this->_M_Start()); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(this->_M_Finish()); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(this->_M_Start()); }
+
+public: // Size, capacity, etc.
+ size_type size() const { return this->_M_Finish() - this->_M_Start(); }
+ size_type length() const { return size(); }
+ size_type max_size() const { return _Base::max_size(); }
+
+ void resize(size_type __n, _CharT __c) {
+ if (__n <= size())
+ erase(begin() + __n, end());
+ else
+ append(__n - size(), __c);
+ }
+
+ void resize(size_type __n) { resize(__n, _M_null()); }
+
+private:
+ void _M_reserve(size_type);
+public:
+ void reserve(size_type = 0);
+
+ size_type capacity() const
+ { return this->_M_capacity() - 1; }
+
+ void clear() {
+ if (!empty()) {
+ _Traits::assign(*(this->_M_Start()), _M_null());
+ this->_M_finish = this->_M_Start();
+ }
+ }
+
+ bool empty() const { return this->_M_Start() == this->_M_Finish(); }
+
+public: // Element access.
+
+ const_reference operator[](size_type __n) const
+ { return *(this->_M_Start() + __n); }
+ reference operator[](size_type __n)
+ { return *(this->_M_Start() + __n); }
+
+ const_reference at(size_type __n) const {
+ if (__n >= size())
+ this->_M_throw_out_of_range();
+ return *(this->_M_Start() + __n);
+ }
+
+ reference at(size_type __n) {
+ if (__n >= size())
+ this->_M_throw_out_of_range();
+ return *(this->_M_Start() + __n);
+ }
+
+public: // Append, operator+=, push_back.
+
+ _Self& operator+=(const _Self& __s) { return append(__s); }
+ _Self& operator+=(const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return append(__s); }
+ _Self& operator+=(_CharT __c) { push_back(__c); return *this; }
+
+private:
+ _Self& _M_append(const _CharT* __first, const _CharT* __last);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _InputIter>
+ _Self& _M_appendT(_InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last ; ++__first)
+ push_back(*__first);
+ return *this;
+ }
+
+ template <class _ForwardIter>
+ _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last));
+ if (__n >= this->_M_rest()) {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _Traits::assign(*this->_M_finish, *__first++);
+ uninitialized_copy(__first, __last, this->_M_Finish() + 1);
+ _M_construct_null(this->_M_Finish() + __n);
+ this->_M_finish += __n;
+ }
+ }
+ return *this;
+ }
+
+ template <class _Integer>
+ _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/)
+ { return append((size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/)
+ { return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); }
+
+public:
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& append(_InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_append_dispatch(__first, __last, _Integral());
+ }
+#else
+public:
+ _Self& append(const _CharT* __first, const _CharT* __last) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ return _M_append(__first, __last);
+ }
+#endif
+
+public:
+ _Self& append(const _Self& __s)
+ { return _M_append(__s._M_Start(), __s._M_Finish()); }
+
+ _Self& append(const _Self& __s,
+ size_type __pos, size_type __n) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ return _M_append(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+
+ _Self& append(const _CharT* __s, size_type __n)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s+__n); }
+ _Self& append(const _CharT* __s)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s + traits_type::length(__s)); }
+ _Self& append(size_type __n, _CharT __c);
+
+public:
+ void push_back(_CharT __c) {
+ if (this->_M_rest() == 1 )
+ _M_reserve(_M_compute_next_size(1));
+ _M_construct_null(this->_M_Finish() + 1);
+ _Traits::assign(*(this->_M_Finish()), __c);
+ ++this->_M_finish;
+ }
+
+ void pop_back() {
+ _Traits::assign(*(this->_M_Finish() - 1), _M_null());
+ --this->_M_finish;
+ }
+
+public: // Assign
+ _Self& assign(const _Self& __s)
+ { return _M_assign(__s._M_Start(), __s._M_Finish()); }
+
+ _Self& assign(const _Self& __s,
+ size_type __pos, size_type __n) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ return _M_assign(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+
+ _Self& assign(const _CharT* __s, size_type __n)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + __n); }
+
+ _Self& assign(const _CharT* __s)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + _Traits::length(__s)); }
+
+ _Self& assign(size_type __n, _CharT __c);
+
+private:
+ _Self& _M_assign(const _CharT* __f, const _CharT* __l);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ // Helper functions for assign.
+ template <class _Integer>
+ _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/)
+ { return assign((size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
+ pointer __cur = this->_M_Start();
+ while (__f != __l && __cur != this->_M_Finish()) {
+ _Traits::assign(*__cur, *__f);
+ ++__f;
+ ++__cur;
+ }
+ if (__f == __l)
+ erase(__cur, this->end());
+ else
+ _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ return *this;
+ }
+
+public:
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& assign(_InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_assign_dispatch(__first, __last, _Integral());
+ }
+#else
+public:
+ _Self& assign(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ return _M_assign(__f, __l);
+ }
+#endif
+
+public: // Insert
+ _Self& insert(size_type __pos, const _Self& __s) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ if (__s.size() > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(begin() + __pos, __s._M_Start(), __s._M_Finish(), &__s == this);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _Self& __s,
+ size_type __beg, size_type __n) {
+ if (__pos > size() || __beg > __s.size())
+ this->_M_throw_out_of_range();
+ size_type __len = (min) (__n, __s.size() - __beg);
+ if (__len > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(begin() + __pos,
+ __s._M_Start() + __beg, __s._M_Start() + __beg + __len, &__s == this);
+ return *this;
+ }
+ _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ if (__n > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(begin() + __pos, __s, __s + __n, _M_inside(__s));
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ size_type __len = _Traits::length(__s);
+ if (__len > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(this->_M_Start() + __pos, __s, __s + __len, _M_inside(__s));
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, size_type __n, _CharT __c) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ if (__n > max_size() - size())
+ this->_M_throw_length_error();
+ insert(begin() + __pos, __n, __c);
+ return *this;
+ }
+
+ iterator insert(iterator __p, _CharT __c) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ if (__p == end()) {
+ push_back(__c);
+ return this->_M_Finish() - 1;
+ }
+ else
+ return _M_insert_aux(__p, __c);
+ }
+
+ void insert(iterator __p, size_t __n, _CharT __c);
+
+_STLP_PRIVATE: // Helper functions for insert.
+ void _M_insert(iterator __p, const _CharT* __first, const _CharT* __last, bool __self_ref);
+
+ pointer _M_insert_aux(pointer, _CharT);
+
+ void _M_copy(const _CharT* __f, const _CharT* __l, _CharT* __res) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_FIX_LITERAL_BUG(__res)
+ _Traits::copy(__res, __f, __l - __f);
+ }
+
+ void _M_move(const _CharT* __f, const _CharT* __l, _CharT* __res) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _Traits::move(__res, __f, __l - __f);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _ForwardIter>
+ void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last,
+ size_type __n) {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), __pos, __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ __new_finish = uninitialized_copy(__pos, this->_M_Finish(), __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+
+ template <class _InputIter>
+ void _M_insertT(iterator __p, _InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first) {
+ __p = insert(__p, *__first);
+ ++__p;
+ }
+ }
+
+ template <class _ForwardIter>
+ void _M_insertT(iterator __pos, _ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (__n < this->_M_rest()) {
+ const size_type __elems_after = this->_M_finish - __pos;
+ if (__elems_after >= __n) {
+ uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
+ this->_M_finish += __n;
+ _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
+ _M_copyT(__first, __last, __pos);
+ }
+ else {
+ pointer __old_finish = this->_M_Finish();
+ _ForwardIter __mid = __first;
+ _STLP_STD::advance(__mid, __elems_after + 1);
+ _STLP_STD::uninitialized_copy(__mid, __last, this->_M_Finish() + 1);
+ this->_M_finish += __n - __elems_after;
+ uninitialized_copy(__pos, __old_finish + 1, this->_M_Finish());
+ this->_M_finish += __elems_after;
+ _M_copyT(__first, __mid, __pos);
+ }
+ }
+ else {
+ _M_insert_overflow(__pos, __first, __last, __n);
+ }
+ }
+ }
+
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x,
+ const __true_type& /*Integral*/)
+ { insert(__p, (size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last,
+ const __false_type& /*Integral*/) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ /* We are forced to do a temporary string to avoid the self referencing issue. */
+ const _Self __self(__first, __last, get_allocator());
+ _M_insertT(__p, __self.begin(), __self.end(), forward_iterator_tag());
+ }
+
+ template <class _InputIterator>
+ void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) {
+ _STLP_FIX_LITERAL_BUG(__result)
+ for ( ; __first != __last; ++__first, ++__result)
+ _Traits::assign(*__result, *__first);
+ }
+
+# if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_FIX_LITERAL_BUG(__res)
+ _Traits::copy(__res, __f, __l - __f);
+ }
+# endif
+public:
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ void insert(iterator __p, _InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ _M_insert_dispatch(__p, __first, __last, _Integral());
+ }
+# endif
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+public:
+ void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _M_insert(__p, __f, __l, _M_inside(__f));
+ }
+#endif
+
+public: // Erase.
+ _Self& erase(size_type __pos = 0, size_type __n = npos) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ erase(begin() + __pos, begin() + __pos + (min) (__n, size() - __pos));
+ return *this;
+ }
+
+ iterator erase(iterator __pos) {
+ // The move includes the terminating _CharT().
+ _Traits::move(__pos, __pos + 1, this->_M_Finish() - __pos);
+ --this->_M_finish;
+ return __pos;
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ if (__first != __last) {
+ // The move includes the terminating _CharT().
+ traits_type::move(__first, __last, (this->_M_Finish() - __last) + 1);
+ this->_M_finish = this->_M_Finish() - (__last - __first);
+ }
+ return __first;
+ }
+
+public: // Replace. (Conceptually equivalent
+ // to erase followed by insert.)
+ _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
+ const size_type __size = size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n, __size - __pos);
+ if (__s.size() > max_size() - (__size - __len))
+ this->_M_throw_length_error();
+ return _M_replace(begin() + __pos, begin() + __pos + __len,
+ __s._M_Start(), __s._M_Finish(), &__s == this);
+ }
+
+ _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) {
+ const size_type __size1 = size();
+ const size_type __size2 = __s.size();
+ if (__pos1 > __size1 || __pos2 > __size2)
+ this->_M_throw_out_of_range();
+ const size_type __len1 = (min) (__n1, __size1 - __pos1);
+ const size_type __len2 = (min) (__n2, __size2 - __pos2);
+ if (__len2 > max_size() - (__size1 - __len1))
+ this->_M_throw_length_error();
+ return _M_replace(begin() + __pos1, begin() + __pos1 + __len1,
+ __s._M_Start() + __pos2, __s._M_Start() + __pos2 + __len2, &__s == this);
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ const _CharT* __s, size_type __n2) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ const size_type __size = size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n1, __size - __pos);
+ if (__n2 > max_size() - (__size - __len))
+ this->_M_throw_length_error();
+ return _M_replace(begin() + __pos, begin() + __pos + __len,
+ __s, __s + __n2, _M_inside(__s));
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return replace(__pos, __n1, __s, _Traits::length(__s));
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ size_type __n2, _CharT __c) {
+ const size_type __size = size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n1, __size - __pos);
+ if (__n2 > max_size() - (__size - __len))
+ this->_M_throw_length_error();
+ return replace(begin() + __pos, begin() + __pos + __len, __n2, __c);
+ }
+
+ _Self& replace(iterator __first, iterator __last, const _Self& __s) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ return _M_replace(__first, __last, __s._M_Start(), __s._M_Finish(), &__s == this);
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_replace(__first, __last, __s, __s + __n, _M_inside(__s));
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_replace(__first, __last, __s, __s + _Traits::length(__s), _M_inside(__s));
+ }
+
+ _Self& replace(iterator __first, iterator __last, size_type __n, _CharT __c);
+
+_STLP_PRIVATE: // Helper functions for replace.
+ _Self& _M_replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l, bool __self_ref);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _Integer>
+ _Self& _M_replace_dispatch(iterator __first, iterator __last,
+ _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return replace(__first, __last, (size_type) __n, (_CharT) __x);
+ }
+
+ template <class _InputIter>
+ _Self& _M_replace_dispatch(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ /* We are forced to do a temporary string to avoid the self referencing issue. */
+ const _Self __self(__f, __l, get_allocator());
+ return _M_replace(__first, __last, __self._M_Start(), __self._M_Finish(), false);
+ }
+
+public:
+ // Check to see if _InputIter is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& replace(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_replace_dispatch(__first, __last, __f, __l, _Integral());
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+public:
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ return _M_replace(__first, __last, __f, __l, _M_inside(__f));
+ }
+#endif
+
+public: // Other modifier member functions.
+
+ size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n, size() - __pos);
+ _Traits::copy(__s, this->_M_Start() + __pos, __len);
+ return __len;
+ }
+
+ void swap(_Self& __s) { this->_M_swap(__s); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public: // Conversion to C string.
+
+ const _CharT* c_str() const { return this->_M_Start(); }
+ const _CharT* data() const { return this->_M_Start(); }
+
+public: // find.
+ size_type find(const _Self& __s, size_type __pos = 0) const
+ { return find(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find(const _CharT* __s, size_type __pos = 0) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find(__s, __pos, _Traits::length(__s)); }
+
+ size_type find(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ // WIE: Versant schema compiler 5.2.2 ICE workaround
+ size_type find(_CharT __c) const { return find(__c, 0); }
+ size_type find(_CharT __c, size_type __pos /* = 0 */) const;
+
+public: // rfind.
+ size_type rfind(const _Self& __s, size_type __pos = npos) const
+ { return rfind(__s._M_Start(), __pos, __s.size()); }
+
+ size_type rfind(const _CharT* __s, size_type __pos = npos) const
+ { _STLP_FIX_LITERAL_BUG(__s) return rfind(__s, __pos, _Traits::length(__s)); }
+
+ size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const;
+ size_type rfind(_CharT __c, size_type __pos = npos) const;
+
+public: // find_first_of
+ size_type find_first_of(const _Self& __s, size_type __pos = 0) const
+ { return find_first_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_first_of(const _CharT* __s, size_type __pos = 0) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_first_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_first_of(_CharT __c, size_type __pos = 0) const
+ { return find(__c, __pos); }
+
+public: // find_last_of
+ size_type find_last_of(const _Self& __s, size_type __pos = npos) const
+ { return find_last_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_last_of(const _CharT* __s, size_type __pos = npos) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_last_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_last_of(_CharT __c, size_type __pos = npos) const
+ { return rfind(__c, __pos); }
+
+public: // find_first_not_of
+ size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const
+ { return find_first_not_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_first_not_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_first_not_of(_CharT __c, size_type __pos = 0) const;
+
+public: // find_last_not_of
+ size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const
+ { return find_last_not_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_last_not_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_last_not_of(_CharT __c, size_type __pos = npos) const;
+
+public: // Substring.
+ _Self substr(size_type __pos = 0, size_type __n = npos) const
+ { return _Self(*this, __pos, __n, get_allocator()); }
+
+public: // Compare
+ int compare(const _Self& __s) const
+ { return _M_compare(this->_M_Start(), this->_M_Finish(), __s._M_Start(), __s._M_Finish()); }
+
+ int compare(size_type __pos1, size_type __n1, const _Self& __s) const {
+ if (__pos1 > size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s._M_Start(), __s._M_Finish());
+ }
+
+ int compare(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) const {
+ if (__pos1 > size() || __pos2 > __s.size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s._M_Start() + __pos2,
+ __s._M_Start() + __pos2 + (min) (__n2, __s.size() - __pos2));
+ }
+
+ int compare(const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_compare(this->_M_Start(), this->_M_Finish(), __s, __s + _Traits::length(__s));
+ }
+
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos1 > size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s, __s + _Traits::length(__s));
+ }
+
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos1 > size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s, __s + __n2);
+ }
+
+public: // Helper functions for compare.
+ static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
+ const _CharT* __f2, const _CharT* __l2) {
+ const ptrdiff_t __n1 = __l1 - __f1;
+ const ptrdiff_t __n2 = __l2 - __f2;
+ const int cmp = _Traits::compare(__f1, __f2, (min) (__n1, __n2));
+ return cmp != 0 ? cmp : (__n1 < __n2 ? -1 : (__n1 > __n2 ? 1 : 0));
+ }
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define _STLP_STRING_SUM_BASE(__reserve, __size, __alloc) _STLP_PRIV _String_base<_CharT,_Alloc>(__alloc, __size + 1)
+# include <stl/_string_sum_methods.h>
+# undef _STLP_STRING_SUM_BASE
+#endif
+};
+
+#undef _STLP_PRIVATE
+
+#if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
+template <class _CharT, class _Traits, class _Alloc>
+const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0;
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<char, char_traits<char>, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+#endif
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# include <stl/_string_workaround.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// ------------------------------------------------------------
+// Non-member functions.
+// Swap.
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _CharT, class _Traits, class _Alloc>
+inline void _STLP_CALL
+swap(basic_string<_CharT,_Traits,_Alloc>& __x,
+ basic_string<_CharT,_Traits,_Alloc>& __y)
+{ __x.swap(__y); }
+#else
+inline void _STLP_CALL swap(string& __x, string& __y)
+{ __x.swap(__y); }
+# if defined (_STLP_HAS_WCHAR_T)
+inline void _STLP_CALL swap(wstring& __x, wstring& __y)
+{ __x.swap(__y); }
+# endif
+#endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _CharT, class _Traits, class _Alloc>
+struct __move_traits<basic_string<_CharT, _Traits, _Alloc> > {
+ typedef __true_type implemented;
+ //Completness depends on the allocator:
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+/*#else
+ * There is no need to specialize for string and wstring in this case
+ * as the default __move_traits will already tell that string is movable
+ * but not complete. We cannot define it as complete as nothing guaranty
+ * that the STLport user hasn't specialized std::allocator for char or
+ * wchar_t.
+ */
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT, class _Traits, class _Alloc>
+void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ _CharT* __buf, size_t __n);
+
+#if defined(_STLP_USE_WIDE_INTERFACE)
+// A couple of functions to transfer between ASCII/Unicode
+wstring __ASCIIToWide(const char *ascii);
+string __WideToASCII(const wchar_t *wide);
+#endif
+
+inline const char* _STLP_CALL
+__get_c_string(const string& __str) { return __str.c_str(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#include <stl/_string_operators.h>
+
+#if defined(_STLP_USE_NO_IOSTREAMS) || \
+ (defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION))
+# include <stl/_string.c>
+#endif
+
+#endif /* _STLP_INTERNAL_STRING_H */
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/stlport/stlport/stl/_string_base.h b/stlport/stlport/stl/_string_base.h
new file mode 100644
index 0000000..7c6d7fe
--- /dev/null
+++ b/stlport/stlport/stl/_string_base.h
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_BASE_H
+#define _STLP_STRING_BASE_H
+
+// ------------------------------------------------------------
+// Class _String_base.
+
+// _String_base is a helper class that makes it it easier to write an
+// exception-safe version of basic_string. The constructor allocates,
+// but does not initialize, a block of memory. The destructor
+// deallocates, but does not destroy elements within, a block of
+// memory. The destructor assumes that _M_start either is null, or else
+// points to a block of memory that was allocated using _String_base's
+// allocator and whose size is _M_end_of_storage - _M_start_of_storage._M_data.
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Alloc>
+class _String_base {
+ typedef _String_base<_Tp, _Alloc> _Self;
+protected:
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+public:
+ //dums: Some compiler(MSVC6) require it to be public not simply protected!
+ enum {_DEFAULT_SIZE = 4 * sizeof( void * )};
+ //This is needed by the full move framework
+ typedef _Alloc allocator_type;
+ typedef _STLP_alloc_proxy<_Tp*, _Tp, allocator_type> _AllocProxy;
+ typedef size_t size_type;
+private:
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ union _Buffers {
+ _Tp* _M_end_of_storage;
+ _Tp _M_static_buf[_DEFAULT_SIZE];
+ } _M_buffers;
+#else
+ _Tp* _M_end_of_storage;
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+protected:
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ bool _M_using_static_buf() const
+ { return (_M_start_of_storage._M_data == _M_buffers._M_static_buf); }
+ _Tp const* _M_Start() const { return _M_start_of_storage._M_data; }
+ _Tp* _M_Start() { return _M_start_of_storage._M_data; }
+ _Tp const* _M_End() const
+ { return _M_using_static_buf() ? _M_buffers._M_static_buf + _DEFAULT_SIZE : _M_buffers._M_end_of_storage; }
+ _Tp* _M_End()
+ { return _M_using_static_buf() ? _M_buffers._M_static_buf + _DEFAULT_SIZE : _M_buffers._M_end_of_storage; }
+ size_type _M_capacity() const
+ { return _M_using_static_buf() ? _DEFAULT_SIZE : _M_buffers._M_end_of_storage - _M_start_of_storage._M_data; }
+ size_type _M_rest() const
+ { return _M_using_static_buf() ? _DEFAULT_SIZE - (_M_finish - _M_buffers._M_static_buf) : _M_buffers._M_end_of_storage - _M_finish; }
+#else
+ _Tp const* _M_Start() const { return _M_start_of_storage._M_data; }
+ _Tp* _M_Start() { return _M_start_of_storage._M_data; }
+ _Tp const* _M_End() const { return _M_end_of_storage; }
+ _Tp* _M_End() { return _M_end_of_storage; }
+ size_type _M_capacity() const
+ { return _M_end_of_storage - _M_start_of_storage._M_data; }
+ size_type _M_rest() const
+ { return _M_end_of_storage - _M_finish; }
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+
+ _Tp* _M_finish;
+ _AllocProxy _M_start_of_storage;
+
+ _Tp const* _M_Finish() const {return _M_finish;}
+ _Tp* _M_Finish() {return _M_finish;}
+
+ // Precondition: 0 < __n <= max_size().
+ void _M_allocate_block(size_t __n = _DEFAULT_SIZE);
+ void _M_deallocate_block() {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (!_M_using_static_buf() && (_M_start_of_storage._M_data != 0))
+ _M_start_of_storage.deallocate(_M_start_of_storage._M_data, _M_buffers._M_end_of_storage - _M_start_of_storage._M_data);
+#else
+ if (_M_start_of_storage._M_data != 0)
+ _M_start_of_storage.deallocate(_M_start_of_storage._M_data, _M_end_of_storage - _M_start_of_storage._M_data);
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ }
+
+ size_t max_size() const {
+ const size_type __string_max_size = size_type(-1) / sizeof(_Tp);
+ typename allocator_type::size_type __alloc_max_size = _M_start_of_storage.max_size();
+ return (min)(__alloc_max_size, __string_max_size) - 1;
+ }
+
+ _String_base(const allocator_type& __a)
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ : _M_finish(_M_buffers._M_static_buf), _M_start_of_storage(__a, _M_buffers._M_static_buf)
+#else
+ : _M_end_of_storage(0), _M_finish(0), _M_start_of_storage(__a, (_Tp*)0)
+#endif
+ {}
+
+ _String_base(const allocator_type& __a, size_t __n)
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ : _M_finish(_M_buffers._M_static_buf), _M_start_of_storage(__a, _M_buffers._M_static_buf) {
+#else
+ : _M_end_of_storage(0), _M_finish(0), _M_start_of_storage(__a, (_Tp*)0) {
+#endif
+ _M_allocate_block(__n);
+ }
+
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ void _M_move_src (_Self &src) {
+ if (src._M_using_static_buf()) {
+ _M_buffers = src._M_buffers;
+ _M_finish = _M_buffers._M_static_buf + (src._M_finish - src._M_start_of_storage._M_data);
+ _M_start_of_storage._M_data = _M_buffers._M_static_buf;
+ }
+ else {
+ _M_start_of_storage._M_data = src._M_start_of_storage._M_data;
+ _M_finish = src._M_finish;
+ _M_buffers._M_end_of_storage = src._M_buffers._M_end_of_storage;
+ src._M_start_of_storage._M_data = 0;
+ }
+ }
+#endif
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _String_base(__move_source<_Self> src)
+# if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ : _M_start_of_storage(__move_source<_AllocProxy>(src.get()._M_start_of_storage)) {
+ _M_move_src(src.get());
+# else
+ : _M_end_of_storage(src.get()._M_end_of_storage), _M_finish(src.get()._M_finish),
+ _M_start_of_storage(__move_source<_AllocProxy>(src.get()._M_start_of_storage)) {
+ src.get()._M_start_of_storage._M_data = 0;
+# endif
+ }
+#endif
+
+ ~_String_base() { _M_deallocate_block(); }
+
+ void _M_reset(_Tp *__start, _Tp *__finish, _Tp *__end_of_storage) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ _M_buffers._M_end_of_storage = __end_of_storage;
+#else
+ _M_end_of_storage = __end_of_storage;
+#endif
+ _M_finish = __finish;
+ _M_start_of_storage._M_data = __start;
+ }
+
+ void _M_swap(_Self &__s) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (_M_using_static_buf()) {
+ if (__s._M_using_static_buf()) {
+ _STLP_STD::swap(_M_buffers, __s._M_buffers);
+ _Tp *__tmp = _M_finish;
+ _M_finish = _M_start_of_storage._M_data + (__s._M_finish - __s._M_start_of_storage._M_data);
+ __s._M_finish = __s._M_buffers._M_static_buf + (__tmp - _M_start_of_storage._M_data);
+ //We need to swap _M_start_of_storage for allocators with state:
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _M_start_of_storage._M_data = _M_buffers._M_static_buf;
+ __s._M_start_of_storage._M_data = __s._M_buffers._M_static_buf;
+ } else {
+ __s._M_swap(*this);
+ return;
+ }
+ }
+ else if (__s._M_using_static_buf()) {
+ _Tp *__tmp = _M_start_of_storage._M_data;
+ _Tp *__tmp_finish = _M_finish;
+ _Tp *__tmp_end_data = _M_buffers._M_end_of_storage;
+ _M_buffers = __s._M_buffers;
+ //We need to swap _M_start_of_storage for allocators with state:
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _M_start_of_storage._M_data = _M_buffers._M_static_buf;
+ _M_finish = _M_buffers._M_static_buf + (__s._M_finish - __s._M_buffers._M_static_buf);
+ __s._M_buffers._M_end_of_storage = __tmp_end_data;
+ __s._M_start_of_storage._M_data = __tmp;
+ __s._M_finish = __tmp_finish;
+ }
+ else {
+ _STLP_STD::swap(_M_buffers._M_end_of_storage, __s._M_buffers._M_end_of_storage);
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _STLP_STD::swap(_M_finish, __s._M_finish);
+ }
+#else
+ _STLP_STD::swap(_M_end_of_storage, __s._M_end_of_storage);
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _STLP_STD::swap(_M_finish, __s._M_finish);
+#endif
+ }
+
+ void _STLP_FUNCTION_THROWS _M_throw_length_error() const;
+ void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _String_base<char, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _String_base<wchar_t, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STRING_BASE_H */
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/stlport/stlport/stl/_string_fwd.h b/stlport/stlport/stl/_string_fwd.h
new file mode 100644
index 0000000..fe65385
--- /dev/null
+++ b/stlport/stlport/stl/_string_fwd.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_FWD_H
+#define _STLP_STRING_FWD_H
+
+#ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT,
+ class _Traits = char_traits<_CharT>,
+ class _Alloc = allocator<_CharT> >
+class basic_string;
+#else
+template <class _CharT,
+ class _Traits,
+ class _Alloc>
+class basic_string;
+#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
+
+typedef basic_string<char, char_traits<char>, allocator<char> > string;
+
+#if defined (_STLP_HAS_WCHAR_T)
+typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//This function limits header dependency between exception and string
+//implementation. It is implemented in _string.h
+const char* _STLP_CALL __get_c_string(const string& __str);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STRING_FWD_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_string_hash.h b/stlport/stlport/stl/_string_hash.h
new file mode 100644
index 0000000..87f2d9f
--- /dev/null
+++ b/stlport/stlport/stl/_string_hash.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_HASH_H
+#define _STLP_STRING_HASH_H
+
+#ifndef _STLP_HASH_FUN_H
+# include <stl/_hash_fun.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _Traits, class _Alloc>
+_STLP_INLINE_LOOP size_t
+__stl_string_hash(const basic_string<_CharT,_Traits,_Alloc>& __s) {
+ unsigned long __h = 0;
+ size_t __len = __s.size();
+ const _CharT* __data = __s.data();
+ for ( size_t __i = 0; __i < __len; ++__i)
+ __h = /* 5 *__h */(__h << 2) + __h + __data[__i];
+ return size_t(__h);
+}
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && \
+ (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x560))
+template <class _CharT, class _Traits, class _Alloc>
+struct hash<basic_string<_CharT,_Traits,_Alloc> > {
+ size_t operator()(const basic_string<_CharT,_Traits,_Alloc>& __s) const
+ { return __stl_string_hash(__s); }
+};
+
+#else
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC hash<string> {
+ size_t operator()(const string& __s) const
+ { return __stl_string_hash(__s); }
+};
+
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC hash<wstring> {
+ size_t operator()(const wstring& __s) const
+ { return __stl_string_hash(__s); }
+};
+# endif
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif
diff --git a/stlport/stlport/stl/_string_npos.h b/stlport/stlport/stl/_string_npos.h
new file mode 100644
index 0000000..faa9c62
--- /dev/null
+++ b/stlport/stlport/stl/_string_npos.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2005
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/* This header contains npos definition used in basic_string and rope
+ * implementation. It do not have to be guarded as files including it
+ * are already guarded and it has sometimes to be included several times.
+ */
+
+#if defined (_STLP_STATIC_CONST_INIT_BUG)
+ enum { npos = -1 };
+#elif defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
+ // inline initializer conflicts with 'extern template'
+ static const size_t npos;
+#else
+ static const size_t npos = ~(size_t)0;
+#endif
diff --git a/stlport/stlport/stl/_string_operators.h b/stlport/stlport/stl/_string_operators.h
new file mode 100644
index 0000000..cff13af
--- /dev/null
+++ b/stlport/stlport/stl/_string_operators.h
@@ -0,0 +1,602 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_OPERATORS_H
+#define _STLP_STRING_OPERATORS_H
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_USE_TEMPLATE_EXPRESSION)
+
+# if defined (__GNUC__) || defined (__MLCCPP__)
+# define _STLP_INIT_AMBIGUITY 1
+# endif
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ typedef basic_string<_CharT,_Traits,_Alloc> _Str;
+ typedef typename _Str::_Reserve_t _Reserve_t;
+# if defined (_STLP_INIT_AMBIGUITY)
+ // gcc counts this as a function
+ _Str __result = _Str(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator());
+# else
+ _Str __result(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator());
+# endif
+ __result.append(__s);
+ __result.append(__y);
+ return __result;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
+operator+(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ typedef basic_string<_CharT,_Traits,_Alloc> _Str;
+ typedef typename _Str::_Reserve_t _Reserve_t;
+ const size_t __n = _Traits::length(__s);
+# if defined (_STLP_INIT_AMBIGUITY)
+ _Str __result = _Str(_Reserve_t(), __n + __y.size(), __y.get_allocator());
+# else
+ _Str __result(_Reserve_t(), __n + __y.size(), __y.get_allocator());
+# endif
+ __result.append(__s, __s + __n);
+ __result.append(__y);
+ return __result;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
+operator+(_CharT __c,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ typedef basic_string<_CharT,_Traits,_Alloc> _Str;
+ typedef typename _Str::_Reserve_t _Reserve_t;
+# if defined (_STLP_INIT_AMBIGUITY)
+ _Str __result = _Str(_Reserve_t(), 1 + __y.size(), __y.get_allocator());
+# else
+ _Str __result(_Reserve_t(), 1 + __y.size(), __y.get_allocator());
+# endif
+ __result.push_back(__c);
+ __result.append(__y);
+ return __result;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ typedef basic_string<_CharT,_Traits,_Alloc> _Str;
+ typedef typename _Str::_Reserve_t _Reserve_t;
+ const size_t __n = _Traits::length(__s);
+# if defined (_STLP_INIT_AMBIGUITY)
+ _Str __result = _Str(_Reserve_t(), __x.size() + __n, __x.get_allocator());
+# else
+ _Str __result(_Reserve_t(), __x.size() + __n, __x.get_allocator());
+# endif
+ __result.append(__x);
+ __result.append(__s, __s + __n);
+ return __result;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT __c) {
+ typedef basic_string<_CharT,_Traits,_Alloc> _Str;
+ typedef typename _Str::_Reserve_t _Reserve_t;
+# if defined (_STLP_INIT_AMBIGUITY)
+ _Str __result = _Str(_Reserve_t(), __x.size() + 1, __x.get_allocator());
+# else
+ _Str __result(_Reserve_t(), __x.size() + 1, __x.get_allocator());
+# endif
+ __result.append(__x);
+ __result.push_back(__c);
+ return __result;
+}
+
+# undef _STLP_INIT_AMBIGUITY
+
+#else /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+// addition with basic_string
+template <class _CharT, class _Traits, class _Alloc>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs,
+ const basic_string<_CharT,_Traits,_Alloc>& __rhs) {
+ typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right> __root_type;
+ __root_type __root(__rhs, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__lhs.get_allocator()));
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ __root_type,
+ _STLP_PRIV __on_right>(__lhs, __root);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs,
+ const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __rhs) {
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right>(__lhs, __rhs);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __on_left> _STLP_CALL
+operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __lhs,
+ const basic_string<_CharT,_Traits,_Alloc>& __rhs) {
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __on_left>(__lhs, __rhs);
+}
+
+// addition with C string
+template <class _CharT, class _Traits, class _Alloc>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ const size_t __n = _Traits::length(__s);
+ typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right> __root_type;
+ __root_type __root(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ __root_type, _STLP_PRIV __on_right>(__x, __root);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ const size_t __n = _Traits::length(__s);
+ typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right> __root_type;
+ __root_type __root(__y, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__y.get_allocator()));
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
+ __root_type,
+ _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __root);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __on_left> _STLP_CALL
+operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x,
+ const _CharT* __s) {
+ const size_t __n = _Traits::length(__s);
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __on_left>(__x, _STLP_PRIV __cstr_wrapper<_CharT>(__s, __n));
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __y) {
+ const size_t __n = _Traits::length(__s);
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __y);
+}
+
+// addition with char
+template <class _CharT, class _Traits, class _Alloc>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT __c) {
+ typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right> __root_type;
+ __root_type __root(__c, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ __root_type, _STLP_PRIV __on_right>(__x, __root);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const _CharT __c, const basic_string<_CharT,_Traits,_Alloc>& __x) {
+ typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right> __root_type;
+ __root_type __root(__x, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
+ __root_type, _STLP_PRIV __on_right>(__c, __root);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __on_left> _STLP_CALL
+operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x, const _CharT __c) {
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __char_wrapper<_CharT>, _STLP_PRIV __on_left>(__x, __c);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const _CharT __c, const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x) {
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right>(__c, __x);
+}
+
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+// Operator== and operator!=
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator==(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator==(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+// Operator< (and also >, <=, and >=).
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end()) < 0;
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end()) < 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end()) < 0;
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n,
+ __y.begin(), __y.end()) < 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
+ __s, __s + __n) < 0;
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n,
+ __y.begin(), __y.end()) < 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
+ __s, __s + __n) < 0;
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+
+/* Only defined if _STLP_USE_SEPARATE_RELOPS_NAMESPACE is defined otherwise
+ * it might introduce ambiguity with pure template relational operators
+ * from rel_ops namespace.
+ */
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y)
+{ return !(__x == __y); }
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y)
+{ return __y < __x; }
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y)
+{ return !(__y < __x); }
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y)
+{ return !(__x < __y); }
+
+# if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y)
+{ return !(__x==__y); }
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y)
+{ return !(__x==__y); }
+# endif
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator!=(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s == __y);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__x == __s);
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator!=(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s == __y);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__x == __s);
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return __y < __s;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return __s < __x;
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator>(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return __y < __s;
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator>(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return __s < __x;
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<=(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__y < __s);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s < __x);
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<=(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__y < __s);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s < __x);
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>=(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s < __y);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__x < __s);
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator>=(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s < __y);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator>=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__x < __s);
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STRING_OPERATORS_H */
+
diff --git a/stlport/stlport/stl/_tempbuf.c b/stlport/stlport/stl/_tempbuf.c
new file mode 100644
index 0000000..179b472
--- /dev/null
+++ b/stlport/stlport/stl/_tempbuf.c
@@ -0,0 +1,57 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_TEMPBUF_C
+#define _STLP_TEMPBUF_C
+
+#ifndef _STLP_INTERNAL_TEMPBUF_H
+# include <stl/_tempbuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+pair<_Tp*, ptrdiff_t> _STLP_CALL
+__get_temporary_buffer(ptrdiff_t __len, _Tp*)
+{
+ if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp)))
+ __len = INT_MAX / sizeof(_Tp);
+
+ while (__len > 0) {
+ _Tp* __tmp = (_Tp*) malloc((size_t)__len * sizeof(_Tp));
+ if (__tmp != 0)
+ return pair<_Tp*, ptrdiff_t>(__tmp, __len);
+ __len /= 2;
+ }
+
+ return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0);
+}
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_TEMPBUF_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/_tempbuf.h b/stlport/stlport/stl/_tempbuf.h
new file mode 100644
index 0000000..0e0a747
--- /dev/null
+++ b/stlport/stlport/stl/_tempbuf.h
@@ -0,0 +1,167 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_TEMPBUF_H
+#define _STLP_INTERNAL_TEMPBUF_H
+
+#ifndef _STLP_CLIMITS
+# include <climits>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+pair<_Tp*, ptrdiff_t> _STLP_CALL
+__get_temporary_buffer(ptrdiff_t __len, _Tp*);
+
+#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+
+template <class _Tp>
+inline pair<_Tp*, ptrdiff_t> _STLP_CALL get_temporary_buffer(ptrdiff_t __len) {
+ return __get_temporary_buffer(__len, (_Tp*) 0);
+}
+
+# if ! defined(_STLP_NO_EXTENSIONS)
+// This overload is not required by the standard; it is an extension.
+// It is supported for backward compatibility with the HP STL, and
+// because not all compilers support the language feature (explicit
+// function template arguments) that is required for the standard
+// version of get_temporary_buffer.
+template <class _Tp>
+inline pair<_Tp*, ptrdiff_t> _STLP_CALL
+get_temporary_buffer(ptrdiff_t __len, _Tp*) {
+ return __get_temporary_buffer(__len, (_Tp*) 0);
+}
+# endif
+#endif
+
+template <class _Tp>
+inline void _STLP_CALL return_temporary_buffer(_Tp* __p) {
+// SunPro brain damage
+ free((char*)__p);
+}
+
+template <class _ForwardIterator, class _Tp>
+class _Temporary_buffer {
+private:
+ ptrdiff_t _M_original_len;
+ ptrdiff_t _M_len;
+ _Tp* _M_buffer;
+
+ void _M_allocate_buffer() {
+ _M_original_len = _M_len;
+ _M_buffer = 0;
+
+ if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp)))
+ _M_len = INT_MAX / sizeof(_Tp);
+
+ while (_M_len > 0) {
+ _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp));
+ if (_M_buffer)
+ break;
+ _M_len /= 2;
+ }
+ }
+
+ void _M_initialize_buffer(const _Tp&, const __true_type&) {}
+ void _M_initialize_buffer(const _Tp& val, const __false_type&) {
+ uninitialized_fill_n(_M_buffer, _M_len, val);
+ }
+
+public:
+ ptrdiff_t size() const { return _M_len; }
+ ptrdiff_t requested_size() const { return _M_original_len; }
+ _Tp* begin() { return _M_buffer; }
+ _Tp* end() { return _M_buffer + _M_len; }
+
+ _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) {
+ // Workaround for a __type_traits bug in the pre-7.3 compiler.
+# if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION < 730
+ typedef typename __type_traits<_Tp>::is_POD_type _Trivial;
+# else
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Trivial;
+# endif
+ _STLP_TRY {
+ _M_len = _STLP_STD::distance(__first, __last);
+ _M_allocate_buffer();
+ if (_M_len > 0)
+ _M_initialize_buffer(*__first, _Trivial());
+ }
+ _STLP_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0)
+ }
+
+ ~_Temporary_buffer() {
+ _STLP_STD::_Destroy_Range(_M_buffer, _M_buffer + _M_len);
+ free(_M_buffer);
+ }
+
+private:
+ // Disable copy constructor and assignment operator.
+ _Temporary_buffer(const _Temporary_buffer<_ForwardIterator, _Tp>&) {}
+ void operator=(const _Temporary_buffer<_ForwardIterator, _Tp>&) {}
+};
+
+# ifndef _STLP_NO_EXTENSIONS
+
+// Class temporary_buffer is not part of the standard. It is an extension.
+
+template <class _ForwardIterator,
+ class _Tp
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ = typename iterator_traits<_ForwardIterator>::value_type
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+ >
+struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>
+{
+ temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
+ : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) {}
+ ~temporary_buffer() {}
+};
+
+# endif /* _STLP_NO_EXTENSIONS */
+
+_STLP_END_NAMESPACE
+
+# ifndef _STLP_LINK_TIME_INSTANTIATION
+# include <stl/_tempbuf.c>
+# endif
+
+#endif /* _STLP_INTERNAL_TEMPBUF_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/char_traits.h b/stlport/stlport/stl/char_traits.h
new file mode 100644
index 0000000..f004a70
--- /dev/null
+++ b/stlport/stlport/stl/char_traits.h
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CHAR_TRAITS_H
+#define _STLP_CHAR_TRAITS_H
+
+// Define char_traits
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#if defined (__unix)
+# include <sys/types.h> // For off_t
+#endif /* __unix */
+
+#if defined (__BORLANDC__)
+# include <mem.h>
+# include <string.h>
+# include <_stddef.h>
+# include <sys/types.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CWCHAR
+# include <stl/_cwchar.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp> class allocator;
+
+#define _STLP_NULL_CHAR_INIT(_ChT) _STLP_DEFAULT_CONSTRUCTED(_ChT)
+
+#if defined(_STLP_WCE)
+typedef long streamoff;
+#elif defined (_STLP_WIN32)
+# if defined (_STLP_LONG_LONG) && !defined (__CYGWIN__)
+//The Win32 file io API support 64 bits access so streamoff and streamsize
+//has to reflect that. Do not change the stringbuf behavior.
+typedef _STLP_LONG_LONG streamoff;
+# else
+typedef ptrdiff_t streamoff;
+# endif
+#else // __unix
+# ifdef _STLP_USE_DEFAULT_FILE_OFFSET
+typedef off_t streamoff;
+# elif defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE) /* || defined(__USE_FILE_OFFSET64) */ \
+ /* || (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */ /* || defined (__sgi) && defined (_STLP_HAS_NO_NEW_C_HEADERS) */
+typedef off64_t streamoff;
+# else
+typedef off_t streamoff;
+# endif
+#endif /* __unix */
+
+#if defined (_STLP_WIN32)
+typedef streamoff streamsize;
+#else
+typedef ptrdiff_t streamsize;
+#endif
+
+// Class fpos, which represents a position within a file. (The C++
+// standard calls for it to be defined in <ios>. This implementation
+// moves it to <iosfwd>, which is included by <ios>.)
+template <class _StateT> class fpos {
+public: // From table 88 of the C++ standard.
+ fpos(streamoff __pos) : _M_pos(__pos), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {}
+ fpos() : _M_pos(0), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {}
+
+ operator streamoff() const { return _M_pos; }
+
+ bool operator==(const fpos& __y) const
+ { return _M_pos == __y._M_pos; }
+ bool operator!=(const fpos& __y) const
+ { return _M_pos != __y._M_pos; }
+
+ fpos& operator+=(streamoff __off) {
+ _M_pos += __off;
+ return *this;
+ }
+ fpos& operator-=(streamoff __off) {
+ _M_pos -= __off;
+ return *this;
+ }
+
+ fpos operator+(streamoff __off) {
+ fpos __tmp(*this);
+ __tmp += __off;
+ return __tmp;
+ }
+ fpos operator-(streamoff __off) {
+ fpos __tmp(*this);
+ __tmp -= __off;
+ return __tmp;
+ }
+
+public: // Manipulation of the state member.
+ _StateT state() const { return _M_st; }
+ void state(_StateT __st) { _M_st = __st; }
+private:
+ streamoff _M_pos;
+ _StateT _M_st;
+};
+
+typedef fpos<mbstate_t> streampos;
+typedef fpos<mbstate_t> wstreampos;
+
+// Class __char_traits_base.
+template <class _CharT, class _IntT>
+class __char_traits_base {
+public:
+ typedef _CharT char_type;
+ typedef _IntT int_type;
+ typedef streamoff off_type;
+ typedef streampos pos_type;
+ typedef mbstate_t state_type;
+
+ static void _STLP_CALL assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; }
+ static bool _STLP_CALL eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+ static bool _STLP_CALL lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int _STLP_CALL compare(const char_type* __s1, const char_type* __s2, size_t __n) {
+ for (size_t __i = 0; __i < __n; ++__i)
+ if (!eq(__s1[__i], __s2[__i]))
+ return __s1[__i] < __s2[__i] ? -1 : 1;
+ return 0;
+ }
+
+ static size_t _STLP_CALL length(const char_type* __s) {
+ const char_type _NullChar = _STLP_DEFAULT_CONSTRUCTED(char_type);
+ size_t __i(0);
+ for (; !eq(__s[__i], _NullChar); ++__i) {}
+ return __i;
+ }
+
+ static const char_type* _STLP_CALL find(const char_type* __s, size_t __n, const char_type& __c) {
+ for ( ; __n > 0 ; ++__s, --__n)
+ if (eq(*__s, __c))
+ return __s;
+ return 0;
+ }
+
+ static char_type* _STLP_CALL move(char_type* __s1, const char_type* __s2, size_t _Sz)
+ { return (_Sz == 0 ? __s1 : (char_type*)memmove(__s1, __s2, _Sz * sizeof(char_type))); }
+
+ static char_type* _STLP_CALL copy(char_type* __s1, const char_type* __s2, size_t __n) {
+ return (__n == 0 ? __s1 :
+ (char_type*)memcpy(__s1, __s2, __n * sizeof(char_type)));
+ }
+
+ static char_type* _STLP_CALL assign(char_type* __s, size_t __n, char_type __c) {
+ for (size_t __i = 0; __i < __n; ++__i)
+ __s[__i] = __c;
+ return __s;
+ }
+
+ static int_type _STLP_CALL not_eof(const int_type& __c)
+ { return !eq_int_type(__c, eof()) ? __c : __STATIC_CAST(int_type, 0); }
+
+ static char_type _STLP_CALL to_char_type(const int_type& __c)
+ { return (char_type)__c; }
+
+ static int_type _STLP_CALL to_int_type(const char_type& __c)
+ { return (int_type)__c; }
+
+ static bool _STLP_CALL eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static int_type _STLP_CALL eof()
+ { return (int_type)-1; }
+};
+
+// Generic char_traits class. Note that this class is provided only
+// as a base for explicit specialization; it is unlikely to be useful
+// as is for any particular user-defined type. In particular, it
+// *will not work* for a non-POD type.
+
+template <class _CharT>
+class char_traits
+ : public __char_traits_base<_CharT, _CharT> {};
+
+// Specialization for char.
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC char_traits<char>
+ : public __char_traits_base<char, int>,
+ public __stlport_class<char_traits<char> > {
+public:
+ typedef char char_type;
+ typedef int int_type;
+ typedef streamoff off_type;
+ typedef streampos pos_type;
+ typedef mbstate_t state_type;
+
+ static char _STLP_CALL to_char_type(const int& __c)
+ { return (char)(unsigned char)__c; }
+
+ static int _STLP_CALL to_int_type(const char& __c)
+ { return (unsigned char)__c; }
+
+ static int _STLP_CALL compare(const char* __s1, const char* __s2, size_t __n)
+ { return memcmp(__s1, __s2, __n); }
+
+ static size_t _STLP_CALL length(const char* __s)
+ { return strlen(__s); }
+
+ static void _STLP_CALL assign(char& __c1, const char& __c2)
+ { __c1 = __c2; }
+
+ static char* _STLP_CALL assign(char* __s, size_t __n, char __c) {
+ memset(__s, __c, __n);
+ return __s;
+ }
+};
+
+#if defined (_STLP_HAS_WCHAR_T)
+// Specialization for wchar_t.
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC char_traits<wchar_t>
+ : public __char_traits_base<wchar_t, wint_t> {
+# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && !defined (_STLP_WCHAR_HPACC_EXCLUDE)
+public:
+# if !defined (__BORLANDC__)
+ static wchar_t* _STLP_CALL move(wchar_t* __dest, const wchar_t* __src, size_t __n)
+ { return wmemmove(__dest, __src, __n); }
+# endif
+
+ static wchar_t* _STLP_CALL copy(wchar_t* __dest, const wchar_t* __src, size_t __n)
+ { return wmemcpy(__dest, __src, __n); }
+
+# if !defined (__DMC__) && !defined (__BORLANDC__)
+ static int _STLP_CALL compare(const wchar_t* __s1, const wchar_t* __s2, size_t __n)
+ { return wmemcmp(__s1, __s2, __n); }
+# endif
+
+ static wchar_t* _STLP_CALL assign(wchar_t* __s, size_t __n, wchar_t __c)
+ { return wmemset(__s, __c, __n); }
+
+ static size_t _STLP_CALL length(const wchar_t* __s)
+ { return wcslen(__s); }
+
+ static void _STLP_CALL assign(wchar_t& __c1, const wchar_t& __c2)
+ { __c1 = __c2; }
+# endif
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_CHAR_TRAITS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/stl/config/_auto_link.h b/stlport/stlport/stl/config/_auto_link.h
new file mode 100644
index 0000000..8898c55
--- /dev/null
+++ b/stlport/stlport/stl/config/_auto_link.h
@@ -0,0 +1,61 @@
+/* We do not use auto link feature when:
+ * - user asked not to use it (_STLP_DONT_USE_AUTO_LINK)
+ * - STLport is used only as a STL library (_STLP_NO_IOSTREAMS || _STLP_USE_NO_IOSTREAMS)
+ * - we are building a C translation unit, STLport is a C++ Standard library implementation
+ */
+#if !defined (__BUILDING_STLPORT) && !defined (_STLP_DONT_USE_AUTO_LINK) && \
+ !defined (_STLP_NO_IOSTREAMS) && !defined (_STLP_USE_NO_IOSTREAMS) && \
+ defined (__cplusplus)
+
+# define _STLP_STRINGIZE(X) _STLP_STRINGIZE_AUX(X)
+# define _STLP_STRINGIZE_AUX(X) #X
+
+# if defined (_STLP_DEBUG)
+# define _STLP_LIB_OPTIM_MODE "stld"
+# elif defined (_DEBUG)
+# define _STLP_LIB_OPTIM_MODE "d"
+# else
+# define _STLP_LIB_OPTIM_MODE ""
+# endif
+
+# if defined (_STLP_LIB_NAME_MOTIF)
+# define _STLP_LIB_MOTIF "_"_STLP_LIB_NAME_MOTIF
+# else
+# define _STLP_LIB_MOTIF ""
+# endif
+
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# define _STLP_LIB_TYPE "_x"
+# else
+# define _STLP_LIB_TYPE ""
+# endif
+# else
+# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# define _STLP_LIB_TYPE "_statix"
+# else
+# define _STLP_LIB_TYPE "_static"
+# endif
+# endif
+
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_VERSION_STR "."_STLP_STRINGIZE(_STLPORT_MAJOR)"."_STLP_STRINGIZE(_STLPORT_MINOR)
+# else
+# define _STLP_VERSION_STR ""
+# endif
+
+# define _STLP_STLPORT_LIB "stlport"_STLP_LIB_OPTIM_MODE""_STLP_LIB_TYPE""_STLP_LIB_MOTIF""_STLP_VERSION_STR".lib"
+
+# if defined (_STLP_VERBOSE)
+# pragma message ("STLport: Auto linking to "_STLP_STLPORT_LIB)
+# endif
+# pragma comment (lib, _STLP_STLPORT_LIB)
+
+# undef _STLP_STLPORT_LIB
+# undef _STLP_LIB_OPTIM_MODE
+# undef _STLP_LIB_TYPE
+# undef _STLP_STRINGIZE_AUX
+# undef _STLP_STRINGIZE
+
+#endif /* _STLP_DONT_USE_AUTO_LINK */
+
diff --git a/stlport/stlport/stl/config/_detect_dll_or_lib.h b/stlport/stlport/stl/config/_detect_dll_or_lib.h
new file mode 100644
index 0000000..a062e69
--- /dev/null
+++ b/stlport/stlport/stl/config/_detect_dll_or_lib.h
@@ -0,0 +1,74 @@
+/* File used to define macros:
+ * _STLP_USE_DYNAMIC_LIB: To signal use STLport as a dll or build of the
+ * STLport dlls.
+ * _STLP_USE_STATIC_LIB: To signal use of STLport as a static lib or build of
+ * the STLport static libs.
+ * _STLP_USING_CROSS_NATIVE_RUNTIME_LIB: Signal that we are using a native runtime
+ * in a version different from the STLport one.
+ * If _STLP_USE_DYNAMIC_LIB or _STLP_USE_STATIC_LIB is alreday defined it means that
+ * user forces use of a specific version. In this case _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+ * will surely be defined otherwise there is no need to force macro defines.
+ *
+ * Before including this file the compiler must define:
+ * _STLP_DLL: If we are building a dll
+ * _STLP_RUNTIME_DLL: If we are using native runtime as a dll
+ */
+#if defined (__BUILDING_STLPORT)
+# undef _STLP_USE_DYNAMIC_LIB
+# undef _STLP_USE_STATIC_LIB
+# if defined (_STLP_DLL)
+/* We are building the STLport dll */
+# define _STLP_USE_DYNAMIC_LIB
+# if !defined (_STLP_RUNTIME_DLL)
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# else
+# define _STLP_USE_STATIC_LIB
+# if defined (_STLP_RUNTIME_DLL)
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# endif
+#else
+# if !defined (_STLP_NO_IOSTREAMS)
+/* STLport use only depend on _STLP_RUNTIME_DLL as we are replacing
+ * the native runtime.
+ */
+# if defined (_STLP_RUNTIME_DLL)
+# if !defined (_STLP_USE_STATIC_LIB)
+# if !defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DYNAMIC_LIB
+# endif
+# else
+/* The user is forcing use of STLport as a dynamic library. We signal it so
+ * that the STLport namespace will be modify to report such a combination
+ * and force the user to link with the rebuilt STLport library.
+ */
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# else
+# if !defined(_STLP_USE_DYNAMIC_LIB)
+# if !defined (_STLP_USE_STATIC_LIB)
+# define _STLP_USE_STATIC_LIB
+# endif
+# else
+/* Idem previous remark but the user forces use of the static native runtime.
+ */
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# endif
+# else
+/* If we do not build and use STLport libs we consider that we are in a static lib
+ * mode as only dynamic lib needs additional export/import specifier.
+ */
+# define _STLP_USE_STATIC_LIB
+# endif
+#endif
+
+/* we don't have a static native runtime library on evc3/evc4 */
+#ifdef _STLP_WCE
+# undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+#endif
+
+#if !defined (_STLP_USE_DYNAMIC_LIB) && !defined (_STLP_USE_STATIC_LIB)
+# error Unknown STLport usage config (dll/lib?)
+#endif
diff --git a/stlport/stlport/stl/config/_epilog.h b/stlport/stlport/stl/config/_epilog.h
new file mode 100644
index 0000000..30d1e24
--- /dev/null
+++ b/stlport/stlport/stl/config/_epilog.h
@@ -0,0 +1,29 @@
+#if defined (_STLP_MSVC) || defined (__ICL)
+
+# pragma warning (pop)
+# pragma pack (pop)
+
+#elif defined (__BORLANDC__)
+
+# pragma option pop
+# pragma option -w-pow // -w-8062 Previous options and warnings not restored
+
+#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+
+# pragma reset woff 1174
+# pragma reset woff 1375
+# pragma reset woff 1209
+/* from iterator_base.h */
+# pragma reset woff 1183
+
+#elif defined (__DECCXX)
+
+# ifdef __PRAGMA_ENVIRONMENT
+# pragma __environment __restore
+# endif
+
+#elif defined (__IBMCPP__)
+
+# pragma info(restore)
+
+#endif
diff --git a/stlport/stlport/stl/config/_feedback.h b/stlport/stlport/stl/config/_feedback.h
new file mode 100644
index 0000000..0171ca5
--- /dev/null
+++ b/stlport/stlport/stl/config/_feedback.h
@@ -0,0 +1,43 @@
+/* Helper header to give feedback about build environment configuration
+ * thanks to #pragma message directives.
+ */
+
+#if defined (_STLP_VERBOSE)
+# define _STLP_VERBOSE_MODE_SUPPORTED
+
+# if defined (_STLP_COMPILER)
+# pragma message (_STLP_COMPILER)
+# endif
+
+# if defined (_STLP_NO_RTTI)
+# pragma message ("STLport: RTTI support -> Disabled")
+# else
+# pragma message ("STLport: RTTI support -> Enabled")
+# endif
+
+# if defined (_STLP_HAS_NO_EXCEPTIONS)
+# pragma message ("STLport: Exception support -> Disabled")
+# else
+# pragma message ("STLport: Exception support -> Enabled")
+# endif
+
+# if defined (_STLP_THREADS)
+# pragma message ("STLport: Threading model -> Multi")
+# else
+# pragma message ("STLport: Threading model -> Mono")
+# endif
+
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# pragma message ("STLport: Library model -> Dynamic")
+# else
+# pragma message ("STLport: Library model -> Static")
+# endif
+
+# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# pragma message ("STLport: Native library model -> Static")
+# else
+# pragma message ("STLport: Native library model -> Dynamic")
+# endif
+# endif
+#endif
diff --git a/stlport/stlport/stl/config/_msvc.h b/stlport/stlport/stl/config/_msvc.h
new file mode 100644
index 0000000..418d018
--- /dev/null
+++ b/stlport/stlport/stl/config/_msvc.h
@@ -0,0 +1,265 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ * Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0, ICL
+ */
+
+#if !defined (_STLP_COMPILER)
+# define _STLP_COMPILER "Microsoft Visual Studio C++"
+#endif
+
+#if !defined (__ICL) && !defined (_STLP_MSVC)
+# define _STLP_MSVC _MSC_VER
+#endif
+
+#if !defined (_STLP_MSVC_LIB)
+# define _STLP_MSVC_LIB _MSC_VER
+#endif
+
+#if defined (__BUILDING_STLPORT) && defined (_MANAGED)
+/* Building a managed version of STLport is not supported because we haven't
+ * found a good reason to support it. However, building a managed translation
+ * unit using STLport _is_ supported.
+ */
+# error Sorry but building a managed version of STLport is not supported.
+#endif
+
+#if defined (_STLP_USING_PLATFORM_SDK_COMPILER)
+/* This is a specific section for compilers coming with platform SDKs. Native
+ * library coming with it is different from the one coming with commercial
+ * MSVC compilers so there is some specific settings.
+ */
+# define _STLP_NATIVE_INCLUDE_PATH ../crt
+# define _STLP_VENDOR_GLOBAL_CSTD
+# define _STLP_VENDOR_TERMINATE_STD
+# define _STLP_GLOBAL_NEW_HANDLER
+# if (_STLP_MSVC_LIB <= 1400)
+/* We hope this bug will be fixed in future versions. */
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+# endif
+#endif
+
+#define _STLP_CALL __cdecl
+
+#ifndef _STLP_LONG_LONG
+# define _STLP_LONG_LONG __int64
+#endif
+
+#define _STLP_PRAGMA_ONCE
+
+/* These switches depend on compiler flags. We are hoping here that compilers
+ * simulating MSVC behavior use identical macros to report compilation context.
+ * Otherwise those macros will have to be undef in specific compiler configuration
+ * files.
+ */
+#ifndef _CPPUNWIND
+# define _STLP_DONT_USE_EXCEPTIONS 1
+#endif
+
+#ifndef _CPPRTTI
+# define _STLP_NO_RTTI 1
+#endif
+
+#if defined (_MT) && !defined (_STLP_NO_THREADS)
+# define _STLP_THREADS 1
+#endif
+
+#if !defined (_NATIVE_WCHAR_T_DEFINED)
+# define _STLP_WCHAR_T_IS_USHORT 1
+#endif
+
+#define _STLP_NO_VENDOR_STDLIB_L 1
+
+#if defined (_STLP_MSVC)
+
+# if (_STLP_MSVC < 1200)
+# error Microsoft Visual C++ compilers before version 6 (SP5) are not supported.
+# endif
+
+# define _STLP_NORETURN_FUNCTION __declspec(noreturn)
+
+/* Full compiler version comes from boost library intrinsics.hpp header. */
+# if defined (_MSC_FULL_VER) && (_MSC_FULL_VER >= 140050215)
+# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
+# define _STLP_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T)
+# define _STLP_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T)
+# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
+# define _STLP_IS_POD(T) __is_pod(T)
+# define _STLP_HAS_TYPE_TRAITS_INTRINSICS
+# endif
+
+# ifndef _STLP_MSVC50_COMPATIBILITY
+# define _STLP_MSVC50_COMPATIBILITY 1
+# endif
+
+# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
+# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1
+# define _STLP_NO_STATIC_CONST_DEFINITION 1
+
+/* # ifndef __BUILDING_STLPORT
+ * # define _STLP_USE_TEMPLATE_EXPORT 1
+ * # endif
+ */
+
+/** Note: the macro _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT is defined
+unconditionally and undef'ed here when applicable. */
+# if defined (UNDER_CE)
+/* eVCx:
+uncaught_exception is declared in the SDKs delivered with eVC4 (eVC3 is
+unknown) and they all reside in namespace 'std' there. However, they are not
+part of any lib so linking fails. When using VC8 to crosscompile for CE 5 on
+an ARMV4I, the uncaught_exception test fails, the function returns the wrong
+value. */
+/* All eVCs up to at least VC8/CE5 have a broken new operator that
+ returns null instead of throwing bad_alloc. */
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+# else
+/* VCx:
+These are present at least since VC6, but the uncaught_exception() of VC6 is
+broken, it returns the wrong value in the unittests. 7.1 and later seem to
+work, 7.0 is still unknown (we assume it works until negative report). */
+# if (_STLP_MSVC >= 1300)// VC7 and later
+# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+# endif
+# if (_STLP_MSVC < 1300)
+# define _STLP_NOTHROW
+# endif
+# endif
+
+# if (_STLP_MSVC <= 1300)
+# define _STLP_STATIC_CONST_INIT_BUG 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+/* There is no partial spec, and MSVC breaks on simulating it for iterator_traits queries */
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+# define _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1
+/* VC++ cannot handle default allocator argument in template constructors */
+# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# endif
+
+# if (_STLP_MSVC < 1300) /* including MSVC 6.0 */
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
+# endif
+
+# define _STLP_HAS_NATIVE_FLOAT_ABS 1
+
+// TODO: some eVC4 compilers report _MSC_VER 1201 or 1202, which category do they belong to?
+# if (_STLP_MSVC > 1200) && (_STLP_MSVC < 1310)
+# define _STLP_NO_MOVE_SEMANTIC
+# endif
+
+# if (_STLP_MSVC < 1300)
+/* TODO: remove this if it is handled and documented elsewhere
+ * dums: VC6 do not handle correctly member templates of class that are explicitely
+ * instanciated to be exported. There is a workaround, seperate the non template methods
+ * from the template ones within 2 different classes and only export the non template one.
+ * It is implemented for basic_string and locale at the writing of this note.
+ * However this problem hos not been considered as important enough to remove template member
+ * methods for other classes. Moreover Boost (www.boost.org) required it to be granted.
+ * The workaround is activated thanks to the _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND macro defined
+ * later in this config file.
+ */
+/*
+# if defined (_DLL)
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# endif
+*/
+
+/* Boris : not defining this macro for SP5 causes other problems */
+/*# if !defined (_MSC_FULL_VER) || (_MSC_FULL_VER < 12008804 ) */
+# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
+/*# endif */
+# define _STLP_DONT_USE_BOOL_TYPEDEF 1
+# define _STLP_DONT_RETURN_VOID 1
+# endif
+
+# if (_STLP_MSVC < 1300) /* MSVC 6.0 and earlier */
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+/* defined for DEBUG and NDEBUG too, to allow user mix own debug build with STLP release library */
+# define _STLP_USE_ABBREVS
+# endif
+
+#endif /* _STLP_MSVC */
+
+/* The desktop variants starting with VC8 have a set of more secure replacements
+ * for the error-prone string handling functions of the C standard lib. */
+/* When user do not consider 'unsafe' string functions as deprecated using _CRT_SECURE_NO_DEPRECATE
+ * macro we use 'unsafe' functions for performance reasons. */
+#if (_STLP_MSVC_LIB >= 1400) && !defined (_STLP_USING_PLATFORM_SDK_COMPILER) && !defined (UNDER_CE) && \
+ !defined (_CRT_SECURE_NO_DEPRECATE)
+# define _STLP_USE_SAFE_STRING_FUNCTIONS 1
+#endif
+
+#if (_STLP_MSVC_LIB <= 1310)
+# define _STLP_VENDOR_GLOBAL_CSTD
+#endif
+
+#if (_STLP_MSVC_LIB >= 1300) && !defined(UNDER_CE)
+/* Starting with MSVC 7.0 and compilers simulating it,
+ * we assume that the new SDK is granted:
+ */
+# define _STLP_NEW_PLATFORM_SDK 1
+#endif
+
+#if (_STLP_MSVC_LIB < 1300) /* including MSVC 6.0 */
+# define _STLP_GLOBAL_NEW_HANDLER 1
+# define _STLP_VENDOR_UNEXPECTED_STD
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+#endif
+
+#define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+
+#if defined (__DLL) || defined (_DLL) || defined (_RTLDLL) || defined (_AFXDLL)
+# define _STLP_RUNTIME_DLL
+#endif
+#if defined (__BUILDING_STLPORT) && \
+ (defined (_STLP_USE_DYNAMIC_LIB) || \
+ defined (_STLP_RUNTIME_DLL) && !defined (_STLP_USE_STATIC_LIB))
+# define _STLP_DLL
+#endif
+#include <stl/config/_detect_dll_or_lib.h>
+#undef _STLP_RUNTIME_DLL
+#undef _STLP_DLL
+
+#if defined (_STLP_USE_DYNAMIC_LIB)
+# undef _STLP_USE_DECLSPEC
+# define _STLP_USE_DECLSPEC 1
+# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300)
+# define _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND 1
+# endif
+#endif
+
+#if !defined (_STLP_IMPORT_TEMPLATE_KEYWORD)
+# if !defined (_MSC_EXTENSIONS) || defined (_STLP_MSVC) && (_STLP_MSVC >= 1300)
+# define _STLP_IMPORT_TEMPLATE_KEYWORD
+# else
+# define _STLP_IMPORT_TEMPLATE_KEYWORD extern
+# endif
+#endif
+#define _STLP_EXPORT_TEMPLATE_KEYWORD
+
+#include <stl/config/_auto_link.h>
+
+#if defined (_STLP_USING_PLATFORM_SDK_COMPILER)
+/* The Windows 64 bits SDK required for the moment link to bufferoverflowU.lib for
+ * additional buffer overrun checks. Rather than require the STLport build system and
+ * users to explicitely link with it we use the MSVC auto link feature.
+ */
+# if !defined (_STLP_DONT_USE_AUTO_LINK) || defined (__BUILDING_STLPORT)
+# pragma comment (lib, "bufferoverflowU.lib")
+# if defined (_STLP_VERBOSE)
+# pragma message ("STLport: Auto linking to bufferoverflowU.lib")
+# endif
+# endif
+#endif
+
+#if defined (_STLP_MSVC)
+# include <stl/config/_feedback.h>
+#endif
diff --git a/stlport/stlport/stl/config/_native_headers.h b/stlport/stlport/stl/config/_native_headers.h
new file mode 100644
index 0000000..f1f4bc9
--- /dev/null
+++ b/stlport/stlport/stl/config/_native_headers.h
@@ -0,0 +1,50 @@
+ /*
+ *
+ * Copyright (c) 2006
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_MAKE_HEADER)
+# define _STLP_MAKE_HEADER(path, header) <path/header>
+#endif
+
+#if !defined (_STLP_NATIVE_HEADER)
+# if !defined (_STLP_NATIVE_INCLUDE_PATH)
+# define _STLP_NATIVE_INCLUDE_PATH ../include
+# endif
+# define _STLP_NATIVE_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_INCLUDE_PATH,header)
+#endif
+
+/* For some compilers, C headers like <stdio.h> are located in separate directory */
+#if !defined (_STLP_NATIVE_C_HEADER)
+# if !defined (_STLP_NATIVE_C_INCLUDE_PATH)
+# define _STLP_NATIVE_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+# endif
+# define _STLP_NATIVE_C_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_C_INCLUDE_PATH,header)
+#endif
+
+/* For some compilers, C-library headers like <cstdio> are located in separate directory */
+#if !defined (_STLP_NATIVE_CPP_C_HEADER)
+# if !defined (_STLP_NATIVE_CPP_C_INCLUDE_PATH)
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+# endif
+# define _STLP_NATIVE_CPP_C_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_CPP_C_INCLUDE_PATH,header)
+#endif
+
+/* Some compilers locate basic C++ runtime support headers (<new>, <typeinfo>, <exception>) in separate directory */
+#if !defined ( _STLP_NATIVE_CPP_RUNTIME_HEADER )
+# if !defined (_STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH)
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+# endif
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH,header)
+#endif
diff --git a/stlport/stlport/stl/config/_prolog.h b/stlport/stlport/stl/config/_prolog.h
new file mode 100644
index 0000000..a16a794
--- /dev/null
+++ b/stlport/stlport/stl/config/_prolog.h
@@ -0,0 +1,43 @@
+
+#if defined (_STLP_MSVC) || defined (__ICL)
+
+# pragma warning (push)
+# include <stl/config/_warnings_off.h>
+/* We are forcing the alignment to guaranty that libraries are use
+ * with the same alignment as the one use to build them.
+ */
+# if !defined (_WIN64)
+# pragma pack(push, 8)
+# else
+# pragma pack(push, 16)
+# endif
+
+#elif defined (__BORLANDC__)
+
+# pragma option push
+# pragma option -Vx- -Ve- -a8 -b -pc
+# include <stl/config/_warnings_off.h>
+
+#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+
+# pragma set woff 1209
+# pragma set woff 1174
+# pragma set woff 1375
+/* from iterator_base.h */
+# pragma set woff 1183
+
+#elif defined (__DECCXX)
+
+# ifdef __PRAGMA_ENVIRONMENT
+# pragma __environment __save
+# pragma __environment __header_defaults
+# endif
+
+#elif defined (__IBMCPP__)
+/* supress EDC3130: A constant is being used as a conditional expression */
+# pragma info(nocnd)
+#elif defined (__WATCOMCPLUSPLUS__)
+# pragma warning 604 10 /* must lookahead to determine... */
+# pragma warning 594 10 /* resolved as declaration/type */
+# pragma warning 595 10 /* resolved as an expression */
+#endif
diff --git a/stlport/stlport/stl/config/_warnings_off.h b/stlport/stlport/stl/config/_warnings_off.h
new file mode 100644
index 0000000..77e9815
--- /dev/null
+++ b/stlport/stlport/stl/config/_warnings_off.h
@@ -0,0 +1,51 @@
+/* This header turns off warnings that STLport headers generate for compiled
+ * user code.
+ */
+
+#if defined (_STLP_MSVC)
+# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+/*
+ * 31/07/2004: dums - now that we do not export the basic_string class anymore but only a base class
+ * we have to disable this warning as the string are used as data members type of many iostream classes.
+ */
+# pragma warning ( disable : 4251 ) // ignore template classes being exported in .dll's
+# endif
+
+# if (_STLP_MSVC < 1300) // VC6, eVC3, eVC4
+# pragma warning( disable : 4097 ) // typedef-name used as based class of (...)
+# pragma warning( disable : 4231 ) // non standard extension : 'extern' before template instanciation
+# pragma warning( disable : 4244 ) // implicit conversion: possible loss of data
+# pragma warning( disable : 4284 ) // for -> operator
+//This warning is necessary because of the native platform headers:
+# pragma warning( disable : 4290 ) // c++ exception specification ignored
+# pragma warning( disable : 4514 ) // unreferenced inline function has been removed
+# pragma warning( disable : 4660 ) // template-class specialization '...' is already instantiated
+# pragma warning( disable : 4701 ) // local variable '...' may be used without having been initialized
+# pragma warning( disable : 4710 ) // function (...) not inlined
+# pragma warning( disable : 4786 ) // identifier truncated to 255 characters
+# endif
+
+# if (_STLP_MSVC < 1400)
+# pragma warning( disable : 4511 ) // copy constructor cannot be generated
+# endif
+
+//Pool of common warnings for all MSVC supported versions:
+//Many are only useful if warning level is set to 4.
+# pragma warning( disable : 4100 ) // unreferenced formal parameter
+# pragma warning( disable : 4127 ) // conditional expression is constant
+# pragma warning( disable : 4146 ) // unary minus operator applied to unsigned type, result still unsigned
+# pragma warning( disable : 4245 ) // conversion from 'enum ' to 'unsigned int', signed/unsigned mismatch
+# pragma warning( disable : 4355 ) // this used in base member initializer list (used in rope implementation)
+# pragma warning( disable : 4510 ) // default constructor cannot be generated
+# pragma warning( disable : 4512 ) // assignment operator could not be generated
+# pragma warning( disable : 4571 ) // catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions
+# pragma warning( disable : 4610 ) // struct '...' can never be instantiated - user defined construtor required
+#elif defined (__BORLANDC__)
+# pragma option -w-ccc // -w-8008 Condition is always true OR Condition is always false
+# pragma option -w-inl // -w-8027 Functions containing reserved words are not expanded inline
+# pragma option -w-ngu // -w-8041 Negating unsigned value
+# pragma option -w-pow // -w-8062 Previous options and warnings not restored
+# pragma option -w-rch // -w-8066 Unreachable code
+# pragma option -w-par // -w-8057 Parameter 'parameter' is never used
+#endif
diff --git a/stlport/stlport/stl/config/_windows.h b/stlport/stlport/stl/config/_windows.h
new file mode 100644
index 0000000..6b42e11
--- /dev/null
+++ b/stlport/stlport/stl/config/_windows.h
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_WINDOWS_H
+#define _STLP_INTERNAL_WINDOWS_H
+
+#if !defined (_STLP_PLATFORM)
+# define _STLP_PLATFORM "Windows"
+#endif
+
+#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
+# if defined (_MIPSEB)
+# define _STLP_BIG_ENDIAN 1
+# endif
+# if defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
+ defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
+ defined (__alpha__)
+# define _STLP_LITTLE_ENDIAN 1
+# endif
+# if defined (__ia64__)
+ /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */
+# if defined (__BIG_ENDIAN__)
+# define _STLP_BIG_ENDIAN 1
+# else
+# define _STLP_LITTLE_ENDIAN 1
+# endif
+# endif
+#endif /* _STLP_BIG_ENDIAN */
+
+#if !defined (_STLP_WINDOWS_H_INCLUDED)
+# define _STLP_WINDOWS_H_INCLUDED
+# if defined (__BUILDING_STLPORT)
+# include <stl/config/_native_headers.h>
+/* Here we define _STLP_OUTERMOST_HEADER_ID to avoid indirect inclusion
+ * of STLport stuffs from C/C++ Standard headers exposed by STLport
+ * as configuration is not yet completed. */
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x100
+# endif
+# if !defined (WIN32_LEAN_AND_MEAN)
+# define WIN32_LEAN_AND_MEAN
+# endif
+# if !defined (VC_EXTRALEAN)
+# define VC_EXTRALEAN
+# endif
+/* Don't let windows.h define its min and max macros. */
+# if !defined (NOMINMAX)
+# define NOMINMAX
+# endif
+# if !defined (STRICT)
+# define STRICT
+# endif
+# if defined (_STLP_USE_MFC)
+# include <afx.h>
+# else
+# include <windows.h>
+# endif
+# if (_STLP_OUTERMOST_HEADER_ID == 0x100)
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# else
+/* This section serves as a replacement for windows.h header. */
+# if defined (__cplusplus)
+extern "C" {
+# endif
+# if (defined (_M_AMD64) || defined (_M_IA64) || (!defined (_STLP_WCE) && defined (_M_MRX000)) || defined (_M_ALPHA) || \
+ (defined (_M_PPC) && (_STLP_MSVC_LIB >= 1000))) && !defined (RC_INVOKED)
+# define InterlockedIncrement _InterlockedIncrement
+# define InterlockedDecrement _InterlockedDecrement
+# define InterlockedExchange _InterlockedExchange
+# define _STLP_STDCALL
+# else
+# if defined (_MAC)
+# define _STLP_STDCALL _cdecl
+# else
+# define _STLP_STDCALL __stdcall
+# endif
+# endif
+
+# if defined (_STLP_NEW_PLATFORM_SDK)
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long volatile *);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long volatile *);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long volatile *, long);
+# if defined (_WIN64)
+_STLP_IMPORT_DECLSPEC void* _STLP_STDCALL _InterlockedExchangePointer(void* volatile *, void*);
+# endif
+# elif !defined (_STLP_WCE)
+/* boris : for the latest SDK, you may actually need the other version of the declaration (above)
+ * even for earlier VC++ versions. There is no way to tell SDK versions apart, sorry ...
+ */
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long*);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long*);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long*, long);
+# else
+/* start of eMbedded Visual C++ specific section */
+# include <stl/config/_native_headers.h>
+
+/* Don't let windef.h define its min and max macros. */
+# if !defined (NOMINMAX)
+# define NOMINMAX
+# endif
+# include <windef.h> /* needed for basic windows types */
+
+ /** in SDKs generated with PB5, windef.h somehow includes headers which then
+ define setjmp. */
+# if (_WIN32_WCE >= 0x500)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+# ifndef _WINBASE_ /* winbase.h already included? */
+long WINAPI InterlockedIncrement(long*);
+long WINAPI InterlockedDecrement(long*);
+long WINAPI InterlockedExchange(long*, long);
+# endif
+
+# ifndef __WINDOWS__ /* windows.h already included? */
+
+# if defined (x86)
+# include <winbase.h> /* needed for inline versions of Interlocked* functions */
+# endif
+
+# ifndef _MFC_VER
+
+# define MessageBox MessageBoxW
+int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
+
+# define wvsprintf wvsprintfW
+int WINAPI wvsprintfW(LPWSTR, LPCWSTR, va_list ArgList);
+
+void WINAPI ExitThread(DWORD dwExitCode);
+
+# if !defined (COREDLL)
+# define _STLP_WCE_WINBASEAPI DECLSPEC_IMPORT
+# else
+# define _STLP_WCE_WINBASEAPI
+# endif
+
+_STLP_WCE_WINBASEAPI int WINAPI
+MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
+ int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
+
+_STLP_WCE_WINBASEAPI UINT WINAPI GetACP();
+
+_STLP_WCE_WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE hProcess, DWORD uExitCode);
+
+# define OutputDebugString OutputDebugStringW
+void WINAPI OutputDebugStringW(LPCWSTR);
+
+_STLP_WCE_WINBASEAPI void WINAPI Sleep(DWORD);
+
+# undef _STLP_WCE_WINBASEAPI
+
+# endif /* !_MFC_VER */
+
+# endif /* !__WINDOWS__ */
+
+/* end of eMbedded Visual C++ specific section */
+# endif
+
+# if !defined (_STLP_WCE)
+_STLP_IMPORT_DECLSPEC void _STLP_STDCALL Sleep(unsigned long);
+_STLP_IMPORT_DECLSPEC void _STLP_STDCALL OutputDebugStringA(const char* lpOutputString);
+# endif
+
+# if defined (InterlockedIncrement)
+# pragma intrinsic(_InterlockedIncrement)
+# pragma intrinsic(_InterlockedDecrement)
+# pragma intrinsic(_InterlockedExchange)
+# if defined (_WIN64)
+# pragma intrinsic(_InterlockedExchangePointer)
+# endif
+# endif
+# if defined (__cplusplus)
+} /* extern "C" */
+# endif
+
+# endif
+
+/* Here we use a macro different than the InterlockedExchangePointer SDK one
+ * to avoid macro definition conflict. */
+# if !defined (_WIN64)
+/* Under 32 bits platform we rely on a simple InterlockedExchange call. */
+# if defined (__cplusplus)
+/* We do not define this function if we are not in a C++ translation unit just
+ * because of the 'inline' keyword portability issue it would introduce. We will
+ * have to fix it the day we need this function for a C translation unit.
+ */
+inline
+void* _STLP_CALL STLPInterlockedExchangePointer(void* volatile* __a, void* __b) {
+# if defined (_STLP_MSVC)
+/* Here MSVC produces warning if 64 bits portability issue is activated.
+ * MSVC do not see that _STLP_ATOMIC_EXCHANGE_PTR is a macro which content
+ * is based on the platform, Win32 or Win64
+ */
+# pragma warning (push)
+# pragma warning (disable : 4311) // pointer truncation from void* to long
+# pragma warning (disable : 4312) // conversion from long to void* of greater size
+# endif
+# if !defined (_STLP_NO_NEW_STYLE_CASTS)
+ return reinterpret_cast<void*>(InterlockedExchange(reinterpret_cast<long*>(const_cast<void**>(__a)),
+ reinterpret_cast<long>(__b)));
+# else
+ return (void*)InterlockedExchange((long*)__a, (long)__b);
+# endif
+# if defined (_STLP_MSVC)
+# pragma warning (pop)
+# endif
+}
+# endif
+# else
+# define STLPInterlockedExchangePointer _InterlockedExchangePointer
+# endif
+
+#endif /* _STLP_WINDOWS_H_INCLUDED */
+
+/* _STLP_WIN95_LIKE signal the Windows 95 OS or assimilated Windows OS version that
+ * has Interlockeded[Increment, Decrement] Win32 API functions not returning modified
+ * value.
+ */
+#if (defined (WINVER) && (WINVER < 0x0410) && (!defined (_WIN32_WINNT) || (_WIN32_WINNT < 0x400))) || \
+ (!defined (WINVER) && (defined (_WIN32_WINDOWS) && (_WIN32_WINDOWS < 0x0410) || \
+ (defined (_WIN32_WINNT) && (_WIN32_WINNT < 0x400))))
+# define _STLP_WIN95_LIKE
+#endif
+
+/* Between Windows 95 (0x400) and later Windows OSes an API enhancement forces us
+ * to change _Refcount_Base internal struct. As _Refcount_base member methods might
+ * be partially inlined we need to check that STLport build/use are coherent. To do
+ * so we try to generate a link time error thanks to the following macro.
+ * This additional check is limited to old compilers that might still be used with
+ * Windows 95. */
+#if (defined (_DEBUG) || defined (_STLP_DEBUG)) && \
+ (defined (_STLP_MSVC) && (_STLP_MSVC < 1310) || \
+ defined (__GNUC__) && (__GNUC__ < 3))
+/* We invert symbol names based on macro detection, when building for Windows
+ * 95 we expose a
+ * building_for_windows95_or_previous_but_library_built_for_windows98_or_later
+ * function in order to have a more obvious link error message signaling how
+ * the lib has been built and how it is used. */
+# if defined (__BUILDING_STLPORT)
+# if defined (_STLP_WIN95_LIKE)
+# define _STLP_SIGNAL_RUNTIME_COMPATIBILITY building_for_windows95_but_library_built_for_at_least_windows98
+# else
+# define _STLP_SIGNAL_RUNTIME_COMPATIBILITY building_for_at_least_windows98_but_library_built_for_windows95
+# endif
+# else
+# if defined (_STLP_WIN95_LIKE)
+# define _STLP_CHECK_RUNTIME_COMPATIBILITY building_for_windows95_but_library_built_for_at_least_windows98
+# else
+# define _STLP_CHECK_RUNTIME_COMPATIBILITY building_for_at_least_windows98_but_library_built_for_windows95
+# endif
+# endif
+#endif
+
+#if defined (__WIN16) || defined (WIN16) || defined (_WIN16)
+# define _STLP_WIN16
+#else
+# define _STLP_WIN32
+#endif
+
+#if defined(_STLP_WIN32)
+# define _STLP_USE_WIN32_IO /* CreateFile/ReadFile/WriteFile */
+#endif
+
+#if defined(__MINGW32__) && !defined(_STLP_USE_STDIO_IO)
+# define _STLP_USE_WIN32_IO /* CreateFile/ReadFile/WriteFile */
+#endif /* __MINGW32__ */
+
+#ifdef _STLP_WIN16
+# define _STLP_USE_UNIX_EMULATION_IO /* _open/_read/_write */
+# define _STLP_LDOUBLE_80
+#endif
+
+#endif /* _STLP_INTERNAL_WINDOWS_H */
diff --git a/stlport/stlport/string b/stlport/stlport/string
new file mode 100644
index 0000000..74d4589
--- /dev/null
+++ b/stlport/stlport/string
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x68
+# include <stl/_prolog.h>
+# define _STLP_STRING
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x68)
+# ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+# endif
+
+# ifndef _STLP_STRING_HASH_H
+# include <stl/_string_hash.h>
+# endif
+
+# if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_STRING_IO_H)
+# include <stl/_string_io.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x68) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <string>
+# else
+# include _STLP_NATIVE_HEADER(string)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x68)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STRING */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stlport/utility b/stlport/stlport/utility
new file mode 100644
index 0000000..4aaaa59
--- /dev/null
+++ b/stlport/stlport/utility
@@ -0,0 +1,60 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_UTILITY
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x75
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x75) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_UTILITY
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x75) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x75) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <utility>
+# else
+# include _STLP_NATIVE_HEADER(utility)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x75)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_UTILITY */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stlport/wchar.h b/stlport/stlport/wchar.h
new file mode 100644
index 0000000..6d66799
--- /dev/null
+++ b/stlport/stlport/wchar.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x278
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x278) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T)
+
+# if defined (__BORLANDC__) && !defined (__linux__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <_str.h>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(_str.h)
+# endif
+# ifdef __cplusplus
+using _STLP_VENDOR_CSTD::strlen;
+using _STLP_VENDOR_CSTD::strspn;
+# endif
+# endif
+
+# if (((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))) && defined (__APPLE__)) || defined (__OpenBSD__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stddef.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+# endif
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <wchar.h>
+# else
+# include _STLP_NATIVE_C_HEADER(wchar.h)
+# endif
+# endif
+#endif /* !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T) */
+
+#ifndef _STLP_INTERNAL_MBSTATE_T
+# include <stl/_mbstate_t.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x278)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+