LOCAL_CFLAGS += -fno-strict-aliasing
LOCAL_CFLAGS += -include "WebCorePrefix.h"
LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_CFLAGS += -D__SGI_STL_INTERNAL_PAIR_H
ifeq ($(TARGET_ARCH),arm)
LOCAL_CFLAGS += -Darm
LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
$(JNI_H_INCLUDE) \
$(LOCAL_PATH)/WebKit/android/icu \
+ bionic/ \
external/ \
external/icu4c/common \
external/icu4c/i18n \
$(LOCAL_PATH)/WebKit/android/WebCoreSupport \
$(LOCAL_PATH)/WebKit/android/jni \
$(LOCAL_PATH)/WebKit/android/nav \
- $(LOCAL_PATH)/WebKit/android/plugins \
- $(LOCAL_PATH)/WebKit/android/stl
+ $(LOCAL_PATH)/WebKit/android/plugins
LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
$(LOCAL_PATH)/JavaScriptCore \
# We have to use the android version of libdl when we are not on the simulator
ifneq ($(TARGET_SIMULATOR),true)
LOCAL_SHARED_LIBRARIES += libdl
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/WebKit/android/stlport
endif
# Build the list of static libraries
#include <wtf/HashSet.h>
#include <wtf/Vector.h>
-#if PLATFORM(ANDROID)
-#include "stl_iterator_base.h"
-#include "heap.h"
-#endif
-
using namespace std;
namespace WebCore {
android/RenderSkinCombo.cpp \
android/RenderSkinRadio.cpp \
android/TimeCounter.cpp \
- android/sort.cpp \
\
android/benchmark/Intercept.cpp \
android/benchmark/MyJavaVM.cpp \
#include <utils/Log.h>
#include <wtf/CurrentTime.h>
+#include <sys/time.h>
+#include <time.h>
+
#if USE(JSC)
#include "JSDOMWindow.h"
#include <runtime/JSGlobalObject.h>
#include "config.h"
#include "android_npapi.h"
+#include "SkTypes.h"
#include "media/AudioTrack.h"
struct ANPAudioTrack {
+++ /dev/null
-/*
- * Copyright 2007, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-namespace std
-{
- void sort(const void** start, const void** end, const void** temp, Comparator comp)
- {
- size_t endlen = end - start;
- size_t midlen = endlen / 2;
- const void** mid = start + midlen;
- if (midlen > 1)
- sort(start, mid, temp, comp);
- if (end - mid > 1)
- sort(mid, end, temp, comp);
- memcpy(temp, start, midlen * sizeof(*start));
- size_t i = 0;
- size_t j = midlen;
- size_t off = 0;
- while (i < midlen && j < endlen)
- start[off++] = (*comp)(start[j], temp[i]) ? start[j++] : temp[i++];
- if (i < midlen)
- memcpy(&start[off], &temp[i], (midlen - i) * sizeof(*start));
- }
-
- void sort(const void** start, const void** end, Comparator comp) {
- if (end - start > 1) {
- const void** temp = new sortType[(end - start) / 2];
- sort(start, end, temp, comp);
- delete[] temp;
- }
- }
-}
+++ /dev/null
-#ifdef __cplusplus
-
-/*
- *
- * 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) 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.
- */
-
- // extracted from stl_algobase.h
- // full STL is not compatible with the ARM build
- // a limited number of STL functions is used by webkit: swap, max, and min are
- // included below for webkit compatibility
-
-#ifdef __GLIBCPP_INTERNAL_ALGOBASE_H
-#error "real STL defined"
-#endif
-
-#ifndef __ANDROID_ALGORITHM
-#define __ANDROID_ALGORITHM
-
-#ifndef __ANDROID_LIMITS
-#include <limits>
-#endif
-
-#ifndef _CPP_UTILITY
-#include <utility>
-#endif
-
-#include <SkScalar.h> // for SK_ScalarNaN
-#ifdef PREFIX_FOR_WEBCORE
-#include <SkTSearch.h>
-#endif
-
-#include <float.h>
-#include <math.h>
-#include <stdint.h>
-#include <stddef.h>
-
-#ifndef WCHAR_MAX
- #define WCHAR_MAX 0xFFFF
-#endif
-
-namespace std
-{
- template<typename _Tp>
- inline void
- swap(_Tp& __a, _Tp& __b)
- {
- _Tp __tmp = __a;
- __a = __b;
- __b = __tmp;
- }
-
- template<typename _Tp>
- inline void
- reverse(_Tp* __first, _Tp* __last)
- {
- while(true)
- {
- if (__first == __last || __first == --__last)
- return;
- else
- {
- _Tp __tmp = *__first;
- *__first = *__last;
- *__last = __tmp;
- }
- ++__first;
- }
- }
-
- #undef min
- #undef max
-
- template<typename _Tp>
- inline const _Tp&
- min(const _Tp& __a, const _Tp& __b)
- {
- return __b < __a ? __b : __a;
- }
-
- template<typename _Tp>
- inline const _Tp&
- max(const _Tp& __a, const _Tp& __b)
- {
- return __a < __b ? __b : __a;
- }
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter copy(_InputIter __first, _InputIter __last,
- _OutputIter __result)
-{
- for (size_t __n = __last - __first; __n > 0; --__n) {
- *__result = *__first;
- ++__first;
- ++__result;
- }
- return __result;
-}
-
-template <class _ForwardIter, class _Tp>
-void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) {
- for ( ; __first != __last; ++__first)
- *__first = __value;
-}
-
-#ifndef UINTPTR_MAX
-#define UINTPTR_MAX UINT32_MAX
-#endif
-
-#ifndef UINT32_MAX
-#define UINT32_MAX (0xffffffff)
-#endif
-
-template <typename T>
-struct numeric_limits {
- /// Returns the minimum value for type T.
- static inline T min (void) { return (T(0)); }
- /// Returns the minimum value for type T.
- static inline T max (void) { return (T(0)); }
- static const bool is_signed = false; ///< True if the type is signed.
- static const bool is_integer = false; ///< True if stores an exact value.
- static const bool is_integral = false; ///< True if fixed size and cast-copyable.
-};
-
-template <typename T>
-struct numeric_limits<T*> {
- static inline T* min (void) { return (NULL); }
- static inline T* max (void) { return (UINTPTR_MAX); }
- static const bool is_signed = false;
- static const bool is_integer = true;
- static const bool is_integral = true;
-};
-
-#define _NUMERIC_LIMITS(type, minVal, maxVal, quietNaN, bSigned, bInteger, bIntegral) \
-template <> \
-struct numeric_limits<type> { \
- static inline type infinity (void) { return (maxVal); } \
- static inline type min (void) { return (minVal); } \
- static inline type max (void) { return (maxVal); } \
- static inline type quiet_NaN() { return (quietNaN); } \
- static const bool is_signed = bSigned; \
- static const bool is_integer = bInteger; \
- static const bool is_integral = bIntegral; \
-}
-
-//--------------------------------------------------------------------------------------
-// type min max NaN signed integer integral
-//--------------------------------------------------------------------------------------
-_NUMERIC_LIMITS (bool, false, true, 0, false, true, true);
-_NUMERIC_LIMITS (char, SCHAR_MIN, SCHAR_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (int, INT_MIN, INT_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (short, SHRT_MIN, SHRT_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (long, LONG_MIN, LONG_MAX, 0, true, true, true);
-#if HAVE_THREE_CHAR_TYPES
-_NUMERIC_LIMITS (signed char, SCHAR_MIN, SCHAR_MAX, 0, true, true, true);
-#endif
-_NUMERIC_LIMITS (unsigned char, 0, UCHAR_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (unsigned int, 0, UINT_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (unsigned short,0, USHRT_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (unsigned long, 0, ULONG_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (wchar_t, 0, WCHAR_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (float, FLT_MIN, FLT_MAX, SK_ScalarNaN, true, false, true);
-_NUMERIC_LIMITS (double, DBL_MIN, DBL_MAX, SK_ScalarNaN, true, false, true);
-_NUMERIC_LIMITS (long double, LDBL_MIN, LDBL_MAX, SK_ScalarNaN, true, false, true);
-#ifdef HAVE_LONG_LONG
-_NUMERIC_LIMITS (long long, LLONG_MIN, LLONG_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (unsigned long long, 0, ULLONG_MAX, 0, false, true, true);
-#endif
-//--------------------------------------------------------------------------------------
-
-using ::ptrdiff_t;
-
-typedef bool (* Comparator)(const void*, const void*);
-extern void sort(const void** start, const void** end, Comparator comp);
-
-#ifdef PREFIX_FOR_WEBCORE
- typedef const void* sortType;
-
- inline bool binary_search(const unsigned short* const base,
- const unsigned short* const end,
- short target)
- {
- return SkTSearch<unsigned short>(base, end - base, target, sizeof(unsigned short)) >= 0;
- }
-
-
- template<typename P> inline void sort (P** start, P**end,
- bool (* comp)(const P*, const P*))
- {
- sort((const void**) start, (const void**) end, (Comparator) comp);
- }
-
- template<typename P> void sort(P* start, P* end,
- bool (* comp)(const P&, const P&)) {
- stable_sort(start, end, *comp);
- }
-
- template<typename P> inline void stable_sort(P** start, P** end,
- bool (* comp)(P*, P*))
- {
- sort((const void**) start, (const void**) end, (Comparator) comp);
- }
-
- template<typename P> inline void stable_sort(P** start, P** end,
- bool (& comp)(const P*, const P*))
- {
- sort((const void**) start, (const void**) end, (Comparator) &comp);
- }
-
- template<typename P> void stable_sort(P* start, P* end, P* temp,
- bool (& comp)(const P&, const P&)) {
- size_t endlen = end - start;
- size_t midlen = endlen / 2;
- P* mid = start + midlen;
- if (midlen > 1)
- stable_sort(start, mid, temp, comp);
- if (end - mid > 1)
- stable_sort(mid, end, temp, comp);
- memcpy(temp, start, midlen * sizeof(*start));
- size_t i = 0;
- size_t j = midlen;
- size_t off = 0;
- while (i < midlen && j < endlen) {
- P* dst = (comp)(start[j], temp[i]) ? &start[j++] : &temp[i++];
- memcpy(&start[off++], dst, sizeof(*start));
- }
- if (i < midlen)
- memcpy(&start[off], &temp[i], (midlen - i) * sizeof(*start));
- }
-
- template<typename P> void stable_sort(P* start, P* end,
- bool (& comp)(const P&, const P&)) {
- if (end - start > 1) {
- size_t count = (end - start) / 2;
- P* temp = static_cast<P*>(malloc(count * sizeof(P)));
- stable_sort(start, end, temp, comp);
- free(temp);
- }
- }
-
- template<typename P> void stable_sort(P* start, P* end,
- bool (& comp)(P, P)) {
- stable_sort(start, end, (bool (&)(const P&, const P&))(comp));
- }
-
- class ostream {
- int this_class_intentionally_left_empty;
- };
-#endif
-
-}
-
-#endif
-
-#endif // __cplusplus
-
+++ /dev/null
-// -*- C++ -*- forwarding header.
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
-// Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-//
-// ISO C++ 14882: 20.4.6 C library
-//
-
-/** @file cstring
- * This is a Standard C++ Library file. You should @c #include this file
- * in your programs, rather than any of the "*.h" implementation files.
- *
- * This is the C++ version of the Standard C Library header @c string.h,
- * and its contents are (mostly) the same as that header, but are all
- * contained in the namespace @c std.
- */
-
-#ifndef _GLIBCXX_CSTRING
-#define _GLIBCXX_CSTRING 1
-
-#pragma GCC system_header
-
-#include <cstddef>
-
-#include <string.h>
-
-// Get rid of those macros defined in <string.h> in lieu of real functions.
-#undef memcpy
-#undef memmove
-#undef strcpy
-#undef strncpy
-#undef strcat
-#undef strncat
-#undef memcmp
-#undef strcmp
-#undef strcoll
-#undef strncmp
-#undef strxfrm
-#undef memchr
-#undef strchr
-#undef strcspn
-#undef strpbrk
-#undef strrchr
-#undef strspn
-#undef strstr
-#undef strtok
-#undef memset
-#undef strerror
-#undef strlen
-
-namespace std
-{
- using ::memcpy;
- using ::memmove;
- using ::strcpy;
- using ::strncpy;
- using ::strcat;
- using ::strncat;
- using ::memcmp;
- using ::strcmp;
-// using ::strcoll;
- using ::strncmp;
-// using ::strxfrm;
- using ::strcspn;
- using ::strspn;
- using ::strtok;
- using ::memset;
- using ::strerror;
- using ::strlen;
-
- using ::memchr;
-
- inline void*
- memchr(void* __p, int __c, size_t __n)
- { return memchr(const_cast<const void*>(__p), __c, __n); }
-
- using ::strchr;
-
- inline char*
- strchr(char* __s1, int __n)
- { return __builtin_strchr(const_cast<const char*>(__s1), __n); }
-
- using ::strpbrk;
-
- inline char*
- strpbrk(char* __s1, const char* __s2)
- { return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); }
-
- using ::strrchr;
-
- inline char*
- strrchr(char* __s1, int __n)
- { return __builtin_strrchr(const_cast<const char*>(__s1), __n); }
-
- using ::strstr;
-
- inline char*
- strstr(char* __s1, const char* __s2)
- { return __builtin_strstr(const_cast<const char*>(__s1), __s2); }
-}
-
-#endif
+++ /dev/null
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * 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.
- */
-
-#ifndef __SGI_STL_HEAP_H
-#define __SGI_STL_HEAP_H
-
-#include <concept_checks.h>
-#include <stl_config.h>
-#include <stl_heap.h>
-
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::push_heap;
-using __STD::pop_heap;
-using __STD::make_heap;
-using __STD::sort_heap;
-
-#endif /* __STL_USE_NAMESPACES */
-
-
-#endif /* __SGI_STL_HEAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
+++ /dev/null
-/*
- * Copyright 2007, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __ANDROID_LIMITS
-#define __ANDROID_LIMITS
-
-#include <limits.h>
-
-#endif // __ANDROID_LIMITS
+++ /dev/null
-/*
- * Copyright (c) 1997-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.
- *
- */
-
-//minimal file to get build to work
-
-#ifdef _CPP_MEMORY
-#error "real STL defined"
-#endif
-
-#ifndef __ANDROID_MEMORY
-#define __ANDROID_MEMORY
-//we good to do this?
-#define __STL_MEMBER_TEMPLATES
-
-#define __STL_NOTHROW
-
-/*#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \*/
-
-#if defined(__STL_MEMBER_TEMPLATES)
-template<class _Tp1> struct auto_ptr_ref {
- _Tp1* _M_ptr;
- auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
-};
-#endif
-
-namespace std {
-
-template <class _Tp> class auto_ptr {
-private:
- _Tp* _M_ptr;
-
-public:
- typedef _Tp element_type;
-
- explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {}
- auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {}
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW
- : _M_ptr(__a.release()) {}
-#endif /* __STL_MEMBER_TEMPLATES */
-
- auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW {
- if (&__a != this) {
- delete _M_ptr;
- _M_ptr = __a.release();
- }
- return *this;
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _Tp1>
- auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW {
- if (__a.get() != this->get()) {
- delete _M_ptr;
- _M_ptr = __a.release();
- }
- return *this;
- }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- // Note: The C++ standard says there is supposed to be an empty throw
- // specification here, but omitting it is standard conforming. Its
- // presence can be detected only if _Tp::~_Tp() throws, but (17.4.3.6/2)
- // this is prohibited.
- ~auto_ptr() { delete _M_ptr; }
-
- _Tp& operator*() const __STL_NOTHROW {
- return *_M_ptr;
- }
- _Tp* operator->() const __STL_NOTHROW {
- return _M_ptr;
- }
- _Tp* get() const __STL_NOTHROW {
- return _M_ptr;
- }
- _Tp* release() __STL_NOTHROW {
- _Tp* __tmp = _M_ptr;
- _M_ptr = 0;
- return __tmp;
- }
- void reset(_Tp* __p = 0) __STL_NOTHROW {
- if (__p != _M_ptr) {
- delete _M_ptr;
- _M_ptr = __p;
- }
- }
-
-/*#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \*/
-#if defined(__STL_MEMBER_TEMPLATES)
-
-public:
- auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW
- : _M_ptr(__ref._M_ptr) {}
-
- auto_ptr& operator=(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW {
- if (__ref._M_ptr != this->get()) {
- delete _M_ptr;
- _M_ptr = __ref._M_ptr;
- }
- return *this;
- }
-
- template <class _Tp1> operator auto_ptr_ref<_Tp1>() __STL_NOTHROW
- { return auto_ptr_ref<_Tp1>(this->release()); }
- template <class _Tp1> operator auto_ptr<_Tp1>() __STL_NOTHROW
- { return auto_ptr<_Tp1>(this->release()); }
-
-#endif /* auto ptr conversions && member templates */
-
-};
-
-} //namespace std
-
-#endif /* __ANDROID_MEMORY */
-
-
-// Local Variables:
-// mode:C++
-// End:
-
+++ /dev/null
-/*
- * Copyright 2007, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
+++ /dev/null
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * 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
- *
- * 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 __STL_CONFIG_H
-# define __STL_CONFIG_H
-
-// Flags:
-// * __STL_NO_BOOL: defined if the compiler doesn't have bool as a builtin
-// type.
-// * __STL_HAS_WCHAR_T: defined if the compier has wchar_t as a builtin type.
-// * __STL_NO_DRAND48: defined if the compiler doesn't have the drand48
-// function.
-// * __STL_STATIC_TEMPLATE_MEMBER_BUG: defined if the compiler can't handle
-// static members of template classes.
-// * __STL_STATIC_CONST_INIT_BUG: defined if the compiler can't handle a
-// constant-initializer in the declaration of a static const data member
-// of integer type. (See section 9.4.2, paragraph 4, of the C++ standard.)
-// * __STL_CLASS_PARTIAL_SPECIALIZATION: defined if the compiler supports
-// partial specialization of template classes.
-// * __STL_PARTIAL_SPECIALIZATION_SYNTAX: defined if the compiler
-// supports partial specialization syntax for full specialization of
-// class templates. (Even if it doesn't actually support partial
-// specialization itself.)
-// * __STL_FUNCTION_TMPL_PARTIAL_ORDER: defined if the compiler supports
-// partial ordering of function templates. (a.k.a partial specialization
-// of function templates.)
-// * __STL_MEMBER_TEMPLATES: defined if the compiler supports template
-// member functions of classes.
-// * __STL_MEMBER_TEMPLATE_CLASSES: defined if the compiler supports
-// nested classes that are member templates of other classes.
-// * __STL_TEMPLATE_FRIENDS: defined if the compiler supports templatized
-// friend declarations.
-// * __STL_EXPLICIT_FUNCTION_TMPL_ARGS: defined if the compiler
-// supports calling a function template by providing its template
-// arguments explicitly.
-// * __STL_LIMITED_DEFAULT_TEMPLATES: defined if the compiler is unable
-// to handle default template parameters that depend on previous template
-// parameters.
-// * __STL_NON_TYPE_TMPL_PARAM_BUG: defined if the compiler has trouble with
-// function template argument deduction for non-type template parameters.
-// * __SGI_STL_NO_ARROW_OPERATOR: defined if the compiler is unable
-// to support the -> operator for iterators.
-// * __STL_DEFAULT_CONSTRUCTOR_BUG: defined if T() does not work properly
-// when T is a builtin type.
-// * __STL_USE_EXCEPTIONS: defined if the compiler (in the current compilation
-// mode) supports exceptions.
-// * __STL_USE_NAMESPACES: defined if the compiler has the necessary
-// support for namespaces.
-// * __STL_NO_EXCEPTION_HEADER: defined if the compiler does not have a
-// standard-conforming header <exception>.
-// * __STL_NO_BAD_ALLOC: defined if the compiler does not have a <new>
-// header, or if <new> does not contain a bad_alloc class. If a bad_alloc
-// class exists, it is assumed to be in namespace std.
-// * __STL_SGI_THREADS: defined if this is being compiled for an SGI IRIX
-// system in multithreaded mode, using native SGI threads instead of
-// pthreads.
-// * __STL_WIN32THREADS: defined if this is being compiled on a WIN32
-// compiler in multithreaded mode.
-// * __STL_PTHREADS: defined if we should use portable pthreads
-// synchronization.
-// * __STL_UITHREADS: defined if we should use UI / solaris / UnixWare threads
-// synchronization. UIthreads are similar to pthreads, but are based
-// on an earlier version of the Posix threads standard.
-// * __STL_LONG_LONG if the compiler has long long and unsigned long long
-// types. (They're not in the C++ standard, but they are expected to be
-// included in the forthcoming C9X standard.)
-// * __STL_THREADS is defined if thread safety is needed.
-// * __STL_VOLATILE is defined to be "volatile" if threads are being
-// used, and the empty string otherwise.
-// * __STL_USE_CONCEPT_CHECKS enables some extra compile-time error
-// checking to make sure that user-defined template arguments satisfy
-// all of the appropriate requirements. This may result in more
-// comprehensible error messages. It incurs no runtime overhead. This
-// feature requires member templates and partial specialization.
-// * __STL_NO_USING_CLAUSE_IN_CLASS: The compiler does not handle "using"
-// clauses inside of class definitions.
-// * __STL_NO_FRIEND_TEMPLATE_CLASS: The compiler does not handle friend
-// declaractions where the friend is a template class.
-// * __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE: The compiler does not
-// support the use of a function pointer type as the argument
-// for a template.
-// * __STL_MEMBER_TEMPLATE_KEYWORD: standard C++ requires the template
-// keyword in a few new places (14.2.4). This flag is set for
-// compilers that support (and require) this usage.
-
-
-// User-settable macros that control compilation:
-// * __STL_USE_SGI_ALLOCATORS: if defined, then the STL will use older
-// SGI-style allocators, instead of standard-conforming allocators,
-// even if the compiler supports all of the language features needed
-// for standard-conforming allocators.
-// * __STL_NO_NAMESPACES: if defined, don't put the library in namespace
-// std, even if the compiler supports namespaces.
-// * __STL_NO_RELOPS_NAMESPACE: if defined, don't put the relational
-// operator templates (>, <=. >=, !=) in namespace std::rel_ops, even
-// if the compiler supports namespaces and partial ordering of
-// function templates.
-// * __STL_ASSERTIONS: if defined, then enable runtime checking through the
-// __stl_assert macro.
-// * _PTHREADS: if defined, use Posix threads for multithreading support.
-// * _UITHREADS:if defined, use SCO/Solaris/UI threads for multithreading
-// support
-// * _NOTHREADS: if defined, don't use any multithreading support.
-// * _STL_NO_CONCEPT_CHECKS: if defined, disables the error checking that
-// we get from __STL_USE_CONCEPT_CHECKS.
-// * __STL_USE_NEW_IOSTREAMS: if defined, then the STL will use new,
-// standard-conforming iostreams (e.g. the <iosfwd> header). If not
-// defined, the STL will use old cfront-style iostreams (e.g. the
-// <iostream.h> header).
-
-// Other macros defined by this file:
-
-// * bool, true, and false, if __STL_NO_BOOL is defined.
-// * typename, as a null macro if it's not already a keyword.
-// * explicit, as a null macro if it's not already a keyword.
-// * namespace-related macros (__STD, __STL_BEGIN_NAMESPACE, etc.)
-// * exception-related macros (__STL_TRY, __STL_UNWIND, etc.)
-// * __stl_assert, either as a test or as a null macro, depending on
-// whether or not __STL_ASSERTIONS is defined.
-
-# if defined(_PTHREADS) && !defined(_NOTHREADS)
-# define __STL_PTHREADS
-# endif
-
-# if defined(_UITHREADS) && !defined(_PTHREADS) && !defined(_NOTHREADS)
-# define __STL_UITHREADS
-# endif
-
-# if defined(__sgi) && !defined(__GNUC__)
-# include <standards.h>
-# if !defined(_BOOL)
-# define __STL_NO_BOOL
-# endif
-# if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32
-# define __STL_STATIC_CONST_INIT_BUG
-# endif
-# if defined(_WCHAR_T_IS_KEYWORD)
-# define __STL_HAS_WCHAR_T
-# endif
-# if !defined(_TYPENAME_IS_KEYWORD)
-# define __STL_NEED_TYPENAME
-# endif
-# ifdef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# endif
-# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# endif
-# ifdef _MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATES
-# define __STL_TEMPLATE_FRIENDS
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# endif
-# if defined(_MEMBER_TEMPLATE_KEYWORD)
-# define __STL_MEMBER_TEMPLATE_KEYWORD
-# endif
-# if defined(_STANDARD_C_PLUS_PLUS)
-# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# endif
-# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32
-# define __STL_MEMBER_TEMPLATE_KEYWORD
-# endif
-# if COMPILER_VERSION < 720 || (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32)
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# endif
-# if !defined(_EXPLICIT_IS_KEYWORD)
-# define __STL_NEED_EXPLICIT
-# endif
-# ifdef __EXCEPTIONS
-# define __STL_USE_EXCEPTIONS
-# endif
-# if (_COMPILER_VERSION >= 721) && defined(_NAMESPACES)
-# define __STL_HAS_NAMESPACES
-# endif
-# if (_COMPILER_VERSION < 721) || \
- !defined(__STL_HAS_NAMESPACES) || defined(__STL_NO_NAMESPACES)
-# define __STL_NO_EXCEPTION_HEADER
-# endif
-# if _COMPILER_VERSION < 730 || !defined(_STANDARD_C_PLUS_PLUS) || \
- !defined(_NAMESPACES)
-# define __STL_NO_BAD_ALLOC
-# endif
-# if !defined(_NOTHREADS) && !defined(__STL_PTHREADS)
-# define __STL_SGI_THREADS
-# endif
-# if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI
-# define __STL_LONG_LONG
-# endif
-# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
-# define __STL_USE_NEW_IOSTREAMS
-# endif
-# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
-# define __STL_CAN_THROW_RANGE_ERRORS
-# endif
-# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
-# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
-# endif
-# endif
-
-
-/*
- * Jochen Schlick '1999 - added new #defines (__STL)_UITHREADS (for
- * providing SCO / Solaris / UI thread support)
- * - added the necessary defines for the SCO UDK 7
- * compiler (and its template friend behavior)
- * - all UDK7 specific STL changes are based on the
- * macro __USLC__ being defined
- */
-// SCO UDK 7 compiler (UnixWare 7x, OSR 5, UnixWare 2x)
-# if defined(__USLC__)
-# define __STL_HAS_WCHAR_T
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_USE_EXCEPTIONS
-# define __STL_HAS_NAMESPACES
-# define __STL_USE_NAMESPACES
-# define __STL_LONG_LONG
-# if defined(_REENTRANT)
-# define _UITHREADS /* if UnixWare < 7.0.1 */
-# define __STL_UITHREADS
-// use the following defines instead of the UI threads defines when
-// you want to use POSIX threads
-//# define _PTHREADS /* only if UnixWare >=7.0.1 */
-//# define __STL_PTHREADS
-# endif
-# endif
-
-
-
-# ifdef __GNUC__
-# if __GNUC__ == 2 && __GNUC_MINOR__ <= 7
-# define __STL_STATIC_TEMPLATE_MEMBER_BUG
-# endif
-# if __GNUC__ < 2
-# define __STL_NEED_TYPENAME
-# define __STL_NEED_EXPLICIT
-# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ <= 8
-# define __STL_NO_EXCEPTION_HEADER
-# define __STL_NO_BAD_ALLOC
-# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ >= 8 || __GNUC__ > 2
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# define __STL_MEMBER_TEMPLATES
-# define __STL_CAN_THROW_RANGE_ERRORS
- // g++ 2.8.1 supports member template functions, but not member
- // template nested classes.
-# if __GNUC_MINOR__ >= 9 || __GNUC__ > 2
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_TEMPLATE_FRIENDS
-# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
-# define __STL_HAS_NAMESPACES
-//# define __STL_USE_NEW_IOSTREAMS
-# endif
-# endif
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# ifdef __EXCEPTIONS
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef _REENTRANT
-# define __STL_PTHREADS
-# endif
-# if (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 95)
-# define __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
-# endif
-# endif
-
-# if defined(__SUNPRO_CC)
-# define __STL_NO_BOOL
-# define __STL_NEED_TYPENAME
-# define __STL_NEED_EXPLICIT
-# define __STL_USE_EXCEPTIONS
-# ifdef _REENTRANT
-# define __STL_PTHREADS
-# endif
-# define __SGI_STL_NO_ARROW_OPERATOR
-# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
-# define __STL_NO_EXCEPTION_HEADER
-# define __STL_NO_BAD_ALLOC
-# endif
-
-# if defined(__COMO__)
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_TEMPLATE_FRIENDS
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_USE_EXCEPTIONS
-# define __STL_HAS_NAMESPACES
-# endif
-
-// Intel compiler, which uses the EDG front end.
-# if defined(__ICL)
-# define __STL_LONG_LONG
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_TEMPLATE_FRIENDS
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_NO_DRAND48
-# define __STL_HAS_NAMESPACES
-# define __STL_USE_EXCEPTIONS
-# define __STL_MEMBER_TEMPLATE_KEYWORD
-# ifdef _CPPUNWIND
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef _MT
-# define __STL_WIN32THREADS
-# endif
-# endif
-
-// Mingw32, egcs compiler using the Microsoft C runtime
-# if defined(__MINGW32__)
-# define __STL_NO_DRAND48
-# ifdef _MT
-# define __STL_WIN32THREADS
-# endif
-# endif
-
-// Cygwin32, egcs compiler on MS Windows
-# if defined(__CYGWIN__)
-# define __STL_NO_DRAND48
-# endif
-
-
-
-// Microsoft compiler.
-# if defined(_MSC_VER) && !defined(__ICL) && !defined(__MWERKS__)
-# define __STL_NO_DRAND48
-# define __STL_STATIC_CONST_INIT_BUG
-# define __STL_NEED_TYPENAME
-# define __STL_NO_USING_CLAUSE_IN_CLASS
-# define __STL_NO_FRIEND_TEMPLATE_CLASS
-# if _MSC_VER < 1100 /* 1000 is version 4.0, 1100 is 5.0, 1200 is 6.0. */
-# define __STL_NEED_EXPLICIT
-# define __STL_NO_BOOL
-# define __STL_NO_BAD_ALLOC
-# endif
-# if _MSC_VER > 1000
-# include <yvals.h>
-# define __STL_DONT_USE_BOOL_TYPEDEF
-# endif
-# define __STL_NON_TYPE_TMPL_PARAM_BUG
-# define __SGI_STL_NO_ARROW_OPERATOR
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# ifdef _CPPUNWIND
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef _MT
-# define __STL_WIN32THREADS
-# endif
-# if _MSC_VER >= 1200
-# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
-# define __STL_HAS_NAMESPACES
-# define __STL_CAN_THROW_RANGE_ERRORS
-# define NOMINMAX
-# undef min
-# undef max
-// disable warning 'initializers put in unrecognized initialization area'
-# pragma warning ( disable : 4075 )
-// disable warning 'empty controlled statement found'
-# pragma warning ( disable : 4390 )
-// disable warning 'debug symbol greater than 255 chars'
-# pragma warning ( disable : 4786 )
-# endif
-# if _MSC_VER < 1100
-# define __STL_NO_EXCEPTION_HEADER
-# define __STL_NO_BAD_ALLOC
-# endif
- // Because of a Microsoft front end bug, we must not provide a
- // namespace qualifier when declaring a friend function.
-# define __STD_QUALIFIER
-# endif
-
-# if defined(__BORLANDC__)
-# define __STL_NO_BAD_ALLOC
-# define __STL_NO_DRAND48
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# if __BORLANDC__ >= 0x540 /* C++ Builder 4.0 */
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# define __STL_MEMBER_TEMPLATES
-# define __STL_TEMPLATE_FRIENDS
-# else
-# define __STL_NEED_TYPENAME
-# define __STL_LIMITED_DEFAULT_TEMPLATES
-# define __SGI_STL_NO_ARROW_OPERATOR
-# define __STL_NON_TYPE_TMPL_PARAM_BUG
-# endif
-# ifdef _CPPUNWIND
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef __MT__
-# define __STL_WIN32THREADS
-# endif
-# endif
-
-# if defined(__STL_NO_BOOL) && !defined(__STL_DONT_USE_BOOL_TYPEDEF)
- typedef int bool;
-# define true 1
-# define false 0
-# endif
-
-# ifdef __STL_NEED_TYPENAME
-# define typename
-# endif
-
-# ifdef __STL_LIMITED_DEFAULT_TEMPLATES
-# define __STL_DEPENDENT_DEFAULT_TMPL(_Tp)
-# else
-# define __STL_DEPENDENT_DEFAULT_TMPL(_Tp) = _Tp
-# endif
-
-# ifdef __STL_MEMBER_TEMPLATE_KEYWORD
-# define __STL_TEMPLATE template
-# else
-# define __STL_TEMPLATE
-# endif
-
-# ifdef __STL_NEED_EXPLICIT
-# define explicit
-# endif
-
-# ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# define __STL_NULL_TMPL_ARGS <>
-# else
-# define __STL_NULL_TMPL_ARGS
-# endif
-
-# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \
- || defined (__STL_PARTIAL_SPECIALIZATION_SYNTAX)
-# define __STL_TEMPLATE_NULL template<>
-# else
-# define __STL_TEMPLATE_NULL
-# endif
-
-// Use standard-conforming allocators if we have the necessary language
-// features. __STL_USE_SGI_ALLOCATORS is a hook so that users can
-// disable new-style allocators, and continue to use the same kind of
-// allocators as before, without having to edit library headers.
-# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && \
- defined(__STL_MEMBER_TEMPLATES) && \
- defined(__STL_MEMBER_TEMPLATE_CLASSES) && \
- !defined(__STL_NO_BOOL) && \
- !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) && \
- !defined(__STL_LIMITED_DEFAULT_TEMPLATES) && \
- !defined(__STL_USE_SGI_ALLOCATORS)
-# define __STL_USE_STD_ALLOCATORS
-# endif
-
-# ifndef __STL_DEFAULT_ALLOCATOR
-# ifdef __STL_USE_STD_ALLOCATORS
-# define __STL_DEFAULT_ALLOCATOR(T) allocator< T >
-# else
-# define __STL_DEFAULT_ALLOCATOR(T) alloc
-# endif
-# endif
-
-// __STL_NO_NAMESPACES is a hook so that users can disable namespaces
-// without having to edit library headers. __STL_NO_RELOPS_NAMESPACE is
-// a hook so that users can disable the std::rel_ops namespace, keeping
-// the relational operator template in namespace std, without having to
-// edit library headers.
-# if defined(__STL_HAS_NAMESPACES) && !defined(__STL_NO_NAMESPACES)
-# define __STL_USE_NAMESPACES
-# define __STD std
-# define __STL_BEGIN_NAMESPACE namespace std {
-# define __STL_END_NAMESPACE }
-# if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) && \
- !defined(__STL_NO_RELOPS_NAMESPACE)
-# define __STL_USE_NAMESPACE_FOR_RELOPS
-# define __STL_BEGIN_RELOPS_NAMESPACE namespace std { namespace rel_ops {
-# define __STL_END_RELOPS_NAMESPACE } }
-# define __STD_RELOPS std::rel_ops
-# else /* Use std::rel_ops namespace */
-# define __STL_USE_NAMESPACE_FOR_RELOPS
-# define __STL_BEGIN_RELOPS_NAMESPACE namespace std {
-# define __STL_END_RELOPS_NAMESPACE }
-# define __STD_RELOPS std
-# endif /* Use std::rel_ops namespace */
-# else
-# define __STD
-# define __STL_BEGIN_NAMESPACE
-# define __STL_END_NAMESPACE
-# undef __STL_USE_NAMESPACE_FOR_RELOPS
-# define __STL_BEGIN_RELOPS_NAMESPACE
-# define __STL_END_RELOPS_NAMESPACE
-# define __STD_RELOPS
-# undef __STL_USE_NAMESPACES
-# endif
-
-// Some versions of the EDG front end sometimes require an explicit
-// namespace spec where they shouldn't. This macro facilitates that.
-// If the bug becomes irrelevant, then all uses of __STD_QUALIFIER
-// should be removed. The 7.3 beta SGI compiler has this bug, but the
-// MR version is not expected to have it.
-
-# if defined(__STL_USE_NAMESPACES) && !defined(__STD_QUALIFIER)
-# define __STD_QUALIFIER std::
-# else
-# define __STD_QUALIFIER
-# endif
-
-# ifdef __STL_USE_EXCEPTIONS
-# define __STL_TRY try
-# define __STL_CATCH_ALL catch(...)
-# define __STL_THROW(x) throw x
-# define __STL_RETHROW throw
-# define __STL_NOTHROW throw()
-# define __STL_UNWIND(action) catch(...) { action; throw; }
-# else
-# define __STL_TRY
-# define __STL_CATCH_ALL if (false)
-# define __STL_THROW(x)
-# define __STL_RETHROW
-# define __STL_NOTHROW
-# define __STL_UNWIND(action)
-# endif
-
-#ifdef __STL_ASSERTIONS
-# include <stdio.h>
-# define __stl_assert(expr) \
- if (!(expr)) { fprintf(stderr, "%s:%d STL assertion failure: %s\n", \
- __FILE__, __LINE__, # expr); abort(); }
-#else
-# define __stl_assert(expr)
-#endif
-
-#if defined(__STL_WIN32THREADS) || defined(__STL_SGI_THREADS) \
- || defined(__STL_PTHREADS) || defined(__STL_UITHREADS)
-# define __STL_THREADS
-# define __STL_VOLATILE volatile
-#else
-# define __STL_VOLATILE
-#endif
-
-#if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \
- && defined(__STL_MEMBER_TEMPLATES) \
- && !defined(_STL_NO_CONCEPT_CHECKS)
-# define __STL_USE_CONCEPT_CHECKS
-#endif
-
-
-#endif /* __STL_CONFIG_H */
-
-// Local Variables:
-// mode:C++
-// End:
+++ /dev/null
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * 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 __SGI_STL_INTERNAL_HEAP_H
-#define __SGI_STL_INTERNAL_HEAP_H
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1209
-#endif
-
-// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap.
-
-template <class _RandomAccessIterator, class _Distance, class _Tp>
-void
-__push_heap(_RandomAccessIterator __first,
- _Distance __holeIndex, _Distance __topIndex, _Tp __value)
-{
- _Distance __parent = (__holeIndex - 1) / 2;
- while (__holeIndex > __topIndex && *(__first + __parent) < __value) {
- *(__first + __holeIndex) = *(__first + __parent);
- __holeIndex = __parent;
- __parent = (__holeIndex - 1) / 2;
- }
- *(__first + __holeIndex) = __value;
-}
-
-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>
-inline void
-push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- __push_heap_aux(__first, __last,
- __DISTANCE_TYPE(__first), __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Distance, class _Tp,
- class _Compare>
-void
-__push_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __topIndex, _Tp __value, _Compare __comp)
-{
- _Distance __parent = (__holeIndex - 1) / 2;
- while (__holeIndex > __topIndex && __comp(*(__first + __parent), __value)) {
- *(__first + __holeIndex) = *(__first + __parent);
- __holeIndex = __parent;
- __parent = (__holeIndex - 1) / 2;
- }
- *(__first + __holeIndex) = __value;
-}
-
-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>
-inline void
-push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __push_heap_aux(__first, __last, __comp,
- __DISTANCE_TYPE(__first), __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Distance, class _Tp>
-void
-__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __len, _Tp __value)
-{
- _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, __value);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Distance>
-inline void
-__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _RandomAccessIterator __result, _Tp __value, _Distance*)
-{
- *__result = *__first;
- __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __value);
-}
-
-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)), __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator>
-inline void pop_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- __pop_heap_aux(__first, __last, __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Distance,
- class _Tp, class _Compare>
-void
-__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __len, _Tp __value, _Compare __comp)
-{
- _Distance __topIndex = __holeIndex;
- _Distance __secondChild = 2 * __holeIndex + 2;
- while (__secondChild < __len) {
- if (__comp(*(__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, __value, __comp);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Compare,
- class _Distance>
-inline void
-__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _RandomAccessIterator __result, _Tp __value, _Compare __comp,
- _Distance*)
-{
- *__result = *__first;
- __adjust_heap(__first, _Distance(0), _Distance(__last - __first),
- __value, __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,
- __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Compare>
-inline void
-pop_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __pop_heap_aux(__first, __last, __VALUE_TYPE(__first), __comp);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Distance>
-void
-__make_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Tp*, _Distance*)
-{
- if (__last - __first < 2) return;
- _Distance __len = __last - __first;
- _Distance __parent = (__len - 2)/2;
-
- while (true) {
- __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)));
- if (__parent == 0) return;
- __parent--;
- }
-}
-
-template <class _RandomAccessIterator>
-inline void
-make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- __make_heap(__first, __last,
- __VALUE_TYPE(__first), __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Compare,
- class _Tp, class _Distance>
-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;
-
- while (true) {
- __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)),
- __comp);
- if (__parent == 0) return;
- __parent--;
- }
-}
-
-template <class _RandomAccessIterator, class _Compare>
-inline void
-make_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __make_heap(__first, __last, __comp,
- __VALUE_TYPE(__first), __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator>
-void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- while (__last - __first > 1)
- pop_heap(__first, __last--);
-}
-
-template <class _RandomAccessIterator, class _Compare>
-void
-sort_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- while (__last - __first > 1)
- pop_heap(__first, __last--, __comp);
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1209
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_HEAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
+++ /dev/null
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * 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) 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.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_ITERATOR_BASE_H
-#define __SGI_STL_INTERNAL_ITERATOR_BASE_H
-
-// This file contains all of the general iterator-related utilities.
-// The internal file stl_iterator.h contains predefined iterators,
-// such as front_insert_iterator and istream_iterator.
-
-#include <concept_checks.h>
-
-struct input_iterator_tag {};
-struct output_iterator_tag {};
-struct forward_iterator_tag : public input_iterator_tag {};
-struct bidirectional_iterator_tag : public forward_iterator_tag {};
-struct random_access_iterator_tag : public bidirectional_iterator_tag {};
-
-// The base classes input_iterator, output_iterator, forward_iterator,
-// bidirectional_iterator, and random_access_iterator are not part of
-// the C++ standard. (They have been replaced by struct iterator.)
-// They are included for backward compatibility with the HP STL.
-
-template <class _Tp, class _Distance> struct input_iterator {
- typedef input_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-struct output_iterator {
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-};
-
-template <class _Tp, class _Distance> struct forward_iterator {
- typedef forward_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-
-template <class _Tp, class _Distance> struct bidirectional_iterator {
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-template <class _Tp, class _Distance> struct random_access_iterator {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-template <class _Category, class _Tp, class _Distance = ptrdiff_t,
- class _Pointer = _Tp*, class _Reference = _Tp&>
-struct iterator {
- typedef _Category iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Pointer pointer;
- typedef _Reference reference;
-};
-
-template <class _Iterator>
-struct iterator_traits {
- typedef typename _Iterator::iterator_category iterator_category;
- typedef typename _Iterator::value_type value_type;
- typedef typename _Iterator::difference_type difference_type;
- typedef typename _Iterator::pointer pointer;
- typedef typename _Iterator::reference reference;
-};
-
-template <class _Tp>
-struct iterator_traits<_Tp*> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-template <class _Tp>
-struct iterator_traits<const _Tp*> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
-};
-
-// The overloaded functions iterator_category, distance_type, and
-// value_type are not part of the C++ standard. (They have been
-// replaced by struct iterator_traits.) They are included for
-// backward compatibility with the HP STL.
-
-// We introduce internal names for these functions.
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::iterator_category
-__iterator_category(const _Iter&)
-{
- typedef typename iterator_traits<_Iter>::iterator_category _Category;
- return _Category();
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::difference_type*
-__distance_type(const _Iter&)
-{
- return static_cast<typename iterator_traits<_Iter>::difference_type*>(0);
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::value_type*
-__value_type(const _Iter&)
-{
- return static_cast<typename iterator_traits<_Iter>::value_type*>(0);
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::iterator_category
-iterator_category(const _Iter& __i) { return __iterator_category(__i); }
-
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::difference_type*
-distance_type(const _Iter& __i) { return __distance_type(__i); }
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::value_type*
-value_type(const _Iter& __i) { return __value_type(__i); }
-
-#define __ITERATOR_CATEGORY(__i) __iterator_category(__i)
-#define __DISTANCE_TYPE(__i) __distance_type(__i)
-#define __VALUE_TYPE(__i) __value_type(__i)
-
-template <class _InputIterator, class _Distance>
-inline void __distance(_InputIterator __first, _InputIterator __last,
- _Distance& __n, input_iterator_tag)
-{
- while (__first != __last) { ++__first; ++__n; }
-}
-
-template <class _RandomAccessIterator, class _Distance>
-inline void __distance(_RandomAccessIterator __first,
- _RandomAccessIterator __last,
- _Distance& __n, random_access_iterator_tag)
-{
- __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
- __n += __last - __first;
-}
-
-template <class _InputIterator, class _Distance>
-inline void distance(_InputIterator __first,
- _InputIterator __last, _Distance& __n)
-{
- __STL_REQUIRES(_InputIterator, _InputIterator);
- __distance(__first, __last, __n, iterator_category(__first));
-}
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _InputIterator>
-inline typename iterator_traits<_InputIterator>::difference_type
-__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag)
-{
- typename iterator_traits<_InputIterator>::difference_type __n = 0;
- while (__first != __last) {
- ++__first; ++__n;
- }
- return __n;
-}
-
-template <class _RandomAccessIterator>
-inline typename iterator_traits<_RandomAccessIterator>::difference_type
-__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
- random_access_iterator_tag) {
- __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
- return __last - __first;
-}
-
-template <class _InputIterator>
-inline typename iterator_traits<_InputIterator>::difference_type
-distance(_InputIterator __first, _InputIterator __last) {
- typedef typename iterator_traits<_InputIterator>::iterator_category
- _Category;
- __STL_REQUIRES(_InputIterator, _InputIterator);
- return __distance(__first, __last, _Category());
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _InputIter, class _Distance>
-inline void __advance(_InputIter& __i, _Distance __n, input_iterator_tag) {
- while (__n--) ++__i;
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1183
-#endif
-
-template <class _BidirectionalIterator, class _Distance>
-inline void __advance(_BidirectionalIterator& __i, _Distance __n,
- bidirectional_iterator_tag) {
- __STL_REQUIRES(_BidirectionalIterator, _BidirectionalIterator);
- if (__n >= 0)
- while (__n--) ++__i;
- else
- while (__n++) --__i;
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1183
-#endif
-
-template <class _RandomAccessIterator, class _Distance>
-inline void __advance(_RandomAccessIterator& __i, _Distance __n,
- random_access_iterator_tag) {
- __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
- __i += __n;
-}
-
-template <class _InputIterator, class _Distance>
-inline void advance(_InputIterator& __i, _Distance __n) {
- __STL_REQUIRES(_InputIterator, _InputIterator);
- __advance(__i, __n, iterator_category(__i));
-}
-
-#endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_H */
-
-
-
-// Local Variables:
-// mode:C++
-// End:
+++ /dev/null
-/*
- * Copyright 2007, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
--- /dev/null
+/*
+ *
+ * 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
+#define _STLP_ALGORITHM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#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
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+# include _STLP_NATIVE_HEADER(algorithm)
+#endif /* _STLP_IMPORT_VENDOR_STD */
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ALGORITHM */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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 0x202
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x202) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 doesn't have assert.h; macro assert() is defined in stl_evc.h */
+#ifndef _STLP_WCE_EVC3
+# include _STLP_NATIVE_C_HEADER(assert.h)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x202)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */
--- /dev/null
+/*
+ * 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
+#define _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>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_bitset.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_BITSET */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * 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_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x103
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x103) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined (_STLP_WCE_EVC3)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(cassert)
+# else
+# include <assert.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x103 )
+# 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
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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 )
+# include _STLP_NATIVE_CPP_C_HEADER(cctype)
+#else
+# ifndef _STLP_INTERNAL_CCTYPE
+# include <stl/_cctype.h>
+# 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:
--- /dev/null
+/*
+ * 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_CERRNO
+# define _STLP_CERRNO
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x105
+# include <stl/_prolog.h>
+# endif
+
+# ifndef _STLP_WCE
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(cerrno)
+# else
+# include <errno.h>
+# endif
+# endif
+
+#ifndef errno
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD) && \
+ ! defined (__IBMCPP__) && ! defined(__hpux) && ! defined(__MWERKS__) && !defined(_STLP_WCE)
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::errno;
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x105 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+#endif /* _STLP_CERRNO */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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__)
+# include _STLP_NATIVE_CPP_C_HEADER(cfloat)
+#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:
--- /dev/null
+/*
+ * 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_CISO646
+#define _STLP_CISO646
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x107
+# include <stl/_prolog.h>
+#endif
+
+#if !defined(_STLP_WCE_EVC3) && !defined (N_PLAT_NLM) && !defined (__BORLANDC__)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(ciso646)
+# else
+# include <iso646.h>
+# endif /* _STLP_USE_NEW_C_HEADERS */
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x107 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CISO646 */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_CLIMITS
+# define _STLP_CLIMITS
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x108
+# include <stl/_prolog.h>
+#endif
+
+#if defined (__SUNPRO_CC) && ((__SUNPRO_CC == 0x500) && (__SUNPRO_CC_COMPAT > 4))
+# include </usr/include/limits.h>
+#elif defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(climits)
+#else
+# if defined (__BORLANDC__)
+# include _STLP_NATIVE_C_HEADER(limits.h)
+# else
+# include <limits.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x108 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CLIMITS */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_CLOCALE
+#define _STLP_CLOCALE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x109
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x109 )
+# include _STLP_NATIVE_CPP_C_HEADER(clocale)
+#else
+# ifndef _STLP_INTERNAL_CLOCALE
+# include <stl/_clocale.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x109 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CLOCALE */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_CMATH
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x110
+# define _STLP_CMATH
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x110)
+# include _STLP_NATIVE_CPP_C_HEADER(cmath)
+#else
+# ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x110 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CMATH */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_COMPLEX
+#define _STLP_COMPLEX
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x10
+# include <stl/_prolog.h>
+#endif
+
+// This header declares the template class complex, as described in
+// in the draft C++ standard. Single-precision complex numbers
+// are complex<float>, double-precision are complex<double>, and
+// quad precision are complex<long double>.
+
+// Note that the template class complex is declared within namespace
+// std, as called for by the draft C++ standard
+
+#ifndef _STLP_INTERNAL_COMPLEX
+# include <stl/_complex.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x10 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_COMPLEX */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_CSETJMP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x111
+# define _STLP_CSETJMP
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x111)
+# include _STLP_NATIVE_CPP_C_HEADER(csetjmp)
+#else
+# ifndef _STLP_INTERNAL_CSETJMP
+# include <stl/_csetjmp.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x111 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSETJMP */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_CSIGNAL
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x112
+# define _STLP_CSIGNAL
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x112)
+# include _STLP_NATIVE_CPP_C_HEADER(csignal)
+#else
+# ifndef _STLP_INTERNAL_CSIGNAL
+# include <stl/_csignal.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x112 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSIGNAL */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_CSTDARG
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x113
+# define _STLP_CSTDARG
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x113)
+# include _STLP_NATIVE_CPP_C_HEADER(cstdarg)
+#else
+# ifndef _STLP_INTERNAL_CSTDARG
+# include <stl/_cstdarg.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x113 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTDARG */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_CSTDDEF
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x114
+# define _STLP_CSTDDEF
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x114)
+# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
+#else
+# ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x114 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTDDEF */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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
+#define _STLP_CSTDIO
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x15
+# define _STLP_CSTDIO
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x15)
+# include _STLP_NATIVE_CPP_C_HEADER(cstdio)
+#else
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x15)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_CSTDLIB
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x116
+# define _STLP_CSTDLIB
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x116)
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+#else
+# ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x116)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTDLIB */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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)
+# include _STLP_NATIVE_CPP_C_HEADER(cstring)
+#else
+# ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+# 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:
--- /dev/null
+/*
+ * 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_CTIME
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x118
+# define _STLP_CTIME
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x118)
+# include _STLP_NATIVE_CPP_C_HEADER(ctime)
+#else
+# ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x118)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CTIME */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_CTYPE_H
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include ctype.h, which results in warnings and errors
+ */
+#if !defined(RC_INVOKED)
+
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x219
+# include <stl/_prolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x219)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_CTYPE_H
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+
+# include _STLP_NATIVE_C_HEADER(ctype.h)
+
+/* on evc4 including ctype.h also defines setjmp macro */
+# if defined (_STLP_WCE)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+# ifndef _STLP_CTYPE_H_SEEN
+# define _STLP_CTYPE_H_SEEN
+
+/* Undef convenience interfaces */
+# undef isspace
+# undef isprint
+# undef iscntrl
+# undef isupper
+# undef islower
+# undef isalpha
+# undef isdigit
+# undef ispunct
+# undef isxdigit
+# undef isalnum
+# undef isgraph
+# undef toupper
+# undef tolower
+
+# if defined (UNDER_CE)
+
+# if (_WIN32_WCE < 300) /* Only wide chars for older versions */
+# define _isctype iswctype
+# endif
+
+__inline int (isalpha)(int c) { return _isctype(c, _ALPHA); }
+__inline int (isupper)(int c) { return _isctype(c, _UPPER); }
+__inline int (islower)(int c) { return _isctype(c, _LOWER); }
+__inline int (isdigit)(int c) { return _isctype(c, _DIGIT); }
+__inline int (isxdigit)(int c) { return _isctype(c, _HEX); }
+__inline int (isspace)(int c) { return _isctype(c, _SPACE); }
+__inline int (ispunct)(int c) { return _isctype(c, _PUNCT); }
+__inline int (isalnum)(int c) { return _isctype(c, _ALPHA|_DIGIT); }
+__inline int (isprint)(int c) { return _isctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); }
+__inline int (isgraph)(int c) { return _isctype(c, _PUNCT|_ALPHA|_DIGIT); }
+__inline int (iscntrl)(int c) { return _isctype(c, _CONTROL); }
+__inline int (isascii)(int c) { return ((unsigned)(c) < 0x80); }
+
+# undef _isctype
+
+__inline int (iswalpha)(int c) { return iswctype(c, _ALPHA); }
+__inline int (iswupper)(int c) { return iswctype(c, _UPPER); }
+__inline int (iswlower)(int c) { return iswctype(c, _LOWER); }
+__inline int (iswdigit)(int c) { return iswctype(c, _DIGIT); }
+__inline int (iswxdigit)(int c) { return iswctype(c, _HEX); }
+__inline int (iswspace)(int c) { return iswctype(c, _SPACE); }
+__inline int (iswpunct)(int c) { return iswctype(c, _PUNCT); }
+__inline int (iswalnum)(int c) { return iswctype(c, _ALPHA|_DIGIT); }
+__inline int (iswprint)(int c) { return iswctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); }
+__inline int (iswgraph)(int c) { return iswctype(c, _PUNCT|_ALPHA|_DIGIT); }
+__inline int (iswcntrl)(int c) { return iswctype(c, _CONTROL); }
+__inline int (iswascii)(int c) { return ((unsigned)(c) < 0x80); }
+
+# endif /* UNDER_CE */
+
+# endif /* _STLP_CTYPE_H_SEEN */
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x219)
+# 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 /* RC_INVOKED */
+
+#endif /* _STLP_CTYPE_H */
--- /dev/null
+/*
+ * 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_CWCHAR
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x120
+# define _STLP_CWCHAR
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x120)
+# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
+#else
+# ifndef _STLP_INTERNAL_CWCHAR
+# include <stl/_cwchar.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x120)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CWCHAR */
+
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_CWCTYPE
+#define _STLP_CWCTYPE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x121
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x121)
+# include _STLP_NATIVE_CPP_C_HEADER(cwctype)
+#else
+# ifndef _STLP_INTERNAL_CWCTYPE
+# include <stl/_cwctype.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x121)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CWCTYPE */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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
+#define _STLP_DEQUE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x22
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+# include _STLP_NATIVE_HEADER(deque)
+#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:
--- /dev/null
+/*
+ * 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 0x205
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x205) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#ifdef _STLP_WCE
+// only show message when directly including this file in a non-library build
+# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x205)
+# pragma message("eMbedded Visual C++ 3 and .NET don't have a errno.h header; STLport won't include native errno.h here")
+# endif
+#else
+# ifndef errno
+/* We define the following macro first to guaranty the header reentrancy: */
+# define _STLP_NATIVE_ERRNO_H_INCLUDED
+# include _STLP_NATIVE_C_HEADER(errno.h)
+# endif /* errno */
+
+# if !defined (_STLP_NATIVE_ERRNO_H_INCLUDED)
+/* If errno has been defined before inclusion of native errno.h including it from STLport errno.h
+ * becomes impossible because if:
+ * #define errno foo
+ * then
+ * #include _STLP_NATIVE_C_HEADER(errno.h)
+ * becomes:
+ * #include _STLP_NATIVE_C_HEADER(foo.h)
+ *
+ * To fix this problem you have to find where this definition comes from and include errno.h before it.
+ */
+# error errno has been defined before inclusion of errno.h header.
+# endif
+
+# ifdef __cplusplus
+# ifndef errno /* errno still not defined */
+_STLP_BEGIN_NAMESPACE
+# if !defined (__BORLANDC__)
+using ::errno;
+# else
+using _STLP_VENDOR_CSTD::errno;
+# endif
+_STLP_END_NAMESPACE
+# endif /* errno */
+# endif /* __cplusplus */
+
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x205)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */
--- /dev/null
+/*
+ * 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)
+/* 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:
+ */
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
+#else
+# include <stl/_exception.h>
+#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:
--- /dev/null
+/*
+ * 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_OLDSTD_exception
+#define _STLP_OLDSTD_exception
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x824
+# include <stl/_prolog.h>
+#endif
+
+#if defined (__BORLANDC__) || defined (_MSC_VER)
+# include <exception>
+#else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x824)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_OLDSTD_exception */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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/_prolog.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
+
+#include _STLP_NATIVE_C_HEADER(float.h)
+
+#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
+
+#if defined (__BORLANDC__) && defined (__cplusplus) && !defined (_STLP_BCC_FPU_BUG)
+# define _STLP_BCC_FPU_BUG
+// Ignore FPU exceptions, set FPU precision to 53 bits for floatio_test and cmath_test
+static unsigned int _bcc_fpu_bug = _control87(PC_53|MCW_EM, MCW_PC|MCW_EM);
+template <class _Fp>
+int __fpclass(_Fp __val)
+{ int __f = _fpclass(__val); _control87(PC_53|MCW_EM, MCW_PC|MCW_EM); return __f; }
+# define _fpclass __fpclass
+#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
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+
+
+// This header defines classes basic_filebuf, basic_ifstream,
+// basic_ofstream, and basic_fstream. These classes represent
+// streambufs and streams whose sources or destinations are files.
+
+#ifndef _STLP_FSTREAM
+#define _STLP_FSTREAM
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1025
+# include <stl/_prolog.h>
+# endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+# include <stl/_ioserr.h>
+# include <stl/_fstream.h>
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x1025)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+#endif /* _STLP_FSTREAM */
+
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_FSTREAM_H
+#define _STLP_FSTREAM_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2026
+# include <stl/_prolog.h>
+#endif
+
+#include <fstream>
+
+// get desired pollution
+#include <iostream.h>
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+# include <using/fstream>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2026)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_FSTREAM_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_FUNCTIONAL
+#define _STLP_FUNCTIONAL
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x27
+# include <stl/_prolog.h>
+# endif
+
+# ifdef _STLP_PRAGMA_ONCE
+# pragma once
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_STD)
+# include _STLP_NATIVE_HEADER(functional)
+# endif
+
+# ifndef _STLP_INTERNAL_FUNCTION_H
+# include <stl/_function.h>
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x27)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+#endif /* _STLP_FUNCTIONAL */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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:
--- /dev/null
+/*
+ * 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:
--- /dev/null
+/*
+ * Copyright (c) 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_IOMANIP
+#define _STLP_IOMANIP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1030
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_ioserr.h>
+#include <stl/_istream.h> // Includes <ostream> and <ios>
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Machinery for defining manipulators.
+
+// Class that calls one of ios_base's single-argument member functions.
+template <class _Arg>
+struct _Ios_Manip_1 {
+ typedef _Arg (ios_base::*__f_ptr_type)(_Arg);
+
+ _Ios_Manip_1(__f_ptr_type __f, const _Arg& __arg)
+ : _M_f(__f), _M_arg(__arg) {}
+
+ void operator()(ios_base& __ios) const
+ { (__ios.*_M_f)(_M_arg); }
+
+ __f_ptr_type _M_f;
+ _Arg _M_arg;
+};
+
+// Class that calls one of ios_base's two-argument member functions.
+struct _Ios_Setf_Manip {
+ ios_base::fmtflags _M_flag;
+ ios_base::fmtflags _M_mask;
+ bool _M_two_args;
+
+ _Ios_Setf_Manip(ios_base::fmtflags __f)
+ : _M_flag(__f), _M_mask(0), _M_two_args(false) {}
+
+ _Ios_Setf_Manip(ios_base::fmtflags __f, ios_base::fmtflags __m)
+ : _M_flag(__f), _M_mask(__m), _M_two_args(true) {}
+
+ void operator()(ios_base& __ios) const {
+ if (_M_two_args)
+ __ios.setf(_M_flag, _M_mask);
+ else
+ __ios.setf(_M_flag);
+ }
+};
+
+
+template <class _CharT, class _Traits, class _Arg>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __istr,
+ const _Ios_Manip_1<_Arg>& __f) {
+ __f(__istr);
+ return __istr;
+}
+
+template <class _CharT, class _Traits, class _Arg>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const _Ios_Manip_1<_Arg>& __f) {
+ __f(__os);
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __istr, const _Ios_Setf_Manip& __f) {
+ __f(__istr);
+ return __istr;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const _Ios_Setf_Manip& __f) {
+ __f(__os);
+ return __os;
+}
+
+//----------------------------------------------------------------------
+// The ios_base manipulators.
+inline _Ios_Setf_Manip _STLP_CALL resetiosflags(ios_base::fmtflags __mask)
+{ return _Ios_Setf_Manip(0, __mask); }
+
+inline _Ios_Setf_Manip _STLP_CALL setiosflags(ios_base::fmtflags __flag)
+{ return _Ios_Setf_Manip(__flag); }
+
+inline _Ios_Setf_Manip _STLP_CALL setbase(int __n) {
+ ios_base::fmtflags __base = __n == 8 ? ios_base::oct :
+ __n == 10 ? ios_base::dec :
+ __n == 16 ? ios_base::hex :
+ ios_base::fmtflags(0);
+ return _Ios_Setf_Manip(__base, ios_base::basefield);
+}
+
+inline _Ios_Manip_1<streamsize> _STLP_CALL
+setprecision(int __n) {
+ _Ios_Manip_1<streamsize>::__f_ptr_type __f = &ios_base::precision;
+ return _Ios_Manip_1<streamsize>(__f, __n);
+}
+
+inline _Ios_Manip_1<streamsize> _STLP_CALL
+setw(int __n) {
+ _Ios_Manip_1<streamsize>::__f_ptr_type __f = &ios_base::width;
+ return _Ios_Manip_1<streamsize>(__f, __n);
+}
+
+//----------------------------------------------------------------------
+// setfill, a manipulator that operates on basic_ios<> instead of ios_base.
+
+template <class _CharT>
+struct _Setfill_Manip {
+ _Setfill_Manip(_CharT __c) : _M_c(__c) {}
+ _CharT _M_c;
+};
+
+template <class _CharT, class _CharT2, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const _Setfill_Manip<_CharT2>& __m) {
+ __os.fill(__m._M_c);
+ return __os;
+}
+
+template <class _CharT, class _CharT2, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is,
+ const _Setfill_Manip<_CharT2>& __m) {
+ __is.fill(__m._M_c);
+ return __is;
+}
+
+template <class _CharT>
+inline _Setfill_Manip<_CharT> _STLP_CALL
+setfill(_CharT __c) {
+ return _Setfill_Manip<_CharT>(__c);
+}
+
+_STLP_END_NAMESPACE
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1030)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOMANIP */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_IOMANIP_H
+#define _STLP_IOMANIP_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2031
+# include <stl/_prolog.h>
+#endif
+
+#include <stl/_ioserr.h>
+
+#include <iomanip>
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+_STLP_USING_NAMESPACE(stlport)
+# else
+using _STLP_STD::setiosflags;
+using _STLP_STD::resetiosflags;
+using _STLP_STD::setbase;
+using _STLP_STD::setfill;
+using _STLP_STD::setprecision;
+using _STLP_STD::setw;
+# endif
+#endif /* _STLP_HAS_NO_NAMESPACES */
+
+// get all the pollution we want
+#include <iostream.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2031)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOMANIP_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_IOS
+#define _STLP_IOS
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1032
+# include <stl/_prolog.h>
+# endif
+
+# ifdef _STLP_PRAGMA_ONCE
+# pragma once
+# endif
+
+# include <stl/_ioserr.h>
+# include <stl/_ios.h>
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x1032)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+#endif /* _STLP_IOS */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_IOS_H
+#define _STLP_IOS_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1033
+# include <stl/_prolog.h>
+#endif
+
+#include <ios>
+
+#if defined (_STLP_USE_NAMESPACES)
+# include <using/ios>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1033)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOS_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_IOSFWD
+#define _STLP_IOSFWD
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1034
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+
+# if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR)
+# include <stl/_cwchar.h>
+# endif /* _STLP_HAS_WCHAR_T && !_STLP_CWCHAR */
+
+# include <stl/_iosfwd.h>
+#else
+# include <stl/char_traits.h>
+#endif /* _STLP_USE_NO_IOSTREAMS */
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1034)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOSFWD */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_IOSTREAM
+#define _STLP_IOSTREAM
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1037
+# include <stl/_prolog.h>
+# endif
+
+# ifdef _STLP_PRAGMA_ONCE
+# pragma once
+# endif
+
+#include <stl/_ioserr.h>
+
+#ifdef _STLP_REDIRECT_STDSTREAMS
+// for ofstream redirection
+# include <fstream>
+#endif
+
+#include <stl/_iosfwd.h>
+#include <stl/_istream.h>
+
+_STLP_BEGIN_NAMESPACE
+
+#ifndef _STLP_USE_NAMESPACES
+// in case of SGI iostreams, we have to rename our streams not to clash with those
+// provided in native lib
+# define cin _STLP_cin
+# define cout _STLP_cout
+# define cerr _STLP_cerr
+# define clog _STLP_clog
+#endif
+
+// Note: cin and wcin are both associated with stdio. The C standard
+// (Amendment 1, section 4.6.2.1) says that it is an error to mix
+// wide- and narrow-oriented I/O on the same stream. This implies
+// that it is an error to use both cin and wcin in the same C++
+// program; the same applies to cout and wcout, and cerr/clog and
+// wcerr/wclog.
+
+# ifdef _STLP_REDIRECT_STDSTREAMS
+extern _STLP_DECLSPEC istream cin;
+extern _STLP_DECLSPEC ofstream cout;
+extern _STLP_DECLSPEC ofstream cerr;
+extern _STLP_DECLSPEC ofstream clog;
+# else
+extern _STLP_DECLSPEC istream cin;
+extern _STLP_DECLSPEC ostream cout;
+extern _STLP_DECLSPEC ostream cerr;
+extern _STLP_DECLSPEC ostream clog;
+# endif
+
+# ifndef _STLP_NO_WCHAR_T
+extern _STLP_DECLSPEC wistream wcin;
+extern _STLP_DECLSPEC wostream wcout;
+extern _STLP_DECLSPEC wostream wcerr;
+extern _STLP_DECLSPEC wostream wclog;
+# endif
+
+_STLP_END_NAMESPACE
+
+//# elif defined ( _STLP_USE_NO_IOSTREAMS )
+//# include <stl/_null_stream.h>
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x1037)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+#endif /* _STLP_IOSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_IOSTREAM_H
+#define _STLP_IOSTREAM_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2035
+# include <stl/_prolog.h>
+#endif
+
+#include <iostream>
+
+// Those should be included all separately, as they do contain using declarations
+#include <streambuf.h>
+#include <ostream.h>
+#include <istream.h>
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+_STLP_USING_NAMESPACE(stlport)
+# else
+using _STLP_STD::cin;
+using _STLP_STD::cout;
+using _STLP_STD::clog;
+using _STLP_STD::cerr;
+using _STLP_STD::iostream;
+# ifndef _STLP_NO_WCHAR_T
+using _STLP_STD::wcin;
+using _STLP_STD::wcout;
+using _STLP_STD::wclog;
+using _STLP_STD::wcerr;
+# endif
+# endif
+#endif /* _STLP_HAS_NO_NAMESPACES */
+
+// Obsolete classes for old-style backwards compatibility
+
+
+class istream_withassign : public istream {
+ public:
+ istream_withassign() : istream((streambuf*)0) {}
+ ~istream_withassign() {}
+
+ istream_withassign& operator=(istream& __s) {
+ ios::init(__s.rdbuf());
+ return *this;
+ }
+ istream_withassign& operator=(streambuf* __s) {
+ ios::init(__s);
+ return *this;
+ }
+};
+
+class ostream_withassign : public ostream {
+ public:
+ ostream_withassign() : ostream((streambuf*)0) {}
+ ~ostream_withassign() {}
+
+ ostream_withassign& operator=(ostream& __s) {
+ ios::init(__s.rdbuf());
+ return *this;
+ }
+ ostream_withassign& operator=(streambuf* __s) {
+ ios::init(__s);
+ return *this;
+ }
+};
+
+class iostream_withassign : public iostream {
+ public:
+ iostream_withassign() : iostream((streambuf*)0) {}
+ ~iostream_withassign() {}
+ iostream_withassign & operator=(ios& __i) {
+ ios::init(__i.rdbuf());
+ return *this;
+ }
+ iostream_withassign & operator=(streambuf* __s) {
+ ios::init(__s);
+ return *this;
+ }
+} ;
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2035)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOSTREAM_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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 0x204
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x204) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 doesn't have iso646.h */
+#if !defined (_STLP_WCE_EVC3) && !defined (N_PLAT_NLM) && !defined (__BORLANDC__)
+# include _STLP_NATIVE_C_HEADER(iso646.h)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x204)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */
--- /dev/null
+/*
+ * Copyright (c) 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_ISTREAM
+#define _STLP_ISTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1036
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_ioserr.h>
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1036)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ISTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_ISTREAM_H
+#define _STLP_ISTREAM_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2037
+# include <stl/_prolog.h>
+#endif
+
+#include <stl/_ioserr.h>
+
+#include <istream>
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+_STLP_USING_NAMESPACE(stlport)
+# else
+using _STLP_STD::basic_istream;
+using _STLP_STD::basic_iostream;
+using _STLP_STD::istream;
+using _STLP_STD::iostream;
+using _STLP_STD::ios;
+# ifndef _STLP_NO_WCHAR_T
+using _STLP_STD::wistream;
+using _STLP_STD::wiostream;
+# endif
+using _STLP_STD::ws;
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2037)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ISTREAM_H */
--- /dev/null
+/*
+ *
+ * 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_ITERATOR
+#define _STLP_ITERATOR
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x38
+# include <stl/_prolog.h>
+# endif
+
+# ifdef _STLP_PRAGMA_ONCE
+# pragma once
+# endif
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+# include _STLP_NATIVE_HEADER(iterator)
+#endif /* IMPORT */
+
+# ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+# endif
+
+# ifndef _STLP_INTERNAL_STREAM_ITERATOR_H
+# include <stl/_stream_iterator.h>
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x38)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+#endif /* _STLP_ITERATOR */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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
+#define _STLP_LIMITS
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x39
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#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:
--- /dev/null
+/*
+ * 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 0x201
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x201) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if defined(_STLP_WCE_EVC3)
+struct _exception;
+#endif
+
+#include _STLP_NATIVE_C_HEADER(limits.h)
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x201)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
--- /dev/null
+/*
+ *
+ * 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_LIST
+#define _STLP_LIST
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x40
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifndef _STLP_INTERNAL_LIST_H
+# include <stl/_list.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+# include _STLP_NATIVE_HEADER(list)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x40)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_LIST */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_LOCALE
+#define _STLP_LOCALE
+
+// Basic framework: class locale and class locale::facet
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1041
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_ioserr.h>
+
+// Individual facets
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CODECVT_H
+# include <stl/_codecvt.h>
+#endif
+
+#ifndef _STLP_INTERNAL_COLLATE_H
+# include <stl/_collate.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+// those never included separately anyway
+#include <stl/_monetary.h>
+#include <stl/_time_facets.h>
+#include <stl/_messages_facets.h>
+
+// some stuff for streambuf iterators ended up defined there
+// Strictly speaking, _istream.h portion is only required for <iterator>, but it may break too many
+// programs if we omit it
+#ifndef _STLP_ISTREAM_H
+# include <stl/_istream.h>
+#endif
+
+// Convenience interfaces
+#undef isspace
+#undef isprint
+#undef iscntrl
+#undef isupper
+#undef islower
+#undef isalpha
+#undef isdigit
+#undef ispunct
+#undef isxdigit
+#undef isalnum
+#undef isgraph
+#undef toupper
+#undef tolower
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT>
+inline bool isspace (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::space, c); }
+
+template <class _CharT>
+inline bool isprint (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::print, c); }
+
+template <class _CharT>
+inline bool iscntrl (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::cntrl, c); }
+
+template <class _CharT>
+inline bool isupper (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::upper, c); }
+
+template <class _CharT>
+inline bool islower (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::lower, c); }
+
+template <class _CharT>
+inline bool isalpha (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alpha, c); }
+
+template <class _CharT>
+inline bool isdigit (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::digit, c); }
+
+template <class _CharT>
+inline bool ispunct (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::punct, c); }
+
+template <class _CharT>
+inline bool isxdigit (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::xdigit, c); }
+
+template <class _CharT>
+inline bool isalnum (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alnum, c); }
+
+template <class _CharT>
+inline bool isgraph (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::graph, c); }
+
+template <class _CharT>
+inline _CharT toupper(_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).toupper(c); }
+
+template <class _CharT>
+inline _CharT tolower(_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).tolower(c); }
+
+_STLP_END_NAMESPACE
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1041)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_LOCALE */
+
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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 0x242
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x242)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# else
+# error STLport include schema violation
+# endif
+#endif
+
+/* evc3 doesn't have locale.h */
+#ifndef _STLP_WCE_EVC3
+# include _STLP_NATIVE_C_HEADER(locale.h)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x242)
+# 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
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */
--- /dev/null
+/*
+ *
+ * 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_MAP
+#define _STLP_MAP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x43
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_map.h>
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+# include _STLP_NATIVE_HEADER(map)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x43)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_MAP */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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 0x244
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x244) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined (exception) && (!defined (__KCC) || (__KCC_VERSION < 4000)) && \
+ !(defined(__IBMCPP__) && (500 <= __IBMCPP__)) && !defined(_STLP_WCE_EVC3)
+# define _STLP_EXCEPTION_WAS_REDEFINED 1
+# define exception __math_exception
+#endif
+
+#include _STLP_NATIVE_C_HEADER(math.h)
+
+#if defined (_STLP_EXCEPTION_WAS_REDEFINED)
+# undef exception
+# undef _STLP_EXCEPTION_WAS_REDEFINED
+#endif
+
+#ifdef _STLP_WCE_EVC3
+# undef _exception
+# define _exception exception
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x244)
+# 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
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */
--- /dev/null
+/*
+ * 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_mem_h
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x245
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x245) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x245) || defined (_STLP_DONT_POP_HEADER_ID)
+# include _STLP_NATIVE_C_HEADER(mem.h)
+#else
+# if defined (__BORLANDC__) && defined (__USING_CNAME__)
+# define _USING_CNAME_WAS_UNDEFINED
+# undef __USING_CNAME__
+# endif
+
+# include _STLP_NATIVE_C_HEADER(mem.h)
+
+# if defined (__BORLANDC__) && defined (_USING_CNAME_WAS_UNDEFINED)
+# define __USING_CNAME__
+# define _STLP_mem_h 1
+# undef _USING_CNAME_WAS_UNDEFINED
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x245)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
+#endif /* _STLP_mem_h */
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */
--- /dev/null
+/*
+ * 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
+#define _STLP_MEMORY
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x46
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#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>
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+
+# if defined (__MSL__)
+# include _STLP_NATIVE_HEADER(limits)
+# endif
+
+# include _STLP_NATIVE_HEADER(memory)
+
+# 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
+
+#endif /* _STLP_MEMORY */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * 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_NEW_HEADER
+#define _STLP_NEW_HEADER
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x447
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x447)
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new)
+#else
+# ifndef _STLP_NEW_H_HEADER
+# include <stl/_new.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x447)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_NEW */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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 0x848
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x848) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined(_STLP_NO_NEW_HEADER)
+# if defined (__BORLANDC__)
+# include <new>
+# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800 && !defined(_MSC_VER))
+# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h)
+# else
+# if defined (__GNUC__) && (__GNUC__ >= 3)
+# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h)
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new.h)
+# endif
+# endif
+#endif /* !defined(_STLP_NO_NEW_HEADER) */
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x848)
+# 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
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_NUMERIC
+#define _STLP_NUMERIC
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x49
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifndef _STLP_INTERNAL_NUMERIC_H
+# include <stl/_numeric.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x49)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_NUMERIC */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_OSTREAM
+#define _STLP_OSTREAM
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1050
+# include <stl/_prolog.h>
+# endif
+
+# ifdef _STLP_PRAGMA_ONCE
+# pragma once
+# endif
+
+# include <stl/_ioserr.h>
+# include <stl/_ostream.h>
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x1050)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+#endif /* _STLP_OSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_OSTREAM_H
+#define _STLP_OSTREAM_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2051
+# include <stl/_prolog.h>
+#endif
+
+#include <stl/_ioserr.h>
+
+#include <ostream>
+
+#ifdef _STLP_USE_NAMESPACES
+# include <using/ostream>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2051)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_OSTREAM_H */
--- /dev/null
+/*
+ * 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 0x280
+# include <stl/_prolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x280) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# endif
+
+# if defined (__SUNPRO_CC) || defined (__HP_aCC)
+# include "/usr/include/pthread.h"
+# else
+# include _STLP_NATIVE_C_HEADER(pthread.h)
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x280)
+# 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
+
+/*
+ Local Variables:
+ mode:C++
+ End:
+*/
--- /dev/null
+/*
+ *
+ * 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_PTHREAD_ALLOC
+#define _STLP_PTHREAD_ALLOC
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x52
+# include <stl/_prolog.h>
+# endif
+
+# ifdef _STLP_PRAGMA_ONCE
+# pragma once
+# endif
+
+# include <stl/_pthread_alloc.h>
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x52)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+#endif /* _STLP_PTHREAD_ALLOC */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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
+#define _STLP_QUEUE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x53
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifndef _STLP_INTERNAL_QUEUE_H
+# include <stl/_queue.h>
+#endif
+
+#ifndef _STLP_FUNCTIONAL
+# include <functional>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+# include _STLP_NATIVE_HEADER(queue)
+#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:
--- /dev/null
+#ifndef _STLP_misc_rlocks_h
+# define _STLP_misc_rlocks_h
+# if (__SUNPRO_CC >= 0x500 )
+# include <../CCios/rlocks.h>
+# elif defined (__SUNPRO_CC)
+# include <../CC/rlocks.h>
+# else
+# error "This file is for SUN CC only. Please remove it if it causes any harm for other compilers."
+# endif
+#endif
+
--- /dev/null
+/*
+ * 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_ROPE
+#define _STLP_ROPE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x54
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#if defined (_STLP_NO_EXTENSIONS)
+/* Comment following if you want to use rope class even if you ask for
+ * no extension.
+ */
+# error The rope class is a STLport extension.
+#endif
+
+#include <stl/_rope.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x54)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ROPE */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_SET
+#define _STLP_SET
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x55
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_set.h>
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+# include _STLP_NATIVE_HEADER(set)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x55)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_SET */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_SETJMP_H
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x256
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x256) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_SETJMP_H
+#endif
+
+#if defined(_STLP_WCE_EVC3)
+struct _exception;
+#endif
+
+#if !defined (setjmp)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# include _STLP_NATIVE_C_HEADER(setjmp.h)
+#endif
+
+#if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
+/* See errno.h file for a description of this problem. */
+# error setjmp has been defined before inclusion of setjmp.h header.
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x256)
+# 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_SETJMP_H */
--- /dev/null
+/*
+ * 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 0x257
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x257) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 and evc4 don't have signal.h */
+#ifndef _STLP_WCE
+# include _STLP_NATIVE_C_HEADER(signal.h)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x257)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */
--- /dev/null
+/*
+ * 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:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// This header defines classes basic_stringbuf, basic_istringstream,
+// basic_ostringstream, and basic_stringstream. These classes
+// represent streamsbufs and streams whose sources or destinations are
+// C++ strings.
+
+#ifndef _STLP_SSTREAM
+#define _STLP_SSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1059
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_ioserr.h>
+
+#include <stl/_sstream.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1059)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_SSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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
+#define _STLP_STACK
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x60
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifndef _STLP_INTERNAL_STACK_H
+# include <stl/_stack.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+# include _STLP_NATIVE_HEADER(stack)
+#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:
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include stdarg.h, which results in warnings and errors
+ */
+#if !defined (RC_INVOKED)
+
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x261
+# include <stl/_prolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x261) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+
+# include _STLP_NATIVE_C_HEADER(stdarg.h)
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x261)
+# 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 /* RC_INVOKED */
--- /dev/null
+/*
+ * 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_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x262
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x262) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+# if defined (_MSC_VER) || defined (__DMC__)
+/* Native stddef.h contains errno macro definition making inclusion of native
+ * errno.h in STLport errno.h impossible. We are then forced to include errno.h
+ * first.
+ */
+# include "errno.h"
+# endif
+
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x262)
+# 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
+
--- /dev/null
+/*
+ * 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_STDEXCEPT
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x63
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x63) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_STDEXCEPT
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x63) || defined (_STLP_DONT_POP_HEADER_ID)
+# include _STLP_NATIVE_HEADER(stdexcept)
+#else
+# ifndef _STLP_INTERNAL_STDEXCEPT
+# include <stl/_stdexcept.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x63)
+# 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_STDEXCEPT */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include stdarg.h, which results in warnings and errors
+ */
+#if !defined(RC_INVOKED)
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x264
+# include <stl/_prolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x264) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+# include _STLP_NATIVE_C_HEADER(stdio.h)
+
+# if defined (__SUNPRO_CC) && !defined (_STRUCT_FILE)
+# define _STRUCT_FILE
+# endif
+
+# if (defined (__MWERKS__) && !defined (N_PLAT_NLM)) || defined (__BORLANDC__)
+# undef stdin
+# undef stdout
+# undef stderr
+# if defined (__MWERKS__)
+# define stdin (&_STLP_VENDOR_CSTD::__files[0])
+# define stdout (&_STLP_VENDOR_CSTD::__files[1])
+# define stderr (&_STLP_VENDOR_CSTD::__files[2])
+# elif defined (__BORLANDC__)
+# define stdin (&_STLP_VENDOR_CSTD::_streams[0])
+# define stdout (&_STLP_VENDOR_CSTD::_streams[1])
+# define stderr (&_STLP_VENDOR_CSTD::_streams[2])
+# endif
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x264)
+# 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 /* RC_INVOKED */
--- /dev/null
+#ifndef _STLP_misc_stdiostream_h
+# define _STLP_misc_stdiostream_h
+# if (__SUNPRO_CC >= 0x500 )
+# include <../CCios/stdiostream.h>
+# else if defined (__SUNPRO_CC)
+# include <../CC/stdiostream.h>
+# else
+# error "This file is for SUN CC only. Please remove it if it causes any harm for other compilers."
+# endif
+#endif
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include stdlib.h, which results in warnings and errors
+ */
+#if !defined (RC_INVOKED)
+
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x265
+# include <stl/_prolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x265) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# endif
+
+# if defined (_MSC_VER) || (defined (__GNUC__) && defined (__MINGW32__)) || \
+ defined (__BORLANDC__) || defined (__DMC__) || \
+ (defined (__HP_aCC) && defined (_REENTRANT))
+/* Native stdlib.h contains errno macro definition making inclusion of native
+ * errno.h in STLport errno.h impossible. We are then forced to include errno.h
+ * first.
+ */
+# include "errno.h"
+# endif
+
+/*
+ forward-declaration for _exception struct; prevents warning message
+ ../include/stdlib.h(817) : warning C4115: '_exception' : named type definition in parentheses
+*/
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+
+# include _STLP_NATIVE_C_HEADER(stdlib.h)
+
+/* on evc3/evc4 including stdlib.h also defines setjmp macro */
+# if defined (_STLP_WCE)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x265)
+# 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 /* RC_INVOKED */
+
+/*
+ Local Variables:
+ mode:C++
+ End:
+*/
--- /dev/null
+/*
+ *
+ * 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_ABBREVS_H
+# define _STLP_INTERNAL_ABBREVS_H
+
+// ugliness is intentional - to reduce conflicts
+# define input_iterator_tag _In__ItT
+# define output_iterator_tag _Ou__ItT
+# define bidirectional_iterator_tag _Bd__ItT
+# define random_access_iterator_tag _Ra__ItT
+# define input_iterator _In__It
+# define output_iterator _Ou__It
+# define bidirectional_iterator _Bd__It
+# define random_access_iterator _Ra__It
+# define reverse_bidirectional_iterator _rBd__It
+# define reverse_iterator _r__It
+# define back_insert_iterator _bI__It
+# define front_insert_iterator _fI__It
+# define raw_storage_iterator _rS__It
+# define _Const_traits _C_Tr
+# define _Const_Const_traits _CC_Tr
+# define _Nonconst_traits _N_Tr
+# define _Nonconst_Const_traits _NC_Tr
+
+// ugliness is intentional - to reduce conflicts probability
+# define __malloc_alloc M__A
+# define __node_alloc D__A
+# define __new_alloc N__A
+# define __debug_alloc G__A
+# define _STLP_alloc_proxy P__A
+
+# define _Deque_iterator_base _Dq__ItB
+# define _Deque_iterator _Dq__It
+
+# define _Select1st _S1st
+# define _Select2nd _S2nd
+# define __move_source __m_s
+# define _Vector_nonconst_traits _V_nct
+
+# define _Ht_iterator _Ht_It
+
+# define _List_node_base _L__NB
+# define _List_iterator_base _L__ItB
+# define _List_iterator _L__It
+
+# define _Slist_iterator_base _SL__ItB
+# define _Slist_iterator _SL__It
+
+# define _Rb_tree_node_base _rbT__NB
+# define _Rb_tree_node _rbT__N
+# define _Rb_tree_base_iterator _rbT__It
+# define _Rb_tree_base _rbT__B
+
+# if defined (__DMC__) && defined (_STLP_DEBUG)
+# define _NonDbg_hashtable _Nd_Ht
+# define _DBG_iter _d__It
+# endif
+#endif
+
--- /dev/null
+/*
+ *
+ * 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 __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 __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 __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 {
+ swap(*__first++, *__first2++);
+ if (__first == __middle)
+ __middle = __first2;
+ } while (__first2 != __last);
+
+ _ForwardIter __new_middle = __first;
+
+ __first2 = __middle;
+
+ while (__first2 != __last) {
+ 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;
+
+ __reverse(__first, __middle, bidirectional_iterator_tag());
+ __reverse(__middle, __last, bidirectional_iterator_tag());
+
+ while (__first != __middle && __middle != __last)
+ swap (*__first++, *--__last);
+
+ if (__first == __middle) {
+ __reverse(__middle, __last, bidirectional_iterator_tag());
+ return __last;
+ }
+ else {
+ __reverse(__first, __middle, bidirectional_iterator_tag());
+ return __first;
+ }
+}
+
+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) {
+ swap_ranges(__first, __middle, __middle);
+ return __result;
+ }
+
+ _Distance __d = __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 __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 = 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 = 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)) {
+ 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;
+ advance(__middle, __half_len);
+ return __rotate(__inplace_stable_partition(__first, __middle, __pred, __half_len, __pred_of_first, false),
+ __middle,
+ __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;
+ }
+ }
+ copy(__buffer, __result2, __result1);
+ return __result1;
+ }
+ else {
+ _ForwardIter __middle = __first;
+ _Distance __half_len = __len / 2;
+ advance(__middle, __half_len);
+ return __rotate(__stable_partition_adaptive(
+ __first, __middle, __pred,
+ __half_len, __buffer, __buffer_size,
+ __pred_of_first, false),
+ __middle,
+ __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 = false) {
+ _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));
+}
+
+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 = copy(__middle, __last, __buffer);
+ copy_backward(__first, __middle, __last);
+ return copy(__buffer, __buffer_end, __first);
+ }
+ else if (__len1 <= __buffer_size) {
+ _BidirectionalIter2 __buffer_end = copy(__first, __middle, __buffer);
+ copy(__middle, __last, __first);
+ return copy_backward(__buffer, __buffer_end, __last);
+ }
+ else
+ return __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 = copy(__first, __middle, __buffer);
+ merge(__buffer, __buffer_end, __middle, __last, __first, __comp);
+ }
+ else if (__len2 <= __buffer_size) {
+ _Pointer __buffer_end = copy(__middle, __last, __buffer);
+ __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;
+ advance(__first_cut, __len11);
+ __second_cut = lower_bound(__middle, __last, *__first_cut, __comp);
+ __len22 += distance(__middle, __second_cut);
+ }
+ else {
+ __len22 = __len2 / 2;
+ advance(__second_cut, __len22);
+ __first_cut = upper_bound(__first, __middle, *__second_cut, __comp);
+ __len11 += 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 = distance(__first, __last);
+ _Distance __half;
+
+ while (__len > 0) {
+ __half = __len >> 1;
+ _ForwardIter __middle = __first;
+ 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 = distance(__first, __last);
+ _Distance __half;
+
+ while (__len > 0) {
+ __half = __len >> 1;
+ _ForwardIter __middle = __first;
+ 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 = __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);
+ }
+ advance(__first, __len);
+ _ForwardIter __right = __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 copy(__first2, __last2, 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 copy(__first2, __last2, 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;
+ advance(__first_cut, __len11);
+ __second_cut = lower_bound(__middle, __last, *__first_cut, __comp);
+ __len22 += distance(__middle, __second_cut);
+ }
+ else {
+ __len22 = __len2 / 2;
+ advance(__second_cut, __len22);
+ __first_cut = upper_bound(__first, __middle, *__second_cut, __comp);
+ __len11 +=distance(__first, __first_cut);
+ }
+ _BidirectionalIter __new_middle
+ = __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 = distance(__first, __middle);
+ _Distance __len2 = 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(__check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(__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(__check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(__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 copy(__first2, __last2, 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(__check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(__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(__check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(__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 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(__check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(__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 copy(__first2, __last2, 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)
+ __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)
+ __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(__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(__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:
--- /dev/null
+/*
+ *
+ * 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,
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _InputIter)));
+}
+
+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
+
+template <class _BidirectionalIter>
+_STLP_INLINE_LOOP void
+__reverse(_BidirectionalIter __first, _BidirectionalIter __last, const bidirectional_iterator_tag &) {
+ for (; __first != __last && __first != --__last; ++__first)
+ 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)
+ iter_swap(__first, --__last);
+}
+
+template <class _BidirectionalIter>
+inline void
+reverse(_BidirectionalIter __first, _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ __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;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// 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;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+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 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:
+
--- /dev/null
+/*
+ *
+ * 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_ALGOBASE_C
+#define _STLP_ALGOBASE_C
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ for ( ; __first1 != __last1 && __first2 != __last2
+ ; ++__first1, ++__first2) {
+ if (*__first1 < *__first2) {
+ return true;
+ }
+ if (*__first2 < *__first1)
+ return false;
+ }
+ return __first1 == __last1 && __first2 != __last2;
+}
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool lexicographical_compare(_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))
+ for ( ; __first1 != __last1 && __first2 != __last2
+ ; ++__first1, ++__first2) {
+ if (__comp(*__first1, *__first2)) {
+ return true;
+ }
+ if (__comp(*__first2, *__first1))
+ return false;
+ }
+ return __first1 == __last1 && __first2 != __last2;
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (*__first1 < *__first2) {
+ _STLP_VERBOSE_ASSERT(!(*__first2 < *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return -1;
+ }
+ if (*__first2 < *__first1)
+ return 1;
+ ++__first1;
+ ++__first2;
+ }
+ if (__first2 == __last2) {
+ return !(__first1 == __last1);
+ }
+ else {
+ return -1;
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
+}
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp>
+_STLP_INLINE_LOOP _RandomAccessIter __find(_RandomAccessIter __first, _RandomAccessIter __last,
+ const _Tp& __val,
+ const random_access_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2;
+
+ for ( ; __trip_count > 0 ; --__trip_count) {
+ if (*__first == __val) return __first;
+ ++__first;
+
+ if (*__first == __val) return __first;
+ ++__first;
+
+ if (*__first == __val) return __first;
+ ++__first;
+
+ if (*__first == __val) return __first;
+ ++__first;
+ }
+
+ switch (__last - __first) {
+ case 3:
+ if (*__first == __val) return __first;
+ ++__first;
+ case 2:
+ if (*__first == __val) return __first;
+ ++__first;
+ case 1:
+ if (*__first == __val) return __first;
+ //++__first;
+ case 0:
+ default:
+ return __last;
+ }
+}
+
+inline char*
+__find(char* __first, char* __last, char __val, const random_access_iterator_tag &) {
+ void *res = memchr(__first, __val, __last - __first);
+ return res != 0 ? __STATIC_CAST(char*, res) : __last;
+}
+inline const char*
+__find(const char* __first, const char* __last, char __val, const random_access_iterator_tag &) {
+ const void *res = memchr(__first, __val, __last - __first);
+ return res != 0 ? __STATIC_CAST(const char*, res) : __last;
+}
+
+template <class _RandomAccessIter, class _Predicate>
+_STLP_INLINE_LOOP _RandomAccessIter __find_if(_RandomAccessIter __first, _RandomAccessIter __last,
+ _Predicate __pred,
+ const random_access_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2;
+
+ for ( ; __trip_count > 0 ; --__trip_count) {
+ if (__pred(*__first)) return __first;
+ ++__first;
+
+ if (__pred(*__first)) return __first;
+ ++__first;
+
+ if (__pred(*__first)) return __first;
+ ++__first;
+
+ if (__pred(*__first)) return __first;
+ ++__first;
+ }
+
+ switch(__last - __first) {
+ case 3:
+ if (__pred(*__first)) return __first;
+ ++__first;
+ case 2:
+ if (__pred(*__first)) return __first;
+ ++__first;
+ case 1:
+ if (__pred(*__first)) return __first;
+ //++__first;
+ case 0:
+ default:
+ return __last;
+ }
+}
+
+template <class _InputIter, class _Tp>
+_STLP_INLINE_LOOP _InputIter __find(_InputIter __first, _InputIter __last,
+ const _Tp& __val,
+ const input_iterator_tag &) {
+ while (__first != __last && !(*__first == __val)) ++__first;
+ return __first;
+}
+
+template <class _InputIter, class _Predicate>
+_STLP_INLINE_LOOP _InputIter __find_if(_InputIter __first, _STLP_MPW_EXTRA_CONST _InputIter __last,
+ _Predicate __pred,
+ const input_iterator_tag &) {
+ while (__first != __last && !__pred(*__first))
+ ++__first;
+ return __first;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _Predicate>
+_InputIter find_if(_InputIter __first, _InputIter __last,
+ _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __find_if(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+}
+
+template <class _InputIter, class _Tp>
+_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __find(__first, __last, __val, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+}
+
+template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2,
+ _BinaryPred __pred) {
+ _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 ) {
+ while (__first1 != __last1 && !__pred(*__first1, *__first2)) {
+ ++__first1;
+ }
+ return __first1;
+ }
+
+ // General case.
+
+ for ( ; ; ) { // __first1 != __last1 will be checked below
+ while (__first1 != __last1 && !__pred(*__first1, *__first2)) {
+ ++__first1;
+ }
+ if (__first1 == __last1) {
+ return __last1;
+ }
+ _ForwardIter2 __p = __p1;
+ _ForwardIter1 __current = __first1;
+ if (++__current == __last1) return __last1;
+
+ while (__pred(*__current, *__p)) {
+ if (++__p == __last2)
+ return __first1;
+ if (++__current == __last1)
+ return __last1;
+ }
+
+ ++__first1;
+ }
+ return __first1;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// find_first_of, with and without an explicitly supplied comparison function.
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _BinaryPredicate __comp) {
+ for ( ; __first1 != __last1; ++__first1) {
+ for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter) {
+ if (__comp(*__first1, *__iter)) {
+ return __first1;
+ }
+ }
+ }
+ return __last1;
+}
+
+// find_end, with and without an explicitly supplied comparison function.
+// Search [first2, last2) as a subsequence in [first1, last1), and return
+// the *last* possible match. Note that find_end for bidirectional iterators
+// is much faster than for forward iterators.
+
+// find_end for forward iterators.
+template <class _ForwardIter1, class _ForwardIter2,
+ class _BinaryPredicate>
+_ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2,
+ const forward_iterator_tag &, const forward_iterator_tag &,
+ _BinaryPredicate __comp) {
+ if (__first2 == __last2)
+ return __last1;
+ else {
+ _ForwardIter1 __result = __last1;
+ for (;;) {
+ _ForwardIter1 __new_result = search(__first1, __last1, __first2, __last2, __comp);
+ if (__new_result == __last1)
+ return __result;
+ else {
+ __result = __new_result;
+ __first1 = __new_result;
+ ++__first1;
+ }
+ }
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// find_end for bidirectional iterators. Requires partial specialization.
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+
+# ifndef _STLP_INTERNAL_ITERATOR_H
+_STLP_END_NAMESPACE
+# include <stl/_iterator.h>
+_STLP_BEGIN_NAMESPACE
+# endif /*_STLP_INTERNAL_ITERATOR_H*/
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _BinaryPredicate>
+_BidirectionalIter1
+__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1,
+ _BidirectionalIter2 __first2, _BidirectionalIter2 __last2,
+ const bidirectional_iterator_tag &, const bidirectional_iterator_tag &,
+ _BinaryPredicate __comp) {
+ typedef reverse_iterator<_BidirectionalIter1> _RevIter1;
+ typedef reverse_iterator<_BidirectionalIter2> _RevIter2;
+
+ _RevIter1 __rlast1(__first1);
+ _RevIter2 __rlast2(__first2);
+ _RevIter1 __rresult = search(_RevIter1(__last1), __rlast1,
+ _RevIter2(__last2), __rlast2,
+ __comp);
+
+ if (__rresult == __rlast1)
+ return __last1;
+ else {
+ _BidirectionalIter1 __result = __rresult.base();
+ advance(__result, -distance(__first2, __last2));
+ return __result;
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+template <class _ForwardIter1, class _ForwardIter2,
+ class _BinaryPredicate>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __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_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
+ __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*) {
+ _Distance __len = distance(__first, __last);
+ _Distance __half;
+ _ForwardIter __middle;
+
+ while (__len > 0) {
+ __half = __len >> 1;
+ __middle = __first;
+ 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
+ __len = __half;
+ }
+ return __first;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_ALGOBASE_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_ALGOBASE_H
+#define _STLP_INTERNAL_ALGOBASE_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_CLIMITS
+# include <climits>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined(_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined(_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template <class _Tp>
+inline void __swap_aux(_Tp& __a, _Tp& __b, const __true_type& /*SwapImplemented*/) {
+ __a.swap(__b);
+}
+
+template <class _Tp>
+inline void __swap_aux(_Tp& __a, _Tp& __b, const __false_type& /*SwapImplemented*/) {
+ _Tp __tmp = __a;
+ __a = __b;
+ __b = __tmp;
+}
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif /* _STLP_USE_PARTIAL_SPEC_WORKAROUND */
+
+// swap and iter_swap
+template <class _Tp>
+inline void swap(_Tp& __a, _Tp& __b) {
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+# if !defined(__BORLANDC__)
+ typedef typename _SwapImplemented<_Tp>::_Ret _Implemented;
+# else
+ enum { _Is = _SwapImplemented<_Tp>::_Is };
+ typedef typename __bool2type<_Is>::_Ret _Implemented;
+# endif
+ _STLP_PRIV __swap_aux(__a, __b, _Implemented());
+#else
+ _Tp __tmp = __a;
+ __a = __b;
+ __b = __tmp;
+#endif /* _STLP_USE_PARTIAL_SPEC_WORKAROUND */
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2, class _Value>
+inline void __iter_swap_aux_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, _Value *) {
+ _Value tmp = *__i1;
+ *__i1 = *__i2;
+ *__i2 = tmp;
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __true_type& /*OKToSwap*/) {
+ swap(*__i1, *__i2);
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __false_type& /*OKToSwap*/) {
+ __iter_swap_aux_aux( __i1, __i2, _STLP_VALUE_TYPE(__i1,_ForwardIter1) );
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2>
+inline void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2) {
+ // swap(*__i1, *__i2);
+ _STLP_PRIV __iter_swap_aux( __i1, __i2, _IsOKToSwap(_STLP_VALUE_TYPE(__i1, _ForwardIter1), _STLP_VALUE_TYPE(__i2, _ForwardIter2),
+ _STLP_IS_REF_TYPE_REAL_REF(__i1, _ForwardIter1),
+ _STLP_IS_REF_TYPE_REAL_REF(__i2, _ForwardIter2))._Answer());
+}
+
+//--------------------------------------------------
+// min and max
+
+#if !defined (__BORLANDC__) || defined (_STLP_USE_OWN_NAMESPACE)
+# if (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) && !defined (__STDC__)
+//In not ANSI mode Borland import min/max in global namespace which conflict
+//with STLport min/max when user does a 'using namespace std' in its code
+//(see test/unit/alg_test.cpp). To avoid this clash we simply import Borland min/max
+//in STLport namespace.
+using _STLP_VENDOR_STD::min;
+using _STLP_VENDOR_STD::max;
+# else
+template <class _Tp>
+inline const _Tp& (min)(const _Tp& __a, const _Tp& __b) { return __b < __a ? __b : __a; }
+template <class _Tp>
+inline const _Tp& (max)(const _Tp& __a, const _Tp& __b) { return __a < __b ? __b : __a; }
+# endif
+#endif
+
+# if defined (__BORLANDC__) && defined (_STLP_USE_OWN_NAMESPACE)
+inline unsigned long (min) (unsigned long __a, unsigned long __b) { return __b < __a ? __b : __a; }
+inline unsigned long (max) (unsigned long __a, unsigned long __b) { return __a < __b ? __b : __a; }
+# endif
+
+template <class _Tp, class _Compare>
+inline const _Tp& (min)(const _Tp& __a, const _Tp& __b, _Compare __comp) {
+ return __comp(__b, __a) ? __b : __a;
+}
+
+template <class _Tp, class _Compare>
+inline const _Tp& (max)(const _Tp& __a, const _Tp& __b, _Compare __comp) {
+ return __comp(__a, __b) ? __b : __a;
+}
+
+//--------------------------------------------------
+// copy
+
+// All of these auxiliary functions serve two purposes. (1) Replace
+// calls to copy with memmove whenever possible. (Memmove, not memcpy,
+// because the input and output ranges are permitted to overlap.)
+// (2) If we're using random access iterators, then write the loop as
+// a for loop with an explicit count.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __copy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const input_iterator_tag &, _Distance*) {
+ for ( ; __first != __last; ++__result, ++__first)
+ *__result = *__first;
+ return __result;
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __copy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const forward_iterator_tag &, _Distance* ) {
+ for ( ; __first != __last; ++__result, ++__first)
+ *__result = *__first;
+ return __result;
+}
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __copy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const bidirectional_iterator_tag &, _Distance* ) {
+ for ( ; __first != __last; ++__result, ++__first)
+ *__result = *__first;
+ return __result;
+}
+#endif
+
+template <class _RandomAccessIter, class _OutputIter, class _Distance>
+inline _OutputIter
+__copy(_RandomAccessIter __first, _RandomAccessIter __last,
+ _OutputIter __result, const random_access_iterator_tag &, _Distance*) {
+ for (_Distance __n = __last - __first; __n > 0; --__n) {
+ *__result = *__first;
+ ++__first;
+ ++__result;
+ }
+ return __result;
+}
+
+inline void*
+__copy_trivial(const void* __first, const void* __last, void* __result) {
+ size_t __n = (const char*)__last - (const char*)__first;
+ return __n ? (void *)((char*)memmove(__result, __first, __n) + __n) : __result;
+}
+
+//--------------------------------------------------
+// copy_backward auxiliary functions
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _Distance>
+inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first,
+ _BidirectionalIter1 __last,
+ _BidirectionalIter2 __result,
+ const bidirectional_iterator_tag &,
+ _Distance*) {
+ while (__first != __last)
+ *--__result = *--__last;
+ return __result;
+}
+
+template <class _RandomAccessIter, class _BidirectionalIter, class _Distance>
+inline _BidirectionalIter __copy_backward(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _BidirectionalIter __result,
+ const random_access_iterator_tag &,
+ _Distance*) {
+ for (_Distance __n = __last - __first; __n > 0; --__n)
+ *--__result = *--__last;
+ return __result;
+}
+
+inline void*
+__copy_trivial_backward(const void* __first, const void* __last, void* __result) {
+ const ptrdiff_t _Num = (const char*)__last - (const char*)__first;
+ return (_Num > 0) ? memmove((char*)__result - _Num, __first, _Num) : __result ;
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*IsOKToMemCpy*/) {
+ return __copy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0);
+}
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*IsOKToMemCpy*/) {
+ // we know they all pointers, so this cast is OK
+ // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result));
+ return (_OutputIter)__copy_trivial(__first, __last, __result);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*BothPtrType*/) {
+ return __copy_ptrs(__first, __last, __result,
+ _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter),
+ _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*BothPtrType*/) {
+ return __copy(__first, __last, __result,
+ _STLP_ITERATOR_CATEGORY(__first, _InputIter),
+ _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter copy(_InputIter __first, _InputIter __last, _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __copy_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer());
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const __false_type& /*TrivialAssignment*/) {
+ return __copy_backward(__first, __last, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter), _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const __true_type& /*TrivialAssignment*/) {
+ return (_OutputIter)__copy_trivial_backward(__first, __last, __result);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __false_type&) {
+ return __copy_backward(__first, __last, __result, _STLP_ITERATOR_CATEGORY(__first,_InputIter), _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __true_type&) {
+ return __copy_backward_ptrs(__first, __last, __result,
+ _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter),
+ _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter copy_backward(_InputIter __first, _InputIter __last, _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __copy_backward_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer() );
+}
+
+#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+# define _STLP_DECLARE_COPY_TRIVIAL(_Tp) \
+inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) \
+{ return (_Tp*)__copy_trivial(__first, __last, __result); } \
+inline _Tp* copy_backward(const _Tp* __first, const _Tp* __last, _Tp* __result) \
+{ return (_Tp*)__copy_trivial_backward(__first, __last, __result); }
+
+_STLP_DECLARE_COPY_TRIVIAL(char)
+# if !defined (_STLP_NO_SIGNED_BUILTINS)
+_STLP_DECLARE_COPY_TRIVIAL(signed char)
+# endif
+_STLP_DECLARE_COPY_TRIVIAL(unsigned char)
+_STLP_DECLARE_COPY_TRIVIAL(short)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned short)
+_STLP_DECLARE_COPY_TRIVIAL(int)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned int)
+_STLP_DECLARE_COPY_TRIVIAL(long)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned long)
+# if !defined(_STLP_NO_WCHAR_T) && !defined (_STLP_WCHAR_T_IS_USHORT)
+_STLP_DECLARE_COPY_TRIVIAL(wchar_t)
+# endif
+# if defined (_STLP_LONG_LONG)
+_STLP_DECLARE_COPY_TRIVIAL(_STLP_LONG_LONG)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned _STLP_LONG_LONG)
+# endif
+_STLP_DECLARE_COPY_TRIVIAL(float)
+_STLP_DECLARE_COPY_TRIVIAL(double)
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLARE_COPY_TRIVIAL(long double)
+# endif
+# undef _STLP_DECLARE_COPY_TRIVIAL
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+//--------------------------------------------------
+// copy_n (not part of the C++ standard)
+
+#if !defined (_STLP_NO_EXTENSIONS)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _Size, class _OutputIter>
+_STLP_INLINE_LOOP pair<_InputIter, _OutputIter>
+__copy_n(_InputIter __first, _Size __count,
+ _OutputIter __result,
+ const input_iterator_tag &) {
+ for ( ; __count > 0; --__count) {
+ *__result = *__first;
+ ++__first;
+ ++__result;
+ }
+ return pair<_InputIter, _OutputIter>(__first, __result);
+}
+
+template <class _RAIter, class _Size, class _OutputIter>
+inline pair<_RAIter, _OutputIter>
+__copy_n(_RAIter __first, _Size __count,
+ _OutputIter __result,
+ const random_access_iterator_tag &) {
+ _RAIter __last = __first + __count;
+ return pair<_RAIter, _OutputIter>(__last, copy(__first, __last, __result));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _Size, class _OutputIter>
+inline pair<_InputIter, _OutputIter>
+copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
+ _STLP_FIX_LITERAL_BUG(__first)
+ return _STLP_PRIV __copy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+}
+#endif
+
+//--------------------------------------------------
+// fill and fill_n
+template <class _ForwardIter, class _Tp>
+_STLP_INLINE_LOOP
+void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ *__first = __val;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _OutputIter, class _Size, class _Tp>
+_STLP_INLINE_LOOP
+_OutputIter __fill_n(_OutputIter __first, _Size __n, const _Tp& __val) {
+ _STLP_FIX_LITERAL_BUG(__first)
+ for ( ; __n > 0; --__n, ++__first)
+ *__first = __val;
+ return __first;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _OutputIter, class _Size, class _Tp>
+_STLP_INLINE_LOOP
+void fill_n(_OutputIter __first, _Size __n, const _Tp& __val) {
+ _STLP_FIX_LITERAL_BUG(__first)
+ _STLP_PRIV __fill_n(__first, __n, __val);
+}
+
+// Specialization: for one-byte types we can use memset.
+inline void fill(unsigned char* __first, unsigned char* __last,
+ const unsigned char& __val) {
+ unsigned char __tmp = __val;
+ memset(__first, __tmp, __last - __first);
+}
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+inline void fill(signed char* __first, signed char* __last,
+ const signed char& __val) {
+ signed char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+#endif
+inline void fill(char* __first, char* __last, const char& __val) {
+ char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Size>
+inline unsigned char* __fill_n(unsigned char* __first, _Size __n,
+ const unsigned char& __val) {
+ fill(__first, __first + __n, __val);
+ return __first + __n;
+}
+
+template <class _Size>
+inline signed char* __fill_n(char* __first, _Size __n,
+ const signed char& __val) {
+ fill(__first, __first + __n, __val);
+ return __first + __n;
+}
+
+template <class _Size>
+inline char* __fill_n(char* __first, _Size __n, const char& __val) {
+ fill(__first, __first + __n, __val);
+ return __first + __n;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+
+//--------------------------------------------------
+// equal and mismatch
+
+template <class _InputIter1, class _InputIter2>
+_STLP_INLINE_LOOP
+pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
+ _InputIter1 __last1,
+ _InputIter2 __first2) {
+ _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ while (__first1 != __last1 && *__first1 == *__first2) {
+ ++__first1;
+ ++__first2;
+ }
+ return pair<_InputIter1, _InputIter2>(__first1, __first2);
+}
+
+template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
+_STLP_INLINE_LOOP
+pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
+ _InputIter1 __last1,
+ _InputIter2 __first2,
+ _BinaryPredicate __binary_pred) {
+ _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) {
+ ++__first1;
+ ++__first2;
+ }
+ return pair<_InputIter1, _InputIter2>(__first1, __first2);
+}
+
+template <class _InputIter1, class _InputIter2>
+_STLP_INLINE_LOOP
+bool equal(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2) {
+ _STLP_FIX_LITERAL_BUG(__first1) _STLP_FIX_LITERAL_BUG(__last1) _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ if (!(*__first1 == *__first2))
+ return false;
+ return true;
+}
+
+template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
+_STLP_INLINE_LOOP
+bool equal(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _BinaryPredicate __binary_pred) {
+ _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ if (!__binary_pred(*__first1, *__first2))
+ return false;
+ return true;
+}
+
+//--------------------------------------------------
+// lexicographical_compare and lexicographical_compare_3way.
+// (the latter is not part of the C++ standard.)
+
+template <class _InputIter1, class _InputIter2>
+bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _Compare __comp);
+
+inline bool
+lexicographical_compare(const unsigned char* __first1,
+ const unsigned char* __last1,
+ const unsigned char* __first2,
+ const unsigned char* __last2) {
+ const size_t __len1 = __last1 - __first1;
+ const size_t __len2 = __last2 - __first2;
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+
+ const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
+ return __result != 0 ? (__result < 0) : (__len1 < __len2);
+}
+
+
+#if !(CHAR_MAX == SCHAR_MAX)
+inline bool lexicographical_compare(const char* __first1, const char* __last1,
+ const char* __first2, const char* __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+
+ return lexicographical_compare((const unsigned char*) __first1,
+ (const unsigned char*) __last1,
+ (const unsigned char*) __first2,
+ (const unsigned char*) __last2);
+}
+#endif /* CHAR_MAX == SCHAR_MAX */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+inline int
+__lexicographical_compare_3way(const unsigned char* __first1,
+ const unsigned char* __last1,
+ const unsigned char* __first2,
+ const unsigned char* __last2) {
+ const ptrdiff_t __len1 = __last1 - __first1;
+ const ptrdiff_t __len2 = __last2 - __first2;
+ const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
+ return __result != 0 ? __result
+ : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
+}
+
+
+#if !(CHAR_MAX == SCHAR_MAX)
+inline int
+__lexicographical_compare_3way(const char* __first1, const char* __last1,
+ const char* __first2, const char* __last2) {
+ return __lexicographical_compare_3way((const unsigned char*) __first1,
+ (const unsigned char*) __last1,
+ (const unsigned char*) __first2,
+ (const unsigned char*) __last2);
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if !defined (_STLP_NO_EXTENSIONS)
+template <class _InputIter1, class _InputIter2>
+int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+#endif /* EXTENSIONS */
+
+// count
+template <class _InputIter, class _Tp>
+_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter)
+count(_InputIter __first, _InputIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0;
+ for ( ; __first != __last; ++__first)
+ if (*__first == __val)
+ ++__n;
+ return __n;
+}
+
+// find and find_if. Note find may be expressed in terms of find_if if appropriate binder was available.
+template <class _InputIter, class _Tp>
+_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val);
+
+template <class _InputIter, class _Predicate>
+_InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred);
+
+// search.
+template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPred __predicate);
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// find_first_of
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _BinaryPredicate __comp);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2,
+ class _BinaryPredicate>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2,
+ _BinaryPredicate __comp);
+
+// replace
+template <class _ForwardIter, class _Tp>
+_STLP_INLINE_LOOP void
+replace(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __old_value, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (*__first == __old_value)
+ *__first = __new_value;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val, _Compare1 __comp1, _Compare2 __comp2, _Distance*);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_algobase.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ALGOBASE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ *
+ * 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_ALLOC_C
+#define _STLP_ALLOC_C
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#if defined (__WATCOMC__)
+# pragma warning 13 9
+# pragma warning 367 9
+# pragma warning 368 9
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Alloc>
+void * _STLP_CALL __debug_alloc<_Alloc>::allocate(size_t __n) {
+ size_t __total_extra = __extra_before_chunk() + __extra_after_chunk();
+ size_t __real_n = __n + __total_extra;
+ if (__real_n < __n) {
+ //It means that we rolled on size_t, __n must be very large, lets hope
+ //that allocating it will raised a bad_alloc exception:
+ __real_n = __n + (__total_extra - __real_n - 1);
+ }
+ __alloc_header *__result = (__alloc_header *)__allocator_type::allocate(__real_n);
+ memset((char*)__result, __shred_byte, __real_n * sizeof(value_type));
+ __result->__magic = __magic;
+ __result->__type_size = sizeof(value_type);
+ __result->_M_size = (_STLP_UINT32_T)__n;
+ return ((char*)__result) + (long)__extra_before;
+}
+
+template <class _Alloc>
+void _STLP_CALL
+__debug_alloc<_Alloc>::deallocate(void *__p, size_t __n) {
+ __alloc_header * __real_p = (__alloc_header*)((char *)__p -(long)__extra_before);
+ // check integrity
+ _STLP_VERBOSE_ASSERT(__real_p->__magic != __deleted_magic, _StlMsg_DBA_DELETED_TWICE)
+ _STLP_VERBOSE_ASSERT(__real_p->__magic == __magic, _StlMsg_DBA_NEVER_ALLOCATED)
+ _STLP_VERBOSE_ASSERT(__real_p->__type_size == 1,_StlMsg_DBA_TYPE_MISMATCH)
+ _STLP_VERBOSE_ASSERT(__real_p->_M_size == __n, _StlMsg_DBA_SIZE_MISMATCH)
+ // check pads on both sides
+ unsigned char* __tmp;
+ for (__tmp = (unsigned char*)(__real_p + 1); __tmp < (unsigned char*)__p; ++__tmp) {
+ _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_UNDERRUN)
+ }
+
+ size_t __real_n = __n + __extra_before_chunk() + __extra_after_chunk();
+
+ for (__tmp= ((unsigned char*)__p) + __n * sizeof(value_type);
+ __tmp < ((unsigned char*)__real_p) + __real_n ; ++__tmp) {
+ _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_OVERRUN)
+ }
+
+ // that may be unfortunate, just in case
+ __real_p->__magic = __deleted_magic;
+ memset((char*)__p, __shred_byte, __n * sizeof(value_type));
+ __allocator_type::deallocate(__real_p, __real_n);
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_ALLOC_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_ALLOC_H
+#define _STLP_INTERNAL_ALLOC_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#if !defined (_STLP_DEBUG_H) && (defined(_STLP_DEBUG) || defined(_STLP_ASSERTIONS) || defined(_STLP_DEBUG_ALLOC))
+# include <stl/debug/_debug.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef __THROW_BAD_ALLOC
+# if !defined(_STLP_USE_EXCEPTIONS)
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+# define __THROW_BAD_ALLOC puts("out of memory\n"); exit(1)
+# else
+# define __THROW_BAD_ALLOC throw _STLP_STD::bad_alloc()
+# endif
+#endif
+
+#ifndef _STLP_INTERNAL_NEW_HEADER
+# include <stl/_new.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+#if !defined (__ALLOC)
+# define __ALLOC __sgi_alloc
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_RAW_SGI_ALLOCATORS)
+template <class _Tp, class _Alloc> struct __allocator;
+#endif
+
+// Malloc-based allocator. Typically slower than default alloc below.
+// Typically thread-safe and more storage efficient.
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+typedef void (* __oom_handler_type)();
+#endif
+
+class _STLP_CLASS_DECLSPEC __malloc_alloc {
+public:
+ // this one is needed for proper simple_alloc wrapping
+ typedef char value_type;
+#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
+ template <class _Tp1> struct rebind {
+ typedef __allocator<_Tp1, __malloc_alloc> other;
+ };
+#endif
+ static void* _STLP_CALL allocate(size_t& __n)
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+ ;
+#else
+ {
+ void *__result = malloc(__n);
+# if defined (_STLP_MALLOC_USABLE_SIZE)
+ if (__result != 0) {
+ __n = _STLP_MALLOC_USABLE_SIZE(__result);
+ }
+# endif
+ if (__result == 0) {
+ __THROW_BAD_ALLOC;
+ }
+ return __result;
+ }
+#endif
+
+ static void _STLP_CALL deallocate(void* __p, size_t /* __n */) { free((char*)__p); }
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+ static __oom_handler_type _STLP_CALL set_malloc_handler(__oom_handler_type __f);
+#endif
+};
+
+// New-based allocator. Typically slower than default alloc below.
+// Typically thread-safe and more storage efficient.
+class _STLP_CLASS_DECLSPEC __new_alloc {
+public:
+ // this one is needed for proper simple_alloc wrapping
+ typedef char value_type;
+#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
+ template <class _Tp1> struct rebind {
+ typedef __allocator<_Tp1, __new_alloc > other;
+ };
+#endif
+ static void* _STLP_CALL allocate(size_t __n) { return __stl_new(__n); }
+ static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); }
+};
+
+
+// Allocator adaptor to check size arguments for debugging.
+// Reports errors using assert. Checking can be disabled with
+// NDEBUG, but it's far better to just use the underlying allocator
+// instead when no checking is desired.
+// There is some evidence that this can confuse Purify.
+// This adaptor can only be applied to raw allocators
+
+template <class _Alloc>
+class __debug_alloc : public _Alloc {
+public:
+ typedef _Alloc __allocator_type;
+ typedef typename _Alloc::value_type value_type;
+private:
+ struct __alloc_header {
+ size_t __magic: 16;
+ size_t __type_size:16;
+ _STLP_UINT32_T _M_size;
+ }; // that is 8 bytes for sure
+ // Sunpro CC has bug on enums, so extra_before/after set explicitly
+ enum { __pad = 8, __magic = 0xdeba, __deleted_magic = 0xdebd,
+ __shred_byte = _STLP_SHRED_BYTE };
+
+ enum { __extra_before = 16, __extra_after = 8 };
+ // Size of space used to store size. Note
+ // that this must be large enough to preserve
+ // alignment.
+ static size_t _STLP_CALL __extra_before_chunk() {
+ return (long)__extra_before / sizeof(value_type) +
+ (size_t)((long)__extra_before % sizeof(value_type) > 0);
+ }
+ static size_t _STLP_CALL __extra_after_chunk() {
+ return (long)__extra_after / sizeof(value_type) +
+ (size_t)((long)__extra_after % sizeof(value_type) > 0);
+ }
+public:
+#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
+ template <class _Tp1> struct rebind {
+ typedef __allocator< _Tp1, __debug_alloc<_Alloc> > other;
+ };
+#endif
+ __debug_alloc() {}
+ ~__debug_alloc() {}
+ static void* _STLP_CALL allocate(size_t);
+ static void _STLP_CALL deallocate(void *, size_t);
+};
+
+# if defined (__OS400__) || defined (_WIN64)
+enum {_ALIGN = 16, _ALIGN_SHIFT = 4, _MAX_BYTES = 256};
+# else
+enum {_ALIGN = 8, _ALIGN_SHIFT = 3, _MAX_BYTES = 128};
+# endif /* __OS400__ */
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+
+# if !defined (_STLP_USE_SIMPLE_NODE_ALLOC)
+// Default node allocator.
+// With a reasonable compiler, this should be roughly as fast as the
+// original STL class-specific allocators, but with less fragmentation.
+// Define _STLP_USE_SIMPLE_NODE_ALLOC to use __new_alloc instead, which
+// can be implemented without out-of-line functions.
+class _STLP_CLASS_DECLSPEC __node_alloc {
+ static void * _STLP_CALL _M_allocate(size_t& __n);
+ /* __p may not be 0 */
+ static void _STLP_CALL _M_deallocate(void *__p, size_t __n);
+
+public:
+ // this one is needed for proper simple_alloc wrapping
+ typedef char value_type;
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
+ template <class _Tp1> struct rebind {
+ typedef __allocator<_Tp1, __node_alloc> other;
+ };
+# endif
+ /* __n must be > 0 */
+ static void* _STLP_CALL allocate(size_t& __n)
+ { return (__n > (size_t)_MAX_BYTES) ? __stl_new(__n) : _M_allocate(__n); }
+ /* __p may not be 0 */
+ static void _STLP_CALL deallocate(void *__p, size_t __n)
+ { if (__n > (size_t)_MAX_BYTES) __stl_delete(__p); else _M_deallocate(__p, __n); }
+};
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__node_alloc>;
+# endif
+
+# else /* _STLP_USE_SIMPLE_NODE_ALLOC */
+// Use __new_alloc instead of __node_alloc. This prevents the need for
+// out-of-line _M_allocate and _M_dealloacte functions.
+typedef __new_alloc __node_alloc;
+
+# endif /* _STLP_USE_SIMPLE_NODE_ALLOC */
+
+#endif /* _STLP_USE_NO_IOSTREAMS */
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__new_alloc>;
+_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__malloc_alloc>;
+#endif
+
+/* macro to convert the allocator for initialization
+ * not using MEMBER_TEMPLATE_CLASSES as it should work given template constructor */
+#if defined (_STLP_MEMBER_TEMPLATES) || ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/* if _STLP_NO_TEMPLATE_CONVERSIONS is set, the member template constructor is
+ * not used implicitly to convert allocator parameter, so let us do it explicitly */
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_NO_TEMPLATE_CONVERSIONS)
+# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
+# else
+# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __a
+# endif
+/* else convert, but only if partial specialization works, since else
+ * Container::allocator_type won't be different */
+#else
+# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
+#endif /* _STLP_MEMBER_TEMPLATES || !_STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+// Another allocator adaptor: _Alloc_traits. This serves two
+// purposes. First, make it possible to write containers that can use
+// either SGI-style allocators or standard-conforming allocator.
+
+// The fully general version.
+template <class _Tp, class _Allocator>
+struct _Alloc_traits {
+ typedef _Allocator _Orig;
+#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+ typedef typename _Allocator::_STLP_TEMPLATE rebind<_Tp> _Rebind_type;
+ typedef typename _Rebind_type::other allocator_type;
+ static allocator_type create_allocator(const _Orig& __a)
+ { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
+#else
+ // this is not actually true, used only to pass this type through
+ // to dynamic overload selection in _STLP_alloc_proxy methods
+ typedef _Allocator allocator_type;
+#endif /* !_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
+};
+
+#if defined (_STLP_USE_PERTHREAD_ALLOC)
+
+_STLP_END_NAMESPACE
+
+// include additional header here
+# include <stl/_pthread_alloc.h>
+
+_STLP_BEGIN_NAMESPACE
+
+# if defined (_STLP_DEBUG_ALLOC)
+typedef __debug_alloc<__pthread_alloc> __sgi_alloc;
+# else
+typedef __pthread_alloc __sgi_alloc;
+# endif /* _STLP_DEBUG_ALLOC */
+
+typedef __pthread_alloc __single_client_alloc;
+typedef __pthread_alloc __multithreaded_alloc;
+
+#else /* _STLP_USE_PERTHREAD_ALLOC */
+
+# if defined (_STLP_USE_NEWALLOC)
+
+# if defined (_STLP_DEBUG_ALLOC)
+typedef __debug_alloc<__new_alloc> __sgi_alloc;
+# else
+typedef __new_alloc __sgi_alloc;
+# endif /* _STLP_DEBUG_ALLOC */
+
+typedef __new_alloc __single_client_alloc;
+typedef __new_alloc __multithreaded_alloc;
+
+# elif defined (_STLP_USE_MALLOC)
+
+# if defined (_STLP_DEBUG_ALLOC)
+typedef __debug_alloc<__malloc_alloc> __sgi_alloc;
+# else
+typedef __malloc_alloc __sgi_alloc;
+# endif /* _STLP_DEBUG_ALLOC */
+
+typedef __malloc_alloc __single_client_alloc;
+typedef __malloc_alloc __multithreaded_alloc;
+
+# else
+
+# if defined (_STLP_DEBUG_ALLOC)
+typedef __debug_alloc<__node_alloc> __sgi_alloc;
+# else
+typedef __node_alloc __sgi_alloc;
+# endif
+
+typedef __node_alloc __single_client_alloc;
+typedef __node_alloc __multithreaded_alloc;
+
+# endif /* _STLP_USE_NEWALLOC */
+#endif /* _STLP_USE_PERTHREAD_ALLOC */
+
+// This implements allocators as specified in the C++ standard.
+//
+// Note that standard-conforming allocators use many language features
+// that are not yet widely implemented. In particular, they rely on
+// member templates, partial specialization, partial ordering of function
+// templates, the typename keyword, and the use of the template keyword
+// to refer to a template member of a dependent type.
+
+/*
+template <class _Tp>
+struct _AllocatorAux {
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+
+ pointer address(reference __x) const {return &__x;}
+ const_pointer address(const_reference __x) const { return &__x; }
+};
+
+template <class _Tp>
+struct _AllocatorAux<const _Tp> {
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+
+ const_pointer address(const_reference __x) const { return &__x; }
+};
+*/
+
+template <class _Tp>
+class allocator //: public _AllocatorAux<_Tp>
+/* A small helper struct to recognize STLport allocator implementation
+ * from any user specialization one.
+ */
+ : public __stlport_class<allocator<_Tp> > {
+public:
+ typedef _Tp value_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+#endif
+ allocator() _STLP_NOTHROW {}
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Tp1> allocator(const allocator<_Tp1>&) _STLP_NOTHROW {}
+#endif
+ allocator(const allocator<_Tp>&) _STLP_NOTHROW {}
+ allocator(__move_source<allocator<_Tp> > src) _STLP_NOTHROW {}
+ ~allocator() _STLP_NOTHROW {}
+ pointer address(reference __x) const {return &__x;}
+ const_pointer address(const_reference __x) const { return &__x; }
+ // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0.
+ _Tp* allocate(size_type __n, const void* = 0) {
+ if (__n > max_size()) {
+ __THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ if (__ret != 0) {
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+ }
+#endif
+ return __ret;
+ }
+ else
+ return 0;
+ }
+ // __p is permitted to be a null pointer, only if n==0.
+ void deallocate(pointer __p, size_type __n) {
+ _STLP_ASSERT( (__p == 0) == (__n == 0) )
+ if (__p != 0) {
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
+#endif
+ __sgi_alloc::deallocate((void*)__p, __n * sizeof(value_type));
+ }
+ }
+ // backwards compatibility
+ void deallocate(pointer __p) const { if (__p != 0) __sgi_alloc::deallocate((void*)__p, sizeof(value_type)); }
+ size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); }
+ void construct(pointer __p, const_reference __val) { _STLP_STD::_Copy_Construct(__p, __val); }
+ void destroy(pointer __p) { _STLP_STD::_Destroy(__p); }
+#if defined(__MRC__)||(defined(__SC__) && !defined(__DMC__))
+ template <class _T2> bool operator==(const allocator<_T2>&) const _STLP_NOTHROW { return true; }
+ template <class _T2> bool operator!=(const allocator<_T2>&) const _STLP_NOTHROW { return false; }
+#endif
+
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ //This is just to make swap workaround for compiler without template function partial
+ //happy.
+ void swap(allocator<_Tp>&) {}
+#endif
+
+#if defined (_STLP_NO_EXTENSIONS)
+ /* STLport extension giving rounded size of an allocated memory buffer
+ * This method do not have to be part of a user defined allocator implementation
+ * and won't even be called if such a function was granted.
+ */
+protected:
+#endif
+ _Tp* allocate(size_type __n, size_type& __allocated_n) {
+ if (__n > max_size()) {
+ __THROW_BAD_ALLOC;
+ }
+
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ if (__ret != 0) {
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+ }
+#endif
+ __allocated_n = __buf_size / sizeof(value_type);
+ return __ret;
+ }
+ else
+ return 0;
+ }
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC allocator<void> {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ typedef void value_type;
+#endif
+#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+#endif
+#if defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__)) //*ty 03/24/2001 - MPW compilers get confused on these operator definitions
+ template <class _T2> bool operator==(const allocator<_T2>&) const _STLP_NOTHROW { return true; }
+ template <class _T2> bool operator!=(const allocator<_T2>&) const _STLP_NOTHROW { return false; }
+#endif
+};
+
+#if !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__))) //*ty 03/24/2001 - MPW compilers get confused on these operator definitions
+template <class _T1, class _T2> inline bool _STLP_CALL operator==(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW { return true; }
+template <class _T1, class _T2> inline bool _STLP_CALL operator!=(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW { return false; }
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS allocator<char>;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS allocator<wchar_t>;
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_EXPORT_TEMPLATE_CLASS allocator<void*>;
+# endif
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct __alloc_type_traits {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<allocator<_Tp> >::_Ret _STLportAlloc;
+#else
+ enum { _Is = _IsSTLportClass<allocator<_Tp> >::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportAlloc;
+#endif
+ //The default allocator implementation which is recognize thanks to the
+ //__stlport_class inheritance is a stateless object so:
+ typedef _STLportAlloc has_trivial_default_constructor;
+ typedef _STLportAlloc has_trivial_copy_constructor;
+ typedef _STLportAlloc has_trivial_assignment_operator;
+ typedef _STLportAlloc has_trivial_destructor;
+ typedef _STLportAlloc is_POD_type;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<allocator<_Tp> > : _STLP_PRIV __alloc_type_traits<_Tp> {};
+#else
+_STLP_TEMPLATE_NULL
+struct __type_traits<allocator<char> > : _STLP_PRIV __alloc_type_traits<char> {};
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct __type_traits<allocator<wchar_t> > : _STLP_PRIV __alloc_type_traits<wchar_t> {};
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_TEMPLATE_NULL
+struct __type_traits<allocator<void*> > : _STLP_PRIV __alloc_type_traits<void*> {};
+# endif
+#endif
+
+
+#if !defined (_STLP_FORCE_ALLOCATORS)
+# define _STLP_FORCE_ALLOCATORS(a,y)
+#endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+// The version for the default allocator, for rare occasion when we have partial spec w/o member template classes
+template <class _Tp, class _Tp1>
+struct _Alloc_traits<_Tp, allocator<_Tp1> > {
+ typedef allocator<_Tp1> _Orig;
+ typedef allocator<_Tp> allocator_type;
+ static allocator_type create_allocator(const allocator<_Tp1 >& __a)
+ { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) && defined (_STLP_MEMBER_TEMPLATES)
+template <class _Tp, class _Alloc>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _Alloc_traits<_Tp, _Alloc>::allocator_type _STLP_CALL
+__stl_alloc_create(const _Alloc& __a, const _Tp*) {
+ typedef typename _Alloc::_STLP_TEMPLATE rebind<_Tp>::other _Rebound_type;
+ return _Rebound_type(__a);
+}
+#else
+// If custom allocators are being used without member template classes support :
+// user (on purpose) is forced to define rebind/get operations !!!
+template <class _Tp1, class _Tp2>
+inline allocator<_Tp2>& _STLP_CALL
+__stl_alloc_rebind(allocator<_Tp1>& __a, const _Tp2*) { return (allocator<_Tp2>&)(__a); }
+template <class _Tp1, class _Tp2>
+inline allocator<_Tp2> _STLP_CALL
+__stl_alloc_create(const allocator<_Tp1>&, const _Tp2*) { return allocator<_Tp2>(); }
+#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
+
+#if defined (_STLP_USE_RAW_SGI_ALLOCATORS)
+// move obsolete stuff out of the way
+# include <stl/_alloc_old.h>
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// inheritance is being used for EBO optimization
+template <class _Value, class _Tp, class _MaybeReboundAlloc>
+class _STLP_alloc_proxy : public _MaybeReboundAlloc {
+private:
+ typedef _MaybeReboundAlloc _Base;
+ typedef typename _Base::size_type size_type;
+ typedef _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc> _Self;
+public:
+ _Value _M_data;
+
+ _STLP_alloc_proxy (const _MaybeReboundAlloc& __a, _Value __p) :
+ _MaybeReboundAlloc(__a), _M_data(__p) {}
+
+ _STLP_alloc_proxy (__move_source<_Self> src) :
+ _MaybeReboundAlloc(_STLP_PRIV _AsMoveSource<_Base>(src.get())),
+ _M_data(_STLP_PRIV _AsMoveSource<_Value>(src.get()._M_data)) {}
+
+private:
+ /* Following are helper methods to detect stateless allocators and avoid
+ * swap in this case. For some compilers (VC6) it is a workaround for a
+ * compiler bug in the Empty Base class Optimization feature, for others
+ * it is a small optimization or nothing if no EBO. */
+ void _M_swap_alloc(_Self&, const __true_type& /*_IsStateless*/)
+ {}
+
+ void _M_swap_alloc(_Self& __x, const __false_type& /*_IsStateless*/) {
+ _MaybeReboundAlloc &__base_this = *this;
+ _MaybeReboundAlloc &__base_x = __x;
+ _STLP_STD::swap(__base_this, __base_x);
+ }
+
+public:
+ void _M_swap_alloc(_Self& __x) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsStateless<_MaybeReboundAlloc>::_Ret _StatelessAlloc;
+#else
+ typedef typename __bool2type<_IsStateless<_MaybeReboundAlloc>::_Is>::_Ret _StatelessAlloc;
+#endif
+ _M_swap_alloc(__x, _StatelessAlloc());
+ }
+
+ /* We need to define the following swap implementation for allocator with state
+ * as those allocators might have implement a special swap function to correctly
+ * move datas from an instance to the oher, _STLP_alloc_proxy should not break
+ * this mecanism. */
+ void swap(_Self& __x) {
+ _M_swap_alloc(__x);
+ _STLP_STD::swap(_M_data, __x._M_data);
+ }
+
+ _Tp* allocate(size_type __n, size_type& __allocated_n) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<_MaybeReboundAlloc>::_Ret _STLportAlloc;
+#else
+ typedef typename __bool2type<_IsSTLportClass<_MaybeReboundAlloc>::_Is>::_Ret _STLportAlloc;
+#endif
+ return allocate(__n, __allocated_n, _STLportAlloc());
+ }
+
+ // Unified interface to perform allocate()/deallocate() with limited
+ // language support
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+ // else it is rebound already, and allocate() member is accessible
+ _Tp* allocate(size_type __n)
+ { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, 0); }
+ void deallocate(_Tp* __p, size_type __n)
+ { __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).deallocate(__p, __n); }
+private:
+ _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
+ { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, __allocated_n); }
+#else
+ //Expose Standard allocate overload (using expression do not work for some compilers (Borland))
+ _Tp* allocate(size_type __n)
+ { return _Base::allocate(__n); }
+private:
+ _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
+ { return _Base::allocate(__n, __allocated_n); }
+#endif
+
+ _Tp* allocate(size_type __n, size_type& __allocated_n, const __false_type& /*STLport allocator*/)
+ { __allocated_n = __n; return allocate(__n); }
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<char*, char, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<wchar_t*, wchar_t, allocator<wchar_t> >;
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<void**, void*, allocator<void*> >;
+# endif
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_alloc.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ALLOC_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+template<class _Tp, class _Alloc>
+class __simple_alloc {
+ typedef _Alloc __alloc_type;
+public:
+ typedef typename _Alloc::value_type __alloc_value_type;
+ typedef _Tp value_type;
+ static size_t _STLP_CALL __chunk(size_t __n) {
+ return (sizeof(__alloc_value_type)==sizeof(value_type)) ? __n :
+ ((__n*sizeof(value_type)+sizeof(__alloc_value_type)-1)/sizeof(__alloc_value_type));
+ }
+ static _Tp* _STLP_CALL allocate(size_t __n) { return 0 == __n ? 0 : (_Tp*) __alloc_type::allocate(__chunk(__n)); }
+ static void _STLP_CALL deallocate(_Tp * __p, size_t __n) {
+ __alloc_type::deallocate((__alloc_value_type*)__p, __chunk(__n)); }
+};
+
+// Allocator adaptor to turn an SGI-style allocator (e.g. alloc, malloc_alloc)
+// into a standard-conforming allocator. Note that this adaptor does
+// *not* assume that all objects of the underlying alloc class are
+// identical, nor does it assume that all of the underlying alloc's
+// member functions are static member functions. Note, also, that
+// __allocator<_Tp, alloc> is essentially the same thing as allocator<_Tp>.
+
+template <class _Tp, class _Alloc>
+struct __allocator : public _Alloc {
+ typedef _Alloc __underlying_alloc;
+
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+ typedef __allocator<_Tp1, _Alloc> other;
+ };
+# endif
+ __allocator() _STLP_NOTHROW {}
+ __allocator(const _Alloc& ) _STLP_NOTHROW {}
+ __allocator(const __allocator<_Tp, _Alloc>& __a) _STLP_NOTHROW
+ : _Alloc(__a) {}
+# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ template <class _Tp1>
+ __allocator(const __allocator<_Tp1, _Alloc>& __a) _STLP_NOTHROW
+ : _Alloc(__a) {}
+# endif
+# ifdef _STLP_TRIVIAL_DESTRUCTOR_BUG
+ ~__allocator() _STLP_NOTHROW {}
+# endif
+ pointer address(reference __x) const { return &__x; }
+
+# if !defined (__WATCOM_CPLUSPLUS__)
+ const_pointer address(const_reference __x) const { return &__x; }
+# endif
+
+ // __n is permitted to be 0.
+ _Tp* allocate(size_type __n, const void* = 0) {
+ if (__n > max_size())
+ __THROW_BAD_ALLOC;
+ return __n != 0
+ ? __STATIC_CAST(_Tp*,__underlying_alloc::allocate(__n * sizeof(_Tp)))
+ : 0;
+ }
+
+ // __p is not permitted to be a null pointer.
+ void deallocate(pointer __p, size_type __n)
+ { if (__p) __underlying_alloc::deallocate(__p, __n * sizeof(_Tp)); }
+
+ size_type max_size() const _STLP_NOTHROW
+ { return size_t(-1) / sizeof(_Tp); }
+
+ void construct(pointer __p, const_reference __val) { _STLP_STD::_Copy_Construct(__p, __val); }
+ void destroy(pointer __p) { _STLP_STD::_Destroy(__p); }
+
+ const __underlying_alloc& __get_underlying_alloc() const { return *this; }
+};
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+template <class _Alloc>
+class __allocator<void, _Alloc> {
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+ typedef void value_type;
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _Tp1> struct rebind {
+ typedef __allocator<_Tp1, _Alloc> other;
+ };
+#endif
+};
+#endif
+
+template <class _Tp, class _Alloc>
+inline bool _STLP_CALL operator==(const __allocator<_Tp, _Alloc>& __a1,
+ const __allocator<_Tp, _Alloc>& __a2)
+{
+ return __a1.__get_underlying_alloc() == __a2.__get_underlying_alloc();
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+template <class _Tp, class _Alloc>
+inline bool _STLP_CALL operator!=(const __allocator<_Tp, _Alloc>& __a1,
+ const __allocator<_Tp, _Alloc>& __a2)
+{
+ return __a1.__get_underlying_alloc() != __a2.__get_underlying_alloc();
+}
+#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+
+// Comparison operators for all of the predifined SGI-style allocators.
+// This ensures that __allocator<malloc_alloc> (for example) will
+// work correctly.
+
+#ifndef _STLP_NON_TYPE_TMPL_PARAM_BUG
+inline bool _STLP_CALL operator==(const __malloc_alloc&, const __malloc_alloc&)
+{ return true; }
+
+# ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+inline bool _STLP_CALL operator!=(const __malloc_alloc&, const __malloc_alloc&)
+{ return false; }
+# endif
+
+inline bool _STLP_CALL operator==(const __new_alloc&, const __new_alloc&) { return true; }
+
+# ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+inline bool _STLP_CALL operator!=(const __new_alloc&, const __new_alloc&) { return false; }
+# endif
+
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+inline bool _STLP_CALL operator==(const __node_alloc&,
+ const __node_alloc&)
+{ return true; }
+
+# if defined( _STLP_FUNCTION_TMPL_PARTIAL_ORDER )
+
+inline bool _STLP_CALL operator!=(const __node_alloc&,
+ const __node_alloc&)
+{ return false; }
+# endif
+# endif
+
+#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+
+template <class _Alloc>
+inline bool _STLP_CALL operator==(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&) { return true; }
+# ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+template <class _Alloc>
+inline bool _STLP_CALL operator!=(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&) { return false; }
+# endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+
+// Versions for the predefined SGI-style allocators.
+template <class _Tp>
+struct _Alloc_traits<_Tp, __malloc_alloc> {
+ typedef __allocator<_Tp, __malloc_alloc> allocator_type;
+};
+
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+template <class _Tp>
+struct _Alloc_traits<_Tp, __node_alloc> {
+ typedef __allocator<_Tp, __node_alloc> allocator_type;
+};
+# endif
+
+template <class _Tp, class _Alloc>
+struct _Alloc_traits<_Tp, __debug_alloc<_Alloc> > {
+ typedef __allocator<_Tp, __debug_alloc<_Alloc> > allocator_type;
+};
+
+// Versions for the __allocator adaptor used with the predefined
+// SGI-style allocators.
+
+template <class _Tp, class _Tp1, class _Alloc>
+struct _Alloc_traits<_Tp, __allocator<_Tp1, _Alloc > > {
+ typedef __allocator<_Tp, _Alloc > allocator_type;
+};
+
+#endif
+
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+
+// Versions for the predefined SGI-style allocators.
+
+
+# if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
+
+typedef __malloc_alloc __malloc_alloc_dfl;
+
+template <class _Tp>
+inline __allocator<_Tp, __malloc_alloc_dfl >& _STLP_CALL
+__stl_alloc_rebind(__malloc_alloc_dfl& __a, const _Tp*) {
+ return (__allocator<_Tp, __malloc_alloc_dfl >&)__a;
+}
+
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+template <class _Tp>
+inline __allocator<_Tp, __node_alloc>& _STLP_CALL
+__stl_alloc_rebind(__node_alloc& __a, const _Tp*) {
+ return (__allocator<_Tp, __node_alloc>&)__a;
+}
+# endif
+
+template <class _Tp>
+inline __allocator<_Tp, __malloc_alloc_dfl > _STLP_CALL
+__stl_alloc_create(const __malloc_alloc_dfl&, const _Tp*) {
+ return __allocator<_Tp, __malloc_alloc_dfl > ();
+}
+
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+template <class _Tp>
+inline __allocator<_Tp, __node_alloc> _STLP_CALL
+__stl_alloc_create(const __node_alloc&, const _Tp*) {
+ return __allocator<_Tp, __node_alloc>();
+}
+
+# endif
+
+# else
+
+template <class _Tp>
+inline __allocator<_Tp, __malloc_alloc>& _STLP_CALL
+__stl_alloc_rebind(__malloc_alloc& __a, const _Tp*) {
+ return (__allocator<_Tp, __malloc_alloc>&)__a;
+}
+
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+template <class _Tp>
+inline __allocator<_Tp, __node_alloc>& _STLP_CALL
+__stl_alloc_rebind(__node_alloc& __a, const _Tp*) {
+ return (__allocator<_Tp, __node_alloc>&)__a;
+}
+# endif
+
+template <class _Tp>
+inline __allocator<_Tp, __malloc_alloc> _STLP_CALL
+__stl_alloc_create(const __malloc_alloc&, const _Tp*) {
+ return __allocator<_Tp, __malloc_alloc>();
+}
+
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+template <class _Tp>
+inline __allocator<_Tp, __node_alloc> _STLP_CALL
+__stl_alloc_create(const __node_alloc&, const _Tp*) {
+ return __allocator<_Tp, __node_alloc>();
+}
+# endif
+
+# endif
+
+template <class _Tp, class _Alloc>
+inline __allocator<_Tp, __debug_alloc<_Alloc> > _STLP_CALL
+__stl_alloc_create(const __debug_alloc<_Alloc>&, const _Tp*) {
+ return __allocator<_Tp, __debug_alloc<_Alloc> >();
+}
+template <class _Tp, class _Alloc>
+inline __allocator<_Tp, __debug_alloc<_Alloc> >& _STLP_CALL
+__stl_alloc_rebind(__debug_alloc<_Alloc>& __a, const _Tp*) {
+ return (__allocator<_Tp, __debug_alloc<_Alloc> >&)__a;
+}
+
+template <class _Tp>
+inline __allocator<_Tp, __new_alloc > _STLP_CALL
+__stl_alloc_create(const __new_alloc&, const _Tp*) {
+ return __allocator<_Tp, __new_alloc >();
+}
+template <class _Tp>
+inline __allocator<_Tp, __new_alloc >& _STLP_CALL
+__stl_alloc_rebind(__new_alloc& __a, const _Tp*) {
+ return (__allocator<_Tp, __new_alloc >&)__a;
+}
+
+template <class _Tp1, class _Alloc, class _Tp2>
+inline __allocator<_Tp2, _Alloc>& _STLP_CALL
+__stl_alloc_rebind(__allocator<_Tp1, _Alloc>& __a, const _Tp2*) {
+ return (__allocator<_Tp2, _Alloc>&)__a;
+}
+
+template <class _Tp1, class _Alloc, class _Tp2>
+inline __allocator<_Tp2, _Alloc> _STLP_CALL
+__stl_alloc_create(const __allocator<_Tp1, _Alloc>&, const _Tp2*) {
+ return __allocator<_Tp2, _Alloc>();
+}
+#endif
--- /dev/null
+/*
+ * 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 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((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
+ { return __REINTERPRET_CAST(_Tp*,__CONST_CAST(void*,_M_p)); }
+
+#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:
--- /dev/null
+/*
+ * 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 */
--- /dev/null
+/*
+ * 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:
--- /dev/null
+/*
+ *
+ * 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_BVECTOR_H
+#define _STLP_INTERNAL_BVECTOR_H
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+#endif
+
+#define _STLP_WORD_BIT (int(CHAR_BIT*sizeof(unsigned int)))
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _Bit_reference {
+ unsigned int* _M_p;
+ unsigned int _M_mask;
+ _Bit_reference(unsigned int* __x, unsigned int __y)
+ : _M_p(__x), _M_mask(__y) {}
+
+public:
+ _Bit_reference() : _M_p(0), _M_mask(0) {}
+
+ operator bool() const {
+ return !(!(*_M_p & _M_mask));
+ }
+ _Bit_reference& operator = (bool __x) {
+ if (__x) *_M_p |= _M_mask;
+ else *_M_p &= ~_M_mask;
+ return *this;
+ }
+ _Bit_reference& operator = (const _Bit_reference& __x) {
+ return *this = bool(__x);
+ }
+ bool operator == (const _Bit_reference& __x) const {
+ return bool(*this) == bool(__x);
+ }
+ bool operator < (const _Bit_reference& __x) const {
+ return !bool(*this) && bool(__x);
+ }
+
+ _Bit_reference& operator |= (bool __x) {
+ if (__x)
+ *_M_p |= _M_mask;
+ return *this;
+ }
+ _Bit_reference& operator &= (bool __x) {
+ if (!__x)
+ *_M_p &= ~_M_mask;
+ return *this;
+ }
+ void flip() { *_M_p ^= _M_mask; }
+};
+
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+inline void swap(_STLP_PRIV _Bit_reference& __x, _STLP_PRIV _Bit_reference& __y) {
+ bool __tmp = (bool)__x;
+ __x = __y;
+ __y = __tmp;
+}
+
+// Might not be very useful but costs nothing!
+_STLP_TEMPLATE_NULL
+struct __type_traits<_STLP_PRIV _Bit_reference> {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _Bit_iterator_base {
+ typedef ptrdiff_t difference_type;
+
+ unsigned int* _M_p;
+ unsigned int _M_offset;
+
+ void _M_bump_up() {
+ if (_M_offset++ == _STLP_WORD_BIT - 1) {
+ _M_offset = 0;
+ ++_M_p;
+ }
+ }
+
+ void _M_bump_down() {
+ if (_M_offset-- == 0) {
+ _M_offset = _STLP_WORD_BIT - 1;
+ --_M_p;
+ }
+ }
+
+ _Bit_iterator_base() : _M_p(0), _M_offset(0) {}
+ _Bit_iterator_base(unsigned int* __x, unsigned int __y) : _M_p(__x), _M_offset(__y) {}
+// see comment in doc/README.evc4 and doc/README.evc8
+#if defined(_MSC_VER) && _MSC_VER<=1401 && defined(MIPS) && defined(NDEBUG)
+ _Bit_iterator_base( const _Bit_iterator_base& __x) : _M_p(__x._M_p), _M_offset(__x._M_offset) {}
+#endif
+ // _Bit_iterator_base& operator = ( const _Bit_iterator_base& __x) { _M_p = __x._M_p ; _M_offset = __x._M_offset ; return *this; }
+
+ void _M_advance (difference_type __i) {
+ difference_type __n = __i + _M_offset;
+ _M_p += __n / _STLP_WORD_BIT;
+ __n = __n % _STLP_WORD_BIT;
+ if (__n < 0) {
+ _M_offset = (unsigned int) __n + _STLP_WORD_BIT;
+ --_M_p;
+ } else
+ _M_offset = (unsigned int) __n;
+ }
+
+ difference_type _M_subtract(const _Bit_iterator_base& __x) const {
+ return _STLP_WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
+ }
+};
+
+inline bool _STLP_CALL operator==(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return __y._M_p == __x._M_p && __y._M_offset == __x._M_offset;
+}
+inline bool _STLP_CALL operator!=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return __y._M_p != __x._M_p || __y._M_offset != __x._M_offset;
+}
+
+inline bool _STLP_CALL operator<(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return __x._M_p < __y._M_p || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset);
+}
+
+inline bool _STLP_CALL operator>(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return operator <(__y , __x);
+}
+inline bool _STLP_CALL operator<=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return !(__y < __x);
+}
+inline bool _STLP_CALL operator>=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return !(__x < __y);
+}
+
+template <class _Ref, class _Ptr>
+struct _Bit_iter : public _Bit_iterator_base {
+ typedef _Ref reference;
+ typedef _Ptr pointer;
+ typedef _Bit_iter<_Ref, _Ptr> _Self;
+ typedef random_access_iterator_tag iterator_category;
+ typedef bool value_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+
+ _Bit_iter(unsigned int* __x, unsigned int __y) : _Bit_iterator_base(__x, __y) {}
+ _Bit_iter() {}
+
+ _Bit_iter(const _Bit_iter<_Bit_reference, _Bit_reference*>& __x):
+ _Bit_iterator_base((const _Bit_iterator_base&)__x) {}
+
+ // _Self& operator = (const _Bit_iter<_Bit_reference, _Bit_reference*>& __x)
+ // { (_Bit_iterator_base&)*this = (const _Bit_iterator_base&)__x; return *this; }
+
+ reference operator*() const {
+ return _Bit_reference(_M_p, 1UL << _M_offset);
+ }
+ _Self& operator++() {
+ _M_bump_up();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ _M_bump_up();
+ return __tmp;
+ }
+ _Self& operator--() {
+ _M_bump_down();
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ _M_bump_down();
+ return __tmp;
+ }
+ _Self& operator+=(difference_type __i) {
+ _M_advance(__i);
+ return *this;
+ }
+ _Self& operator-=(difference_type __i) {
+ *this += -__i;
+ return *this;
+ }
+ _Self operator+(difference_type __i) const {
+ _Self __tmp = *this;
+ return __tmp += __i;
+ }
+ _Self operator-(difference_type __i) const {
+ _Self __tmp = *this;
+ return __tmp -= __i;
+ }
+ difference_type operator-(const _Self& __x) const {
+ return _M_subtract(__x);
+ }
+ reference operator[](difference_type __i) { return *(*this + __i); }
+};
+
+template <class _Ref, class _Ptr>
+inline _Bit_iter<_Ref,_Ptr> _STLP_CALL
+operator+(ptrdiff_t __n, const _Bit_iter<_Ref, _Ptr>& __x) {
+ return __x + __n;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Ref, class _Ptr>
+struct __type_traits< _STLP_PRIV _Bit_iter<_Ref, _Ptr> > {
+ 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)
+inline random_access_iterator_tag iterator_category(const _STLP_PRIV _Bit_iterator_base&)
+{ return random_access_iterator_tag(); }
+inline ptrdiff_t* distance_type(const _STLP_PRIV _Bit_iterator_base&)
+{ return (ptrdiff_t*)0; }
+inline bool* value_type(const _STLP_PRIV _Bit_iter<_STLP_PRIV _Bit_reference, _STLP_PRIV _Bit_reference*>&)
+{ return (bool*)0; }
+inline bool* value_type(const _STLP_PRIV _Bit_iter<bool, const bool*>&)
+{ return (bool*)0; }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+typedef _Bit_iter<bool, const bool*> _Bit_const_iterator;
+typedef _Bit_iter<_Bit_reference, _Bit_reference*> _Bit_iterator;
+
+// Bit-vector base class, which encapsulates the difference between
+// old SGI-style allocators and standard-conforming allocators.
+template <class _Alloc>
+class _Bvector_base {
+ typedef _Bvector_base<_Alloc> _Self;
+public:
+ _STLP_FORCE_ALLOCATORS(bool, _Alloc)
+ typedef typename _Alloc_traits<bool, _Alloc>::allocator_type allocator_type;
+ typedef unsigned int __chunk_type;
+ typedef typename _Alloc_traits<__chunk_type,
+ _Alloc>::allocator_type __chunk_allocator_type;
+ allocator_type get_allocator() const {
+ return _STLP_CONVERT_ALLOCATOR((const __chunk_allocator_type&)_M_end_of_storage, bool);
+ }
+ static allocator_type __get_dfl_allocator() { return allocator_type(); }
+
+ _Bvector_base(const allocator_type& __a)
+ : _M_start(), _M_finish(), _M_end_of_storage(_STLP_CONVERT_ALLOCATOR(__a, __chunk_type),
+ (__chunk_type*)0)
+ {}
+ _Bvector_base(__move_source<_Self> src)
+ : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
+ _M_end_of_storage(src.get()._M_end_of_storage) {
+ //Make the source destroyable
+ src.get()._M_start._M_p = 0;
+ }
+
+ ~_Bvector_base() {
+ _M_deallocate();
+ }
+
+protected:
+
+ unsigned int* _M_bit_alloc(size_t __n) {
+ return _M_end_of_storage.allocate((__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT);
+ }
+ void _M_deallocate() {
+ if (_M_start._M_p)
+ _M_end_of_storage.deallocate(_M_start._M_p,
+ _M_end_of_storage._M_data - _M_start._M_p);
+ }
+
+ _Bit_iterator _M_start;
+ _Bit_iterator _M_finish;
+ _STLP_alloc_proxy<__chunk_type*, __chunk_type, __chunk_allocator_type> _M_end_of_storage;
+};
+
+
+// The next few lines are confusing. What we're doing is declaring a
+// partial specialization of vector<T, Alloc> if we have the necessary
+// compiler support. Otherwise, we define a class bit_vector which uses
+// the default allocator.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_BOOL) && !defined (__SUNPRO_CC)
+# define _STLP_VECBOOL_TEMPLATE
+# define __BVEC_TMPL_HEADER template <class _Alloc>
+#else
+# undef _STLP_VECBOOL_TEMPLATE
+# ifdef _STLP_NO_BOOL
+# define __BVEC_TMPL_HEADER
+# else
+# define __BVEC_TMPL_HEADER _STLP_TEMPLATE_NULL
+# endif
+# if !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__))) //*TY 12/17/2000 -
+# define _Alloc _STLP_DEFAULT_ALLOCATOR(bool)
+# else
+# define _Alloc allocator<bool>
+# endif
+#endif
+
+#if defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+#endif
+
+#ifdef _STLP_NO_BOOL
+# define __BVECTOR_QUALIFIED bit_vector
+# define __BVECTOR bit_vector
+#else
+# ifdef _STLP_VECBOOL_TEMPLATE
+# define __BVECTOR_QUALIFIED vector<bool, _Alloc>
+# else
+# define __BVECTOR_QUALIFIED vector<bool, allocator<bool> >
+# endif
+# if defined (_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS)
+# define __BVECTOR __BVECTOR_QUALIFIED
+# else
+# define __BVECTOR vector
+# endif
+#endif
+
+#if !defined (_STLP_DEBUG) || defined (_STLP_NO_BOOL)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+__BVEC_TMPL_HEADER
+class __BVECTOR_QUALIFIED : public _STLP_PRIV _Bvector_base<_Alloc >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_DEBUG)
+ , public __stlport_class< __BVECTOR_QUALIFIED >
+#endif
+{
+ typedef _STLP_PRIV _Bvector_base<_Alloc > _Base;
+ typedef __BVECTOR_QUALIFIED _Self;
+public:
+ typedef bool value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _STLP_PRIV _Bit_reference reference;
+ typedef bool const_reference;
+ typedef _STLP_PRIV _Bit_reference* pointer;
+ typedef const bool* const_pointer;
+ typedef random_access_iterator_tag _Iterator_category;
+
+ typedef _STLP_PRIV _Bit_iterator iterator;
+ typedef _STLP_PRIV _Bit_const_iterator const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+#ifdef _STLP_VECBOOL_TEMPLATE
+ typedef typename _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
+ typedef typename _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
+#else
+ typedef _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
+ typedef _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
+#endif
+
+protected:
+
+ void _M_initialize(size_type __n) {
+ unsigned int* __q = this->_M_bit_alloc(__n);
+ this->_M_end_of_storage._M_data = __q + (__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
+ this->_M_start = iterator(__q, 0);
+ this->_M_finish = this->_M_start + difference_type(__n);
+ }
+ void _M_insert_aux(iterator __position, bool __x) {
+ if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
+ _STLP_PRIV __copy_backward(__position, this->_M_finish, this->_M_finish + 1,
+ random_access_iterator_tag(), (difference_type*)0 );
+ *__position = __x;
+ ++this->_M_finish;
+ }
+ else {
+ size_type __len = size() ? 2 * size() : _STLP_WORD_BIT;
+ unsigned int* __q = this->_M_bit_alloc(__len);
+ iterator __i = copy(begin(), __position, iterator(__q, 0));
+ *__i++ = __x;
+ this->_M_finish = copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_initialize_range(_InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ this->_M_start = iterator();
+ this->_M_finish = iterator();
+ this->_M_end_of_storage._M_data = 0;
+ for ( ; __first != __last; ++__first)
+ push_back(*__first);
+ }
+
+ template <class _ForwardIterator>
+ void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __n = distance(__first, __last);
+ _M_initialize(__n);
+ copy(__first, __last, this->_M_start);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_range(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first) {
+ __pos = insert(__pos, *__first);
+ ++__pos;
+ }
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert_range(iterator __position,
+ _ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ size_type __n = distance(__first, __last);
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
+ random_access_iterator_tag(), (difference_type*)0 );
+ copy(__first, __last, __position);
+ this->_M_finish += difference_type(__n);
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ unsigned int* __q = this->_M_bit_alloc(__len);
+ iterator __i = copy(begin(), __position, iterator(__q, 0));
+ __i = copy(__first, __last, __i);
+ this->_M_finish = copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+ }
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+public:
+ iterator begin() { return this->_M_start; }
+ const_iterator begin() const { return this->_M_start; }
+ iterator end() { return this->_M_finish; }
+ const_iterator end() const { return this->_M_finish; }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ size_type size() const { return size_type(end() - begin()); }
+ size_type max_size() const { return size_type(-1); }
+ size_type capacity() const {
+ return size_type(const_iterator(this->_M_end_of_storage._M_data, 0) - begin());
+ }
+ bool empty() const { return begin() == end(); }
+ reference operator[](size_type __n)
+ { return *(begin() + difference_type(__n)); }
+ const_reference operator[](size_type __n) const
+ { return *(begin() + difference_type(__n)); }
+
+ void _M_range_check(size_type __n) const {
+ if (__n >= this->size())
+ __stl_throw_range_error("vector<bool>");
+ }
+
+ 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]; }
+
+ explicit __BVECTOR(const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {}
+
+ __BVECTOR(size_type __n, bool __val,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ _M_initialize(__n);
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __val ? ~0 : 0);
+ }
+
+ explicit __BVECTOR(size_type __n)
+ : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
+ _M_initialize(__n);
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), 0);
+ }
+
+ __BVECTOR(const _Self& __x)
+ : _STLP_PRIV _Bvector_base<_Alloc >(__x.get_allocator()) {
+ _M_initialize(__x.size());
+ copy(__x.begin(), __x.end(), this->_M_start);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) {
+ _M_initialize(__n);
+ fill(this->_M_start._M_p, this->_M_end_of_storage._M_data, __x ? ~0 : 0);
+ }
+
+ template <class _InputIterator>
+ void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_initialize_range(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ __BVECTOR(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+# endif
+ template <class _InputIterator>
+ __BVECTOR(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+#else /* _STLP_MEMBER_TEMPLATES */
+ __BVECTOR(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ size_type __n = distance(__first, __last);
+ _M_initialize(__n);
+ copy(__first, __last, this->_M_start);
+ }
+ __BVECTOR(const bool* __first, const bool* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ size_type __n = distance(__first, __last);
+ _M_initialize(__n);
+ copy(__first, __last, this->_M_start);
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ __BVECTOR(__move_source<_Self> src)
+ : _STLP_PRIV _Bvector_base<_Alloc >(__move_source<_Base>(src.get())) {}
+
+ ~__BVECTOR() {}
+
+ __BVECTOR_QUALIFIED& operator=(const __BVECTOR_QUALIFIED& __x) {
+ if (&__x == this) return *this;
+ if (__x.size() > capacity()) {
+ this->_M_deallocate();
+ _M_initialize(__x.size());
+ }
+ copy(__x.begin(), __x.end(), begin());
+ this->_M_finish = begin() + difference_type(__x.size());
+ return *this;
+ }
+
+ // 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_t __n, bool __x) {
+ if (__n > size()) {
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
+ insert(end(), __n - size(), __x);
+ }
+ else {
+ erase(begin() + __n, end());
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
+ }
+ }
+ void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); }
+
+#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());
+ }
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
+ { _M_fill_assign((size_t) __n, (bool) __val); }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last, const __false_type&)
+ { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
+
+ template <class _InputIterator>
+ void _M_assign_aux(_InputIterator __first, _InputIterator __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 &) {
+ size_type __len = distance(__first, __last);
+ if (__len < size())
+ erase(copy(__first, __last, begin()), end());
+ else {
+ _ForwardIterator __mid = __first;
+ advance(__mid, size());
+ copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void reserve(size_type __n) {
+ if (capacity() < __n) {
+ if (max_size() < __n)
+ __stl_throw_length_error("vector<bool>");
+ unsigned int* __q = this->_M_bit_alloc(__n);
+ _STLP_PRIV _Bit_iterator __z(__q, 0);
+ this->_M_finish = copy(begin(), end(), __z);
+ this->_M_deallocate();
+ this->_M_start = iterator(__q, 0);
+ this->_M_end_of_storage._M_data = __q + (__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
+ }
+ }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(end() - 1); }
+ const_reference back() const { return *(end() - 1); }
+ void push_back(bool __x) {
+ if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
+ *(this->_M_finish) = __x;
+ ++this->_M_finish;
+ }
+ else
+ _M_insert_aux(end(), __x);
+ }
+ void swap(__BVECTOR_QUALIFIED& __x) {
+ _STLP_STD::swap(this->_M_start, __x._M_start);
+ _STLP_STD::swap(this->_M_finish, __x._M_finish);
+ this->_M_end_of_storage.swap(__x._M_end_of_storage);
+ }
+ iterator insert(iterator __position, bool __x = bool()) {
+ difference_type __n = __position - begin();
+ if (this->_M_finish._M_p != this->_M_end_of_storage._M_data && __position == end()) {
+ *(this->_M_finish) = __x;
+ ++this->_M_finish;
+ }
+ else
+ _M_insert_aux(__position, __x);
+ return begin() + __n;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_fill_insert(__pos, (size_type) __n, (bool) __x);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_insert_range(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ void insert(iterator __position,
+ _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__position, __first, __last, _Integral());
+ }
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __position,
+ const_iterator __first, const_iterator __last) {
+ if (__first == __last) return;
+ size_type __n = distance(__first, __last);
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
+ random_access_iterator_tag(), (difference_type*)0 );
+ copy(__first, __last, __position);
+ this->_M_finish += __n;
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ unsigned int* __q = this->_M_bit_alloc(__len);
+ iterator __i = copy(begin(), __position, iterator(__q, 0));
+ __i = copy(__first, __last, __i);
+ this->_M_finish = copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+
+ void insert(iterator __position, const bool* __first, const bool* __last) {
+ if (__first == __last) return;
+ size_type __n = distance(__first, __last);
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
+ random_access_iterator_tag(), (difference_type*)0 );
+ copy(__first, __last, __position);
+ this->_M_finish += __n;
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ unsigned int* __q = this->_M_bit_alloc(__len);
+ iterator __i = copy(begin(), __position, iterator(__q, 0));
+ __i = copy(__first, __last, __i);
+ this->_M_finish = copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void _M_fill_insert(iterator __position, size_type __n, bool __x) {
+ if (__n == 0) return;
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
+ random_access_iterator_tag(), (difference_type*)0 );
+ fill(__position, __position + difference_type(__n), __x);
+ this->_M_finish += difference_type(__n);
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ unsigned int* __q = this->_M_bit_alloc(__len);
+ iterator __i = copy(begin(), __position, iterator(__q, 0));
+ fill_n(__i, __n, __x);
+ this->_M_finish = copy(__position, end(), __i + difference_type(__n));
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+
+ void insert(iterator __position, size_type __n, bool __x) {
+ _M_fill_insert(__position, __n, __x);
+ }
+
+ void pop_back() {
+ --this->_M_finish;
+ }
+ iterator erase(iterator __position) {
+ if (__position + 1 != end())
+ copy(__position + 1, end(), __position);
+ --this->_M_finish;
+ return __position;
+ }
+ iterator erase(iterator __first, iterator __last) {
+ this->_M_finish = copy(__last, end(), __first);
+ return __first;
+ }
+ void resize(size_type __new_size, bool __x = bool()) {
+ if (__new_size < size())
+ erase(begin() + difference_type(__new_size), end());
+ else
+ insert(end(), __new_size - size(), __x);
+ }
+ void flip() {
+ for (unsigned int* __p = this->_M_start._M_p; __p != this->_M_end_of_storage._M_data; ++__p)
+ *__p = ~*__p;
+ }
+
+ void clear() { erase(begin(), end()); }
+};
+
+#if defined (_STLP_NO_BOOL) || defined (__HP_aCC) // fixed soon (03/17/2000)
+# define _STLP_TEMPLATE_HEADER __BVEC_TMPL_HEADER
+# define _STLP_TEMPLATE_CONTAINER __BVECTOR_QUALIFIED
+# include <stl/_relops_cont.h>
+# undef _STLP_TEMPLATE_CONTAINER
+# undef _STLP_TEMPLATE_HEADER
+#endif /* NO_BOOL */
+
+#if defined (_STLP_DEBUG) && !defined (_STLP_NO_BOOL)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef vector
+#undef _Alloc
+#undef _STLP_VECBOOL_TEMPLATE
+#undef __BVECTOR
+#undef __BVECTOR_QUALIFIED
+#undef __BVEC_TMPL_HEADER
+
+#undef _STLP_WORD_BIT
+
+#endif /* _STLP_INTERNAL_BVECTOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_CARRAY_H
+#define _STLP_CARRAY_H
+
+/* Purpose: Mimic a pur C array with the additionnal feature of
+ * being able to be used with type not default constructible.
+ */
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, size_t _Nb>
+struct _CArray {
+ _CArray (const _Tp& __val) {
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ _Copy_Construct(__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp)), __val);
+ }
+ }
+
+ ~_CArray() {
+ _Destroy_Range(__REINTERPRET_CAST(_Tp*, _M_data + 0),
+ __REINTERPRET_CAST(_Tp*, _M_data + _Nb * sizeof(_Tp)));
+ }
+
+ _Tp& operator [] (size_t __i) {
+ _STLP_ASSERT(__i < _Nb)
+ return *__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp));
+ }
+
+private:
+ char _M_data[sizeof(_Tp) * _Nb];
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif //_STLP_CARRAY_H
--- /dev/null
+/*
+ * 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)
+# include _STLP_NATIVE_CPP_C_HEADER(cctype)
+#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
--- /dev/null
+// This file is reserved to site configuration purpose
+// and should NEVER be overridden by user
+
+/*
+ * Consistency check : if we use SGI iostreams, we have to use consistent
+ * thread model (single-threaded or multi-threaded) with the compiled library
+ *
+ * Default is multithreaded build. If you want to build and use single-threaded
+ * STLport, please change _STLP_NOTHREADS configuration setting above and rebuild the library
+ *
+ */
+
+# if !defined(_STLP_USE_NO_IOSTREAMS) && !defined(_STLP_NO_THREADS) && !defined(_REENTRANT)
+
+# if defined(_MSC_VER) && !defined(__MWERKS__) && !defined (__COMO__) && !defined(_MT)
+# error "Only multi-threaded runtime library may be linked with STLport!"
+# endif
+
+// boris : you may change that to build non-threadsafe STLport library
+# if defined (__BUILDING_STLPORT) /* || defined (_STLP_DEBUG) */
+# define _REENTRANT 1
+# endif
+
+# endif
--- /dev/null
+/*
+ * 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_CLOCALE
+#define _STLP_INTERNAL_CLOCALE
+
+#if !defined (_STLP_WCE_EVC3)
+
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(clocale)
+# else
+# include _STLP_NATIVE_C_HEADER(locale.h)
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::lconv;
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::localeconv;
+using _STLP_VENDOR_CSTD::setlocale;
+# endif
+_STLP_END_NAMESPACE
+# endif
+
+#endif /* !_STLP_WCE_EVC3 */
+
+#endif
--- /dev/null
+/*
+ * 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_CMATH
+#define _STLP_INTERNAL_CMATH
+
+/* gcc do not like when a using directive appear after a function
+ * declaration. cmath have abs overloads and cstdlib a using directive
+ * so cstdlib has to be included first.
+ */
+#if defined (__GNUC__) && defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+#endif
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_NO_NAMESPACES) && !defined (exception)
+# define exception __math_exception
+# endif
+# include _STLP_NATIVE_CPP_C_HEADER(cmath)
+# if defined (_STLP_HAS_NO_NAMESPACES)
+# undef exception
+# endif
+#else
+# include <math.h>
+#endif
+
+#if (defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) || \
+ !(defined (__IBMCPP__) && (__IBMCPP__ >= 500) || !(defined(__HP_aCC) && (__HP_aCC >= 30000) ))
+# ifndef _STLP_HAS_NO_NAMESPACES
+namespace std {
+# endif
+extern "C" double hypot(double x, double y);
+# ifndef _STLP_HAS_NO_NAMESPACES
+}
+# endif
+
+#endif
+
+#if defined (__sun) && defined (__GNUC__)
+extern "C" {
+ float __cosf(float v);
+ float __sinf(float v);
+ float __atan2f(float, float);
+ float __coshf(float v);
+ float __sinhf(float v);
+ float __sqrtf(float v);
+ float __expf(float v);
+ float __logf(float v);
+ float __log10f(float v);
+
+ long double __cosl(long double v);
+ long double __sinl(long double v);
+ long double __atan2l(long double, long double);
+ long double __coshl(long double v);
+ long double __sinhl(long double v);
+ long double __sqrtl(long double v);
+ long double __expl(long double v);
+ long double __logl(long double v);
+ long double __log10l(long double v);
+}
+
+extern "C" {
+ inline float cosf(float v) { return __cosf(v); }
+ inline float sinf(float v) { return __sinf(v); }
+ inline float atan2f(float v1, float v2) { return __atan2f(v1,v2); }
+ inline float coshf(float v) { return __coshf(v); }
+ inline float sinhf(float v) { return __sinhf(v); }
+ inline float sqrtf(float v) { return __sqrtf(v); }
+ inline float expf(float v) { return __expf(v); }
+ inline float logf(float v) { return __logf(v); }
+ inline float log10f(float v) { return __log10f(v); }
+
+ inline long double cosl(long double v) { return __cosl(v); }
+ inline long double sinl(long double v) { return __sinl(v); }
+ inline long double atan2l(long double v1, long double v2) { return __atan2l(v1,v2); }
+ inline long double coshl(long double v) { return __coshl(v); }
+ inline long double sinhl(long double v) { return __sinhl(v); }
+ inline long double sqrtl(long double v) { return __sqrtl(v); }
+ inline long double expl(long double v) { return __expl(v); }
+ inline long double logl(long double v) { return __logl(v); }
+ inline long double log10l(long double v) { return __log10l(v); }
+}
+#endif // __sun && __GNUC__
+
+#if defined (__sun)
+extern "C" {
+extern float __acosf(float);
+extern float __asinf(float);
+extern float __atanf(float);
+extern float __atan2f(float, float);
+extern float __ceilf(float);
+extern float __cosf(float);
+extern float __coshf(float);
+extern float __expf(float);
+extern float __fabsf(float);
+extern float __floorf(float);
+extern float __fmodf(float, float);
+extern float __frexpf(float, int *);
+extern float __ldexpf(float, int);
+extern float __logf(float);
+extern float __log10f(float);
+extern float __modff(float, float *);
+extern float __powf(float, float);
+extern float __sinf(float);
+extern float __sinhf(float);
+extern float __sqrtf(float);
+extern float __tanf(float);
+extern float __tanhf(float);
+
+extern long double __acosl(long double);
+extern long double __asinl(long double);
+extern long double __atanl(long double);
+extern long double __atan2l(long double, long double);
+extern long double __ceill(long double);
+extern long double __cosl(long double);
+extern long double __coshl(long double);
+extern long double __expl(long double);
+extern long double __fabsl(long double);
+extern long double __floorl(long double);
+extern long double __fmodl(long double, long double);
+extern long double __frexpl(long double, int *);
+extern long double __ldexpl(long double, int);
+extern long double __logl(long double);
+extern long double __log10l(long double);
+extern long double __modfl(long double, long double *);
+extern long double __powl(long double, long double);
+extern long double __sinl(long double);
+extern long double __sinhl(long double);
+extern long double __sqrtl(long double);
+extern long double __tanl(long double);
+extern long double __tanhl(long double);
+}
+#endif
+
+#if defined (__BORLANDC__)
+# define _STLP_CMATH_FUNC_NAMESPACE _STLP_VENDOR_CSTD
+#else
+# define _STLP_CMATH_FUNC_NAMESPACE
+#endif
+
+#if !defined (__sun) || defined (__GNUC__)
+# define _STLP_MATH_INLINE(float_type, func, cfunc) \
+ inline float_type func (float_type x) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x); }
+# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
+ inline float_type func (float_type x, type y) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x, y); }
+# define _STLP_MATH_INLINE_D(float_type, func, cfunc)
+# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc)
+#else
+# ifdef __SUNPRO_CC
+# define _STLP_MATH_INLINE(float_type, func, cfunc) \
+ inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::__##cfunc(x); }
+# define _STLP_MATH_INLINE_D(float_type, func, cfunc) \
+ inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::cfunc(x); }
+# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
+ inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::__##cfunc(x,y); }
+# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) \
+ inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::cfunc(x,y); }
+# else
+# error Unknown compiler for the Sun platform
+# endif
+#endif
+
+/** macros to define math functions
+These macros (having an X somewhere in the name) forward to the C library's
+double functions but cast the arguments and return values to the given type. */
+
+#define _STLP_MATH_INLINEX(__type,func,cfunc) \
+ inline __type func (__type x) \
+ { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x)); }
+#define _STLP_MATH_INLINE2X(__type1,__type2,func,cfunc) \
+ inline __type1 func (__type1 x, __type2 y) \
+ { return __STATIC_CAST(__type1, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, y)); }
+#define _STLP_MATH_INLINE2PX(__type,func,cfunc) \
+ inline __type func (__type x, __type *y) { \
+ double tmp1, tmp2; \
+ tmp1 = _STLP_CMATH_FUNC_NAMESPACE::cfunc(__STATIC_CAST(double, x), &tmp2); \
+ *y = __STATIC_CAST(__type, tmp2); \
+ return __STATIC_CAST(__type, tmp1); \
+ }
+#define _STLP_MATH_INLINE2XX(__type,func,cfunc) \
+ inline __type func (__type x, __type y) \
+ { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, (double)y)); }
+
+
+/** rough characterization of compiler and native C library
+For the compiler, it can either support long double or not. If it doesn't, the
+macro _STLP_NO_LONG_DOUBLE is not defined and we don't define any long double
+overloads.
+For the native C library the question is whether it has variants with an 'f'
+suffix (for float as opposed to double) or an 'l' suffix (for long double). If
+the float variants are missing, _STLP_NO_VENDOR_MATH_F is defined, when the
+long double variants are missing, _STLP_NO_VENDOR_MATH_L is defined. Of course
+the latter doesn't make sense anyway when the compiler already has no long
+double support.
+
+Those two traits determine a) which overloads get defined and b) how they are
+defined.
+
+Meaning of suffixes:
+"" : function returning and taking a float_type
+"2" : function returning a float_type and taking to float_types
+"2P" : function returning a float_type and taking a float_type and a float_type*
+"2PI": function returning a float_type and taking a float_type and an int*
+"2I" : function returning a float_type and taking a float_Type and an int
+*/
+
+#if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_NO_VENDOR_MATH_L) && !defined (_STLP_NO_VENDOR_MATH_F)
+ // long double support and both e.g. sinl(long double) and sinf(float)
+ // This is the default for a correct and complete native library.
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINE(float,func,cf##f) \
+ _STLP_MATH_INLINE_D(double,func,cf) \
+ _STLP_MATH_INLINE(long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2(float,float,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,double,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2(float,float *,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,double *,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2(float,int *,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,int *,func,cf) \
+ _STLP_MATH_INLINE2(long double,int *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2(float,int,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,int,func,cf) \
+ _STLP_MATH_INLINE2(long double,int,func,cf##l)
+#else
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if !defined (_STLP_NO_VENDOR_MATH_F)
+ // long double support and e.g. sinf(float) but not e.g. sinl(long double)
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINE(float,func,cf##f) \
+ _STLP_MATH_INLINEX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2(float,float,func,cf##f) \
+ _STLP_MATH_INLINE2XX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2(float,float *,func,cf##f) \
+ _STLP_MATH_INLINE2PX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2(float,int *,func,cf##f) \
+ _STLP_MATH_INLINE2X(long double,int *,func,cf)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2(float,int,func,cf##f) \
+ _STLP_MATH_INLINE2X(long double,int,func,cf)
+# elif !defined (_STLP_NO_VENDOR_MATH_L)
+ // long double support and e.g. sinl(long double) but not e.g. sinf(float)
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINEX(float,func,cf) \
+ _STLP_MATH_INLINE(long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2XX(float,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2PX(float,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2X(float,int *,func,cf) \
+ _STLP_MATH_INLINE2(long double,int *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2X(float,int,func,cf) \
+ _STLP_MATH_INLINE2(long double,int,func,cf##l)
+# else
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINEX(float,func,cf) \
+ _STLP_MATH_INLINEX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2XX(float,func,cf) \
+ _STLP_MATH_INLINE2XX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2PX(float,func,cf) \
+ _STLP_MATH_INLINE2PX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2X(float,int *,func,cf) \
+ _STLP_MATH_INLINE2X(long double,int *,func,cf)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2X(float,int,func,cf) \
+ _STLP_MATH_INLINE2X(long double,int,func,cf)
+# endif
+# else
+# if !defined (_STLP_NO_VENDOR_MATH_F)
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINE(float,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2(float,float,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2(float,float *,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2(float,int *,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2(float,int,func,cf##f)
+# else // _STLP_NO_VENDOR_MATH_F
+ // neither long double support nor e.g. sinf(float) functions
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINEX(float,func,cf)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2XX(float,func,cf)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2PX(float,func,cf)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2X(float,int *,func,cf)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2X(float,int,func,cf)
+# endif // _STLP_NO_VENDOR_MATH_F
+# endif
+#endif
+
+#if defined (_STLP_WCE) || \
+ (defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) && defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */)
+/*
+ * dums: VC6 has all the required C++ functions but only define them if
+ * _MSC_EXTENSIONS is not defined (a bug?). STLport just do the same
+ * thing also when _MSC_EXTENSIONS is defined.
+ * TODO: above check (_STLP_MSVC <= 1300) also catches VC7.0, is that intended?
+ */
+//We have to tell the compilers that abs, acos ... math functions are not intrinsic
+//otherwise we have Internal Compiler Error in release mode...
+# pragma warning(push)
+# pragma warning(disable: 4162) // no function with C linkage found
+# pragma warning(disable: 4163) // not available as an intrinsic function
+# pragma function (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
+# if defined (_STLP_WCE)
+# pragma function (ceil, floor)
+# endif
+# define _STLP_RESTORE_FUNCTION_INTRINSIC
+#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
+
+#if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
+/* In this config Borland native lib only define functions in std namespace.
+ * In order to have all overloads in STLport namespace we need to add the
+ * double overload in global namespace. We do not use a using statement to avoid
+ * import of invalid overload.
+ */
+# define _STLP_DMATH_INLINE(func) _STLP_MATH_INLINE(double, func, func)
+# define _STLP_DMATH_INLINE2(func) _STLP_MATH_INLINE2(double, double, func, func)
+
+_STLP_DMATH_INLINE(acos)
+_STLP_DMATH_INLINE(asin)
+_STLP_DMATH_INLINE(atan)
+_STLP_DMATH_INLINE2(atan2)
+_STLP_DMATH_INLINE(ceil)
+_STLP_DMATH_INLINE(cos)
+_STLP_DMATH_INLINE(cosh)
+_STLP_DMATH_INLINE(exp)
+_STLP_DMATH_INLINE(fabs)
+_STLP_DMATH_INLINE(floor)
+_STLP_DMATH_INLINE2(fmod)
+_STLP_MATH_INLINE2X(double, int*, frexp, frexp)
+_STLP_MATH_INLINE2X(double, int, ldexp, ldexp)
+_STLP_DMATH_INLINE(log)
+_STLP_DMATH_INLINE(log10)
+_STLP_MATH_INLINE2PX(double, modf, modf)
+_STLP_DMATH_INLINE(sin)
+_STLP_DMATH_INLINE(sinh)
+_STLP_DMATH_INLINE(sqrt)
+_STLP_DMATH_INLINE(tan)
+_STLP_DMATH_INLINE(tanh)
+_STLP_DMATH_INLINE2(pow)
+_STLP_DMATH_INLINE2(hypot)
+
+# undef _STLP_DMATH_INLINE
+# undef _STLP_DMATH_INLINE2
+#endif
+
+#if defined (__DMC__)
+# if defined (fabs)
+inline double __stlp_fabs(double __x) { return fabs(__x); }
+# undef fabs
+inline double fabs(double __x) { return __stlp_fabs(__x); }
+# endif
+# if defined (cos)
+inline double __stlp_cos(double __x) { return cos(__x); }
+# undef cos
+inline double cos(double __x) { return __stlp_cos(__x); }
+# endif
+# if defined (sin)
+inline double __stlp_sin(double __x) { return sin(__x); }
+# undef sin
+inline double sin(double __x) { return __stlp_sin(__x); }
+# endif
+# if defined (sqrt)
+inline double __stlp_sqrt(double __x) { return sqrt(__x); }
+# undef sqrt
+inline double sqrt(double __x) { return __stlp_sqrt(__x); }
+# endif
+# if defined (ldexp)
+inline double __stlp_ldexp(double __x, int __y) { return ldexp(__x, __y); }
+# undef ldexp
+inline double ldexp(double __x, int __y) { return __stlp_ldexp(__x, __y); }
+# endif
+#endif
+
+/* MSVC native lib starting with .Net 2003 has already all math functions
+ * in global namespace.
+ * HP-UX native lib has math functions in the global namespace.
+ */
+#if (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)) && \
+ (!defined (__HP_aCC) || (__HP_aCC < 30000))
+inline double abs(double __x)
+{ return ::fabs(__x); }
+# if !defined (__MVS__)
+_STLP_DEF_MATH_INLINE(abs, fabs)
+# else // __MVS__ has native long double abs?
+inline float abs(float __x) { return ::fabsf(__x); }
+# endif
+
+_STLP_DEF_MATH_INLINE(acos, acos)
+_STLP_DEF_MATH_INLINE(asin, asin)
+_STLP_DEF_MATH_INLINE(atan, atan)
+_STLP_DEF_MATH_INLINE2(atan2, atan2)
+_STLP_DEF_MATH_INLINE(ceil, ceil)
+_STLP_DEF_MATH_INLINE(cos, cos)
+_STLP_DEF_MATH_INLINE(cosh, cosh)
+_STLP_DEF_MATH_INLINE(exp, exp)
+_STLP_DEF_MATH_INLINE(fabs, fabs)
+_STLP_DEF_MATH_INLINE(floor, floor)
+_STLP_DEF_MATH_INLINE2(fmod, fmod)
+_STLP_DEF_MATH_INLINE2PI(frexp, frexp)
+_STLP_DEF_MATH_INLINE2I(ldexp, ldexp)
+_STLP_DEF_MATH_INLINE(log, log)
+_STLP_DEF_MATH_INLINE(log10, log10)
+_STLP_DEF_MATH_INLINE2P(modf, modf)
+_STLP_DEF_MATH_INLINE(sin, sin)
+_STLP_DEF_MATH_INLINE(sinh, sinh)
+_STLP_DEF_MATH_INLINE(sqrt, sqrt)
+_STLP_DEF_MATH_INLINE(tan, tan)
+_STLP_DEF_MATH_INLINE(tanh, tanh)
+_STLP_DEF_MATH_INLINE2(pow, pow)
+
+# if !defined(_STLP_MSVC) /* || (_STLP_MSVC > 1300) */ || defined(_STLP_WCE) || !defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */
+# ifndef _STLP_NO_VENDOR_MATH_F
+# ifndef __sun
+inline float pow(float __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powf(__x, __STATIC_CAST(float,__y)); }
+# else
+inline float pow(float __x, int __y) { return ::__powf(__x, __STATIC_CAST(float,__y)); }
+# endif
+# else
+inline float pow(float __x, int __y) { return __STATIC_CAST(float, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(float,__y))); }
+# endif
+inline double pow(double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(double,__y)); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if !defined(_STLP_NO_VENDOR_MATH_L)
+# ifndef __sun
+inline long double pow(long double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powl(__x, __STATIC_CAST(long double,__y)); }
+# else
+# ifndef __SUNPRO_CC
+inline long double pow(long double __x, int __y) { return ::__powl(__x, __STATIC_CAST(long double,__y)); }
+# else
+inline long double pow(long double __x, int __y) { return _STLP_VENDOR_CSTD::__powl(__x, __STATIC_CAST(long double,__y)); }
+# endif
+# endif
+# else
+inline long double pow(long double __x, int __y) { return __STATIC_CAST(long double, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(long double,__y))); }
+# endif
+# endif
+# else
+//The MS native pow version has a bugged overload so it is not imported
+//in the STLport namespace.
+//Here is the bugged version:
+//inline double pow(int __x, int __y) { return (_Pow_int(__x, __y)); }
+inline double pow(double __x, int __y) { return (_Pow_int(__x, __y)); }
+inline float pow(float __x, int __y) { return (_Pow_int(__x, __y)); }
+inline long double pow(long double __x, int __y) { return (_Pow_int(__x, __y)); }
+# endif
+#endif
+
+#if (defined (_STLP_MSVC) && !defined (_STLP_WCE)) || defined (__ICL) || defined (__sun)
+# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
+# pragma warning (push)
+# pragma warning (disable : 4996) // hypot is deprecated.
+# endif
+_STLP_MATH_INLINE2XX(float, hypot, hypot)
+inline long double hypot(long double x, long double y) { return sqrt(x * x + y * y); }
+# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
+# pragma warning (pop)
+# endif
+#else
+# if defined (_STLP_USE_UCLIBC)
+inline double hypot(double x, double y) { return sqrt(x * x + y * y); }
+_STLP_DEF_MATH_INLINE2(hypot, hypot)
+# elif defined (_STLP_WCE)
+ /* CE has a double _hypot(double,double) which we use */
+inline double hypot(double __x, double __y) { return _hypot(__x,__y); }
+_STLP_DEF_MATH_INLINE2(hypot, _hypot)
+# endif
+#endif
+
+#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
+//restoration of the default intrinsic status of those functions:
+# pragma intrinsic (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
+# if defined (_STLP_WCE)
+# pragma intrinsic (ceil, floor)
+# endif
+# pragma warning(pop)
+# undef _STLP_RESTORE_FUNCTION_INTRINSIC
+#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
+
+/* C++ Standard is unclear about several call to 'using ::func' if new overloads
+ * of ::func appears between 2 successive 'using' calls. To avoid this potential
+ * problem we provide all abs overload before the 'using' call.
+ * Beware: This header inclusion has to be after all abs overload of this file.
+ * The first 'using ::abs' call is going to be in the other header.
+ */
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+_STLP_BEGIN_NAMESPACE
+using ::abs;
+using ::acos;
+using ::asin;
+using ::atan;
+using ::atan2;
+using ::ceil;
+using ::cos;
+using ::cosh;
+using ::exp;
+using ::fabs;
+using ::floor;
+using ::fmod;
+using ::frexp;
+using ::hypot;
+using ::ldexp;
+using ::log;
+using ::log10;
+using ::modf;
+using ::pow;
+using ::sin;
+using ::sinh;
+using ::sqrt;
+using ::tan;
+using ::tanh;
+_STLP_END_NAMESPACE
+# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x560)
+using _STLP_VENDOR_CSTD::_ecvt;
+using _STLP_VENDOR_CSTD::_fcvt;
+# endif
+#endif
+
+#endif /* _STLP_INTERNAL_CMATH */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// 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_CODECVT_H
+#define _STLP_INTERNAL_CODECVT_H
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class _STLP_CLASS_DECLSPEC codecvt_base {
+public:
+ enum result {ok, partial, error, noconv};
+};
+
+template <class _InternT, class _ExternT, class _StateT>
+class codecvt : public locale::facet, public codecvt_base {
+public:
+ typedef _InternT intern_type;
+ typedef _ExternT extern_type;
+ typedef _StateT state_type;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300)
+ /* For the moment VC6 do not support this facet default implementation
+ * because of the static locale::id instance. When VC6 see this definition
+ * it goes crasy with locale::id static instances and all the has_facet tests
+ * unit tests are failing.
+ */
+};
+#else
+ explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ result out(state_type& __state,
+ const intern_type* __from,
+ const intern_type* __from_end,
+ const intern_type*& __from_next,
+ extern_type* __to,
+ extern_type* __to_limit,
+ extern_type*& __to_next) const {
+ return do_out(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ result unshift(state_type& __state,
+ extern_type* __to,
+ extern_type* __to_limit,
+ extern_type*& __to_next) const {
+ return do_unshift(__state, __to, __to_limit, __to_next);
+ }
+
+ result in(state_type& __state,
+ const extern_type* __from,
+ const extern_type* __from_end,
+ const extern_type*& __from_next,
+ intern_type* __to,
+ intern_type* __to_limit,
+ intern_type*& __to_next) const {
+ return do_in(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ int encoding() const _STLP_NOTHROW { return do_encoding(); }
+
+ bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
+
+ int length(const state_type& __state,
+ const extern_type* __from,
+ const extern_type* __end,
+ size_t __max) const {
+ return do_length(__state, __from, __end, __max);
+ }
+
+ int max_length() const _STLP_NOTHROW { return do_max_length(); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ ~codecvt() {}
+
+ virtual result do_out(state_type&,
+ const intern_type* __from,
+ const intern_type*,
+ const intern_type*& __from_next,
+ extern_type* __to,
+ extern_type*,
+ extern_type*& __to_next) const
+ { __from_next = __from; __to_next = __to; return noconv; }
+
+ virtual result do_in (state_type&,
+ const extern_type* __from,
+ const extern_type*,
+ const extern_type*& __from_next,
+ intern_type* __to,
+ intern_type*,
+ intern_type*& __to_next) const
+ { __from_next = __from; __to_next = __to; return noconv; }
+
+ virtual result do_unshift(state_type&,
+ extern_type* __to,
+ extern_type*,
+ extern_type*& __to_next) const
+ { __to_next = __to; return noconv; }
+
+ virtual int do_encoding() const _STLP_NOTHROW
+ { return 1; }
+
+ virtual bool do_always_noconv() const _STLP_NOTHROW
+ { return true; }
+
+ virtual int do_length(const state_type&,
+ const extern_type* __from,
+ const extern_type* __end,
+ size_t __max) const
+ { return (int)(min) ( __STATIC_CAST(size_t, (__end - __from)), __max); }
+
+ virtual int do_max_length() const _STLP_NOTHROW
+ { return 1; }
+
+private:
+ codecvt(const codecvt<intern_type, extern_type, state_type>&);
+ codecvt<intern_type, extern_type, state_type>& operator = (const codecvt<intern_type, extern_type, state_type>&);
+};
+
+# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# if (_STLP_STATIC_TEMPLATE_DATA > 0)
+# if !defined (__BORLANDC__)
+template <class _InternT, class _ExternT, class _StateT>
+locale::id codecvt<_InternT, _ExternT, _StateT>::id;
+# endif
+# endif
+# endif
+#endif
+
+template <class _InternT, class _ExternT, class _StateT>
+class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt<char, char, mbstate_t>
+ : public locale::facet, public codecvt_base
+{
+ friend class _Locale_impl;
+
+public:
+ typedef char intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ result out(mbstate_t& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const {
+ return do_out(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ result unshift(mbstate_t& __state,
+ char* __to, char* __to_limit, char*& __to_next) const
+ { return do_unshift(__state, __to, __to_limit, __to_next); }
+
+ result in(state_type& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const {
+ return do_in(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ int encoding() const _STLP_NOTHROW { return do_encoding(); }
+
+ bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
+
+ int length(const state_type& __state,
+ const char* __from, const char* __end,
+ size_t __max) const
+ { return do_length(__state, __from, __end, __max); }
+
+ int max_length() const _STLP_NOTHROW { return do_max_length(); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ ~codecvt();
+
+ virtual result do_out(mbstate_t& /* __state */,
+ const char* __from,
+ const char* /* __from_end */,
+ const char*& __from_next,
+ char* __to,
+ char* /* __to_limit */,
+ char*& __to_next) const;
+
+ virtual result do_in (mbstate_t& /* __state */ ,
+ const char* __from,
+ const char* /* __from_end */,
+ const char*& __from_next,
+ char* __to,
+ char* /* __to_end */,
+ char*& __to_next) const;
+
+ virtual result do_unshift(mbstate_t& /* __state */,
+ char* __to,
+ char* /* __to_limit */,
+ char*& __to_next) const;
+
+ virtual int do_encoding() const _STLP_NOTHROW;
+ virtual bool do_always_noconv() const _STLP_NOTHROW;
+ virtual int do_length(const mbstate_t& __state,
+ const char* __from,
+ const char* __end,
+ size_t __max) const;
+ virtual int do_max_length() const _STLP_NOTHROW;
+private:
+ codecvt(const codecvt<char, char, mbstate_t>&);
+ codecvt<char, char, mbstate_t>& operator =(const codecvt<char, char, mbstate_t>&);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt<wchar_t, char, mbstate_t>
+ : public locale::facet, public codecvt_base
+{
+ friend class _Locale_impl;
+public:
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ result out(mbstate_t& __state,
+ const wchar_t* __from,
+ const wchar_t* __from_end,
+ const wchar_t*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const {
+ return do_out(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ result unshift(mbstate_t& __state,
+ char* __to, char* __to_limit, char*& __to_next) const {
+ return do_unshift(__state, __to, __to_limit, __to_next);
+ }
+
+ result in(mbstate_t& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ wchar_t* __to,
+ wchar_t* __to_limit,
+ wchar_t*& __to_next) const {
+ return do_in(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ int encoding() const _STLP_NOTHROW { return do_encoding(); }
+
+ bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
+
+ int length(const mbstate_t& __state,
+ const char* __from, const char* __end,
+ size_t __max) const
+ { return do_length(__state, __from, __end, __max); }
+
+ int max_length() const _STLP_NOTHROW { return do_max_length(); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ ~codecvt();
+
+ virtual result do_out(mbstate_t& __state,
+ const wchar_t* __from,
+ const wchar_t* __from_end,
+ const wchar_t*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual result do_in (mbstate_t& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ wchar_t* __to,
+ wchar_t* __to_limit,
+ wchar_t*& __to_next) const;
+
+ virtual result do_unshift(mbstate_t& __state,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual int do_encoding() const _STLP_NOTHROW;
+
+ virtual bool do_always_noconv() const _STLP_NOTHROW;
+
+ virtual int do_length(const mbstate_t& __state,
+ const char* __from,
+ const char* __end,
+ size_t __max) const;
+
+ virtual int do_max_length() const _STLP_NOTHROW;
+
+private:
+ codecvt(const codecvt<wchar_t, char, mbstate_t>&);
+ codecvt<wchar_t, char, mbstate_t>& operator = (const codecvt<wchar_t, char, mbstate_t>&);
+};
+
+# endif
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt_byname<char, char, mbstate_t>
+ : public codecvt<char, char, mbstate_t> {
+public:
+ explicit codecvt_byname(const char* __name, size_t __refs = 0);
+ ~codecvt_byname();
+private:
+ codecvt_byname(const codecvt_byname<char, char, mbstate_t>&);
+ codecvt_byname<char, char, mbstate_t>& operator =(const codecvt_byname<char, char, mbstate_t>&);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt_byname<wchar_t, char, mbstate_t>
+ : public codecvt<wchar_t, char, mbstate_t>
+{
+public:
+ explicit codecvt_byname(const char * __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
+
+protected:
+ ~codecvt_byname();
+
+ virtual result do_out(mbstate_t& __state,
+ const wchar_t* __from,
+ const wchar_t* __from_end,
+ const wchar_t*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual result do_in (mbstate_t& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ wchar_t* __to,
+ wchar_t* __to_limit,
+ wchar_t*& __to_next) const;
+
+ virtual result do_unshift(mbstate_t& __state,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual int do_encoding() const _STLP_NOTHROW;
+
+ virtual bool do_always_noconv() const _STLP_NOTHROW;
+
+ virtual int do_length(const mbstate_t& __state,
+ const char* __from,
+ const char* __end,
+ size_t __max) const;
+
+ virtual int do_max_length() const _STLP_NOTHROW;
+
+private:
+ _Locale_ctype* _M_ctype;
+ codecvt_byname(const codecvt_byname<wchar_t, char, mbstate_t>&);
+ codecvt_byname<wchar_t, char, mbstate_t>& operator =(const codecvt_byname<wchar_t, char, mbstate_t>&);
+};
+
+# endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_CODECVT_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// 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_COLLATE_H
+#define _STLP_INTERNAL_COLLATE_H
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT> class collate {};
+template <class _CharT> class collate_byname {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate<char> : public locale::facet
+{
+ friend class _Locale_impl;
+
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit collate(size_t __refs = 0) : locale::facet(__refs) {}
+
+ int compare(const char* __low1, const char* __high1,
+ const char* __low2, const char* __high2) const {
+ return do_compare( __low1, __high1, __low2, __high2);
+ }
+
+ string_type transform(const char* __low, const char* __high) const {
+ return do_transform(__low, __high);
+ }
+
+ long hash(const char* __low, const char* __high) const
+ { return do_hash(__low, __high); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ ~collate();
+
+ virtual int do_compare(const char*, const char*,
+ const char*, const char*) const;
+ virtual string_type do_transform(const char*, const char*) const;
+ virtual long do_hash(const char*, const char*) const;
+private:
+ collate(const collate<char>&);
+ collate<char>& operator =(const collate<char>&);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate<wchar_t> : public locale::facet
+{
+ friend class _Locale_impl;
+
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit collate(size_t __refs = 0) : locale::facet(__refs) {}
+
+ int compare(const wchar_t* __low1, const wchar_t* __high1,
+ const wchar_t* __low2, const wchar_t* __high2) const {
+ return do_compare( __low1, __high1, __low2, __high2);
+ }
+
+ string_type transform(const wchar_t* __low, const wchar_t* __high) const {
+ return do_transform(__low, __high);
+ }
+
+ long hash(const wchar_t* __low, const wchar_t* __high) const
+ { return do_hash(__low, __high); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ ~collate();
+
+ virtual int do_compare(const wchar_t*, const wchar_t*,
+ const wchar_t*, const wchar_t*) const;
+ virtual string_type do_transform(const wchar_t*, const wchar_t*) const;
+ virtual long do_hash(const wchar_t* __low, const wchar_t* __high) const;
+private:
+ collate(const collate<wchar_t>&);
+ collate<wchar_t>& operator = (const collate<wchar_t>&);
+};
+
+# endif /* NO_WCHAR_T */
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate_byname<char>: public collate<char>
+{
+public:
+ explicit collate_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
+
+protected:
+ ~collate_byname();
+
+ virtual int do_compare(const char*, const char*,
+ const char*, const char*) const;
+ virtual string_type do_transform(const char*, const char*) const;
+
+private:
+ _Locale_collate* _M_collate;
+ collate_byname(const collate_byname<char>&);
+ collate_byname<char>& operator =(const collate_byname<char>&);
+ friend _Locale_name_hint* _Locale_extract_hint(collate_byname<char>*);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate_byname<wchar_t>: public collate<wchar_t>
+{
+public:
+ explicit collate_byname(const char * __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
+
+protected:
+ ~collate_byname();
+
+ virtual int do_compare(const wchar_t*, const wchar_t*,
+ const wchar_t*, const wchar_t*) const;
+ virtual string_type do_transform(const wchar_t*, const wchar_t*) const;
+
+private:
+ _Locale_collate* _M_collate;
+ collate_byname(const collate_byname<wchar_t>&);
+ collate_byname<wchar_t>& operator =(const collate_byname<wchar_t>&);
+};
+
+# endif /* NO_WCHAR_T */
+
+template <class _CharT, class _Traits, class _Alloc>
+bool
+__locale_do_operator_call (const locale& __loc,
+ const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y) {
+ collate<_CharT> const& __coll = use_facet<collate<_CharT> >(__loc);
+ return __coll.compare(__x.data(), __x.data() + __x.size(),
+ __y.data(), __y.data() + __y.size()) < 0;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_COLLATE_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_COMPLEX_C
+#define _STLP_COMPLEX_C
+
+#ifndef _STLP_INTERNAL_COMPLEX
+# include <stl/_complex.h>
+#endif
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+# ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+# endif
+
+# ifndef _STLP_INTERNAL_SSTREAM
+# include <stl/_sstream.h>
+# endif
+
+# ifndef _STLP_STRING_IO_H
+# include <stl/_string_io.h>
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// Non-inline member functions.
+
+template <class _Tp>
+void complex<_Tp>::_div(const _Tp& __z1_r, const _Tp& __z1_i,
+ const _Tp& __z2_r, const _Tp& __z2_i,
+ _Tp& __res_r, _Tp& __res_i) {
+ _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
+ _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
+
+ if (__ar <= __ai) {
+ _Tp __ratio = __z2_r / __z2_i;
+ _Tp __denom = __z2_i * (1 + __ratio * __ratio);
+ __res_r = (__z1_r * __ratio + __z1_i) / __denom;
+ __res_i = (__z1_i * __ratio - __z1_r) / __denom;
+ }
+ else {
+ _Tp __ratio = __z2_i / __z2_r;
+ _Tp __denom = __z2_r * (1 + __ratio * __ratio);
+ __res_r = (__z1_r + __z1_i * __ratio) / __denom;
+ __res_i = (__z1_i - __z1_r * __ratio) / __denom;
+ }
+}
+
+template <class _Tp>
+void complex<_Tp>::_div(const _Tp& __z1_r,
+ const _Tp& __z2_r, const _Tp& __z2_i,
+ _Tp& __res_r, _Tp& __res_i) {
+ _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
+ _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
+
+ if (__ar <= __ai) {
+ _Tp __ratio = __z2_r / __z2_i;
+ _Tp __denom = __z2_i * (1 + __ratio * __ratio);
+ __res_r = (__z1_r * __ratio) / __denom;
+ __res_i = - __z1_r / __denom;
+ }
+ else {
+ _Tp __ratio = __z2_i / __z2_r;
+ _Tp __denom = __z2_r * (1 + __ratio * __ratio);
+ __res_r = __z1_r / __denom;
+ __res_i = - (__z1_r * __ratio) / __denom;
+ }
+}
+
+// I/O.
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+
+// Complex output, in the form (re,im). We use a two-step process
+// involving stringstream so that we get the padding right.
+template <class _Tp, class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z) {
+ basic_ostringstream<_CharT, _Traits, allocator<_CharT> > __tmp;
+ __tmp.flags(__os.flags());
+ __tmp.imbue(__os.getloc());
+ __tmp.precision(__os.precision());
+ __tmp << '(' << __z.real() << ',' << __z.imag() << ')';
+ return __os << __tmp.str();
+}
+
+// Complex input from arbitrary streams. Note that results in some
+// locales may be confusing, since the decimal character varies with
+// locale and the separator between real and imaginary parts does not.
+
+template <class _Tp, class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z) {
+ _Tp __re = 0;
+ _Tp __im = 0;
+
+ // typedef ctype<_CharT> _Ctype;
+ // locale __loc = __is.getloc();
+ //const _Ctype& __c_type = use_facet<_Ctype>(__loc);
+ const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __is._M_ctype_facet());
+
+ const char __punct[4] = "(,)";
+ _CharT __wpunct[3];
+ __c_type.widen(__punct, __punct + 3, __wpunct);
+
+ _CharT __c;
+
+ __is >> __c;
+ if (_Traits::eq(__c, __wpunct[0])) { // Left paren
+ __is >> __re >> __c;
+ if (_Traits::eq(__c, __wpunct[1])) // Comma
+ __is >> __im >> __c;
+ if (!_Traits::eq(__c, __wpunct[2])) // Right paren
+ __is.setstate(ios_base::failbit);
+ }
+ else {
+ __is.putback(__c);
+ __is >> __re;
+ }
+
+ if (__is)
+ __z = complex<_Tp>(__re, __im);
+ return __is;
+}
+
+#endif /* _STLP_USE_NO_IOSTREAMS */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_COMPLEX_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_COMPLEX
+#define _STLP_INTERNAL_COMPLEX
+
+// This header declares the template class complex, as described in
+// in the draft C++ standard. Single-precision complex numbers
+// are complex<float>, double-precision are complex<double>, and
+// quad precision are complex<long double>.
+
+// Note that the template class complex is declared within namespace
+// std, as called for by the draft C++ standard.
+
+#ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround
+
+template <class _Tp> struct complex;
+
+_STLP_TEMPLATE_NULL struct complex<float>;
+_STLP_TEMPLATE_NULL struct complex<double>;
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL struct complex<long double>;
+# endif
+#endif /* _STLP_NO_COMPLEX_SPECIALIZATIONS */
+
+template <class _Tp>
+struct complex {
+ typedef _Tp value_type;
+ typedef complex<_Tp> _Self;
+
+ // Constructors, destructor, assignment operator.
+ complex() : _M_re(0), _M_im(0) {}
+ complex(const value_type& __x)
+ : _M_re(__x), _M_im(0) {}
+ complex(const value_type& __x, const value_type& __y)
+ : _M_re(__x), _M_im(__y) {}
+ complex(const _Self& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES) && (defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined(_STLP_NO_COMPLEX_SPECIALIZATIONS))
+ template <class _Tp2>
+ explicit complex(const complex<_Tp2>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+
+ template <class _Tp2>
+ _Self& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (const value_type& __x) {
+ _M_re = __x;
+ _M_im = 0;
+ return *this;
+ }
+ _Self& operator+= (const value_type& __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (const value_type& __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (const value_type& __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (const value_type& __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const value_type& __z1_r, const value_type& __z1_i,
+ const value_type& __z2_r, const value_type& __z2_i,
+ value_type& __res_r, value_type& __res_i);
+
+ static void _STLP_CALL _div(const value_type& __z1_r,
+ const value_type& __z2_r, const value_type& __z2_i,
+ value_type& __res_r, value_type& __res_i);
+
+#if defined (_STLP_MEMBER_TEMPLATES) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+
+ template <class _Tp2> _Self& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2> _Self& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2> _Self& operator*= (const complex<_Tp2>& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2> _Self& operator/= (const complex<_Tp2>& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+#if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround
+// Explicit specializations for float, double, long double. The only
+// reason for these specializations is to enable automatic conversions
+// from complex<float> to complex<double>, and complex<double> to
+// complex<long double>.
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC complex<float> {
+ typedef float value_type;
+ typedef complex<float> _Self;
+ // Constructors, destructor, assignment operator.
+
+ complex(value_type __x = 0.0f, value_type __y = 0.0f)
+ : _M_re(__x), _M_im(__y) {}
+
+ complex(const complex<float>& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {}
+
+ inline explicit complex(const complex<double>& __z);
+# ifndef _STLP_NO_LONG_DOUBLE
+ inline explicit complex(const complex<long double>& __z);
+# endif
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (value_type __x) {
+ _M_re = __x;
+ _M_im = 0.0f;
+ return *this;
+ }
+ _Self& operator+= (value_type __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (value_type __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (value_type __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (value_type __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i,
+ const float& __z2_r, const float& __z2_i,
+ float& __res_r, float& __res_i);
+
+ static void _STLP_CALL _div(const float& __z1_r,
+ const float& __z2_r, const float& __z2_i,
+ float& __res_r, float& __res_i);
+
+# if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Tp2>
+ complex<float>& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator*= (const complex<_Tp2>& __z) {
+ float __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ float __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator/= (const complex<_Tp2>& __z) {
+ float __r;
+ float __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+# endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC complex<double> {
+ typedef double value_type;
+ typedef complex<double> _Self;
+
+ // Constructors, destructor, assignment operator.
+
+ complex(value_type __x = 0.0, value_type __y = 0.0)
+ : _M_re(__x), _M_im(__y) {}
+
+ complex(const complex<double>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+ inline complex(const complex<float>& __z);
+# if !defined (_STLP_NO_LONG_DOUBLE)
+ explicit inline complex(const complex<long double>& __z);
+# endif
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (value_type __x) {
+ _M_re = __x;
+ _M_im = 0.0;
+ return *this;
+ }
+ _Self& operator+= (value_type __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (value_type __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (value_type __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (value_type __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const double& __z1_r, const double& __z1_i,
+ const double& __z2_r, const double& __z2_i,
+ double& __res_r, double& __res_i);
+ static void _STLP_CALL _div(const double& __z1_r,
+ const double& __z2_r, const double& __z2_i,
+ double& __res_r, double& __res_i);
+
+# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ template <class _Tp2>
+ complex<double>& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator*= (const complex<_Tp2>& __z) {
+ double __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ double __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator/= (const complex<_Tp2>& __z) {
+ double __r;
+ double __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+# endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC complex<long double> {
+ typedef long double value_type;
+ typedef complex<long double> _Self;
+
+ // Constructors, destructor, assignment operator.
+ complex(value_type __x = 0.0l, value_type __y = 0.0l)
+ : _M_re(__x), _M_im(__y) {}
+
+ complex(const complex<long double>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+ inline complex(const complex<float>& __z);
+ inline complex(const complex<double>& __z);
+
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (value_type __x) {
+ _M_re = __x;
+ _M_im = 0.0l;
+ return *this;
+ }
+ _Self& operator+= (value_type __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (value_type __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (value_type __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (value_type __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const long double& __z1_r, const long double& __z1_i,
+ const long double& __z2_r, const long double& __z2_i,
+ long double& __res_r, long double& __res_i);
+
+ static void _STLP_CALL _div(const long double& __z1_r,
+ const long double& __z2_r, const long double& __z2_i,
+ long double& __res_r, long double& __res_i);
+
+# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+
+ template <class _Tp2>
+ complex<long double>& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator*= (const complex<_Tp2>& __z) {
+ long double __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ long double __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator/= (const complex<_Tp2>& __z) {
+ long double __r;
+ long double __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+# endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+# endif /* _STLP_NO_LONG_DOUBLE */
+
+// Converting constructors from one of these three specialized types
+// to another.
+
+inline complex<float>::complex(const complex<double>& __z)
+ : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
+inline complex<double>::complex(const complex<float>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+# ifndef _STLP_NO_LONG_DOUBLE
+inline complex<float>::complex(const complex<long double>& __z)
+ : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
+inline complex<double>::complex(const complex<long double>& __z)
+ : _M_re((double)__z._M_re), _M_im((double)__z._M_im) {}
+inline complex<long double>::complex(const complex<float>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+inline complex<long double>::complex(const complex<double>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+# endif
+
+#endif /* SPECIALIZATIONS */
+
+// Unary non-member arithmetic operators.
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z)
+{ return __z; }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z)
+{ return complex<_Tp>(-__z._M_re, -__z._M_im); }
+
+// Non-member arithmetic operations involving one real argument.
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z)
+{ return complex<_Tp>(__x + __z._M_re, __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re + __x, __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z)
+{ return complex<_Tp>(__x - __z._M_re, -__z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re - __x, __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z)
+{ return complex<_Tp>(__x * __z._M_re, __x * __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re * __x, __z._M_im * __x); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator/(const _Tp& __x, const complex<_Tp>& __z) {
+ complex<_Tp> __result;
+ complex<_Tp>::_div(__x,
+ __z._M_re, __z._M_im,
+ __result._M_re, __result._M_im);
+ return __result;
+}
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re / __x, __z._M_im / __x); }
+
+// Non-member arithmetic operations involving two complex arguments
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator*(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
+ return complex<_Tp>(__z1._M_re * __z2._M_re - __z1._M_im * __z2._M_im,
+ __z1._M_re * __z2._M_im + __z1._M_im * __z2._M_re);
+}
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator/(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
+ complex<_Tp> __result;
+ complex<_Tp>::_div(__z1._M_re, __z1._M_im,
+ __z2._M_re, __z2._M_im,
+ __result._M_re, __result._M_im);
+ return __result;
+}
+
+// Comparison operators.
+
+template <class _Tp>
+inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x)
+{ return __z._M_re == __x && __z._M_im == 0; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z)
+{ return __x == __z._M_re && 0 == __z._M_im; }
+
+//04/27/04 dums: removal of this check, if it is restablish
+//please explain why the other operators are not macro guarded
+//#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im; }
+
+//#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x)
+{ return __z._M_re != __x || __z._M_im != 0; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z)
+{ return __x != __z._M_re || 0 != __z._M_im; }
+
+// Other basic arithmetic operations
+template <class _Tp>
+inline _Tp _STLP_CALL real(const complex<_Tp>& __z)
+{ return __z._M_re; }
+
+template <class _Tp>
+inline _Tp _STLP_CALL imag(const complex<_Tp>& __z)
+{ return __z._M_im; }
+
+template <class _Tp>
+_Tp _STLP_CALL abs(const complex<_Tp>& __z);
+
+template <class _Tp>
+_Tp _STLP_CALL arg(const complex<_Tp>& __z);
+
+template <class _Tp>
+inline _Tp _STLP_CALL norm(const complex<_Tp>& __z)
+{ return __z._M_re * __z._M_re + __z._M_im * __z._M_im; }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z)
+{ return complex<_Tp>(__z._M_re, -__z._M_im); }
+
+template <class _Tp>
+complex<_Tp> _STLP_CALL polar(const _Tp& __rho)
+{ return complex<_Tp>(__rho, 0); }
+
+template <class _Tp>
+complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi);
+
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC float _STLP_CALL abs(const complex<float>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC double _STLP_CALL abs(const complex<double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC float _STLP_CALL arg(const complex<float>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC double _STLP_CALL arg(const complex<double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi);
+
+template <class _Tp>
+_Tp _STLP_CALL abs(const complex<_Tp>& __z)
+{ return _Tp(abs(complex<double>(double(__z.real()), double(__z.imag())))); }
+
+template <class _Tp>
+_Tp _STLP_CALL arg(const complex<_Tp>& __z)
+{ return _Tp(arg(complex<double>(double(__z.real()), double(__z.imag())))); }
+
+template <class _Tp>
+complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) {
+ complex<double> __tmp = polar(double(__rho), double(__phi));
+ return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag()));
+}
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double&, const long double&);
+#endif
+
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+
+_STLP_END_NAMESPACE
+
+# include <iosfwd>
+
+_STLP_BEGIN_NAMESPACE
+
+// Complex output, in the form (re,im). We use a two-step process
+// involving stringstream so that we get the padding right.
+template <class _Tp, class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z);
+
+template <class _Tp, class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z);
+
+// Specializations for narrow characters; lets us avoid widen.
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<float>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<double>& __z);
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<long double>& __z);
+
+# endif
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T)
+
+_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
+_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
+_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
+_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
+_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
+# endif
+# endif
+#endif
+
+
+// Transcendental functions. These are defined only for float,
+// double, and long double. (Sqrt isn't transcendental, of course,
+// but it's included in this section anyway.)
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sqrt(const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL exp(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL log(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, int);
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const float&);
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const float&, const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sin(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL cos(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL tan(const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sinh(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL cosh(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL tanh(const complex<float>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sqrt(const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL exp(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL log(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, int);
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const double&);
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const double&, const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sin(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL cos(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL tan(const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sinh(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>&);
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL sqrt(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>&);
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, int);
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, const long double&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const long double&, const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&,
+ const complex<long double>&);
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL sin(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL cos(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL tan(const complex<long double>&);
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>&);
+#endif
+
+_STLP_END_NAMESPACE
+
+#ifndef _STLP_LINK_TIME_INSTANTIATION
+# include <stl/_complex.c>
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*========================================== */
+#if 1 /* def _STLP_3_COMPATIBILITY */
+
+# define __SGI_STL_PORT _STLPORT_VERSION
+
+# if defined (_STLP_DEBUG) && ! defined ( __STL_DEBUG )
+# define __STL_DEBUG _STLP_DEBUG
+# endif
+
+# if defined (_STLP_USE_NAMESPACES)
+# undef __STL_USE_NAMESPACES
+# define __STL_USE_NAMESPACES _STLP_USE_NAMESPACES
+# endif
+
+# if defined (_STLP_USE_EXCEPTIONS)
+# undef __STL_USE_EXCEPTIONS
+# define __STL_USE_EXCEPTIONS _STLP_USE_EXCEPTIONS
+# endif
+
+# if defined (_STLP_BEGIN_NAMESPACE) && ! defined ( __STL_BEGIN_NAMESPACE )
+# define __STL_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE
+# define __STL_END_NAMESPACE _STLP_END_NAMESPACE
+# define __STL_VENDOR_STD _STLP_VENDOR_STD
+# define __STL_VENDOR_CSTD _STLP_VENDOR_CSTD
+# endif
+# endif
+
+/*
+# if defined (_STLP_XXX) && ! defined ( __STL_XXX )
+# define __STL_XXX _STLP_XXX
+# endif
+*/
+
+/* 5.0 -> 4.6 compatibility section */
+#if 1 /* def _STLP_46_COMPATIBILITY */
+
+#ifndef _STLP_USING_NAMESPACE_BUG
+# define _STLP_USING_NAMESPACE_BUG
+#endif
+
+/* provide a uniform way to access full funclionality */
+# define __slist__ slist
+# define __map__ map
+# define __multimap__ multimap
+# define __set__ set
+# define __multiset__ multiset
+# define __list__ list
+# define __hash_map__ hash_map
+# define __hash_multimap__ hash_multimap
+# define __hash_set__ hash_set
+# define __hash_multiset__ hash_multiset
+# define __vector__ vector
+
+#endif
+
--- /dev/null
+/*
+ *
+ * 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_CONSTRUCT_H
+#define _STLP_INTERNAL_CONSTRUCT_H
+
+#if !defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_INTERNAL_CSTRING)
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NEW
+# include <stl/_new.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+#ifndef _STLP_MOVE_CONSTRUCT_FWK_H
+# include <stl/_move_construct_fwk.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+inline void __destroy_aux(_Tp* __pointer, const __false_type& /*_Trivial_destructor*/)
+{ __pointer->~_Tp(); }
+
+template <class _Tp>
+inline void __destroy_aux(_Tp*, const __true_type& /*_Trivial_destructor*/) {}
+
+template <class _Tp>
+inline void _Destroy(_Tp* __pointer) {
+#if defined (_STLP_MSVC) && (_STLP_MSVC <= 1010)
+ __pointer;
+#endif
+ typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
+ __destroy_aux(__pointer, _Trivial_destructor());
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset(__REINTERPRET_CAST(char*, __pointer), _STLP_SHRED_BYTE, sizeof(_Tp));
+#endif
+}
+
+template <class _Tp>
+inline void _Destroy_Moved(_Tp* __pointer) {
+ typedef typename __move_traits<_Tp>::complete _Trivial_destructor;
+ __destroy_aux(__pointer, _Trivial_destructor());
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__pointer, _STLP_SHRED_BYTE, sizeof(_Tp));
+#endif
+}
+
+#if defined (new)
+# define _STLP_NEW_REDEFINE new
+# undef new
+#endif
+
+#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
+template <class _T1>
+inline void _Construct_aux (_T1* __p, const __false_type&) {
+ _STLP_PLACEMENT_NEW (__p) _T1();
+}
+
+template <class _T1>
+inline void _Construct_aux (_T1* __p, const __true_type&) {
+ _STLP_PLACEMENT_NEW (__p) _T1(0);
+}
+#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */
+
+template <class _T1>
+inline void _Construct(_T1* __p) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
+#endif
+#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
+ _Construct_aux (__p, _HasDefaultZeroValue(__p)._Answer() );
+#else
+ _STLP_PLACEMENT_NEW (__p) _T1();
+#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */
+}
+
+template <class _Tp>
+inline void _Copy_Construct(_Tp* __p, const _Tp& __val) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_Tp));
+#endif
+ _STLP_PLACEMENT_NEW (__p) _Tp(__val);
+}
+
+template <class _T1, class _T2>
+inline void _Param_Construct(_T1* __p, const _T2& __val) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
+#endif
+ _STLP_PLACEMENT_NEW (__p) _T1(__val);
+}
+
+template <class _T1, class _T2>
+inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __false_type& /*_IsPOD*/) {
+ _STLP_PLACEMENT_NEW (__p) _T1(_STLP_PRIV _AsMoveSource(__val));
+}
+
+template <class _T1, class _T2>
+inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __true_type& /*_IsPOD*/) {
+ _STLP_PLACEMENT_NEW (__p) _T1(__val);
+}
+
+template <class _T1, class _T2>
+inline void _Move_Construct(_T1* __p, _T2& __val) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
+#endif
+ _Move_Construct_Aux(__p, __val, _Is_POD(__p)._Answer());
+}
+
+#if defined(_STLP_NEW_REDEFINE)
+# if defined (DEBUG_NEW)
+# define new DEBUG_NEW
+# endif
+# undef _STLP_NEW_REDEFINE
+#endif
+
+template <class _ForwardIterator, class _Tp>
+_STLP_INLINE_LOOP void
+__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __false_type& /*_Trivial_destructor*/) {
+ for ( ; __first != __last; ++__first) {
+ __destroy_aux(&(*__first), __false_type());
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp));
+#endif
+ }
+}
+
+template <class _ForwardIterator, class _Tp>
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+_STLP_INLINE_LOOP void
+__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __true_type& /*_Trivial_destructor*/) {
+ for ( ; __first != __last; ++__first)
+ memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp));
+}
+#else
+inline void
+__destroy_range_aux(_ForwardIterator, _ForwardIterator, _Tp*, const __true_type& /*_Trivial_destructor*/) {}
+#endif
+
+template <class _ForwardIterator, class _Tp>
+inline void
+__destroy_range(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) {
+ typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
+ __destroy_range_aux(__first, __last, __ptr, _Trivial_destructor());
+}
+
+template <class _ForwardIterator>
+inline void _Destroy_Range(_ForwardIterator __first, _ForwardIterator __last) {
+ __destroy_range(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator));
+}
+
+inline void _Destroy_Range(char*, char*) {}
+#if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97
+inline void _Destroy_Range(wchar_t*, wchar_t*) {}
+inline void _Destroy_Range(const wchar_t*, const wchar_t*) {}
+#endif
+
+template <class _ForwardIterator, class _Tp>
+inline void
+__destroy_mv_srcs(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) {
+ typedef typename __move_traits<_Tp>::complete _CompleteMove;
+ __destroy_range_aux(__first, __last, __ptr, _CompleteMove());
+}
+
+template <class _ForwardIterator>
+inline void _Destroy_Moved_Range(_ForwardIterator __first, _ForwardIterator __last) {
+ __destroy_mv_srcs(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator));
+}
+
+#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG)
+// Those adaptors are here to fix common compiler bug regarding builtins:
+// expressions like int k = int() should initialize k to 0
+template <class _Tp>
+inline _Tp __default_constructed_aux(_Tp*, const __false_type&) {
+ return _Tp();
+}
+template <class _Tp>
+inline _Tp __default_constructed_aux(_Tp*, const __true_type&) {
+ return _Tp(0);
+}
+
+template <class _Tp>
+inline _Tp __default_constructed(_Tp* __p) {
+ return __default_constructed_aux(__p, _HasDefaultZeroValue(__p)._Answer());
+}
+
+# define _STLP_DEFAULT_CONSTRUCTED(_TTp) __default_constructed((_TTp*)0)
+#else
+# define _STLP_DEFAULT_CONSTRUCTED(_TTp) _TTp()
+#endif /* _STLP_DEF_CONST_DEF_PARAM_BUG */
+
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+// --------------------------------------------------
+// Old names from the HP STL.
+
+template <class _T1, class _T2>
+inline void construct(_T1* __p, const _T2& __val) {_Param_Construct(__p, __val); }
+template <class _T1>
+inline void construct(_T1* __p) { _STLP_STD::_Construct(__p); }
+template <class _Tp>
+inline void destroy(_Tp* __pointer) { _STLP_STD::_Destroy(__pointer); }
+template <class _ForwardIterator>
+inline void destroy(_ForwardIterator __first, _ForwardIterator __last) { _STLP_STD::_Destroy_Range(__first, __last); }
+#endif /* _STLP_NO_ANACHRONISMS */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_CONSTRUCT_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_CSETJMP
+#define _STLP_INTERNAL_CSETJMP
+
+// if the macro is on, the header is already there
+#if !defined (setjmp)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(csetjmp)
+# else
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# include _STLP_NATIVE_C_HEADER(setjmp.h)
+# endif
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD)
+
+# if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
+/* For Borland, even if stdjmp.h is included symbols won't be in global namespace
+ * so we need to reach them in vendor namespace:
+ */
+# undef _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+_STLP_BEGIN_NAMESPACE
+# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
+using _STLP_VENDOR_CSTD::jmp_buf;
+# else
+// if setjmp.h was included first, this is in global namespace, not in
+// vendor's std. - 2005-08-04, ptr
+using ::jmp_buf;
+# endif
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if !defined (setjmp)
+# if !defined (__MSL__) || ((__MSL__ > 0x7001) && (__MSL__ < 0x8000))
+# ifndef _STLP_NATIVE_SETJMP_H_INCLUDED
+using _STLP_VENDOR_CSTD::setjmp;
+# else
+using ::setjmp;
+# endif
+# endif
+# endif
+# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
+using _STLP_VENDOR_CSTD::longjmp;
+# else
+using ::longjmp;
+# endif
+# endif
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif
--- /dev/null
+/*
+ * 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_CSIGNAL
+#define _STLP_INTERNAL_CSIGNAL
+
+#if !defined (_STLP_WCE)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(csignal)
+# else
+# include _STLP_NATIVE_C_HEADER(signal.h)
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+_STLP_BEGIN_NAMESPACE
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::signal;
+using _STLP_VENDOR_CSTD::raise;
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+using _STLP_VENDOR_CSTD::sig_atomic_t;
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+#endif
+
+#endif /* _STLP_INTERNAL_CSIGNAL */
--- /dev/null
+/*
+ * 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_CSTDARG
+#define _STLP_INTERNAL_CSTDARG
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(cstdarg)
+#else
+# include _STLP_NATIVE_C_HEADER(stdarg.h)
+#endif
+
+#ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::va_list;
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif
--- /dev/null
+/*
+ * 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_CSTDDEF
+#define _STLP_INTERNAL_CSTDDEF
+
+# if (__GNUC__ >= 3) && defined (__CYGWIN__) // this total HACK is the only expedient way I could cygwin to work with GCC 3.0
+# define __need_wint_t // mostly because wint_t didn't seem to get defined otherwise :(
+# define __need_wchar_t
+# define __need_size_t
+# define __need_ptrdiff_t
+# define __need_NULL
+# endif
+
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
+# else
+# include <stddef.h>
+# endif
+
+# ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::ptrdiff_t;
+using _STLP_VENDOR_CSTD::size_t;
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif /* _STLP_INTERNAL_CSTDDEF */
--- /dev/null
+/*
+ * 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_CSTDIO
+#define _STLP_INTERNAL_CSTDIO
+
+#if defined (__Lynx__)
+# include _STLP_NATIVE_C_HEADER(stdarg.h)
+#endif
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(cstdio)
+#else
+# include _STLP_NATIVE_C_HEADER(stdio.h)
+#endif
+
+#if (defined (__MWERKS__) && !defined (N_PLAT_NLM)) || defined (__BORLANDC__)
+# undef stdin
+# undef stdout
+# undef stderr
+# if defined (__MWERKS__)
+# define stdin (&_STLP_VENDOR_CSTD::__files[0])
+# define stdout (&_STLP_VENDOR_CSTD::__files[1])
+# define stderr (&_STLP_VENDOR_CSTD::__files[2])
+# elif defined (__BORLANDC__)
+# define stdin (&_STLP_VENDOR_CSTD::_streams[0])
+# define stdout (&_STLP_VENDOR_CSTD::_streams[1])
+# define stderr (&_STLP_VENDOR_CSTD::_streams[2])
+# endif
+#endif
+
+#if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER)
+inline int vsnprintf(char *s1, size_t n, const char *s2, va_list v)
+{ return _STLP_VENDOR_CSTD::_vsnprintf(s1, n, s2, v); }
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD )
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::FILE;
+using _STLP_VENDOR_CSTD::fpos_t;
+using _STLP_VENDOR_CSTD::size_t;
+
+// undef obsolete macros
+# undef putc
+# undef getc
+# undef getchar
+# undef putchar
+# undef feof
+# undef ferror
+
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::clearerr;
+using _STLP_VENDOR_CSTD::fclose;
+using _STLP_VENDOR_CSTD::feof;
+using _STLP_VENDOR_CSTD::ferror;
+using _STLP_VENDOR_CSTD::fflush;
+using _STLP_VENDOR_CSTD::fgetc;
+using _STLP_VENDOR_CSTD::fgetpos;
+using _STLP_VENDOR_CSTD::fgets;
+using _STLP_VENDOR_CSTD::fopen;
+using _STLP_VENDOR_CSTD::fprintf;
+using _STLP_VENDOR_CSTD::fputc;
+using _STLP_VENDOR_CSTD::fputs;
+using _STLP_VENDOR_CSTD::fread;
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this
+using _STLP_VENDOR_CSTD::freopen;
+# endif
+using _STLP_VENDOR_CSTD::fscanf;
+using _STLP_VENDOR_CSTD::fseek;
+using _STLP_VENDOR_CSTD::fsetpos;
+using _STLP_VENDOR_CSTD::ftell;
+using _STLP_VENDOR_CSTD::fwrite;
+
+# if !(defined (__IBMCPP__) && (__IBMCPP__ >= 500))
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this except as macros. TODO: use inline function to redirect to the macros?
+ using _STLP_VENDOR_CSTD::getc;
+ using _STLP_VENDOR_CSTD::putc;
+# endif
+ using _STLP_VENDOR_CSTD::getchar;
+ using _STLP_VENDOR_CSTD::putchar;
+# endif
+
+using _STLP_VENDOR_CSTD::gets;
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this
+using _STLP_VENDOR_CSTD::perror;
+# endif
+using _STLP_VENDOR_CSTD::printf;
+using _STLP_VENDOR_CSTD::puts;
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this
+using _STLP_VENDOR_CSTD::remove;
+using _STLP_VENDOR_CSTD::rename;
+using _STLP_VENDOR_CSTD::rewind;
+using _STLP_VENDOR_CSTD::setbuf;
+using _STLP_VENDOR_CSTD::tmpfile;
+using _STLP_VENDOR_CSTD::tmpnam;
+# endif
+using _STLP_VENDOR_CSTD::scanf;
+using _STLP_VENDOR_CSTD::setvbuf;
+using _STLP_VENDOR_CSTD::sprintf;
+using _STLP_VENDOR_CSTD::sscanf;
+using _STLP_VENDOR_CSTD::ungetc;
+using _STLP_VENDOR_CSTD::vfprintf;
+using _STLP_VENDOR_CSTD::vprintf;
+using _STLP_VENDOR_CSTD::vsprintf;
+# if ((defined (__MWERKS__) && !defined (N_PLAT_NLM)) || (defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400)) || \
+ (defined (__BORLANDC__)))
+using _STLP_VENDOR_CSTD::vsnprintf;
+# endif
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif /* _STLP_INTERNAL_CSTDIO */
--- /dev/null
+/*
+ * 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_CSTDLIB
+#define _STLP_INTERNAL_CSTDLIB
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+#else
+# include <stdlib.h>
+#endif
+
+#if defined (__BORLANDC__)
+/* Borland process.h header do not bring anything here and is just included
+ * in order to avoid inclusion later. This header cannot be included later
+ * because Borland compiler consider that for instance the abort function
+ * defined as extern "C" cannot be overloaded and it finds 2 "overloads",
+ * once in native std namespace and the other in STLport namespace...
+ */
+# include <process.h>
+#endif
+
+/* on evc3/evc4 including stdlib.h also defines setjmp macro */
+#if defined (_STLP_WCE)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+#endif
+
+#if defined (__MSL__) && (__MSL__ <= 0x5003)
+namespace std {
+ typedef ::div_t div_t;
+ typedef ::ldiv_t ldiv_t;
+# ifdef __MSL_LONGLONG_SUPPORT__
+ typedef ::lldiv_t lldiv_t;
+# endif
+}
+#endif
+
+#ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+# if !defined (ANDROID)
+// these types don't exist on Android
+using _STLP_VENDOR_CSTD::div_t;
+using _STLP_VENDOR_CSTD::ldiv_t;
+# endif
+using _STLP_VENDOR_CSTD::size_t;
+
+# ifndef _STLP_NO_CSTD_FUNCTION_IMPORTS
+# ifndef _STLP_WCE
+// these functions just don't exist on Windows CE
+using _STLP_VENDOR_CSTD::abort;
+using _STLP_VENDOR_CSTD::getenv;
+# if !defined (ANDROID)
+// these functions don't exist on Android
+using _STLP_VENDOR_CSTD::mblen;
+using _STLP_VENDOR_CSTD::mbtowc;
+using _STLP_VENDOR_CSTD::system;
+using _STLP_VENDOR_CSTD::bsearch;
+# endif
+# endif
+using _STLP_VENDOR_CSTD::atexit;
+using _STLP_VENDOR_CSTD::exit;
+using _STLP_VENDOR_CSTD::calloc;
+using _STLP_VENDOR_CSTD::free;
+using _STLP_VENDOR_CSTD::malloc;
+using _STLP_VENDOR_CSTD::realloc;
+using _STLP_VENDOR_CSTD::atof;
+using _STLP_VENDOR_CSTD::atoi;
+using _STLP_VENDOR_CSTD::atol;
+# if !defined (ANDROID)
+// this function doesn't exist on Android
+using _STLP_VENDOR_CSTD::mbstowcs;
+# endif
+using _STLP_VENDOR_CSTD::strtod;
+using _STLP_VENDOR_CSTD::strtol;
+using _STLP_VENDOR_CSTD::strtoul;
+
+# if !(defined (_STLP_NO_NATIVE_WIDE_STREAMS) || defined (_STLP_NO_MBSTATE_T))
+using _STLP_VENDOR_CSTD::wcstombs;
+# ifndef _STLP_WCE
+using _STLP_VENDOR_CSTD::wctomb;
+# endif
+# endif
+using _STLP_VENDOR_CSTD::qsort;
+using _STLP_VENDOR_CSTD::labs;
+# if !defined (ANDROID)
+// this function doesn't exist on Android
+using _STLP_VENDOR_CSTD::ldiv;
+# endif
+# if defined (_STLP_LONG_LONG) && !defined (_STLP_NO_VENDOR_STDLIB_L)
+# if !defined(__sun)
+using _STLP_VENDOR_CSTD::llabs;
+# if !defined (ANDROID)
+// these types don't exist on Android
+using _STLP_VENDOR_CSTD::lldiv_t;
+using _STLP_VENDOR_CSTD::lldiv;
+# endif
+# else
+using ::llabs;
+using ::lldiv_t;
+using ::lldiv;
+# endif
+# endif
+using _STLP_VENDOR_CSTD::rand;
+using _STLP_VENDOR_CSTD::srand;
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
+//In this config bcc define everything in std namespace and not in
+//the global one.
+inline int abs(int __x) { return _STLP_VENDOR_CSTD::abs(__x); }
+inline _STLP_VENDOR_CSTD::div_t div(int __x, int __y) { return _STLP_VENDOR_CSTD::div(__x, __y); }
+#endif
+
+#if defined(_MSC_EXTENSIONS) && defined(_STLP_MSVC) && (_STLP_MSVC <= 1300)
+# define _STLP_RESTORE_FUNCTION_INTRINSIC
+# pragma warning (push)
+# pragma warning (disable: 4162)
+# pragma function (abs)
+#endif
+
+//HP-UX native lib has abs() and div() functions in global namespace
+#if !defined (__HP_aCC) || (__HP_aCC < 30000)
+
+//MSVC starting with .Net 2003 already define all math functions in global namespace:
+# if !defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)
+inline long abs(long __x) { return _STLP_VENDOR_CSTD::labs(__x); }
+# endif
+
+/** VC since version 8 has this, the platform SDK and CE SDKs hanging behind.
+ * Android doesn't have ldiv_t. */
+# if (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER) || defined(UNDER_CE)) && !defined (ANDROID)
+inline _STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y) { return _STLP_VENDOR_CSTD::ldiv(__x, __y); }
+# endif
+
+#endif
+
+#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
+# pragma intrinsic (abs)
+# pragma warning (pop)
+# undef _STLP_RESTORE_FUNCTION_INTRINSIC
+#endif
+
+#if defined (_STLP_LONG_LONG)
+# if !defined (_STLP_NO_VENDOR_STDLIB_L)
+# if !defined (__sun)
+inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return _STLP_VENDOR_CSTD::llabs(__x); }
+# if !defined (ANDROID)
+// Android doesn't have lldiv_t.
+inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return _STLP_VENDOR_CSTD::lldiv(__x, __y); }
+# endif
+# else
+inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return ::llabs(__x); }
+inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return ::lldiv(__x, __y); }
+# endif
+# else
+inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; }
+# endif
+#endif
+
+/* C++ Standard is unclear about several call to 'using ::func' if new overloads
+ * of ::func appears between 2 successive 'using' calls. To avoid this potential
+ * problem we provide all abs overload before the 'using' call.
+ * Beware: This header inclusion has to be after all abs overload of this file.
+ * The first 'using ::abs' call is going to be in the other header.
+ */
+#ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+// ad hoc, don't replace with _STLP_VENDOR_CSTD::abs here! - ptr 2005-03-05
+_STLP_BEGIN_NAMESPACE
+using ::abs;
+# if !defined (ANDROID)
+// Android doesn't have div_t or ldiv_t.
+# if !defined (N_PLAT_NLM)
+using ::div;
+# else
+// Don't use div from clib or libc on NetWare---buggy! - ptr 2005-06-06
+inline div_t div(int __x, int __y) { div_t d; d.quot = __x / __y; d.rem = __x % __y; return d; }
+inline ldiv_t div(long __x, long __y) { ldiv_t d; d.quot = __x / __y; d.rem = __x % __y; return d; }
+# endif
+# endif
+_STLP_END_NAMESPACE
+#endif
+
+#endif /* _STLP_INTERNAL_CSTDLIB */
--- /dev/null
+/*
+ * 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_CSTRING
+#define _STLP_INTERNAL_CSTRING
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(cstring)
+#else
+# include _STLP_NATIVE_C_HEADER(string.h)
+#endif
+
+#ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+# include <using/cstring>
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif /* _STLP_INTERNAL_CSTRING */
--- /dev/null
+/*
+ * 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_CTIME
+#define _STLP_INTERNAL_CTIME
+
+#if !defined (_STLP_WCE_EVC3)
+
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(ctime)
+# else
+# include _STLP_NATIVE_C_HEADER(time.h)
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::size_t;
+using _STLP_VENDOR_CSTD::clock_t;
+using _STLP_VENDOR_CSTD::time_t;
+using _STLP_VENDOR_CSTD::tm;
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::clock;
+using _STLP_VENDOR_CSTD::asctime;
+using _STLP_VENDOR_CSTD::ctime;
+using _STLP_VENDOR_CSTD::gmtime;
+
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this
+using _STLP_VENDOR_CSTD::difftime;
+# endif
+using _STLP_VENDOR_CSTD::mktime;
+using _STLP_VENDOR_CSTD::localtime;
+using _STLP_VENDOR_CSTD::strftime;
+using _STLP_VENDOR_CSTD::time;
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif
+
+#endif /* _STLP_INTERNAL_CTIME */
--- /dev/null
+/*
+ * 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:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// 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_CTYPE_H
+#define _STLP_INTERNAL_CTYPE_H
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class _STLP_CLASS_DECLSPEC ctype_base {
+public:
+ enum mask {
+ space = _Locale_SPACE,
+ print = _Locale_PRINT,
+ cntrl = _Locale_CNTRL,
+ upper = _Locale_UPPER,
+ lower = _Locale_LOWER,
+ alpha = _Locale_ALPHA,
+ digit = _Locale_DIGIT,
+ punct = _Locale_PUNCT,
+ xdigit = _Locale_XDIGIT,
+ alnum = alpha | digit,
+ graph = alnum | punct
+ };
+};
+
+// ctype<> template
+
+template <class charT> class ctype {};
+template <class charT> class ctype_byname {};
+
+//ctype specializations
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype<char> : public locale::facet, public ctype_base {
+#ifndef _STLP_NO_WCHAR_T
+# ifdef _STLP_MSVC
+ typedef ctype<wchar_t> _Wctype;
+ friend _Wctype;
+# else
+ friend class ctype<wchar_t>;
+# endif
+#endif
+ friend class _Locale_impl;
+public:
+
+ typedef char char_type;
+
+ explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
+ bool is(mask __m, char __c) const
+ { return ((*(_M_ctype_table+(unsigned char)__c)) & __m) != 0; }
+
+ const char* is(const char* __low, const char* __high, mask* __vec) const {
+ for (const char* __p = __low;__p != __high; ++__p, ++__vec) {
+ *__vec = _M_ctype_table[(unsigned char)*__p];
+ }
+ return __high;
+ }
+
+ const char* scan_is(mask __m, const char* __low, const char* __high) const;
+ const char* scan_not(mask __m, const char* __low, const char* __high) const;
+
+ char (toupper)(char __c) const { return do_toupper(__c); }
+ const char* (toupper)(char* __low, const char* __high) const {
+ return do_toupper(__low, __high);
+ }
+
+ char (tolower)(char __c) const { return do_tolower(__c); }
+ const char* (tolower)(char* __low, const char* __high) const {
+ return do_tolower(__low, __high);
+ }
+
+ char widen(char __c) const { return do_widen(__c); }
+ const char* widen(const char* __low, const char* __high, char* __to) const {
+ return do_widen(__low, __high, __to);
+ }
+
+ char narrow(char __c, char __dfault) const {
+ return do_narrow(__c, __dfault);
+ }
+ const char* narrow(const char* __low, const char* __high,
+ char __dfault, char* __to) const {
+ return do_narrow(__low, __high, __dfault, __to);
+ }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+# if defined(_STLP_STATIC_CONST_INIT_BUG)
+ enum __TableSize { table_size = 256 };
+# else
+ static const size_t table_size = 256;
+# endif
+
+protected:
+ const mask* table() const _STLP_NOTHROW { return _M_ctype_table; }
+ static const mask* _STLP_CALL classic_table() _STLP_NOTHROW;
+
+ ~ctype();
+
+ virtual char do_toupper(char __c) const;
+ virtual char do_tolower(char __c) const;
+ virtual const char* do_toupper(char* __low, const char* __high) const;
+ virtual const char* do_tolower(char* __low, const char* __high) const;
+ virtual char do_widen(char __c) const;
+ virtual const char* do_widen(const char* __low, const char* __high,
+ char* __to) const;
+ virtual char do_narrow(char __c, char /* dfault */ ) const;
+ virtual const char* do_narrow(const char* __low, const char* __high,
+ char /* dfault */, char* __to) const;
+private:
+ struct _Is_mask {
+ mask __m;
+ _Is_mask(mask __x): __m(__x) {}
+ bool operator()(char __c) {return (__m & (unsigned char) __c) != 0;}
+ };
+
+protected:
+ const mask* _M_ctype_table;
+private:
+ bool _M_delete;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype_byname<char>: public ctype<char> {
+public:
+ explicit ctype_byname(const char*, size_t = 0, _Locale_name_hint* __hint = 0);
+ ~ctype_byname();
+
+ virtual char do_toupper(char __c) const;
+ virtual char do_tolower(char __c) const;
+
+ virtual const char* do_toupper(char*, const char*) const;
+ virtual const char* do_tolower(char*, const char*) const;
+
+private:
+ mask _M_byname_table[table_size];
+ _Locale_ctype* _M_ctype;
+
+ //explicitely defined as private to avoid warnings:
+ typedef ctype_byname<char> _Self;
+ ctype_byname(_Self const&);
+ _Self& operator = (_Self const&);
+ friend _Locale_name_hint* _Locale_extract_hint(ctype_byname<char>*);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype<wchar_t> : public locale::facet, public ctype_base
+{
+ friend class _Locale_impl;
+public:
+ typedef wchar_t char_type;
+
+ explicit ctype(size_t __refs = 0) : locale::facet(__refs) {}
+
+ bool is(mask __m, wchar_t __c) const
+ { return do_is(__m, __c); }
+
+ const wchar_t* is(const wchar_t* __low, const wchar_t* __high,
+ mask* __vec) const
+ { return do_is(__low, __high, __vec); }
+
+ const wchar_t* scan_is(mask __m,
+ const wchar_t* __low, const wchar_t* __high) const
+ { return do_scan_is(__m, __low, __high); }
+
+ const wchar_t* scan_not (mask __m,
+ const wchar_t* __low, const wchar_t* __high) const
+ { return do_scan_not(__m, __low, __high); }
+
+ wchar_t (toupper)(wchar_t __c) const { return do_toupper(__c); }
+ const wchar_t* (toupper)(wchar_t* __low, const wchar_t* __high) const
+ { return do_toupper(__low, __high); }
+
+ wchar_t (tolower)(wchar_t __c) const { return do_tolower(__c); }
+ const wchar_t* (tolower)(wchar_t* __low, const wchar_t* __high) const
+ { return do_tolower(__low, __high); }
+
+ wchar_t widen(char __c) const { return do_widen(__c); }
+ const char* widen(const char* __low, const char* __high,
+ wchar_t* __to) const
+ { return do_widen(__low, __high, __to); }
+
+ char narrow(wchar_t __c, char __dfault) const
+ { return do_narrow(__c, __dfault); }
+ const wchar_t* narrow(const wchar_t* __low, const wchar_t* __high,
+ char __dfault, char* __to) const
+ { return do_narrow(__low, __high, __dfault, __to); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ ~ctype();
+
+ virtual bool do_is(mask __m, wchar_t __c) const;
+ virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const;
+ virtual const wchar_t* do_scan_is(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual const wchar_t* do_scan_not(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_toupper(wchar_t __c) const;
+ virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_tolower(wchar_t c) const;
+ virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_widen(char c) const;
+ virtual const char* do_widen(const char*, const char*, wchar_t*) const;
+ virtual char do_narrow(wchar_t __c, char __dfault) const;
+ virtual const wchar_t* do_narrow(const wchar_t*, const wchar_t*,
+ char, char*) const;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype_byname<wchar_t>: public ctype<wchar_t> {
+public:
+ explicit ctype_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
+
+protected:
+ ~ctype_byname();
+
+ virtual bool do_is(mask __m, wchar_t __c) const;
+ virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const;
+ virtual const wchar_t* do_scan_is(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual const wchar_t* do_scan_not(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_toupper(wchar_t __c) const;
+ virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_tolower(wchar_t c) const;
+ virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const;
+
+private:
+ _Locale_ctype* _M_ctype;
+
+ //explicitely defined as private to avoid warnings:
+ typedef ctype_byname<wchar_t> _Self;
+ ctype_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+
+# endif /* WCHAR_T */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_CTYPE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * 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__)
+# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
+# endif
+
+# if !defined (_STLP_NO_CWCHAR) && defined (_STLP_USE_NEW_C_HEADERS)
+# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
+# if defined (__OpenBSD__)
+typedef _BSD_WINT_T_ wint_t;
+# endif /* __OpenBSD__ */
+
+# elif defined (_STLP_NO_WCHAR_T) || defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)) || \
+ (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) || \
+ defined (__OpenBSD__) || defined (__FreeBSD__) || \
+ (defined (__GNUC__) && (defined (__APPLE__) || defined ( __Lynx__ )))
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+# 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__ */
+# elif defined (__MWERKS__) && defined (N_PLAT_NLM)
+# include <wchar.h>
+# elif !defined (ANDROID)
+// Android doesn't have a working wchar.h
+# include _STLP_NATIVE_C_HEADER(wchar.h)
+
+# 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_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 (__GNUC__) && defined (__alpha__)
+/* Definition of WCHAR_MIN and MAX are wrong for alpha platform
+ * as gcc consider wchar_t as an unsigned type. Static assertion are
+ * here to check that a future alpha SDK or a future gcc won't change the
+ * situation making this workaround useless.
+ */
+_STLP_STATIC_ASSERT(((wchar_t)-1 > 0) && (WCHAR_MIN < 0))
+# undef WCHAR_MIN
+# define WCHAR_MIN 0
+# undef WCHAR_MAX
+# define WCHAR_MAX ((wchar_t)~0)
+# 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)) // || (defined(__MWERKS__) && defined(N_PLAT_NLM))
+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) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
+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) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
+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) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
+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) || (defined(__MWERKS__) && defined(N_PLAT_NLM)))
+# 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) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
+# 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) || (defined (__MWERKS__) && defined (N_PLAT_NLM)))
+# 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(__MWERKS__) && defined(N_PLAT_NLM))
+# 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;
+# endif
+
+# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
+using _STLP_VENDOR_CSTD::wcstod;
+using _STLP_VENDOR_CSTD::wcstol;
+# endif
+
+# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_HPACC_EXCLUDE) || \
+ (defined (__MWERKS__) && defined (N_PLAT_NLM)))
+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__)
+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
+
+# elif defined (__MWERKS__) && defined (N_PLAT_NLM) /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */
+using _STLP_VENDOR_CSTD::wcslen;
+using _STLP_VENDOR_CSTD::wcscmp;
+using _STLP_VENDOR_CSTD::wcscpy;
+using _STLP_VENDOR_CSTD::wcsstr;
+using _STLP_VENDOR_CSTD::wcschr;
+using _STLP_VENDOR_CSTD::wcsrchr;
+using _STLP_VENDOR_CSTD::wcspbrk;
+# 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 */
--- /dev/null
+/*
+ * 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_CWCTYPE
+#define _STLP_INTERNAL_CWCTYPE
+
+#if defined (__BORLANDC__) && !defined (_STLP_INTERNAL_CCTYPE)
+# include <stl/_cctype.h>
+#endif
+
+#if !defined (_STLP_WCE_EVC3)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if !defined (N_PLAT_NLM)
+# include _STLP_NATIVE_CPP_C_HEADER(cwctype)
+# else
+ // see comments in stlport/cwchar about wint_t on Novell
+# include _STLP_NATIVE_CPP_C_HEADER(wchar_t.h)
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+# include _STLP_NATIVE_C_HEADER(stdio.h)
+# endif
+# if defined (__MSL__) && !defined (N_PLAT_NLM)
+namespace std {
+ typedef wchar_t wctrans_t;
+ wint_t towctrans(wint_t c, wctrans_t value);
+ wctrans_t wctrans(const char *name);
+}
+using std::wctrans_t;
+using std::towctrans;
+using std::wctrans;
+# endif
+# else
+# include _STLP_NATIVE_C_HEADER(wctype.h)
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+
+# if defined (_STLP_USE_GLIBC) && !(defined (_GLIBCPP_USE_WCHAR_T) || defined (_GLIBCXX_USE_WCHAR_T)) || \
+ defined (__sun) || defined (__FreeBSD__) || \
+ defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION < 3) || (__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION <= 0))
+//We take wide functions from global namespace:
+# define _STLP_VENDOR_CSTD_WFUNC
+# else
+# define _STLP_VENDOR_CSTD_WFUNC _STLP_VENDOR_CSTD
+# endif
+
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD_WFUNC::wctype_t;
+using _STLP_VENDOR_CSTD_WFUNC::wint_t;
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if !defined (__BORLANDC__) && !defined (__MSL__)
+using _STLP_VENDOR_CSTD_WFUNC::wctrans_t;
+# if !defined (__DMC__) && (!defined(_WIN32_WCE) || _WIN32_WCE<0x500)
+using _STLP_VENDOR_CSTD_WFUNC::towctrans;
+using _STLP_VENDOR_CSTD_WFUNC::wctrans;
+using _STLP_VENDOR_CSTD_WFUNC::wctype;
+# endif
+using _STLP_VENDOR_CSTD_WFUNC::iswctype;
+# endif
+# if !defined(N_PLAT_NLM)
+using _STLP_VENDOR_CSTD_WFUNC::iswalnum;
+using _STLP_VENDOR_CSTD_WFUNC::iswalpha;
+using _STLP_VENDOR_CSTD_WFUNC::iswcntrl;
+
+using _STLP_VENDOR_CSTD_WFUNC::iswdigit;
+using _STLP_VENDOR_CSTD_WFUNC::iswgraph;
+using _STLP_VENDOR_CSTD_WFUNC::iswlower;
+using _STLP_VENDOR_CSTD_WFUNC::iswprint;
+using _STLP_VENDOR_CSTD_WFUNC::iswpunct;
+using _STLP_VENDOR_CSTD_WFUNC::iswspace;
+using _STLP_VENDOR_CSTD_WFUNC::iswupper;
+using _STLP_VENDOR_CSTD_WFUNC::iswxdigit;
+
+using _STLP_VENDOR_CSTD_WFUNC::towlower;
+using _STLP_VENDOR_CSTD_WFUNC::towupper;
+# endif /* !N_PLAT_NLM */
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+#endif /* _STLP_WCE_EVC3 */
+
+#endif /* _STLP_INTERNAL_CWCTYPE */
--- /dev/null
+/*
+ *
+ *
+ * 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(copy(__x.begin(), __x.end(), this->_M_start), this->_M_finish);
+ else {
+ const_iterator __mid = __x.begin() + difference_type(__len);
+ 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 (__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) {
+ 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) {
+ 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 {
+ 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 {
+ 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;
+ copy(__start_n, __pos, __old_start);
+ 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;
+ copy(__start_n, __pos, __old_start);
+ copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ const value_type* __mid = __first + (difference_type(__n) - __elems_before);
+ __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ 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;
+ copy_backward(__pos, __finish_n, __old_finish);
+ copy(__first, __last, __pos);
+ }
+ else {
+ const value_type* __mid = __first + __elems_after;
+ __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ 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;
+ copy(__start_n, __pos, __old_start);
+ copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ const_iterator __mid = __first + (__n - __elems_before);
+ __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ 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;
+ copy_backward(__pos, __finish_n, __old_finish);
+ copy(__first, __last, __pos);
+ }
+ else {
+ const_iterator __mid = __first + __elems_after;
+ __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ 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)
+ copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart);
+ else
+ 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);
+ 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:
--- /dev/null
+/*
+ *
+ * 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 {
+
+ enum _Constants {
+ _blocksize = _MAX_BYTES,
+ __buffer_size = (sizeof(_Tp) < (size_t)_blocksize ?
+ ( (size_t)_blocksize / sizeof(_Tp)) : size_t(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 + __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(__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) {
+ difference_type __offset = __n + (_M_cur - _M_first);
+ if (__offset >= 0 && __offset < difference_type(__buffer_size))
+ _M_cur += __n;
+ else {
+ difference_type __node_offset =
+ __offset > 0 ? __offset / __buffer_size
+ : -difference_type((-__offset - 1) / __buffer_size) - 1;
+ _M_set_node(_M_node + __node_offset);
+ _M_cur = _M_first +
+
+ (__offset - __node_offset * difference_type(__buffer_size));
+ }
+ }
+
+ void _M_set_node(_Map_pointer __new_node) {
+ _M_last = (_M_first = *(_M_node = __new_node)) + difference_type(__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 typename _Alloc_traits<_Tp,_Alloc>::allocator_type 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 (size_t)_Deque_iterator_base<_Tp>::__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) {}
+
+ _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;
+ }
+
+ ~_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_DEFAULT_ALLOCATOR_SELECT(_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;
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialAss;
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialCpy;
+ typedef typename _TrivialInit<_Tp>::_Ret _TrivialInit;
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#else
+ 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))
+ { _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)
+ { _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 */
+
+ deque(__move_source<_Self> src)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__move_source<_Base>(src.get()))
+ {}
+
+ ~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);
+ }
+
+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;
+ copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ else {
+ erase(copy(__first, __last, begin()), end());
+ }
+ }
+ void assign(const_iterator __first, const_iterator __last) {
+ typedef const_iterator _ForwardIterator;
+#endif /* _STLP_MEMBER_TEMPLATES */
+ size_type __len = distance(__first, __last);
+ if (__len > size()) {
+ _ForwardIterator __mid = __first;
+ advance(__mid, size());
+ copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ else {
+ erase(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 (__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) {
+ return _M_erase(__pos, _Movable());
+ }
+ iterator erase(iterator __first, iterator __last) {
+ 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 = 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;
+ advance(__mid, this->buffer_size());
+ uninitialized_copy(__first, __mid, *__cur_node);
+ __first = __mid;
+ }
+ 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 &) {
+ copy(__first, __last, inserter(*this, __pos));
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __n = 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);
+ uninitialized_copy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ copy(__start_n, __pos, __old_start);
+ copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ _ForwardIterator __mid = __first;
+ advance(__mid, difference_type(__n) - __elemsbefore);
+ _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ 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);
+ uninitialized_copy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ copy_backward(__pos, __finish_n, __old_finish);
+ copy(__first, __last, __pos);
+ }
+ else {
+ _ForwardIterator __mid = __first;
+ advance(__mid, __elemsafter);
+ _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ 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)
+template <class _Tp, class _Alloc>
+struct __move_traits<deque<_Tp, _Alloc> > {
+ typedef __stlp_movable implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_DEQUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/* NOTE : this header has no guards and is MEANT for multiple inclusion!
+ * If you are using "header protection" option with your compiler,
+ * please also find #pragma which disables it and put it here, to
+ * allow reentrancy of this header.
+ */
+
+#ifndef _STLP_PROLOG_HEADER_INCLUDED
+# error STLport epilog header can not be included as long as prolog has not be included.
+#endif
+
+/* If the platform provides any specific epilog actions,
+ * like #pragmas, do include platform-specific prolog file
+ */
+#if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG)
+# include <stl/config/_epilog.h>
+#endif
+
+#if !defined (_STLP_NO_POST_COMPATIBLE_SECTION)
+# include <stl/_config_compat_post.h>
+#endif
+
+#if defined (_STLP_USE_OWN_NAMESPACE)
+
+# if !defined (_STLP_DONT_REDEFINE_STD)
+/* We redefine "std" to STLPORT, so that user code may use std:: transparently
+ * The STLPORT macro contains the STLport namespace name containing all the std
+ * stuff.
+ */
+# if defined (std)
+/*
+ * Looks like the compiler native library on which STLport rely defined the std macro.
+ * This might introduce major incompatibility so report the problem to the STLport
+ * forum or comment the following #error at your own risk.
+ */
+# error Incompatible native Std library.
+# endif /* std */
+# define std STLPORT
+# endif /* _STLP_DONT_REDEFINE_STD */
+
+#endif
+
+#undef _STLP_PROLOG_HEADER_INCLUDED /* defined in _prolog.h */
--- /dev/null
+/*
+ * 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)
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
+# endif
+# endif
+
+# if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) && (defined (_STLP_MSVC) || defined (__ICL))
+// dwa 02/04/00 - here I'm assuming that __ICL uses the same library headers as vc6.
+// 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:
+# if !defined(_STLP_USE_NO_IOSTREAMS) && !defined(_STLP_INLINE_EXCEPTION_CLASS)
+ 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:
+# if !defined(_STLP_USE_NO_IOSTREAMS) && !defined(_STLP_INLINE_EXCEPTION_CLASS)
+ 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 */
--- /dev/null
+/*
+ * 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_FSTREAM_C
+#define _STLP_FSTREAM_C
+
+#ifndef _STLP_INTERNAL_FSTREAM_H
+# include <stl/_fstream.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+// no wchar_t is supported for this mode
+# define __BF_int_type__ int
+# define __BF_pos_type__ streampos
+# define __BF_off_type__ streamoff
+# else
+# define __BF_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type
+# define __BF_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::pos_type
+# define __BF_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::off_type
+# endif
+
+
+//----------------------------------------------------------------------
+// Public basic_filebuf<> member functions
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>::basic_filebuf()
+ : basic_streambuf<_CharT, _Traits>(), _M_base(),
+ _M_constant_width(false), _M_always_noconv(false),
+ _M_int_buf_dynamic(false),
+ _M_in_input_mode(false), _M_in_output_mode(false),
+ _M_in_error_mode(false), _M_in_putback_mode(false),
+ _M_int_buf(0), _M_int_buf_EOS(0),
+ _M_ext_buf(0), _M_ext_buf_EOS(0),
+ _M_ext_buf_converted(0), _M_ext_buf_end(0),
+ _M_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)),
+ _M_end_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)),
+ _M_mmap_base(0), _M_mmap_len(0),
+ _M_saved_eback(0), _M_saved_gptr(0), _M_saved_egptr(0),
+ _M_codecvt(0),
+ _M_width(1), _M_max_width(1)
+{
+ this->_M_setup_codecvt(locale(), false);
+}
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>::~basic_filebuf() {
+ this->close();
+ _M_deallocate_buffers();
+}
+
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type
+basic_filebuf<_CharT, _Traits>::underflow() {
+ return _Underflow<_CharT, _Traits>::_M_doit(this);
+}
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::close() {
+ bool __ok = this->is_open();
+
+ if (_M_in_output_mode) {
+ __ok = __ok && !_Traits::eq_int_type(this->overflow(traits_type::eof()),
+ traits_type::eof());
+ __ok == __ok && this->_M_unshift();
+ }
+ else if (_M_in_input_mode)
+ this->_M_exit_input_mode();
+
+ // Note order of arguments. We close the file even if __ok is false.
+ __ok = _M_base._M_close() && __ok;
+
+ // Restore the initial state, except that we don't deallocate the buffer
+ // or mess with the cached codecvt information.
+ _M_state = _M_end_state = _State_type();
+ _M_ext_buf_converted = _M_ext_buf_end = 0;
+
+ _M_mmap_base = 0;
+ _M_mmap_len = 0;
+
+ this->setg(0, 0, 0);
+ this->setp(0, 0);
+
+ _M_saved_eback = _M_saved_gptr = _M_saved_egptr = 0;
+
+ _M_in_input_mode = _M_in_output_mode = _M_in_error_mode = _M_in_putback_mode
+ = false;
+
+ return __ok ? this : 0;
+}
+
+// This member function is called whenever we exit input mode.
+// It unmaps the memory-mapped file, if any, and sets
+// _M_in_input_mode to false.
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::_M_exit_input_mode() {
+ if (_M_mmap_base != 0)
+ _M_base._M_unmap(_M_mmap_base, _M_mmap_len);
+ _M_in_input_mode = false;
+ _M_mmap_base = 0;
+}
+
+
+//----------------------------------------------------------------------
+// basic_filebuf<> overridden protected virtual member functions
+
+template <class _CharT, class _Traits>
+streamsize basic_filebuf<_CharT, _Traits>::showmanyc() {
+ // Is there any possibility that reads can succeed?
+ if (!this->is_open() || _M_in_output_mode || _M_in_error_mode)
+ return -1;
+ else if (_M_in_putback_mode)
+ return this->egptr() - this->gptr();
+ else if (_M_constant_width) {
+ streamoff __pos = _M_base._M_seek(0, ios_base::cur);
+ streamoff __size = _M_base._M_file_size();
+ return __pos >= 0 && __size > __pos ? __size - __pos : 0;
+ }
+ else
+ return 0;
+}
+
+
+// Make a putback position available, if necessary, by switching to a
+// special internal buffer used only for putback. The buffer is
+// [_M_pback_buf, _M_pback_buf + _S_pback_buf_size), but the base
+// class only sees a piece of it at a time. (We want to make sure
+// that we don't try to read a character that hasn't been initialized.)
+// The end of the putback buffer is always _M_pback_buf + _S_pback_buf_size,
+// but the beginning is usually not _M_pback_buf.
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c) {
+ const int_type __eof = traits_type::eof();
+
+ // If we aren't already in input mode, pushback is impossible.
+ if (!_M_in_input_mode)
+ return __eof;
+
+ // We can use the ordinary get buffer if there's enough space, and
+ // if it's a buffer that we're allowed to write to.
+ if (this->gptr() != this->eback() &&
+ (traits_type::eq_int_type(__c, __eof) ||
+ traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]) ||
+ !_M_mmap_base)) {
+ this->gbump(-1);
+ if (traits_type::eq_int_type(__c, __eof) ||
+ traits_type::eq(traits_type::to_char_type(__c), *this->gptr()))
+ return traits_type::to_int_type(*this->gptr());
+ }
+ else if (!traits_type::eq_int_type(__c, __eof)) {
+ // Are we in the putback buffer already?
+ _CharT* __pback_end = _M_pback_buf + __STATIC_CAST(int,_S_pback_buf_size);
+ if (_M_in_putback_mode) {
+ // Do we have more room in the putback buffer?
+ if (this->eback() != _M_pback_buf)
+ this->setg(this->egptr() - 1, this->egptr() - 1, __pback_end);
+ else
+ return __eof; // No more room in the buffer, so fail.
+ }
+ else { // We're not yet in the putback buffer.
+ _M_saved_eback = this->eback();
+ _M_saved_gptr = this->gptr();
+ _M_saved_egptr = this->egptr();
+ this->setg(__pback_end - 1, __pback_end - 1, __pback_end);
+ _M_in_putback_mode = true;
+ }
+ }
+ else
+ return __eof;
+
+ // We have made a putback position available. Assign to it, and return.
+ *this->gptr() = traits_type::to_char_type(__c);
+ return __c;
+}
+
+// This member function flushes the put area, and also outputs the
+// character __c (unless __c is eof). Invariant: we always leave room
+// in the internal buffer for one character more than the base class knows
+// about. We see the internal buffer as [_M_int_buf, _M_int_buf_EOS), but
+// the base class only sees [_M_int_buf, _M_int_buf_EOS - 1).
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::overflow(int_type __c) {
+ // Switch to output mode, if necessary.
+ if (!_M_in_output_mode)
+ if (!_M_switch_to_output_mode())
+ return traits_type::eof();
+
+ _CharT* __ibegin = this->_M_int_buf;
+ _CharT* __iend = this->pptr();
+ this->setp(_M_int_buf, _M_int_buf_EOS - 1);
+
+ // Put __c at the end of the internal buffer.
+ if (!traits_type::eq_int_type(__c, traits_type::eof()))
+ *__iend++ = _Traits::to_char_type(__c);
+
+ // For variable-width encodings, output may take more than one pass.
+ while (__ibegin != __iend) {
+ const _CharT* __inext = __ibegin;
+ char* __enext = _M_ext_buf;
+ typename _Codecvt::result __status
+ = _M_codecvt->out(_M_state, __ibegin, __iend, __inext,
+ _M_ext_buf, _M_ext_buf_EOS, __enext);
+ if (__status == _Codecvt::noconv) {
+ return _Noconv_output<_Traits>::_M_doit(this, __ibegin, __iend)
+ ? traits_type::not_eof(__c)
+ : _M_output_error();
+ }
+
+ // For a constant-width encoding we know that the external buffer
+ // is large enough, so failure to consume the entire internal buffer
+ // or to produce the correct number of external characters, is an error.
+ // For a variable-width encoding, however, we require only that we
+ // consume at least one internal character
+ else if (__status != _Codecvt::error &&
+ (((__inext == __iend) &&
+ (__enext - _M_ext_buf == _M_width * (__iend - __ibegin))) ||
+ (!_M_constant_width && __inext != __ibegin))) {
+ // We successfully converted part or all of the internal buffer.
+ ptrdiff_t __n = __enext - _M_ext_buf;
+ if (_M_write(_M_ext_buf, __n))
+ __ibegin += __inext - __ibegin;
+ else
+ return _M_output_error();
+ }
+ else
+ return _M_output_error();
+ }
+
+ return traits_type::not_eof(__c);
+}
+
+// This member function must be called before any I/O has been
+// performed on the stream, otherwise it has no effect.
+//
+// __buf == 0 && __n == 0 means to make this stream unbuffered.
+// __buf != 0 && __n > 0 means to use __buf as the stream's internal
+// buffer, rather than the buffer that would otherwise be allocated
+// automatically. __buf must be a pointer to an array of _CharT whose
+// size is at least __n.
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::setbuf(_CharT* __buf, streamsize __n) {
+ if (!_M_in_input_mode &&! _M_in_output_mode && !_M_in_error_mode &&
+ _M_int_buf == 0) {
+ if (__buf == 0 && __n == 0)
+ _M_allocate_buffers(0, 1);
+ else if (__buf != 0 && __n > 0)
+ _M_allocate_buffers(__buf, __n);
+ }
+ return this;
+}
+
+template <class _CharT, class _Traits>
+__BF_pos_type__
+basic_filebuf<_CharT, _Traits>::seekoff(off_type __off,
+ ios_base::seekdir __whence,
+ ios_base::openmode /* dummy */) {
+ if (this->is_open() &&
+ (__off == 0 || (_M_constant_width && this->_M_base._M_in_binary_mode()))) {
+
+ if (!_M_seek_init(__off != 0 || __whence != ios_base::cur))
+ return pos_type(-1);
+
+ // Seek to beginning or end, regardless of whether we're in input mode.
+ if (__whence == ios_base::beg || __whence == ios_base::end)
+ return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence),
+ _State_type());
+
+ // Seek relative to current position. Complicated if we're in input mode.
+ else if (__whence == ios_base::cur) {
+ if (!_M_in_input_mode)
+ return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence),
+ _State_type());
+ else if (_M_mmap_base != 0) {
+ // __off is relative to gptr(). We need to do a bit of arithmetic
+ // to get an offset relative to the external file pointer.
+ streamoff __adjust = _M_mmap_len - (this->gptr() - (_CharT*) _M_mmap_base);
+
+ // if __off == 0, we do not need to exit input mode and to shift file pointer
+ return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __adjust)
+ : _M_seek_return(_M_base._M_seek(__off - __adjust, ios_base::cur), _State_type());
+ }
+ else if (_M_constant_width) { // Get or set the position.
+ streamoff __iadj = _M_width * (this->gptr() - this->eback());
+
+ // Compensate for offset relative to gptr versus offset relative
+ // to external pointer. For a text-oriented stream, where the
+ // compensation is more than just pointer arithmetic, we may get
+ // but not set the current position.
+
+ if (__iadj <= _M_ext_buf_end - _M_ext_buf) {
+ streamoff __eadj = _M_base._M_get_offset(_M_ext_buf + __STATIC_CAST(ptrdiff_t, __iadj), _M_ext_buf_end);
+
+ return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __eadj)
+ : _M_seek_return(_M_base._M_seek(__off - __eadj, ios_base::cur), _State_type());
+ }
+ } else { // Get the position. Encoding is var width.
+ // Get position in internal buffer.
+ ptrdiff_t __ipos = this->gptr() - this->eback();
+
+ // Get corresponding position in external buffer.
+ _State_type __state = _M_state;
+ int __epos = _M_codecvt->length(__state, _M_ext_buf, _M_ext_buf_end,
+ __ipos);
+
+ if (__epos >= 0) {
+ // Sanity check (expensive): make sure __epos is the right answer.
+ _State_type __tmp_state = _M_state;
+ _Filebuf_Tmp_Buf<_CharT> __buf(__ipos);
+ _CharT* __ibegin = __buf._M_ptr;
+ _CharT* __inext = __ibegin;
+
+ const char* __dummy;
+ typename _Codecvt::result __status
+ = _M_codecvt->in(__tmp_state,
+ _M_ext_buf, _M_ext_buf + __epos, __dummy,
+ __ibegin, __ibegin + __ipos, __inext);
+ if (__status != _Codecvt::error &&
+ (__status == _Codecvt::noconv ||
+ (__inext == __ibegin + __ipos &&
+ equal(this->eback(), this->gptr(), __ibegin, _STLP_PRIV _Eq_traits<traits_type>())))) {
+ // Get the current position (at the end of the external buffer),
+ // then adjust it. Again, it might be a text-oriented stream.
+ streamoff __cur = _M_base._M_seek(0, ios_base::cur);
+ streamoff __adj =
+ _M_base._M_get_offset(_M_ext_buf, _M_ext_buf + __epos) -
+ _M_base._M_get_offset(_M_ext_buf, _M_ext_buf_end);
+ if (__cur != -1 && __cur + __adj >= 0)
+ return __off == 0 ? pos_type(__cur + __adj)
+ : _M_seek_return(__cur + __adj, __state);
+ //return _M_seek_return(__cur + __adj, __state);
+ }
+ // We failed the sanity check here.
+ }
+ }
+ }
+ // Unrecognized value for __whence here.
+ }
+
+ return pos_type(-1);
+}
+
+
+template <class _CharT, class _Traits>
+__BF_pos_type__
+basic_filebuf<_CharT, _Traits>::seekpos(pos_type __pos,
+ ios_base::openmode /* dummy */) {
+ if (this->is_open()) {
+ if (!_M_seek_init(true))
+ return pos_type(-1);
+
+ streamoff __off = off_type(__pos);
+ if (__off != -1 && _M_base._M_seek(__off, ios_base::beg) != -1) {
+ _M_state = __pos.state();
+ return _M_seek_return(__off, __pos.state());
+ }
+ }
+
+ return pos_type(-1);
+}
+
+
+template <class _CharT, class _Traits>
+int basic_filebuf<_CharT, _Traits>::sync() {
+ if (_M_in_output_mode)
+ return traits_type::eq_int_type(this->overflow(traits_type::eof()),
+ traits_type::eof()) ? -1 : 0;
+ return 0;
+}
+
+
+// Change the filebuf's locale. This member function has no effect
+// unless it is called before any I/O is performed on the stream.
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) {
+ if (!_M_in_input_mode && !_M_in_output_mode && !_M_in_error_mode) {
+ this->_M_setup_codecvt(__loc);
+ }
+}
+
+//----------------------------------------------------------------------
+// basic_filebuf<> helper functions.
+
+//----------------------------------------
+// Helper functions for switching between modes.
+
+// This member function is called if we're performing the first I/O
+// operation on a filebuf, or if we're performing an input operation
+// immediately after a seek.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_switch_to_input_mode() {
+ if (this->is_open() && (((int)_M_base.__o_mode() & (int)ios_base::in) != 0)
+ && (_M_in_output_mode == 0) && (_M_in_error_mode == 0)) {
+ if (!_M_int_buf && !_M_allocate_buffers())
+ return false;
+
+ _M_ext_buf_converted = _M_ext_buf;
+ _M_ext_buf_end = _M_ext_buf;
+
+ _M_end_state = _M_state;
+
+ _M_in_input_mode = true;
+ return true;
+ }
+
+ return false;
+}
+
+
+// This member function is called if we're performing the first I/O
+// operation on a filebuf, or if we're performing an output operation
+// immediately after a seek.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_switch_to_output_mode() {
+ if (this->is_open() && (_M_base.__o_mode() & (int)ios_base::out) &&
+ _M_in_input_mode == 0 && _M_in_error_mode == 0) {
+
+ if (!_M_int_buf && !_M_allocate_buffers())
+ return false;
+
+ // In append mode, every write does an implicit seek to the end
+ // of the file. Whenever leaving output mode, the end of file
+ // get put in the initial shift state.
+ if (_M_base.__o_mode() & ios_base::app)
+ _M_state = _State_type();
+
+ this->setp(_M_int_buf, _M_int_buf_EOS - 1);
+ _M_in_output_mode = true;
+ return true;
+ }
+
+ return false;
+}
+
+
+//----------------------------------------
+// Helper functions for input
+
+// This member function is called if there is an error during input.
+// It puts the filebuf in error mode, clear the get area buffer, and
+// returns eof.
+// returns eof. Error mode is sticky; it is cleared only by close or
+// seek.
+
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::_M_input_error() {
+ this->_M_exit_input_mode();
+ _M_in_output_mode = false;
+ _M_in_error_mode = true;
+ this->setg(0, 0, 0);
+ return traits_type::eof();
+}
+
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::_M_underflow_aux() {
+ // We have the state and file position from the end of the internal
+ // buffer. This round, they become the beginning of the internal buffer.
+ _M_state = _M_end_state;
+
+ // Fill the external buffer. Start with any leftover characters that
+ // didn't get converted last time.
+ if (_M_ext_buf_end > _M_ext_buf_converted)
+
+ _M_ext_buf_end = copy(_M_ext_buf_converted, _M_ext_buf_end, _M_ext_buf);
+ // boris : copy_backward did not work
+ //_M_ext_buf_end = copy_backward(_M_ext_buf_converted, _M_ext_buf_end,
+ //_M_ext_buf+ (_M_ext_buf_end - _M_ext_buf_converted));
+ else
+ _M_ext_buf_end = _M_ext_buf;
+
+ // Now fill the external buffer with characters from the file. This is
+ // a loop because occasionally we don't get enough external characters
+ // to make progress.
+ for (;;) {
+ ptrdiff_t __n = _M_base._M_read(_M_ext_buf_end, _M_ext_buf_EOS - _M_ext_buf_end);
+
+ // Don't enter error mode for a failed read. Error mode is sticky,
+ // and we might succeed if we try again.
+ if (__n <= 0)
+ return traits_type::eof();
+
+ // Convert the external buffer to internal characters.
+ _M_ext_buf_end += __n;
+ const char* __enext;
+ _CharT* __inext;
+
+ typename _Codecvt::result __status
+ = _M_codecvt->in(_M_end_state,
+ _M_ext_buf, _M_ext_buf_end, __enext,
+ _M_int_buf, _M_int_buf_EOS, __inext);
+
+ // Error conditions: (1) Return value of error. (2) Producing internal
+ // characters without consuming external characters. (3) In fixed-width
+ // encodings, producing an internal sequence whose length is inconsistent
+ // with that of the internal sequence. (4) Failure to produce any
+ // characters if we have enough characters in the external buffer, where
+ // "enough" means the largest possible width of a single character.
+ if (__status == _Codecvt::noconv)
+ return _Noconv_input<_Traits>::_M_doit(this);
+ else if (__status == _Codecvt::error ||
+ (__inext != _M_int_buf && __enext == _M_ext_buf) ||
+ (_M_constant_width &&
+ // __inext - _M_int_buf != _M_width * (__enext - _M_ext_buf)) ||
+ (__inext - _M_int_buf) * _M_width != (__enext - _M_ext_buf)) ||
+ (__inext == _M_int_buf && __enext - _M_ext_buf >= _M_max_width))
+ return _M_input_error();
+ else if (__inext != _M_int_buf) {
+ _M_ext_buf_converted = _M_ext_buf + (__enext - _M_ext_buf);
+ this->setg(_M_int_buf, _M_int_buf, __inext);
+ return traits_type::to_int_type(*_M_int_buf);
+ }
+ // We need to go around the loop again to get more external characters.
+ }
+}
+
+//----------------------------------------
+// Helper functions for output
+
+// This member function is called if there is an error during output.
+// It puts the filebuf in error mode, clear the put area buffer, and
+// returns eof. Error mode is sticky; it is cleared only by close or
+// seek.
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::_M_output_error() {
+ _M_in_output_mode = false;
+ _M_in_input_mode = false;
+ _M_in_error_mode = true;
+ this->setp(0, 0);
+ return traits_type::eof();
+}
+
+
+// Write whatever sequence of characters is necessary to get back to
+// the initial shift state. This function overwrites the external
+// buffer, changes the external file position, and changes the state.
+// Precondition: the internal buffer is empty.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_unshift() {
+ if (_M_in_output_mode && !_M_constant_width) {
+ typename _Codecvt::result __status;
+ do {
+ char* __enext = _M_ext_buf;
+ __status = _M_codecvt->unshift(_M_state,
+ _M_ext_buf, _M_ext_buf_EOS, __enext);
+ if (__status == _Codecvt::noconv ||
+ (__enext == _M_ext_buf && __status == _Codecvt::ok))
+ return true;
+ else if (__status == _Codecvt::error)
+ return false;
+ else if (!_M_write(_M_ext_buf, __enext - _M_ext_buf))
+ return false;
+ } while (__status == _Codecvt::partial);
+ }
+
+ return true;
+}
+
+
+//----------------------------------------
+// Helper functions for buffer allocation and deallocation
+
+// This member function is called when we're initializing a filebuf's
+// internal and external buffers. The argument is the size of the
+// internal buffer; the external buffer is sized using the character
+// width in the current encoding. Preconditions: the buffers are currently
+// null. __n >= 1. __buf is either a null pointer or a pointer to an
+// array show size is at least __n.
+
+// We need __n >= 1 for two different reasons. For input, the base
+// class always needs a buffer because of the semantics of underflow().
+// For output, we want to have an internal buffer that's larger by one
+// element than the buffer that the base class knows about. (See
+// basic_filebuf<>::overflow() for the reason.)
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers(_CharT* __buf, streamsize __n) {
+ //The major hypothesis in the following implementation is that size_t is unsigned.
+ //We also need streamsize byte representation to be larger or equal to the int
+ //representation to correctly store the encoding information.
+ _STLP_STATIC_ASSERT(!numeric_limits<size_t>::is_signed &&
+ sizeof(streamsize) >= sizeof(int))
+
+ if (__buf == 0) {
+ streamsize __bufsize = __n * sizeof(_CharT);
+ //We first check that the streamsize representation can't overflow a size_t one.
+ //If it can, we check that __bufsize is not higher than the size_t max value.
+ if ((sizeof(streamsize) > sizeof(size_t)) &&
+ (__bufsize > __STATIC_CAST(streamsize, (numeric_limits<size_t>::max)())))
+ return false;
+ _M_int_buf = __STATIC_CAST(_CharT*, malloc(__STATIC_CAST(size_t, __bufsize)));
+ if (!_M_int_buf)
+ return false;
+ _M_int_buf_dynamic = true;
+ }
+ else {
+ _M_int_buf = __buf;
+ _M_int_buf_dynamic = false;
+ }
+
+ streamsize __ebufsiz = (max)(__n * __STATIC_CAST(streamsize, _M_width),
+ __STATIC_CAST(streamsize, _M_codecvt->max_length()));
+ _M_ext_buf = 0;
+ if ((sizeof(streamsize) < sizeof(size_t)) ||
+ ((sizeof(streamsize) == sizeof(size_t)) && numeric_limits<streamsize>::is_signed) ||
+ (__ebufsiz <= __STATIC_CAST(streamsize, (numeric_limits<size_t>::max)()))) {
+ _M_ext_buf = __STATIC_CAST(char*, malloc(__STATIC_CAST(size_t, __ebufsiz)));
+ }
+
+ if (!_M_ext_buf) {
+ _M_deallocate_buffers();
+ return false;
+ }
+
+ _M_int_buf_EOS = _M_int_buf + __STATIC_CAST(ptrdiff_t, __n);
+ _M_ext_buf_EOS = _M_ext_buf + __STATIC_CAST(ptrdiff_t, __ebufsiz);
+ return true;
+}
+
+// Abbreviation for the most common case.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers() {
+ // Choose a buffer that's at least 4096 characters long and that's a
+ // multiple of the page size.
+ streamsize __default_bufsiz =
+ ((_M_base.__page_size() + 4095UL) / _M_base.__page_size()) * _M_base.__page_size();
+ return _M_allocate_buffers(0, __default_bufsiz);
+}
+
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::_M_deallocate_buffers() {
+ if (_M_int_buf_dynamic)
+ free(_M_int_buf);
+ free(_M_ext_buf);
+ _M_int_buf = 0;
+ _M_int_buf_EOS = 0;
+ _M_ext_buf = 0;
+ _M_ext_buf_EOS = 0;
+}
+
+
+//----------------------------------------
+// Helper functiosn for seek and imbue
+
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_seek_init(bool __do_unshift) {
+ // If we're in error mode, leave it.
+ _M_in_error_mode = false;
+
+ // Flush the output buffer if we're in output mode, and (conditionally)
+ // emit an unshift sequence.
+ if (_M_in_output_mode) {
+ bool __ok = !traits_type::eq_int_type(this->overflow(traits_type::eof()),
+ traits_type::eof());
+ if (__do_unshift)
+ __ok = __ok && this->_M_unshift();
+ if (!__ok) {
+ _M_in_output_mode = false;
+ _M_in_error_mode = true;
+ this->setp(0, 0);
+ return false;
+ }
+ }
+
+ // Discard putback characters, if any.
+ if (_M_in_input_mode && _M_in_putback_mode)
+ _M_exit_putback_mode();
+
+ return true;
+}
+
+
+/* Change the filebuf's locale. This member function has no effect
+ * unless it is called before any I/O is performed on the stream.
+ * This function is called on construction and on an imbue call. In the
+ * case of the construction the codecvt facet might be a custom one if
+ * the basic_filebuf user has instanciate it with a custom char_traits.
+ * The user will have to call imbue before any I/O operation.
+ */
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::_M_setup_codecvt(const locale& __loc, bool __on_imbue) {
+ if (has_facet<_Codecvt>(__loc)) {
+ _M_codecvt = &use_facet<_Codecvt>(__loc) ;
+ int __encoding = _M_codecvt->encoding();
+
+ _M_width = (max)(__encoding, 1);
+ _M_max_width = _M_codecvt->max_length();
+ _M_constant_width = __encoding > 0;
+ _M_always_noconv = _M_codecvt->always_noconv();
+ }
+ else {
+ _M_codecvt = 0;
+ _M_width = _M_max_width = 1;
+ _M_constant_width = _M_always_noconv = false;
+ if (__on_imbue) {
+ //This call will generate an exception reporting the problem.
+ use_facet<_Codecvt>(__loc);
+ }
+ }
+}
+
+_STLP_END_NAMESPACE
+
+# undef __BF_int_type__
+# undef __BF_pos_type__
+# undef __BF_off_type__
+
+#endif /* _STLP_FSTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// This header defines classes basic_filebuf, basic_ifstream,
+// basic_ofstream, and basic_fstream. These classes represent
+// streambufs and streams whose sources or destinations are files.
+
+#ifndef _STLP_INTERNAL_FSTREAM_H
+#define _STLP_INTERNAL_FSTREAM_H
+
+#if defined(__sgi) && !defined(__GNUC__) && !defined(_STANDARD_C_PLUS_PLUS)
+# error This header file requires the -LANG:std option
+#endif
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CODECVT_H
+# include <stl/_codecvt.h>
+#endif
+
+#if !defined (_STLP_USE_UNIX_IO) && !defined(_STLP_USE_WIN32_IO) && \
+ !defined (_STLP_USE_UNIX_EMULATION_IO) && !defined (_STLP_USE_STDIO_IO)
+
+# if defined (_STLP_UNIX) || defined (__CYGWIN__) || defined (__amigaos__) || defined (__EMX__)
+// open/close/read/write
+# define _STLP_USE_UNIX_IO
+# elif defined (_STLP_WIN32)
+// CreateFile/ReadFile/WriteFile
+# define _STLP_USE_WIN32_IO
+# elif defined (_STLP_WIN16) || defined (_STLP_MAC)
+// _open/_read/_write
+# define _STLP_USE_UNIX_EMULATION_IO
+# else
+// fopen/fread/fwrite
+# define _STLP_USE_STDIO_IO
+# endif /* _STLP_UNIX */
+#endif /* mode selection */
+
+#if defined (_STLP_USE_WIN32_IO)
+typedef void* _STLP_fd;
+#elif defined (_STLP_USE_UNIX_EMULATION_IO) || defined (_STLP_USE_STDIO_IO) || defined (_STLP_USE_UNIX_IO)
+typedef int _STLP_fd;
+#else
+# error "Configure i/o !"
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Class _Filebuf_base, a private base class to factor out the system-
+// dependent code from basic_filebuf<>.
+
+class _STLP_CLASS_DECLSPEC _Filebuf_base {
+public: // Opening and closing files.
+ _Filebuf_base();
+
+ bool _M_open(const char*, ios_base::openmode, long __protection);
+ bool _M_open(const char*, ios_base::openmode);
+ bool _M_open(int __id, ios_base::openmode = ios_base::__default_mode);
+#if defined (_STLP_USE_WIN32_IO)
+ bool _M_open(_STLP_fd __id, ios_base::openmode = ios_base::__default_mode);
+#endif /* _STLP_USE_WIN32_IO */
+ bool _M_close();
+
+public: // Low-level I/O, like Unix read/write
+ ptrdiff_t _M_read(char* __buf, ptrdiff_t __n);
+ streamoff _M_seek(streamoff __offset, ios_base::seekdir __dir);
+ streamoff _M_file_size();
+ bool _M_write(char* __buf, ptrdiff_t __n);
+
+public: // Memory-mapped I/O.
+ void* _M_mmap(streamoff __offset, streamoff __len);
+ void _M_unmap(void* __mmap_base, streamoff __len);
+
+public:
+ // Returns a value n such that, if pos is the file pointer at the
+ // beginning of the range [first, last), pos + n is the file pointer at
+ // the end. On many operating systems n == __last - __first.
+ // In Unix, writing n characters always bumps the file position by n.
+ // In Windows text mode, however, it bumps the file position by n + m,
+ // where m is the number of newlines in the range. That's because an
+ // internal \n corresponds to an external two-character sequence.
+ streamoff _M_get_offset(char* __first, char* __last) {
+#if defined (_STLP_UNIX) || defined (_STLP_MAC)
+ return __last - __first;
+#else // defined (_STLP_WIN32) || defined (_STLP_WIN16) || defined (_STLP_DOS) || defined(N_PLAT_NLM)
+ return ( (_M_openmode & ios_base::binary) != 0 )
+ ? (__last - __first)
+ : count(__first, __last, '\n') + (__last - __first);
+#endif
+ }
+
+ // Returns true if we're in binary mode or if we're using an OS or file
+ // system where there is no distinction between text and binary mode.
+ bool _M_in_binary_mode() const {
+#if defined (_STLP_UNIX) || defined (_STLP_MAC) || defined(__BEOS__) || defined (__amigaos__)
+ return true;
+#elif defined (_STLP_WIN32) || defined (_STLP_WIN16) || defined (_STLP_DOS) || defined (_STLP_VM) || defined (__EMX__) || defined(N_PLAT_NLM)
+ return (_M_openmode & ios_base::binary) != 0;
+#else
+# error "Port!"
+#endif
+ }
+
+ static void _S_initialize();
+
+protected: // Static data members.
+ static size_t _M_page_size;
+
+protected: // Data members.
+ _STLP_fd _M_file_id;
+#if defined (_STLP_USE_STDIO_IO)
+ // for stdio, the whole FILE* is being kept here
+ FILE* _M_file;
+#endif
+#if defined (_STLP_USE_WIN32_IO)
+ _STLP_fd _M_view_id;
+#endif
+
+ ios_base::openmode _M_openmode ;
+ unsigned char _M_is_open ;
+ unsigned char _M_should_close ;
+ unsigned char _M_regular_file ;
+
+public :
+ static size_t _STLP_CALL __page_size() { return _M_page_size; }
+ int __o_mode() const { return (int)_M_openmode; }
+ bool __is_open() const { return (_M_is_open !=0 ); }
+ bool __should_close() const { return (_M_should_close != 0); }
+ bool __regular_file() const { return (_M_regular_file != 0); }
+ _STLP_fd __get_fd() const { return _M_file_id; }
+};
+
+//----------------------------------------------------------------------
+// Class basic_filebuf<>.
+
+// Forward declaration of two helper classes.
+template <class _Traits> class _Noconv_input;
+_STLP_TEMPLATE_NULL
+class _Noconv_input<char_traits<char> >;
+
+template <class _Traits> class _Noconv_output;
+_STLP_TEMPLATE_NULL
+class _Noconv_output< char_traits<char> >;
+
+// There is a specialized version of underflow, for basic_filebuf<char>,
+// in fstream.cxx.
+
+template <class _CharT, class _Traits>
+class _Underflow;
+
+_STLP_TEMPLATE_NULL class _Underflow< char, char_traits<char> >;
+
+template <class _CharT, class _Traits>
+class basic_filebuf : public basic_streambuf<_CharT, _Traits> {
+public: // Types.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef typename _Traits::state_type _State_type;
+ typedef basic_streambuf<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Self;
+
+public: // Constructors, destructor.
+ basic_filebuf();
+ ~basic_filebuf();
+
+public: // Opening and closing files.
+ bool is_open() const { return _M_base.__is_open(); }
+
+ _Self* open(const char* __s, ios_base::openmode __m) {
+ return _M_base._M_open(__s, __m) ? this : 0;
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ // These two version of open() and file descriptor getter are extensions.
+ _Self* open(const char* __s, ios_base::openmode __m,
+ long __protection) {
+ return _M_base._M_open(__s, __m, __protection) ? this : 0;
+ }
+
+ _STLP_fd fd() const { return _M_base.__get_fd(); }
+
+ _Self* open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
+ return this->_M_open(__id, _Init_mode);
+ }
+
+# if defined (_STLP_USE_WIN32_IO)
+ _Self* open(_STLP_fd __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
+ return _M_base._M_open(__id, _Init_mode) ? this : 0;
+ }
+# endif /* _STLP_USE_WIN32_IO */
+
+#endif
+
+ _Self* _M_open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
+ return _M_base._M_open(__id, _Init_mode) ? this : 0;
+ }
+
+ _Self* close();
+
+protected: // Virtual functions from basic_streambuf.
+ virtual streamsize showmanyc();
+ virtual int_type underflow();
+
+ virtual int_type pbackfail(int_type = traits_type::eof());
+ virtual int_type overflow(int_type = traits_type::eof());
+
+ virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize);
+ virtual pos_type seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type,
+ ios_base::openmode = ios_base::in | ios_base::out);
+
+ virtual int sync();
+ virtual void imbue(const locale&);
+
+private: // Helper functions.
+
+ // Precondition: we are currently in putback input mode. Effect:
+ // switches back to ordinary input mode.
+ void _M_exit_putback_mode() {
+ this->setg(_M_saved_eback, _M_saved_gptr, _M_saved_egptr);
+ _M_in_putback_mode = false;
+ }
+ bool _M_switch_to_input_mode();
+ void _M_exit_input_mode();
+ bool _M_switch_to_output_mode();
+
+ int_type _M_input_error();
+ int_type _M_underflow_aux();
+ // friend class _Noconv_input<_Traits>;
+ // friend class _Noconv_output<_Traits>;
+ friend class _Underflow<_CharT, _Traits>;
+
+ int_type _M_output_error();
+ bool _M_unshift();
+
+ bool _M_allocate_buffers(_CharT* __buf, streamsize __n);
+ bool _M_allocate_buffers();
+ void _M_deallocate_buffers();
+
+ pos_type _M_seek_return(off_type __off, _State_type __state) {
+ if (__off != -1) {
+ if (_M_in_input_mode)
+ _M_exit_input_mode();
+ _M_in_input_mode = false;
+ _M_in_output_mode = false;
+ _M_in_putback_mode = false;
+ _M_in_error_mode = false;
+ this->setg(0, 0, 0);
+ this->setp(0, 0);
+ }
+
+ pos_type __result(__off);
+ __result.state(__state);
+ return __result;
+ }
+
+ bool _M_seek_init(bool __do_unshift);
+
+ void _M_setup_codecvt(const locale&, bool __on_imbue = true);
+
+private: // Data members used in all modes.
+
+ _Filebuf_base _M_base;
+
+private: // Locale-related information.
+
+ unsigned char _M_constant_width;
+ unsigned char _M_always_noconv;
+
+ // private: // Mode flags.
+ unsigned char _M_int_buf_dynamic; // True if internal buffer is heap allocated,
+ // false if it was supplied by the user.
+ unsigned char _M_in_input_mode;
+ unsigned char _M_in_output_mode;
+ unsigned char _M_in_error_mode;
+ unsigned char _M_in_putback_mode;
+
+ // Internal buffer: characters seen by the filebuf's clients.
+ _CharT* _M_int_buf;
+ _CharT* _M_int_buf_EOS;
+
+ // External buffer: characters corresponding to the external file.
+ char* _M_ext_buf;
+ char* _M_ext_buf_EOS;
+
+ // The range [_M_ext_buf, _M_ext_buf_converted) contains the external
+ // characters corresponding to the sequence in the internal buffer. The
+ // range [_M_ext_buf_converted, _M_ext_buf_end) contains characters that
+ // have been read into the external buffer but have not been converted
+ // to an internal sequence.
+ char* _M_ext_buf_converted;
+ char* _M_ext_buf_end;
+
+ // State corresponding to beginning of internal buffer.
+ _State_type _M_state;
+
+private: // Data members used only in input mode.
+
+ // Similar to _M_state except that it corresponds to
+ // the end of the internal buffer instead of the beginning.
+ _State_type _M_end_state;
+
+ // This is a null pointer unless we are in mmap input mode.
+ void* _M_mmap_base;
+ streamoff _M_mmap_len;
+
+private: // Data members used only in putback mode.
+ _CharT* _M_saved_eback;
+ _CharT* _M_saved_gptr;
+ _CharT* _M_saved_egptr;
+
+ typedef codecvt<_CharT, char, _State_type> _Codecvt;
+ const _Codecvt* _M_codecvt;
+
+ int _M_width; // Width of the encoding (if constant), else 1
+ int _M_max_width; // Largest possible width of single character.
+
+
+ enum { _S_pback_buf_size = 8 };
+ _CharT _M_pback_buf[_S_pback_buf_size];
+
+ // for _Noconv_output
+public:
+ bool _M_write(char* __buf, ptrdiff_t __n) {return _M_base._M_write(__buf, __n); }
+
+public:
+ int_type
+ _M_do_noconv_input() {
+ _M_ext_buf_converted = _M_ext_buf_end;
+ /* this-> */ _Base::setg((char_type*)_M_ext_buf, (char_type*)_M_ext_buf, (char_type*)_M_ext_buf_end);
+ return traits_type::to_int_type(*_M_ext_buf);
+ }
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf<wchar_t, char_traits<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+// public:
+// helper class.
+template <class _CharT>
+struct _Filebuf_Tmp_Buf {
+ _CharT* _M_ptr;
+ _Filebuf_Tmp_Buf(ptrdiff_t __n) : _M_ptr(0) { _M_ptr = new _CharT[__n]; }
+ ~_Filebuf_Tmp_Buf() { delete[] _M_ptr; }
+};
+
+
+//
+// This class had to be designed very carefully to work
+// with Visual C++.
+//
+template <class _Traits>
+class _Noconv_output {
+public:
+ typedef typename _Traits::char_type char_type;
+ static bool _STLP_CALL _M_doit(basic_filebuf<char_type, _Traits >*,
+ char_type*, char_type*)
+ { return false; }
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC _Noconv_output< char_traits<char> > {
+public:
+ static bool _STLP_CALL
+ _M_doit(basic_filebuf<char, char_traits<char> >* __buf,
+ char* __first, char* __last) {
+ ptrdiff_t __n = __last - __first;
+ return (__buf->_M_write(__first, __n));
+ }
+};
+
+//----------------------------------------------------------------------
+// basic_filebuf<> helper functions.
+
+
+//----------------------------------------
+// Helper functions for switching between modes.
+
+//
+// This class had to be designed very carefully to work
+// with Visual C++.
+//
+template <class _Traits>
+class _Noconv_input {
+public:
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::char_type char_type;
+
+ static inline int_type _STLP_CALL
+ _M_doit(basic_filebuf<char_type, _Traits>*)
+ { return _Traits::eof(); }
+};
+
+_STLP_TEMPLATE_NULL
+class _Noconv_input<char_traits<char> > {
+public:
+ static inline int _STLP_CALL
+ _M_doit(basic_filebuf<char, char_traits<char> >* __buf) {
+ return __buf->_M_do_noconv_input();
+ }
+};
+
+// underflow() may be called for one of two reasons. (1) We've
+// been going through the special putback buffer, and we need to move back
+// to the regular internal buffer. (2) We've exhausted the internal buffer,
+// and we need to replentish it.
+template <class _CharT, class _Traits>
+class _Underflow {
+public:
+ typedef typename _Traits::int_type int_type;
+ typedef _Traits traits_type;
+
+ static int_type _STLP_CALL _M_doit(basic_filebuf<_CharT, _Traits>* __this);
+};
+
+
+// Specialization of underflow: if the character type is char, maybe
+// we can use mmap instead of read.
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC _Underflow< char, char_traits<char> > {
+public:
+ typedef char_traits<char>::int_type int_type;
+ typedef char_traits<char> traits_type;
+ static int _STLP_CALL _M_doit(basic_filebuf<char, traits_type >* __this);
+};
+
+// There is a specialized version of underflow, for basic_filebuf<char>,
+// in fstream.cxx.
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE _Underflow<_CharT, _Traits>::int_type // _STLP_CALL
+ _Underflow<_CharT, _Traits>::_M_doit(basic_filebuf<_CharT, _Traits>* __this) {
+ if (!__this->_M_in_input_mode) {
+ if (!__this->_M_switch_to_input_mode())
+ return traits_type::eof();
+ }
+ else if (__this->_M_in_putback_mode) {
+ __this->_M_exit_putback_mode();
+ if (__this->gptr() != __this->egptr()) {
+ int_type __c = traits_type::to_int_type(*__this->gptr());
+ return __c;
+ }
+ }
+
+ return __this->_M_underflow_aux();
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _Underflow<wchar_t, char_traits<wchar_t> >;
+#endif
+
+//----------------------------------------------------------------------
+// Class basic_ifstream<>
+
+template <class _CharT, class _Traits>
+class basic_ifstream : public basic_istream<_CharT, _Traits> {
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_istream<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Buf;
+
+public: // Constructors, destructor.
+
+ basic_ifstream() :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ }
+
+ explicit basic_ifstream(const char* __s, ios_base::openmode __mod = ios_base::in) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0),
+ _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ explicit basic_ifstream(int __id, ios_base::openmode __mod = ios_base::in) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+ basic_ifstream(const char* __s, ios_base::openmode __m,
+ long __protection) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __m | ios_base::in, __protection))
+ this->setstate(ios_base::failbit);
+ }
+
+# if defined (_STLP_USE_WIN32_IO)
+ explicit basic_ifstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::in) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+# endif /* _STLP_USE_WIN32_IO */
+#endif
+
+ ~basic_ifstream() {}
+
+public: // File and buffer operations.
+ basic_filebuf<_CharT, _Traits>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ bool is_open() {
+ return this->rdbuf()->is_open();
+ }
+
+ void open(const char* __s, ios_base::openmode __mod = ios_base::in) {
+ if (!this->rdbuf()->open(__s, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+
+ void close() {
+ if (!this->rdbuf()->close())
+ this->setstate(ios_base::failbit);
+ }
+
+private:
+ basic_filebuf<_CharT, _Traits> _M_buf;
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_ofstream<>
+
+template <class _CharT, class _Traits>
+class basic_ofstream : public basic_ostream<_CharT, _Traits> {
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_ostream<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Buf;
+
+public: // Constructors, destructor.
+ basic_ofstream() :
+ basic_ios<_CharT, _Traits>(),
+ basic_ostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ }
+ explicit basic_ofstream(const char* __s, ios_base::openmode __mod = ios_base::out)
+ : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ explicit basic_ofstream(int __id, ios_base::openmode __mod = ios_base::out)
+ : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0),
+ _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+ basic_ofstream(const char* __s, ios_base::openmode __m, long __protection) :
+ basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __m | ios_base::out, __protection))
+ this->setstate(ios_base::failbit);
+ }
+# if defined (_STLP_USE_WIN32_IO)
+ explicit basic_ofstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::out)
+ : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0),
+ _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+# endif /* _STLP_USE_WIN32_IO */
+#endif
+
+ ~basic_ofstream() {}
+
+public: // File and buffer operations.
+ basic_filebuf<_CharT, _Traits>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ bool is_open() {
+ return this->rdbuf()->is_open();
+ }
+
+ void open(const char* __s, ios_base::openmode __mod= ios_base::out) {
+ if (!this->rdbuf()->open(__s, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+
+ void close() {
+ if (!this->rdbuf()->close())
+ this->setstate(ios_base::failbit);
+ }
+
+private:
+ basic_filebuf<_CharT, _Traits> _M_buf;
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_fstream<>
+
+template <class _CharT, class _Traits>
+class basic_fstream : public basic_iostream<_CharT, _Traits> {
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_iostream<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Buf;
+
+public: // Constructors, destructor.
+
+ basic_fstream()
+ : basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ }
+
+ explicit basic_fstream(const char* __s,
+ ios_base::openmode __mod = ios_base::in | ios_base::out) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __mod))
+ this->setstate(ios_base::failbit);
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ explicit basic_fstream(int __id,
+ ios_base::openmode __mod = ios_base::in | ios_base::out) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod))
+ this->setstate(ios_base::failbit);
+ }
+ basic_fstream(const char* __s, ios_base::openmode __m, long __protection) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __m, __protection))
+ this->setstate(ios_base::failbit);
+ }
+# if defined (_STLP_USE_WIN32_IO)
+ explicit basic_fstream(_STLP_fd __id,
+ ios_base::openmode __mod = ios_base::in | ios_base::out) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod))
+ this->setstate(ios_base::failbit);
+ }
+# endif /* _STLP_USE_WIN32_IO */
+#endif
+ ~basic_fstream() {}
+
+public: // File and buffer operations.
+
+ basic_filebuf<_CharT, _Traits>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ bool is_open() {
+ return this->rdbuf()->is_open();
+ }
+
+ void open(const char* __s,
+ ios_base::openmode __mod =
+ ios_base::in | ios_base::out) {
+ if (!this->rdbuf()->open(__s, __mod))
+ this->setstate(ios_base::failbit);
+ }
+
+ void close() {
+ if (!this->rdbuf()->close())
+ this->setstate(ios_base::failbit);
+ }
+
+private:
+ basic_filebuf<_CharT, _Traits> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_fstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_fstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_fstream.c>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_fstream<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_fstream<wchar_t, char_traits<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_FSTREAM */
+
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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>::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>::param_type _FstArgParamType;
+ typedef typename __call_traits<second_argument_type>::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<typename _Operation::first_argument_type>::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()(_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<typename _Operation::second_argument_type>::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()(_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>::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>::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:
--- /dev/null
+/*
+ *
+ * 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<const _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<const _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;
+ };
+};
+
+/*Specialization 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<const _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<const _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) {}
+};
+
+
+#endif /*_STLP_DONT_RETURN_VOID && _STLP_NO_CLASS_PARTIAL_SPECIALIZATION && _STLP_MEMBER_TEMPLATE_CLASSES*/
+
+
+#if !defined(_STLP_DONT_RETURN_VOID) || !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) || !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+
+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 specialization 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 /*_STLP_DONT_RETURN_VOID && !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION*/
+
+#else /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/
+
+//mem_fun_t
+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) {}
+};
+
+//const_mem_fun_t
+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) {}
+};
+
+//mem_fun_ref_t
+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) {}
+};
+
+//const_mem_fun_ref_t
+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) {}
+};
+
+//mem_fun1_t
+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) {}
+};
+
+//const_mem_fun1_t
+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) {}
+};
+
+//mem_fun1_ref_t
+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) {}
+};
+
+//const_mem_fun1_t
+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) {}
+};
+
+#endif /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/
+
+
+# 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 /* _STLP_NO_EXTENSIONS */
+
+# endif /* _STLP_MEMBER_POINTER_PARAM_BUG */
+
+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
--- /dev/null
+/*
+ *
+ * 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_BASE_H
+#define _STLP_INTERNAL_FUNCTION_BASE_H
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_TYPE_TRAITS_H)
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Arg, class _Result>
+struct unary_function {
+ typedef _Arg argument_type;
+ typedef _Result result_type;
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+struct binary_function {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+};
+
+template <class _Tp>
+struct equal_to : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; }
+};
+
+template <class _Tp>
+struct less : public binary_function<_Tp,_Tp,bool>
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/* less is the default template parameter for many STL containers, to fully use
+ * the move constructor feature we need to know that the default less is just a
+ * functor.
+ */
+ , public __stlport_class<less<_Tp> >
+#endif
+{
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; }
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ //This is for a very special compiler config: partial template specialization
+ //but no template function partial ordering.
+ void swap(less<_Tp>&) {}
+#endif
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<less<_Tp> > {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<less<_Tp> >::_Ret _STLportLess;
+#else
+ enum { _Is = _IsSTLportClass<less<_Tp> >::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportLess;
+#endif
+ typedef _STLportLess has_trivial_default_constructor;
+ typedef _STLportLess has_trivial_copy_constructor;
+ typedef _STLportLess has_trivial_assignment_operator;
+ typedef _STLportLess has_trivial_destructor;
+ typedef _STLportLess is_POD_type;
+};
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+less<_Tp> __less(_Tp* ) { return less<_Tp>(); }
+
+template <class _Tp>
+equal_to<_Tp> __equal_to(_Tp* ) { return equal_to<_Tp>(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp>
+struct plus : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; }
+};
+
+template <class _Tp>
+struct minus : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; }
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+plus<_Tp> __plus(_Tp* ) { return plus<_Tp>(); }
+
+template <class _Tp>
+minus<_Tp> __minus(_Tp* ) { return minus<_Tp>(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp>
+struct multiplies : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; }
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Pair>
+struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> {
+ const typename _Pair::first_type& operator()(const _Pair& __x) const {
+ return __x.first;
+ }
+};
+
+template <class _Pair>
+struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> {
+ const typename _Pair::second_type& operator()(const _Pair& __x) const {
+ return __x.second;
+ }
+};
+
+// project1st and project2nd are extensions: they are not part of the standard
+template <class _Arg1, class _Arg2>
+struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> {
+ _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; }
+};
+
+template <class _Arg1, class _Arg2>
+struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> {
+ _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; }
+};
+
+#if defined (_STLP_MULTI_CONST_TEMPLATE_ARG_BUG)
+// fbp : sort of select1st just for maps
+template <class _Pair, class _Whatever>
+// JDJ (CW Pro1 doesn't like const when first_type is also const)
+struct __Select1st_hint : public unary_function<_Pair, _Whatever> {
+ const _Whatever& operator () (const _Pair& __x) const { return __x.first; }
+};
+# define _STLP_SELECT1ST(__x,__y) _STLP_PRIV __Select1st_hint< __x, __y >
+#else
+# define _STLP_SELECT1ST(__x, __y) _STLP_PRIV _Select1st< __x >
+#endif
+
+template <class _Tp>
+struct _Identity : public unary_function<_Tp,_Tp> {
+ const _Tp& operator()(const _Tp& __x) const { return __x; }
+};
+
+template <class _Result, class _Argument>
+struct _Constant_unary_fun {
+ typedef _Argument argument_type;
+ typedef _Result result_type;
+ result_type _M_val;
+
+ _Constant_unary_fun(const result_type& __v) : _M_val(__v) {}
+ const result_type& operator()(const _Argument&) const { return _M_val; }
+};
+
+template <class _Result, class _Arg1, class _Arg2>
+struct _Constant_binary_fun {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+ _Result _M_val;
+
+ _Constant_binary_fun(const _Result& __v) : _M_val(__v) {}
+ const result_type& operator()(const _Arg1&, const _Arg2&) const {
+ return _M_val;
+ }
+};
+
+// 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); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_FUNCTION_BASE_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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 (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300)
+_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:
--- /dev/null
+/*
+ *
+ * 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(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;
+#if !defined (__DMC__)
+ typedef pair<const key_type, data_type> value_type;
+#else
+ /* DMC goes too far in template instanciation and tries to fully instanciate
+ * slist<pair<const int, string> > for instance. The generation of assignment
+ * operator fails of course so we are force to use mutable key for this compiler.
+ */
+ typedef pair<key_type, data_type> value_type;
+#endif
+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(100, 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) {}
+
+ hash_map(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {
+ }
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l)
+ : _M_ht(100, 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(100, 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(100, 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); }
+ 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(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;
+#if !defined (__DMC__)
+ typedef pair<const key_type, data_type> value_type;
+#else
+ typedef pair<key_type, data_type> value_type;
+#endif
+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(100, 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) {}
+
+ hash_multimap(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {
+ }
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l)
+ : _M_ht(100, 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(100, 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(100, 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); }
+
+ 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)
+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>
+{};
+
+// 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:
--- /dev/null
+/*
+ *
+ * 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_DEFAULT_ALLOCATOR_SELECT(_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(100, 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) {}
+
+ hash_set(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l)
+ : _M_ht(100, 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(100, 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(100, 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); }
+
+ 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_DEFAULT_ALLOCATOR_SELECT(_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(100, 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) {}
+
+ hash_multiset(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l)
+ : _M_ht(100, 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(100, 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(100, 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); }
+
+ 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)
+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>
+{};
+
+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:
--- /dev/null
+/*
+ * 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>
+size_t _STLP_CALL
+_Stl_prime<_Dummy>::_S_max_nb_buckets() {
+ const size_t _list[] = __PRIME_LIST_BODY;
+# ifndef __MWERKS__
+ return _list[(sizeof(_list)/sizeof(_list[0])) - 1];
+# else
+ return _list[30/sizeof(size_t) - 1]; // stupid MWERKS!
+# endif
+}
+
+template <class _Dummy>
+size_t _STLP_CALL
+_Stl_prime<_Dummy>::_S_next_size(size_t __n) {
+ static const size_t _list[] = __PRIME_LIST_BODY;
+ const size_t* __first = _list;
+# ifndef __MWERKS__
+ const size_t* __last = _list + (sizeof(_list)/sizeof(_list[0]));
+# else
+ const size_t* __last = _list + (30/sizeof(size_t)); // stupid MWERKS
+# endif
+ 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);
+}
+
+# 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) {
+ resize(_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>
+__reference__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::find_or_insert(const value_type& __obj) {
+ _Node* __first = _M_find(_M_get_key(__obj));
+ if (__first)
+ return __first->_M_val;
+ else
+ return _M_insert(__obj);
+}
+*/
+
+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;
+ 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]);
+
+ 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);
+ --_M_num_elements;
+ }
+ 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);
+ --_M_num_elements;
+ break;
+ }
+ }
+ }
+}
+
+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);
+ }
+ //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);
+ --_M_num_elements;
+ }
+ fill(_M_buckets.begin() + __f_bucket, _M_buckets.begin() + __l_bucket + 1, __cur._M_node);
+}
+
+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) &&
+ (max_load_factor() > load_factor()))
+ return;
+
+ //Here if max_load_factor is lower than 1.0 the resulting value might not be representable
+ //as a size_type. The result concerning the respect of the max_load_factor will then be
+ //undefined.
+ __num_buckets_hint = (max) (__num_buckets_hint, (size_type)((float)size() / max_load_factor()));
+ size_type __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>
+ ::resize(size_type __num_elements_hint) {
+ if (((float)__num_elements_hint / (float)bucket_count() <= max_load_factor()) &&
+ (max_load_factor() >= load_factor())) {
+ return;
+ }
+
+ size_type __num_buckets_hint = (size_type)((float)(max) (__num_elements_hint, size()) / max_load_factor());
+ size_type __num_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__num_buckets_hint);
+#if defined (_STLP_DEBUG)
+ _M_check();
+#endif
+ _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_rehash(size_type __num_buckets) {
+ _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:
--- /dev/null
+/*
+ *
+ * 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 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 {
+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);
+};
+
+#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 _M_bucket_allocator_type;
+ /*
+ * 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*, _M_bucket_allocator_type> _BucketVector;
+#else
+ typedef vector<_BucketType*, _M_bucket_allocator_type> _BucketVector;
+#endif
+
+ hasher _M_hash;
+ key_equal _M_equals;
+ _ExK _M_get_key;
+ _ElemsCont _M_elems;
+ _BucketVector _M_buckets;
+ size_type _M_num_elements;
+ float _M_max_load_factor;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+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 typename _Alloc_traits<_Val, _All>::allocator_type 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 _ExK& __ext,
+ const allocator_type& __a = allocator_type())
+#else
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const _ExK& __ext)
+ : _M_hash(__hf),
+ _M_equals(__eql),
+ _M_get_key(__ext),
+ _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 _ExK& __ext,
+ const allocator_type& __a)
+#endif
+ : _M_hash(__hf),
+ _M_equals(__eql),
+ _M_get_key(__ext),
+ _M_elems(__a),
+ _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)),
+ _M_num_elements(0),
+ _M_max_load_factor(1.0f)
+ { _M_initialize_buckets(__n); }
+
+#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_get_key(_ExK()),
+ _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_get_key(_ExK()),
+ _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_get_key(__ht._M_get_key),
+ _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); }
+
+ hashtable(__move_source<_Self> src)
+ : _M_hash(_STLP_PRIV _AsMoveSource(src.get()._M_hash)),
+ _M_equals(_STLP_PRIV _AsMoveSource(src.get()._M_equals)),
+ _M_get_key(_STLP_PRIV _AsMoveSource(src.get()._M_get_key)),
+ _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) {}
+
+ _Self& operator= (const _Self& __ht) {
+ if (&__ht != this) {
+ clear();
+ _M_hash = __ht._M_hash;
+ _M_equals = __ht._M_equals;
+ _M_get_key = __ht._M_get_key;
+ _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);
+ _STLP_STD::swap(_M_get_key, __ht._M_get_key);
+ _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 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;}
+
+ pair<iterator, bool> insert_unique(const value_type& __obj) {
+ resize(_M_num_elements + 1);
+ return insert_unique_noresize(__obj);
+ }
+
+ iterator insert_equal(const value_type& __obj) {
+ resize(_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 = distance(__f, __l);
+ resize(_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 = distance(__f, __l);
+ resize(_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;
+ resize(_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;
+ resize(_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 = distance(__f, __l);
+ resize(_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 = distance(__f, __l);
+ resize(_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_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_elements_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)
+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 __stlp_movable 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:
--- /dev/null
+/*
+ *
+ *
+ * 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:
--- /dev/null
+/*
+ *
+ * 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:
--- /dev/null
+/*
+ * Copyright (c) 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_IOS_C
+#define _STLP_IOS_C
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// basic_ios<>'s non-inline member functions
+
+// Public constructor, taking a streambuf.
+template <class _CharT, class _Traits>
+basic_ios<_CharT, _Traits>
+ ::basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf)
+ : ios_base(),
+ _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) {
+ basic_ios<_CharT, _Traits>::init(__streambuf);
+}
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>*
+basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf) {
+ basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf;
+ _M_streambuf = __buf;
+ this->clear();
+ return __tmp;
+}
+
+template <class _CharT, class _Traits>
+basic_ios<_CharT, _Traits>&
+basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x) {
+ _M_invoke_callbacks(erase_event);
+ _M_copy_state(__x); // Inherited from ios_base.
+ _M_fill = __x._M_fill;
+ _M_tied_ostream = __x._M_tied_ostream;
+ _M_invoke_callbacks(copyfmt_event);
+ this->_M_set_exception_mask(__x.exceptions());
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) {
+ locale __tmp = ios_base::imbue(__loc);
+ _STLP_TRY {
+ if (_M_streambuf)
+ _M_streambuf->pubimbue(__loc);
+
+ // no throwing here
+ this->_M_cached_ctype = __loc._M_get_facet(ctype<char_type>::id);
+ this->_M_cached_numpunct = __loc._M_get_facet(numpunct<char_type>::id);
+ this->_M_cached_grouping = ((numpunct<char_type>*)_M_cached_numpunct)->grouping();
+ }
+ _STLP_CATCH_ALL {
+ __tmp = ios_base::imbue(__tmp);
+ _M_handle_exception(ios_base::failbit);
+ }
+ return __tmp;
+}
+
+// Protected constructor and initialization functions. The default
+// constructor creates an uninitialized basic_ios, and init() initializes
+// all of the members to the values in Table 89 of the C++ standard.
+
+template <class _CharT, class _Traits>
+basic_ios<_CharT, _Traits>::basic_ios()
+ : ios_base(),
+ _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0)
+{}
+
+template <class _CharT, class _Traits>
+void
+basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
+{
+ this->rdbuf(__sb);
+ this->imbue(locale());
+ this->tie(0);
+ this->_M_set_exception_mask(ios_base::goodbit);
+ this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit);
+ ios_base::flags(ios_base::skipws | ios_base::dec);
+ ios_base::width(0);
+ ios_base::precision(6);
+ this->fill(widen(' '));
+ // We don't need to worry about any of the three arrays: they are
+ // initialized correctly in ios_base's constructor.
+}
+
+// This is never called except from within a catch clause.
+template <class _CharT, class _Traits>
+void basic_ios<_CharT, _Traits>::_M_handle_exception(ios_base::iostate __flag)
+{
+ this->_M_setstate_nothrow(__flag);
+ if (this->_M_get_exception_mask() & __flag)
+ _STLP_RETHROW;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_IOS_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_IOS_H
+#define _STLP_INTERNAL_IOS_H
+
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// ----------------------------------------------------------------------
+
+// Class basic_ios, a subclass of ios_base. The only important difference
+// between the two is that basic_ios is a class template, parameterized
+// by the character type. ios_base exists to factor out all of the
+// common properties that don't depend on the character type.
+
+// The second template parameter, _Traits, defaults to char_traits<_CharT>.
+// The default is declared in header <iosfwd>, and it isn't declared here
+// because C++ language rules do not allow it to be declared twice.
+
+template <class _CharT, class _Traits>
+class basic_ios : public ios_base {
+ friend class ios_base;
+public: // Synonyms for types.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+public: // Constructor, destructor.
+ explicit basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf);
+ virtual ~basic_ios() {}
+
+public: // Members from clause 27.4.4.2
+ basic_ostream<_CharT, _Traits>* tie() const {
+ return _M_tied_ostream;
+ }
+ basic_ostream<_CharT, _Traits>*
+ tie(basic_ostream<char_type, traits_type>* __new_tied_ostream) {
+ basic_ostream<char_type, traits_type>* __tmp = _M_tied_ostream;
+ _M_tied_ostream = __new_tied_ostream;
+ return __tmp;
+ }
+
+ basic_streambuf<_CharT, _Traits>* rdbuf() const
+ { return _M_streambuf; }
+
+ basic_streambuf<_CharT, _Traits>*
+ rdbuf(basic_streambuf<char_type, traits_type>*);
+
+ // Copies __x's state to *this.
+ basic_ios<_CharT, _Traits>& copyfmt(const basic_ios<_CharT, _Traits>& __x);
+
+ char_type fill() const { return _M_fill; }
+ char_type fill(char_type __fill) {
+ char_type __tmp(_M_fill);
+ _M_fill = __fill;
+ return __tmp;
+ }
+
+public: // Members from 27.4.4.3. These four functions
+ // can almost be defined in ios_base.
+
+ void clear(iostate __state = goodbit) {
+ _M_clear_nothrow(this->rdbuf() ? __state : iostate(__state|ios_base::badbit));
+ _M_check_exception_mask();
+ }
+ void setstate(iostate __state) { this->clear(rdstate() | __state); }
+
+ iostate exceptions() const { return this->_M_get_exception_mask(); }
+ void exceptions(iostate __mask) {
+ this->_M_set_exception_mask(__mask);
+ this->clear(this->rdstate());
+ }
+
+public: // Locale-related member functions.
+ locale imbue(const locale&);
+
+ inline char narrow(_CharT, char) const ;
+ inline _CharT widen(char) const;
+
+ // Helper function that makes testing for EOF more convenient.
+ static bool _STLP_CALL _S_eof(int_type __c) {
+ const int_type __eof = _Traits::eof();
+ return _Traits::eq_int_type(__c, __eof);
+ }
+
+protected:
+ basic_ios();
+
+ void init(basic_streambuf<_CharT, _Traits>* __streambuf);
+
+public:
+
+ // Helper function used in istream and ostream. It is called only from
+ // a catch clause.
+ void _M_handle_exception(ios_base::iostate __flag);
+
+private: // Data members
+ char_type _M_fill; // The fill character, used for padding.
+
+ basic_streambuf<_CharT, _Traits>* _M_streambuf;
+ basic_ostream<_CharT, _Traits>* _M_tied_ostream;
+
+};
+
+
+template <class _CharT, class _Traits>
+inline char
+basic_ios<_CharT, _Traits>::narrow(_CharT __c, char __default) const
+{ return __STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())->narrow(__c, __default); }
+
+template <class _CharT, class _Traits>
+inline _CharT
+basic_ios<_CharT, _Traits>::widen(char __c) const
+{ return __STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())->widen(__c); }
+
+# if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+_STLP_TEMPLATE_NULL
+inline char
+basic_ios<char, char_traits<char> >::narrow(char __c, char) const
+{
+ return __c;
+}
+
+_STLP_TEMPLATE_NULL
+inline char
+basic_ios<char, char_traits<char> >::widen(char __c) const
+{
+ return __c;
+}
+# endif /* _STLP_NO_METHOD_SPECIALIZATION */
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ios<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ios<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_ios.c>
+#endif
+
+#endif /* _STLP_IOS */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * Copyright (c) 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_IOS_BASE_H
+#define _STLP_IOS_BASE_H
+
+#ifndef _STLP_INTERNAL_STDEXCEPT_BASE
+# include <stl/_stdexcept_base.h>
+#endif
+
+#ifndef _STLP_UTILITY
+# include <utility>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// ----------------------------------------------------------------------
+
+// Class ios_base. This is the base class of the ios hierarchy, which
+// includes basic_istream and basic_ostream. Classes in the ios
+// hierarchy are actually quite simple: they are just glorified
+// wrapper classes. They delegate buffering and physical character
+// manipulation to the streambuf classes, and they delegate most
+// formatting tasks to a locale.
+
+class _STLP_CLASS_DECLSPEC ios_base {
+public:
+
+ class _STLP_CLASS_DECLSPEC failure : public __Named_exception {
+ public:
+ explicit failure(const string&);
+ virtual ~failure() _STLP_NOTHROW_INHERENTLY;
+ };
+
+ typedef int fmtflags;
+ typedef int iostate;
+ typedef int openmode;
+ typedef int seekdir;
+
+# ifndef _STLP_NO_ANACHRONISMS
+ typedef fmtflags fmt_flags;
+# endif
+
+ // Formatting flags.
+#if defined (_STLP_STATIC_CONST_INIT_BUG)
+ enum {
+#else
+ // boris : type for all those constants is int
+ static const int
+#endif
+ left = 0x0001,
+ right = 0x0002,
+ internal = 0x0004,
+ dec = 0x0008,
+ hex = 0x0010,
+ oct = 0x0020,
+ fixed = 0x0040,
+ scientific = 0x0080,
+ boolalpha = 0x0100,
+ showbase = 0x0200,
+ showpoint = 0x0400,
+ showpos = 0x0800,
+ skipws = 0x1000,
+ unitbuf = 0x2000,
+ uppercase = 0x4000,
+ adjustfield = left | right | internal,
+ basefield = dec | hex | oct,
+ floatfield = scientific | fixed,
+
+ // State flags.
+ goodbit = 0x00,
+ badbit = 0x01,
+ eofbit = 0x02,
+ failbit = 0x04,
+
+ // Openmode flags.
+ __default_mode = 0x0, /* implementation detail */
+ app = 0x01,
+ ate = 0x02,
+ binary = 0x04,
+ in = 0x08,
+ out = 0x10,
+ trunc = 0x20,
+
+ // Seekdir flags
+
+ beg = 0x01,
+ cur = 0x02,
+ end = 0x04
+# ifdef _STLP_STATIC_CONST_INIT_BUG
+ }
+# endif
+ ;
+
+public: // Flag-manipulation functions.
+ fmtflags flags() const { return _M_fmtflags; }
+ fmtflags flags(fmtflags __flags) {
+ fmtflags __tmp = _M_fmtflags;
+ _M_fmtflags = __flags;
+ return __tmp;
+ }
+
+ fmtflags setf(fmtflags __flag) {
+ fmtflags __tmp = _M_fmtflags;
+ _M_fmtflags |= __flag;
+ return __tmp;
+ }
+ fmtflags setf(fmtflags __flag, fmtflags __mask) {
+ fmtflags __tmp = _M_fmtflags;
+ _M_fmtflags &= ~__mask;
+ _M_fmtflags |= __flag & __mask;
+ return __tmp;
+ }
+ void unsetf(fmtflags __mask) { _M_fmtflags &= ~__mask; }
+
+ streamsize precision() const { return _M_precision; }
+ streamsize precision(streamsize __newprecision) {
+ streamsize __tmp = _M_precision;
+ _M_precision = __newprecision;
+ return __tmp;
+ }
+
+ streamsize width() const { return _M_width; }
+ streamsize width(streamsize __newwidth) {
+ streamsize __tmp = _M_width;
+ _M_width = __newwidth;
+ return __tmp;
+ }
+
+public: // Locales
+ locale imbue(const locale&);
+ locale getloc() const { return _M_locale; }
+
+public: // Auxiliary storage.
+ static int _STLP_CALL xalloc();
+ long& iword(int __index);
+ void*& pword(int __index);
+
+public: // Destructor.
+ virtual ~ios_base();
+
+public: // Callbacks.
+ enum event { erase_event, imbue_event, copyfmt_event };
+ typedef void (*event_callback)(event, ios_base&, int __index);
+ void register_callback(event_callback __fn, int __index);
+
+public: // This member function affects only
+ // the eight predefined ios objects:
+ // cin, cout, etc.
+ static bool _STLP_CALL sync_with_stdio(bool __sync = true);
+
+public: // The C++ standard requires only that these
+ // member functions be defined in basic_ios.
+ // We define them in the non-template
+ // base class to avoid code duplication.
+ operator void*() const { return !fail() ? (void*) __CONST_CAST(ios_base*,this) : (void*) 0; }
+ bool operator!() const { return fail(); }
+
+ iostate rdstate() const { return _M_iostate; }
+
+ bool good() const { return _M_iostate == 0; }
+ bool eof() const { return (_M_iostate & eofbit) != 0; }
+ bool fail() const { return (_M_iostate & (failbit | badbit)) != 0; }
+ bool bad() const { return (_M_iostate & badbit) != 0; }
+
+protected: // The functional protected interface.
+
+ // Copies the state of __x to *this. This member function makes it
+ // possible to implement basic_ios::copyfmt without having to expose
+ // ios_base's private data members. Does not copy _M_exception_mask
+ // or _M_iostate.
+ void _M_copy_state(const ios_base& __x);
+
+ void _M_setstate_nothrow(iostate __state) { _M_iostate |= __state; }
+ void _M_clear_nothrow(iostate __state) { _M_iostate = __state; }
+ iostate _M_get_exception_mask() const { return _M_exception_mask; }
+ void _M_set_exception_mask(iostate __mask) { _M_exception_mask = __mask; }
+ void _M_check_exception_mask() {
+ if (_M_iostate & _M_exception_mask)
+ _M_throw_failure();
+ }
+
+ void _M_invoke_callbacks(event);
+ void _STLP_FUNCTION_THROWS _M_throw_failure();
+
+ ios_base(); // Default constructor.
+
+protected: // Initialization of the I/O system
+ static void _STLP_CALL _S_initialize();
+ static void _STLP_CALL _S_uninitialize();
+ static bool _S_was_synced;
+
+private: // Invalidate the copy constructor and
+ // assignment operator.
+ ios_base(const ios_base&);
+ void operator=(const ios_base&);
+
+private: // Data members.
+
+ fmtflags _M_fmtflags; // Flags
+ iostate _M_iostate;
+ openmode _M_openmode;
+ seekdir _M_seekdir;
+ iostate _M_exception_mask;
+
+ streamsize _M_precision;
+ streamsize _M_width;
+
+ locale _M_locale;
+
+ pair<event_callback, int>* _M_callbacks;
+ size_t _M_num_callbacks; // Size of the callback array.
+ size_t _M_callback_index; // Index of the next available callback;
+ // initially zero.
+
+ long* _M_iwords; // Auxiliary storage. The count is zero
+ size_t _M_num_iwords; // if and only if the pointer is null.
+
+ void** _M_pwords;
+ size_t _M_num_pwords;
+
+protected:
+ // Cached copies of the curent locale's facets. Set by init() and imbue().
+ locale::facet* _M_cached_ctype;
+ locale::facet* _M_cached_numpunct;
+ string _M_cached_grouping;
+public:
+ // Equivalent to &use_facet< Facet >(getloc()), but faster.
+ const locale::facet* _M_ctype_facet() const { return _M_cached_ctype; }
+ const locale::facet* _M_numpunct_facet() const { return _M_cached_numpunct; }
+ const string& _M_grouping() const { return _M_cached_grouping; }
+public:
+
+ // ----------------------------------------------------------------------
+ // Nested initializer class. This is an implementation detail, but it's
+ // prescribed by the standard. The static initializer object (on
+ // implementations where such a thing is required) is declared in
+ // <iostream>
+
+ class _STLP_CLASS_DECLSPEC Init
+ {
+ public:
+ Init();
+ ~Init();
+ private:
+ static long _S_count;
+ friend class ios_base;
+ };
+
+ friend class Init;
+
+public:
+# ifndef _STLP_NO_ANACHRONISMS
+ // 31.6 Old iostreams members [depr.ios.members]
+ typedef iostate io_state;
+ typedef openmode open_mode;
+ typedef seekdir seek_dir;
+ typedef _STLP_STD::streamoff streamoff;
+ typedef _STLP_STD::streampos streampos;
+# endif
+};
+
+// ----------------------------------------------------------------------
+// ios_base manipulator functions, from section 27.4.5 of the C++ standard.
+// All of them are trivial one-line wrapper functions.
+
+// fmtflag manipulators, section 27.4.5.1
+inline ios_base& _STLP_CALL boolalpha(ios_base& __s)
+ { __s.setf(ios_base::boolalpha); return __s;}
+
+inline ios_base& _STLP_CALL noboolalpha(ios_base& __s)
+ { __s.unsetf(ios_base::boolalpha); return __s;}
+
+inline ios_base& _STLP_CALL showbase(ios_base& __s)
+ { __s.setf(ios_base::showbase); return __s;}
+
+inline ios_base& _STLP_CALL noshowbase(ios_base& __s)
+ { __s.unsetf(ios_base::showbase); return __s;}
+
+inline ios_base& _STLP_CALL showpoint(ios_base& __s)
+ { __s.setf(ios_base::showpoint); return __s;}
+
+inline ios_base& _STLP_CALL noshowpoint(ios_base& __s)
+ { __s.unsetf(ios_base::showpoint); return __s;}
+
+inline ios_base& _STLP_CALL showpos(ios_base& __s)
+ { __s.setf(ios_base::showpos); return __s;}
+
+inline ios_base& _STLP_CALL noshowpos(ios_base& __s)
+ { __s.unsetf(ios_base::showpos); return __s;}
+
+inline ios_base& _STLP_CALL skipws(ios_base& __s)
+ { __s.setf(ios_base::skipws); return __s;}
+
+inline ios_base& _STLP_CALL noskipws(ios_base& __s)
+ { __s.unsetf(ios_base::skipws); return __s;}
+
+inline ios_base& _STLP_CALL uppercase(ios_base& __s)
+ { __s.setf(ios_base::uppercase); return __s;}
+
+inline ios_base& _STLP_CALL nouppercase(ios_base& __s)
+ { __s.unsetf(ios_base::uppercase); return __s;}
+
+inline ios_base& _STLP_CALL unitbuf(ios_base& __s)
+ { __s.setf(ios_base::unitbuf); return __s;}
+
+inline ios_base& _STLP_CALL nounitbuf(ios_base& __s)
+ { __s.unsetf(ios_base::unitbuf); return __s;}
+
+
+// adjustfield manipulators, section 27.4.5.2
+inline ios_base& _STLP_CALL internal(ios_base& __s)
+ { __s.setf(ios_base::internal, ios_base::adjustfield); return __s; }
+
+inline ios_base& _STLP_CALL left(ios_base& __s)
+ { __s.setf(ios_base::left, ios_base::adjustfield); return __s; }
+
+inline ios_base& _STLP_CALL right(ios_base& __s)
+ { __s.setf(ios_base::right, ios_base::adjustfield); return __s; }
+
+// basefield manipulators, section 27.4.5.3
+inline ios_base& _STLP_CALL dec(ios_base& __s)
+ { __s.setf(ios_base::dec, ios_base::basefield); return __s; }
+
+inline ios_base& _STLP_CALL hex(ios_base& __s)
+ { __s.setf(ios_base::hex, ios_base::basefield); return __s; }
+
+inline ios_base& _STLP_CALL oct(ios_base& __s)
+ { __s.setf(ios_base::oct, ios_base::basefield); return __s; }
+
+
+// floatfield manipulators, section 27.4.5.3
+inline ios_base& _STLP_CALL fixed(ios_base& __s)
+ { __s.setf(ios_base::fixed, ios_base::floatfield); return __s; }
+
+inline ios_base& _STLP_CALL scientific(ios_base& __s)
+ { __s.setf(ios_base::scientific, ios_base::floatfield); return __s; }
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_IOS_BASE */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * This file is included in every header that needs the STLport library to be
+ * built; the header files mostly are the iostreams-headers. The file checks for
+ * _STLP_USE_NO_IOSTREAMS or _STLP_NO_IOSTREAMS being not defined, so that the
+ * iostreams part of STLport cannot be used when the symbols were defined
+ * accidentally.
+ */
+#if defined (_STLP_NO_IOSTREAMS)
+# error STLport iostreams header cannot be used; you chose not to use iostreams in the STLport configuration file (stlport/stl/config/user_config.h).
+#elif defined (_STLP_USE_NO_IOSTREAMS )
+# error STLport iostreams header cannot be used; your compiler do not support it.
+#endif
--- /dev/null
+#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;
+#if defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)
+template <class _Facet>
+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
+template <class _Facet> 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:
--- /dev/null
+/*
+ * Copyright (c) 2004
+ * 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 is an internal string for the STLport own iostream implementation.
+ * The only diference rely on the allocator used to instanciate the basic_string.
+ * Its goals is to improve performance limitating the number of dynamic allocation
+ * that could occur when requesting a big float ouput for instance. This allocator
+ * is not standard conformant as it has an internal state (the static buffer)
+ */
+
+
+#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
+#define _STLP_INTERNAL_IOSTREAM_STRING_H
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif /* _STLP_INTERNAL_ALLOC_H */
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif /* _STLP_INTERNAL_STRING_H */
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT>
+class __iostring_allocator : public allocator<_CharT> {
+public:
+ enum { _STR_SIZE = 256 };
+
+private:
+ enum { _BUF_SIZE = _STR_SIZE + 1 };
+ typedef allocator<_CharT> _Base;
+ _CharT _M_static_buf[_BUF_SIZE];
+
+public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::pointer pointer;
+#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+# if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1300)
+ typedef __iostring_allocator<_Tp1> other;
+# else
+ typedef _STLP_PRIV __iostring_allocator<_Tp1> other;
+# endif
+ };
+#endif
+
+ _CharT* allocate(size_type __n, const void* __ptr = 0) {
+ if (__n > _BUF_SIZE) {
+ return _Base::allocate(__n, __ptr);
+ }
+ return _M_static_buf;
+ }
+ void deallocate(pointer __p, size_type __n) {
+ if (__p != _M_static_buf) _Base::deallocate(__p, __n);
+ }
+};
+
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) || !defined (_STLP_MEMBER_TEMPLATES)
+/*
+ * As the __iostring_allocator allocator will only be used in the basic_string implementation
+ * we known that it is never going to be bound to another type that the one used to instantiate
+ * the basic_string. This is why the associated __stl_alloc_rebind has only one template
+ * parameter.
+ */
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp>
+inline _STLP_PRIV __iostring_allocator<_Tp>& _STLP_CALL
+__stl_alloc_rebind(_STLP_PRIV __iostring_allocator<_Tp>& __a, const _Tp*)
+{ return __a; }
+template <class _Tp>
+inline _STLP_PRIV __iostring_allocator<_Tp> _STLP_CALL
+__stl_alloc_create(const _STLP_PRIV __iostring_allocator<_Tp>&, const _Tp*)
+{ return _STLP_PRIV __iostring_allocator<_Tp>(); }
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
+
+#if !defined (_STLP_DEBUG)
+template <class _CharT>
+struct __basic_iostring : public basic_string<_CharT, char_traits<_CharT>, __iostring_allocator<_CharT> > {
+ /*
+ * A consequence of the non standard conformant allocator is that a string using it
+ * must always be presized to the allocator static buffer size because the basic_string implementation
+ * do not manage an allocator returning always the same memory adress as long as the
+ * requested memory block size is under a certain value.
+ */
+ typedef __basic_iostring<_CharT> _Self;
+ typedef basic_string<_CharT, char_traits<_CharT>, __iostring_allocator<_CharT> > _Base;
+ typedef typename _Base::_Reserve_t _Reserve_t;
+
+ __basic_iostring() : _Base(_Reserve_t(), __iostring_allocator<_CharT>::_STR_SIZE)
+ {}
+
+ _Self& operator=(const _CharT* __s) {
+ _Base::operator=(__s);
+ return *this;
+ }
+};
+
+typedef __basic_iostring<char> __iostring;
+
+# if !defined (_STLP_NO_WCHAR_T)
+typedef __basic_iostring<wchar_t> __iowstring;
+# endif
+
+# define _STLP_BASIC_IOSTRING(_CharT) _STLP_PRIV __basic_iostring<_CharT>
+
+#else
+
+typedef string __iostring;
+# if !defined (_STLP_NO_WCHAR_T)
+typedef wstring __iowstring;
+# endif
+
+# define _STLP_BASIC_IOSTRING(_CharT) basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
+
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_IOSTREAM_STRING_H */
--- /dev/null
+/*
+ * Copyright (c) 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_ISTREAM_C
+#define _STLP_ISTREAM_C
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+// no wchar_t is supported for this mode
+# define __BIS_int_type__ int
+# define __BIS_pos_type__ streampos
+# define __BIS_off_type__ streamoff
+#else
+# define __BIS_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::int_type
+# define __BIS_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::pos_type
+# define __BIS_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::off_type
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Function object structs used by some member functions.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Traits>
+struct _Is_not_wspace {
+ typedef typename _Traits::char_type argument_type;
+ typedef bool result_type;
+
+ const ctype<argument_type>* _M_ctype;
+
+ _Is_not_wspace(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
+ bool operator()(argument_type __c) const
+ { return !_M_ctype->is(ctype_base::space, __c); }
+};
+
+template <class _Traits>
+struct _Is_wspace_null {
+ typedef typename _Traits::char_type argument_type;
+ typedef bool result_type;
+
+ const ctype<argument_type>* _M_ctype;
+
+ _Is_wspace_null(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
+ bool operator()(argument_type __c) const {
+ return _Traits::eq(__c, argument_type()) ||
+ _M_ctype->is(ctype_base::space, __c);
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_wspace {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ const ctype<char_type>* _M_ctype;
+
+ _Scan_for_wspace(const ctype<char_type>* __ctype) : _M_ctype(__ctype) {}
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return _M_ctype->scan_is(ctype_base::space, __first, __last);
+ }
+};
+
+template <class _Traits>
+struct _Scan_wspace_null {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ const ctype<char_type>* _M_ctype;
+
+ _Scan_wspace_null(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ __last = find_if(__first, __last,
+ _Eq_char_bound<_Traits>(char_type()));
+ return _M_ctype->scan_is(ctype_base::space, __first, __last);
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_not_wspace {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ const ctype<char_type>* _M_ctype;
+
+ _Scan_for_not_wspace(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return _M_ctype->scan_not(ctype_base::space, __first, __last);
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_char_val {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ char_type _M_val;
+
+ _Scan_for_char_val(char_type __val) : _M_val(__val) {}
+
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return find_if(__first, __last, _Eq_char_bound<_Traits>(_M_val));
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_int_val {
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ int_type _M_val;
+
+ _Scan_for_int_val(int_type __val) : _M_val(__val) {}
+
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return find_if(__first, __last,
+ _Eq_int_bound<_Traits>(_M_val));
+ }
+};
+
+// Helper function: try to push back a character to a streambuf,
+// return true if the pushback succeeded. Does not throw.
+
+template <class _CharT, class _Traits>
+bool _STLP_CALL
+__pushback(basic_streambuf<_CharT, _Traits>* __buf, _CharT __c) {
+ bool ret;
+ _STLP_TRY {
+ const typename _Traits::int_type __eof = _Traits::eof();
+ ret = !_Traits::eq_int_type(__buf->sputbackc(__c), __eof);
+ }
+ _STLP_CATCH_ALL {
+ ret = false;
+ }
+ return ret;
+}
+
+//----------------------------------------------------------------------
+// Definitions of basic_istream<>'s noninline member functions.
+
+// Helper function for formatted input of numbers.
+template <class _CharT, class _Traits, class _Number>
+ios_base::iostate _STLP_CALL
+__get_num(basic_istream<_CharT, _Traits>& __that, _Number& __val) {
+ typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
+ ios_base::iostate __err = 0;
+ _Sentry __sentry( __that ); // Skip whitespace.
+ if (__sentry) {
+ typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > _Num_get;
+ _STLP_TRY {
+ ((const _Num_get&)use_facet<_Num_get>(__that.getloc())).get(istreambuf_iterator<_CharT, _Traits>(__that.rdbuf()),
+ 0, __that, __err, __val);
+ }
+ _STLP_CATCH_ALL {
+ __that._M_handle_exception(ios_base::badbit);
+ }
+ if (__err) __that.setstate(__err);
+ }
+ return __err;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (short& __val) {
+ long __lval;
+ _STLP_PRIV __get_num(*this, __lval);
+ if ( this->fail() ) {
+ return *this;
+ }
+ short __tmp = __STATIC_CAST(short, __lval);
+ unsigned short __uval = __STATIC_CAST(unsigned short, __lval);
+ // check if we lose digits
+ // if ((__val != __lval) && ((unsigned short)__val != __lval))
+ if ((__tmp != __lval) && ((long)__uval != __lval))
+ this->setstate(ios_base::failbit);
+ else
+ __val = __tmp;
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (int& __val) {
+ long __lval;
+ _STLP_PRIV __get_num(*this, __lval);
+ if ( this->fail() ) {
+ return *this;
+ }
+ int __tmp = __lval;
+ unsigned int __uval = __lval;
+ // check if we lose digits
+ // if ((__val != __lval) && ((unsigned int)__val != __lval))
+ if ((__tmp != __lval) && ((long)__uval != __lval))
+ this->setstate(ios_base::failbit);
+ else
+ __val = __tmp;
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned short& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned int& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned long& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+#if defined (_STLP_LONG_LONG)
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (_STLP_LONG_LONG& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned _STLP_LONG_LONG& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#endif
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (float& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (double& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#if !defined (_STLP_NO_LONG_DOUBLE)
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long double& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#endif
+#if !defined (_STLP_NO_BOOL)
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (bool& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#endif
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (void*& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+// Unformatted input
+
+template <class _CharT, class _Traits>
+__BIS_int_type__
+basic_istream<_CharT, _Traits>::peek() {
+ typename _Traits::int_type __tmp = _Traits::eof();
+
+ this->_M_gcount = 0;
+ sentry __sentry(*this, _No_Skip_WS());
+
+ if (__sentry) {
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sgetc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ if (this->_S_eof(__tmp))
+ this->setstate(ios_base::eofbit);
+ }
+
+ return __tmp;
+}
+
+
+template <class _CharT, class _Traits>
+__BIS_int_type__
+basic_istream<_CharT, _Traits>::get() {
+ typename _Traits::int_type __tmp = _Traits::eof();
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (!this->_S_eof(__tmp))
+ this->_M_gcount = 1;
+ }
+
+ if (_M_gcount == 0)
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return __tmp;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::get(_CharT& __c) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ typename _Traits::int_type __tmp = _Traits::eof();
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (!this->_S_eof(__tmp)) {
+ this->_M_gcount = 1;
+ __c = _Traits::to_char_type(__tmp);
+ }
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return *this;
+}
+
+
+// Read characters and discard them. The standard specifies a single
+// function with two arguments, each with a default. We instead use
+// three overloded functions, because it's possible to implement the
+// first two more efficiently than the fully general third version.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore() {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ int_type __c;
+ _STLP_TRY {
+ __c = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ return *this;
+ }
+
+ if (!this->_S_eof(__c))
+ this->_M_gcount = 1;
+ else
+ this->setstate(ios_base::eofbit);
+ }
+
+ return *this;
+}
+
+// Putback
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::putback(_CharT __c) {
+ this->_M_gcount = 0;
+ sentry __sentry(*this, _No_Skip_WS());
+
+ if (__sentry) {
+ typename _Traits::int_type __tmp = _Traits::eof();
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+// if (!__buf || this->_S_eof(__buf->sputbackc(__c)))
+ if (__buf) {
+ _STLP_TRY {
+ __tmp = __buf->sputbackc(__c);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ }
+ if (this->_S_eof(__tmp))
+ this->setstate(ios_base::badbit);
+ }
+ else
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() {
+ this->_M_gcount = 0;
+
+ sentry __sentry(*this, _No_Skip_WS());
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ // if (!__buf || _Traits::eq_int_type(__buf->sungetc(), _Traits::eof()))
+ if (__buf) {
+ _STLP_TRY {
+ if (this->_S_eof(__buf->sungetc()))
+ this->setstate(ios_base::badbit);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ } else
+ this->setstate(ios_base::badbit);
+ }
+ else
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Positioning and buffer control.
+
+template <class _CharT, class _Traits>
+int basic_istream<_CharT, _Traits>::sync() {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (__buf) {
+ if (__buf->pubsync() == -1) {
+ this->setstate(ios_base::badbit);
+ return -1;
+ }
+ else
+ return 0;
+ }
+ else
+ return -1;
+}
+
+template <class _CharT, class _Traits>
+__BIS_pos_type__
+basic_istream<_CharT, _Traits>::tellg() {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ return (__buf && !this->fail()) ? __buf->pubseekoff(0, ios_base::cur, ios_base::in)
+ : pos_type(-1);
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::seekg(pos_type __pos) {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (!this->fail() && __buf) {
+ if (__buf->pubseekpos(__pos) == pos_type(-1)) {
+ this->setstate(ios_base::failbit);
+ }
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (!this->fail() && __buf)
+ __buf->pubseekoff(__off, __dir);
+ return *this;
+}
+
+// Formatted input of characters and character arrays.
+
+template <class _CharT, class _Traits>
+void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT& __c) {
+// typename _Traits::int_type __tmp = _Traits::eof();
+
+ sentry __sentry(*this); // Skip whitespace.
+
+ if (__sentry) {
+ typename _Traits::int_type __tmp;// = _Traits::eof();
+
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ return;
+ }
+
+ if (!this->_S_eof(__tmp))
+ __c = _Traits::to_char_type(__tmp);
+ else
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ }
+}
+
+
+//---------------------------------------------------------------------------
+// istream's helper functions.
+
+// A generic function for unbuffered input. We stop when we reach EOF,
+// or when we have extracted _Num characters, or when the function object
+// __is_delim return true. In the last case, it extracts the character
+// for which __is_delim is true, if and only if __extract_delim is true.
+// It appends a null character to the end of the string; this means that
+// it may store up to _Num + 1 characters.
+//
+// __is_getline governs two corner cases: reading _Num characters without
+// encountering delim or eof (in which case failbit is set if __is_getline
+// is true); and reading _Num characters where the _Num+1'st character is
+// eof (in which case eofbit is set if __is_getline is true).
+//
+// It is assumed that __is_delim never throws.
+//
+// Return value is the number of characters extracted, including the
+// delimiter if it is extracted. Note that the number of characaters
+// extracted isn't necessarily the same as the number stored.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template < class _CharT, class _Traits, class _Is_Delim>
+streamsize _STLP_CALL
+__read_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num, _CharT* __s,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __append_null,
+ bool __is_getline) {
+ streamsize __n = 0;
+ ios_base::iostate __status = 0;
+
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+ // The operations that can potentially throw are sbumpc, snextc, and sgetc.
+ _STLP_TRY {
+ for (;;) {
+ int_type __c = __buf->sbumpc(); // sschwarz
+
+ if (__that->_S_eof(__c)) {
+ if (__n < _Num || __is_getline)
+ __status |= ios_base::eofbit;
+ break;
+ }
+ else if (__is_delim(_Traits::to_char_type(__c))) {
+ if (__extract_delim) { // Extract and discard current character.
+ ++__n;
+ } else if ( !__pushback(__buf, _Traits::to_char_type(__c)) ) { // leave delimiter
+ __status |= ios_base::failbit;
+ }
+ break;
+ }
+ else { // regular character
+ *__s++ = _Traits::to_char_type(__c);
+ ++__n;
+ }
+
+ if (__n == _Num) {
+ if (__is_getline) // didn't find delimiter as one of the _Num chars
+ __status |= ios_base::failbit;
+ break;
+ }
+ }
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ return __n;
+ }
+
+ if (__append_null)
+ *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ if (__status)
+ __that->setstate(__status); // This might throw.
+ return __n;
+}
+
+// Much like __read_unbuffered, but with one additional function object:
+// __scan_delim(first, last) returns the first pointer p in [first, last)
+// such that __is_delim(p) is true.
+
+template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
+streamsize _STLP_CALL
+__read_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num, _CharT* __s,
+ _Is_Delim __is_delim, _Scan_Delim __scan_delim,
+ bool __extract_delim, bool __append_null,
+ bool __is_getline) {
+ streamsize __n = 0;
+ ios_base::iostate __status = 0;
+ bool __done = false;
+
+ _STLP_TRY {
+ while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
+ const _CharT* __first = __buf->_M_gptr();
+ const _CharT* __last = __buf->_M_egptr();
+ //casting numeric_limits<ptrdiff_t>::max to streamsize only works is ptrdiff_t is signed or streamsize representation
+ //is larger than ptrdiff_t one.
+ _STLP_STATIC_ASSERT(((sizeof(streamsize) > sizeof(ptrdiff_t)) ||
+ (sizeof(streamsize) == sizeof(ptrdiff_t))) && numeric_limits<ptrdiff_t>::is_signed)
+ ptrdiff_t __request = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()), _Num - __n));
+
+ const _CharT* __p = __scan_delim(__first, __last);
+ ptrdiff_t __chunk = (min) (ptrdiff_t(__p - __first), __request);
+ _Traits::copy(__s, __first, __chunk);
+ __s += __chunk;
+ __n += __chunk;
+ __buf->_M_gbump((int)__chunk);
+
+ // We terminated by finding delim.
+ if (__p != __last && __p - __first <= __request) {
+ if (__extract_delim) {
+ __n += 1;
+ __buf->_M_gbump(1);
+ }
+ __done = true;
+ }
+
+ // We terminated by reading all the characters we were asked for.
+ else if (__n == _Num) {
+
+ // Find out if we have reached eof. This matters for getline.
+ if (__is_getline) {
+ if (__chunk == __last - __first) {
+ if (__that->_S_eof(__buf->sgetc()))
+ __status |= ios_base::eofbit;
+ }
+ else
+ __status |= ios_base::failbit;
+ }
+ __done = true;
+ }
+
+ // The buffer contained fewer than _Num - __n characters. Either we're
+ // at eof, or we should refill the buffer and try again.
+ else {
+ if (__that->_S_eof(__buf->sgetc())) {
+ __status |= ios_base::eofbit;
+ __done = true;
+ }
+ }
+ } // Close the while loop.
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ __done = true;
+ }
+
+ if (__done) {
+ if (__append_null)
+ *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ if (__status != 0)
+ __that->setstate(__status); // This might throw.
+ return __n;
+ }
+
+ // If execution has reached this point, then we have an empty buffer but
+ // we have not reached eof. What that means is that the streambuf has
+ // decided to switch from buffered to unbuffered input. We switch to
+ // to __read_unbuffered.
+
+ return __n + __read_unbuffered(__that, __buf, _Num - __n, __s, __is_delim,
+ __extract_delim,__append_null,__is_getline);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::get(_CharT* __s, streamsize __n,
+ _CharT __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ if (__n > 0) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+
+ if (__buf->egptr() != __buf->gptr())
+ this->_M_gcount =
+ _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
+ false, true, false);
+ else
+ this->_M_gcount =
+ _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ false, true, false);
+ }
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Getline is essentially identical to get, except that it extracts
+// the delimiter.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::getline(_CharT* __s, streamsize __n,
+ _CharT __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ if (__n > 0) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ this->_M_gcount = __buf->egptr() != __buf->gptr()
+ ? _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
+ true, true, true)
+ : _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ true, true, true);
+ }
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Read n characters. We don't look for any delimiter, and we don't
+// put in a terminating null character.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry && !this->eof()) {
+ basic_streambuf<_CharT, _Traits>*__buf = this->rdbuf();
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount
+ = _STLP_PRIV __read_buffered(this, __buf, __n, __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false, false);
+ else
+ _M_gcount
+ = _STLP_PRIV __read_unbuffered(this, __buf, __n, __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, false, false);
+ }
+ else
+ this->setstate(ios_base::failbit);
+
+ if (this->eof())
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return *this;
+}
+
+
+// Read n or fewer characters. We don't look for any delimiter, and
+// we don't put in a terminating null character.
+template <class _CharT, class _Traits>
+streamsize
+basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __nmax) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry && !this->eof() && __nmax >= 0) {
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ streamsize __avail = __buf->in_avail();
+
+ // fbp : isn't full-blown setstate required here ?
+ if (__avail == -1)
+ this->_M_setstate_nothrow(ios_base::eofbit);
+
+ else if (__avail != 0) {
+
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount
+ = _STLP_PRIV __read_buffered(this, __buf, (min) (__avail, __nmax), __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false, false);
+ else
+ _M_gcount
+ = _STLP_PRIV __read_unbuffered(this, __buf, (min) (__avail, __nmax), __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, false, false);
+ }
+ }
+ else {
+ // fbp : changed so that failbit is set only there, to pass Dietmar's test
+ if (this->eof())
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ else
+ this->setstate(ios_base::failbit);
+ }
+
+ // if (this->eof())
+ // this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return _M_gcount;
+}
+
+template <class _CharT, class _Traits>
+void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT* __s) {
+ sentry __sentry(*this); // Skip whitespace.
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ streamsize __nmax = this->width() > 0
+ ? this->width() - 1
+ : ((numeric_limits<streamsize>::max)() / sizeof(_CharT)) - 1;
+
+ streamsize __n = __buf->gptr() != __buf->egptr()
+ ? _STLP_PRIV __read_buffered(this, __buf, __nmax, __s,
+ _STLP_PRIV _Is_wspace_null<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
+ _STLP_PRIV _Scan_wspace_null<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
+ false, true, false)
+ : _STLP_PRIV __read_unbuffered(this, __buf, __nmax, __s,
+ _STLP_PRIV _Is_wspace_null<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
+ false, true, false);
+ if (__n == 0)
+ this->setstate(ios_base::failbit);
+ }
+ this->width(0);
+}
+
+// A generic unbuffered function for ignoring characters. We stop
+// when we reach EOF, or when the function object __is_delim returns
+// true. In the last case, it extracts the character for which
+// __is_delim is true, if and only if __extract_delim is true.
+
+template < class _CharT, class _Traits, class _Is_Delim>
+void _STLP_CALL
+_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __set_failbit) {
+ bool __done = false;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+
+ _STLP_TRY {
+ while (!__done) {
+ int_type __c = __buf->sbumpc();
+
+ if (__that->_S_eof(__c)) {
+ __done = true;
+ __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit;
+ }
+
+ else if (__is_delim(_Traits::to_char_type(__c))) {
+ __done = true;
+ if (!__extract_delim)
+ if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
+ __status |= ios_base::failbit;
+ }
+ }
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ }
+
+ __that->setstate(__status);
+}
+
+// A generic buffered function for ignoring characters. Much like
+// _M_ignore_unbuffered, but with one additional function object:
+// __scan_delim(first, last) returns the first pointer p in [first,
+// last) such that __is_delim(p) is true.
+
+template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
+void _STLP_CALL
+_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ _Is_Delim __is_delim, _Scan_Delim __scan_delim,
+ bool __extract_delim, bool __set_failbit) {
+ bool __at_eof = false;
+ bool __found_delim = false;
+
+ _STLP_TRY {
+ while (__buf->_M_egptr() != __buf->_M_gptr() && !__at_eof && !__found_delim) {
+ const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
+ __buf->_M_gbump((int)(__p - __buf->_M_gptr()));
+
+ if (__p != __buf->_M_egptr()) { // We found delim, so we're done.
+ if (__extract_delim)
+ __buf->_M_gbump(1);
+ __found_delim = true;
+ }
+
+ else // No delim. Try to refil the buffer.
+ __at_eof = __that->_S_eof(__buf->sgetc());
+ } // Close the while loop.
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ return;
+ }
+
+ if (__at_eof) {
+ __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit);
+ return;
+ }
+ if (__found_delim)
+ return;
+
+ // If execution has reached this point, then we have an empty buffer but
+ // we have not reached eof. What that means is that the streambuf has
+ // decided to switch from a buffered to an unbuffered mode. We switch
+ // to _M_ignore_unbuffered.
+ _M_ignore_unbuffered(__that, __buf, __is_delim, __extract_delim, __set_failbit);
+}
+
+// Overloaded versions of _M_ignore_unbuffered and _M_ignore_unbuffered
+// with an explicit count _Num. Return value is the number of
+// characters extracted.
+//
+// The function object __max_chars takes two arguments, _Num and __n
+// (the latter being the number of characters we have already read),
+// and returns the maximum number of characters to read from the buffer.
+// We parameterize _M_ignore_buffered so that we can use it for both
+// bounded and unbounded input; for the former the function object should
+// be minus<>, and for the latter it should return a constant maximum value.
+
+template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim>
+streamsize _STLP_CALL
+_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num, _Max_Chars __max_chars,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __set_failbit) {
+ streamsize __n = 0;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+
+ _STLP_TRY {
+ while (__max_chars(_Num, __n) > 0) {
+ int_type __c = __buf->sbumpc();
+
+ if (__that->_S_eof(__c)) {
+ __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit;
+ break;
+ }
+
+ else if (__is_delim(_Traits::to_char_type(__c))) {
+ if (__extract_delim)
+ ++__n;
+ else if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
+ __status |= ios_base::failbit;
+
+ break;
+ }
+ // fbp : added counter increment to pass Dietmar's test
+ ++__n;
+ }
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__status)
+ __that->setstate(__status); // This might throw.
+ return __n;
+}
+
+template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim, class _Scan_Delim>
+streamsize _STLP_CALL
+_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num,
+ _Max_Chars __max_chars,
+ _Is_Delim __is_delim, _Scan_Delim __scan_delim,
+ bool __extract_delim, bool __set_failbit) {
+ streamsize __n = 0;
+ bool __at_eof = false;
+ bool __done = false;
+
+ _STLP_TRY {
+ while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
+ ptrdiff_t __avail = __buf->_M_egptr() - __buf->_M_gptr();
+ streamsize __m = __max_chars(_Num, __n);
+
+ if (__avail >= __m) { // We have more characters than we need.
+ const _CharT* __last = __buf->_M_gptr() + __STATIC_CAST(ptrdiff_t, __m);
+ const _CharT* __p = __scan_delim(__buf->_M_gptr(), __last);
+ ptrdiff_t __chunk = __p - __buf->_M_gptr();
+ __n += __chunk;
+ __buf->_M_gbump((int)__chunk);
+
+ if (__extract_delim && __p != __last) {
+ __n += 1;
+ __buf->_M_gbump(1);
+ }
+
+ __done = true;
+ }
+
+ else {
+ const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
+ ptrdiff_t __chunk = __p - __buf->_M_gptr();
+ __n += __chunk;
+ __buf->_M_gbump((int)__chunk);
+
+ if (__p != __buf->_M_egptr()) { // We found delim.
+ if (__extract_delim) {
+ __n += 1;
+ __buf->_M_gbump(1);
+ }
+
+ __done = true;
+ }
+
+ // We didn't find delim. Try to refill the buffer.
+ else if (__that->_S_eof(__buf->sgetc())) {
+ __done = true;
+ __at_eof = true;
+ }
+ }
+ } // Close the while loop.
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ return __n;
+ }
+
+ if (__at_eof)
+ __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit);
+
+ if (__done)
+ return __n;
+
+ // If execution has reached this point, then we have an empty buffer but
+ // we have not reached eof. What that means is that the streambuf has
+ // decided to switch from buffered to unbuffered input. We switch to
+ // to _M_ignore_unbuffered.
+
+ return __n + _M_ignore_unbuffered(__that, __buf, _Num, __max_chars,
+ __is_delim, __extract_delim, __set_failbit);
+}
+
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::ignore(streamsize __n) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ typedef _STLP_PRIV _Constant_unary_fun<bool, int_type> _Const_bool;
+ typedef _STLP_PRIV _Constant_binary_fun<streamsize, streamsize, streamsize> _Const_streamsize;
+ const streamsize __maxss = (numeric_limits<streamsize>::max)();
+
+ if (__n == (numeric_limits<int>::max)()) {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _Const_bool(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _Const_bool(false), false, false);
+ }
+ else {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __n, minus<streamsize>(),
+ _Const_bool(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
+ _Const_bool(false), false, false);
+ }
+ }
+
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ typedef _STLP_PRIV _Constant_unary_fun<bool, int_type> _Const_bool;
+ typedef _STLP_PRIV _Constant_binary_fun<streamsize, streamsize, streamsize>
+ _Const_streamsize;
+ const streamsize __maxss = (numeric_limits<streamsize>::max)();
+
+ if (__n == (numeric_limits<int>::max)()) {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_int_val<_Traits>(__delim),
+ true, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ true, false);
+ }
+ else {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __n, minus<streamsize>(),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_int_val<_Traits>(__delim),
+ true, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ true, false);
+ }
+ }
+
+ return *this;
+}
+
+// This member function does not construct a sentry object, because
+// it is called from sentry's constructor.
+template <class _CharT, class _Traits>
+void basic_istream<_CharT, _Traits>::_M_skip_whitespace(bool __set_failbit) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (!__buf)
+ this->setstate(ios_base::badbit);
+ else if (__buf->gptr() != __buf->egptr())
+ _M_ignore_buffered(this, __buf,
+ _STLP_PRIV _Is_not_wspace<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
+ _STLP_PRIV _Scan_for_not_wspace<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
+ false, __set_failbit);
+ else
+ _M_ignore_unbuffered(this, __buf,
+ _STLP_PRIV _Is_not_wspace<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
+ false, __set_failbit);
+}
+
+
+// This is a very simple loop that reads characters from __src and puts
+// them into __dest. It looks complicated because of the (standard-
+// mandated) exception handling policy.
+//
+// We stop when we get an exception, when we fail to insert into the
+// output streambuf, or when __is_delim is true.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template < class _CharT, class _Traits, class _Is_Delim>
+streamsize _STLP_CALL
+__copy_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
+ basic_streambuf<_CharT, _Traits>* __dest,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __rethrow) {
+ streamsize __extracted = 0;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+ int_type __c;
+
+ _STLP_TRY {
+ for (;;) {
+ // Get a character. If there's an exception, catch and (maybe) rethrow it.
+ __c = __src->sbumpc();
+
+ // If we failed to get a character, then quit.
+ if (__that->_S_eof(__c)) {
+ __status |= ios_base::eofbit;
+ break;
+ }
+ // If it's the delimiter, then quit.
+ else if (__is_delim(_Traits::to_char_type(__c))) {
+ if (!__extract_delim && !__pushback(__src, _Traits::to_char_type(__c)))
+ __status |= ios_base::failbit;
+ break;
+ }
+ else {
+ // Try to put the character in the output streambuf.
+ bool __failed = false;
+ _STLP_TRY {
+ if (!__that->_S_eof(__dest->sputc(_Traits::to_char_type(__c))))
+ ++__extracted;
+ else
+ __failed = true;
+ }
+ _STLP_CATCH_ALL {
+ __failed = true;
+ }
+
+ // If we failed to put the character in the output streambuf, then
+ // try to push it back to the input streambuf.
+ if (__failed && !__pushback(__src, _Traits::to_char_type(__c)))
+ __status |= ios_base::failbit;
+
+ // fbp : avoiding infinite loop in io-27-6-1-2-3.exp
+ if (__failed)
+ break;
+ }
+
+ } /* for (;;) */
+
+ }
+ // fbp : this try/catch moved here in reasonable assumption
+ // __is_delim never throw (__pushback is guaranteed not to)
+ _STLP_CATCH_ALL {
+ // See 27.6.1.2.3, paragraph 13.
+ if (__rethrow && __extracted == 0)
+ __that->_M_handle_exception(ios_base::failbit);
+ }
+ __that->setstate(__status);
+ return __extracted;
+}
+
+// Buffered copying from one streambuf to another. We copy the characters
+// in chunks, rather than one at a time. We still have to worry about all
+// of the error conditions we checked in __copy_unbuffered, plus one more:
+// the streambuf might decide to switch from a buffered to an unbuffered mode.
+
+template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
+streamsize _STLP_CALL
+__copy_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
+ basic_streambuf<_CharT, _Traits>* __dest,
+ _Scan_Delim __scan_delim, _Is_Delim __is_delim,
+ bool __extract_delim, bool __rethrow) {
+ streamsize __extracted = 0;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+ //Borland compiler generates a warning if assignment because value is never used:
+ int_type __c /*= _Traits::eof()*/;
+ _CharT* __first = __src->_M_gptr();
+ ptrdiff_t __avail = __src->_M_egptr() - __first;
+ // fbp : introduced to move catch/try blocks out of the loop
+ bool __do_handle_exceptions = false;
+
+ _STLP_TRY {
+ for (;;) {
+ const _CharT* __last = __scan_delim(__first, __src->_M_egptr());
+
+ // Try to copy the entire input buffer to the output buffer.
+ streamsize __n = __dest->sputn(__first, __extract_delim && __last != __src->_M_egptr()
+ ? (__last - __first) + 1
+ : (__last - __first));
+ __src->_M_gbump((int)__n);
+ __extracted += __n;
+
+ // from this on, catch() will call _M_handle_exceptions()
+ __do_handle_exceptions = true;
+
+ if (__n < __avail) // We found the delimiter, or else failed to
+ break; // copy some characters.
+
+ __c = __src->sgetc();
+
+ // Three possibilities: we succeeded in refilling the buffer, or
+ // we got EOF, or the streambuf has switched to unbuffered mode.
+ __first = __src->_M_gptr();
+ __avail = __src->_M_egptr() - __first;
+
+ if (__avail > 0)
+ {} // dwa 1/16/00 -- suppress a Metrowerks warning
+ else if (__that->_S_eof(__c)) {
+ __status |= ios_base::eofbit;
+ break;
+ }
+ else {
+ return __extracted + __copy_unbuffered(__that, __src, __dest, __is_delim,
+ __extract_delim, __rethrow);
+ }
+
+ __do_handle_exceptions = false;
+ }
+ }
+
+ _STLP_CATCH_ALL {
+ // See 27.6.1.2.3, paragraph 13.
+ if (__rethrow && __do_handle_exceptions && __extracted == 0)
+ __that->_M_handle_exception(ios_base::failbit);
+ }
+
+ if (__status)
+ __that->setstate(__status); // This might throw.
+ return __extracted;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>
+ ::get(basic_streambuf<_CharT, _Traits>& __dest, _CharT __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
+
+ if (__src)
+ this->_M_gcount = __src->egptr() != __src->gptr()
+ ? _STLP_PRIV __copy_buffered(this, __src, &__dest,
+ _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ false, false)
+ : _STLP_PRIV __copy_unbuffered(this, __src, &__dest,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ false, false);
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Copying characters into a streambuf.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>
+ ::operator>>(basic_streambuf<_CharT, _Traits>* __dest) {
+ streamsize __n = 0;
+ typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
+ _Sentry __sentry(*this);
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
+ if (__src && __dest)
+ __n = __src->egptr() != __src->gptr()
+ ? _STLP_PRIV __copy_buffered(this, __src, __dest,
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, true)
+ : _STLP_PRIV __copy_unbuffered(this, __src, __dest,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, true);
+ }
+
+ if (__n == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// ----------------------------------------------------------------
+// basic_iostream<> class
+// ----------------------------------------------------------------
+
+template <class _CharT, class _Traits>
+basic_iostream<_CharT, _Traits>
+ ::basic_iostream(basic_streambuf<_CharT, _Traits>* __buf)
+ : basic_ios<_CharT, _Traits>(),
+ basic_istream<_CharT, _Traits>(__buf),
+ basic_ostream<_CharT, _Traits>(__buf) {
+ this->init(__buf);
+}
+
+template <class _CharT, class _Traits>
+basic_iostream<_CharT, _Traits>::~basic_iostream()
+{}
+
+_STLP_END_NAMESPACE
+
+#undef __BIS_int_type__
+#undef __BIS_pos_type__
+#undef __BIS_off_type__
+
+#endif /* _STLP_ISTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_ISTREAM
+#define _STLP_INTERNAL_ISTREAM
+
+// this block is included by _ostream.h, we include it here to lower #include level
+#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR)
+# include <stl/_cwchar.h>
+#endif
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h> // For basic_ios<>. Includes <iosfwd>.
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAM_H
+# include <stl/_ostream.h> // Needed as a base class of basic_iostream.
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+#include <stl/_ctraits_fns.h> // Helper functions that allow char traits
+ // to be used as function objects.
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+template <class _CharT, class _Traits>
+class _Isentry;
+#endif
+
+struct _No_Skip_WS {}; // Dummy class used by sentry.
+
+template <class _CharT, class _Traits>
+bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr);
+template <class _CharT, class _Traits>
+bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr);
+
+//----------------------------------------------------------------------
+// Class basic_istream, a class that performs formatted input through
+// a stream buffer.
+
+// The second template parameter, _Traits, defaults to char_traits<_CharT>.
+// The default is declared in header <iosfwd>, and it isn't declared here
+// because C++ language rules do not allow it to be declared twice.
+
+template <class _CharT, class _Traits>
+class basic_istream : virtual public basic_ios<_CharT, _Traits> {
+ typedef basic_istream<_CharT, _Traits> _Self;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ //explicitely defined as private to avoid warnings:
+ basic_istream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+
+public:
+ // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+
+ typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&);
+ typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&);
+ typedef _Self& (_STLP_CALL *__istream_fn)(_Self&);
+
+public: // Constructor and destructor.
+ explicit basic_istream(basic_streambuf<_CharT, _Traits>* __buf) :
+ basic_ios<_CharT, _Traits>(), _M_gcount(0) {
+ this->init(__buf);
+ }
+ ~basic_istream() {};
+
+public: // Nested sentry class.
+
+public: // Hooks for manipulators. The arguments are
+ // function pointers.
+ _Self& operator>> (__istream_fn __f) { return __f(*this); }
+ _Self& operator>> (__ios_fn __f) { __f(*this); return *this; }
+ _Self& operator>> (__ios_base_fn __f) { __f(*this); return *this; }
+
+public: // Formatted input of numbers.
+ _Self& operator>> (short& __val);
+ _Self& operator>> (int& __val);
+ _Self& operator>> (unsigned short& __val);
+ _Self& operator>> (unsigned int& __val);
+ _Self& operator>> (long& __val);
+ _Self& operator>> (unsigned long& __val);
+#ifdef _STLP_LONG_LONG
+ _Self& operator>> (_STLP_LONG_LONG& __val);
+ _Self& operator>> (unsigned _STLP_LONG_LONG& __val);
+#endif
+ _Self& operator>> (float& __val);
+ _Self& operator>> (double& __val);
+# ifndef _STLP_NO_LONG_DOUBLE
+ _Self& operator>> (long double& __val);
+# endif
+# ifndef _STLP_NO_BOOL
+ _Self& operator>> (bool& __val);
+# endif
+ _Self& operator>> (void*& __val);
+
+public: // Copying characters into a streambuf.
+ _Self& operator>>(basic_streambuf<_CharT, _Traits>*);
+
+public: // Unformatted input.
+ streamsize gcount() const { return _M_gcount; }
+ int_type peek();
+
+public: // get() for single characters
+ int_type get();
+ _Self& get(char_type& __c);
+
+public: // get() for character arrays.
+ _Self& get(char_type* __s, streamsize __n, char_type __delim);
+ _Self& get(char_type* __s, streamsize __n)
+ { return get(__s, __n, this->widen('\n')); }
+
+public: // get() for streambufs
+ _Self& get(basic_streambuf<_CharT, _Traits>& __buf,
+ char_type __delim);
+ _Self& get(basic_streambuf<_CharT, _Traits>& __buf)
+ { return get(__buf, this->widen('\n')); }
+
+public: // getline()
+ _Self& getline(char_type* __s, streamsize __n, char_type delim);
+ _Self& getline(char_type* __s, streamsize __n)
+ { return getline(__s, __n, this->widen('\n')); }
+
+public: // read(), readsome(), ignore()
+ _Self& ignore();
+ _Self& ignore(streamsize __n);
+#if (defined (_STLP_MSVC) && _STLP_MSVC < 1200)
+ inline
+#endif
+ _Self& ignore(streamsize __n, int_type __delim);
+
+ _Self& read(char_type* __s, streamsize __n);
+ streamsize readsome(char_type* __s, streamsize __n);
+
+public: // putback
+ _Self& putback(char_type __c);
+ _Self& unget();
+
+public: // Positioning and buffer control.
+ int sync();
+
+ pos_type tellg();
+ _Self& seekg(pos_type __pos);
+ _Self& seekg(off_type, ios_base::seekdir);
+
+public: // Helper functions for non-member extractors.
+ void _M_formatted_get(_CharT& __c);
+ void _M_formatted_get(_CharT* __s);
+ void _M_skip_whitespace(bool __set_failbit);
+
+private: // Number of characters extracted by the
+ streamsize _M_gcount; // most recent unformatted input function.
+
+public:
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+ // If we are using DLL specs, we have not to use inner classes
+ // end class declaration here
+ typedef _Isentry<_CharT, _Traits> sentry;
+};
+# define sentry _Isentry
+template <class _CharT, class _Traits>
+class _Isentry {
+ typedef _Isentry<_CharT, _Traits> _Self;
+# else
+ class sentry {
+ typedef sentry _Self;
+#endif
+
+ private:
+ const bool _M_ok;
+ // basic_streambuf<_CharT, _Traits>* _M_buf;
+
+ public:
+ typedef _Traits traits_type;
+
+ explicit sentry(basic_istream<_CharT, _Traits>& __istr,
+ bool __noskipws = false) :
+ _M_ok((__noskipws || !(__istr.flags() & ios_base::skipws)) ? _M_init_noskip(__istr) : _M_init_skip(__istr) )
+ /* , _M_buf(__istr.rdbuf()) */
+ {}
+
+ // Calling this constructor is the same as calling the previous one with
+ // __noskipws = true, except that it doesn't require a runtime test.
+ sentry(basic_istream<_CharT, _Traits>& __istr, _No_Skip_WS) : /* _M_buf(__istr.rdbuf()), */
+ _M_ok(_M_init_noskip(__istr)) {}
+
+ ~sentry() {}
+
+ operator bool() const { return _M_ok; }
+
+ private: // Disable assignment and copy constructor.
+ //Implementation is here only to avoid warning with some compilers.
+ sentry(const _Self&) : _M_ok(false) {}
+ _Self& operator=(const _Self&) { return *this; }
+ };
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+# undef sentry
+# else
+ // close basic_istream class definition here
+};
+# endif
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _Isentry<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_istream<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _Isentry<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_istream<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+// Non-member character and string extractor functions.
+template <class _CharT, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT& __c) {
+ __in_str._M_formatted_get(__c);
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, unsigned char& __c) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c));
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, signed char& __c) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c));
+ return __in_str;
+}
+
+template <class _CharT, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT* __s) {
+ __in_str._M_formatted_get(__s);
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, unsigned char* __s) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s));
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, signed char* __s) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s));
+ return __in_str;
+}
+
+//----------------------------------------------------------------------
+// istream manipulator.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+ws(basic_istream<_CharT, _Traits>& __istr) {
+ if (!__istr.eof()) {
+ typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
+ _Sentry __sentry(__istr, _No_Skip_WS()); // Don't skip whitespace.
+ if (__sentry)
+ __istr._M_skip_whitespace(false);
+ }
+ return __istr;
+}
+
+// Helper functions for istream<>::sentry constructor.
+template <class _CharT, class _Traits>
+inline bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr) {
+ if (__istr.good()) {
+ if (__istr.tie())
+ __istr.tie()->flush();
+
+ __istr._M_skip_whitespace(true);
+ }
+
+ if (!__istr.good()) {
+ __istr.setstate(ios_base::failbit);
+ return false;
+ } else
+ return true;
+}
+
+template <class _CharT, class _Traits>
+inline bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr) {
+ if (__istr.good()) {
+ if (__istr.tie())
+ __istr.tie()->flush();
+
+ if (!__istr.rdbuf())
+ __istr.setstate(ios_base::badbit);
+ }
+ else
+ __istr.setstate(ios_base::failbit);
+ return __istr.good();
+}
+
+//----------------------------------------------------------------------
+// Class iostream.
+template <class _CharT, class _Traits>
+class basic_iostream
+ : public basic_istream<_CharT, _Traits>,
+ public basic_ostream<_CharT, _Traits>
+{
+public:
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+
+ explicit basic_iostream(basic_streambuf<_CharT, _Traits>* __buf);
+ virtual ~basic_iostream();
+};
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_iostream<char, char_traits<char> >;
+
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_iostream<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& __istr)
+{ return __istr.rdbuf(); }
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_istream.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ISTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// 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_ISTREAMBUF_ITERATOR_H
+#define _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// defined in _istream.h
+template <class _CharT, class _Traits>
+extern basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& ) ;
+
+// We do not read any characters until operator* is called. operator* calls sgetc
+// unless the iterator is unchanged from the last call in which case a cached value is
+// used. Calls to operator++ use sbumpc.
+
+template<class _CharT, class _Traits>
+class istreambuf_iterator :
+ public iterator<input_iterator_tag, _CharT, typename _Traits::off_type, _CharT*, _CharT&>
+{
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::int_type int_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
+ typedef input_iterator_tag iterator_category;
+ typedef _CharT value_type;
+ typedef typename _Traits::off_type difference_type;
+ typedef const _CharT* pointer;
+ typedef const _CharT& reference;
+
+public:
+ istreambuf_iterator(streambuf_type* __p = 0) { this->_M_init(__p); }
+ // istreambuf_iterator(basic_istream<_CharT, _Traits>& __is) { this->_M_init(_M_get_istreambuf(__is)); }
+ inline istreambuf_iterator(basic_istream<_CharT, _Traits>& __is);
+
+ char_type operator*() const { this->_M_getc(); return _M_c; }
+ istreambuf_iterator<_CharT, _Traits>& operator++()
+ {
+ _M_buf->sbumpc();
+ _M_have_c = false;
+ return *this;
+ }
+ istreambuf_iterator<_CharT, _Traits> operator++(int);
+
+ bool equal(const istreambuf_iterator<_CharT, _Traits>& __i) const {
+ if (this->_M_buf)
+ this->_M_getc();
+ if (__i._M_buf)
+ __i._M_getc();
+ return this->_M_eof == __i._M_eof;
+ }
+
+private:
+ void _M_init(streambuf_type* __p) {
+ _M_buf = __p;
+ _M_eof = (__p == 0);
+ _M_have_c = false;
+ }
+
+ void _M_getc() const {
+ if (_M_have_c)
+ return;
+ int_type __c = _M_buf->sgetc();
+# if !defined (_STLP_NEED_MUTABLE) /* && ! defined (__SUNPRO_CC) */
+ _M_c = traits_type::to_char_type(__c);
+ _M_eof = traits_type::eq_int_type(__c, traits_type::eof());
+ _M_have_c = true;
+# else
+ typedef istreambuf_iterator<_CharT,_Traits> _Self;
+ _Self* __that = __CONST_CAST(_Self*, this);
+ __that->_M_c = __STATIC_CAST(_CharT, traits_type::to_char_type(__c));
+ __that->_M_eof = traits_type::eq_int_type(__c, traits_type::eof());
+ __that->_M_have_c = true;
+# endif
+ }
+
+private:
+ streambuf_type* _M_buf;
+ mutable _CharT _M_c;
+ mutable bool _M_eof;
+ mutable bool _M_have_c;
+};
+
+template<class _CharT, class _Traits>
+inline istreambuf_iterator<_CharT, _Traits>::istreambuf_iterator(basic_istream<_CharT, _Traits>& __is)
+{ this->_M_init(_M_get_istreambuf(__is)); }
+
+template<class _CharT, class _Traits>
+inline bool _STLP_CALL operator==(const istreambuf_iterator<_CharT, _Traits>& __x,
+ const istreambuf_iterator<_CharT, _Traits>& __y) {
+ return __x.equal(__y);
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template<class _CharT, class _Traits>
+inline bool _STLP_CALL operator!=(const istreambuf_iterator<_CharT, _Traits>& __x,
+ const istreambuf_iterator<_CharT, _Traits>& __y) {
+ return !__x.equal(__y);
+}
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator<char, char_traits<char> >;
+# if defined (INSTANTIATE_WIDE_STREAMS)
+_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _CharT, class _Traits>
+inline input_iterator_tag _STLP_CALL iterator_category(const istreambuf_iterator<_CharT, _Traits>&) { return input_iterator_tag(); }
+template <class _CharT, class _Traits>
+inline streamoff* _STLP_CALL
+distance_type(const istreambuf_iterator<_CharT, _Traits>&) { return (streamoff*)0; }
+template <class _CharT, class _Traits>
+inline _CharT* _STLP_CALL value_type(const istreambuf_iterator<_CharT, _Traits>&) { return (_CharT*)0; }
+# endif
+
+template <class _CharT, class _Traits>
+istreambuf_iterator<_CharT, _Traits>
+istreambuf_iterator<_CharT, _Traits>::operator++(int) {
+ _M_getc(); // __tmp should avoid any future actions under
+ // underlined buffer---during call of operator *()
+ // (due to buffer for *this and __tmp are the same).
+ istreambuf_iterator<_CharT, _Traits> __tmp = *this;
+ _M_buf->sbumpc();
+ _M_have_c = false;
+ return __tmp;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ *
+ * 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_ITERATOR_H
+#define _STLP_INTERNAL_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+// This is the new version of reverse_iterator, as defined in the
+// draft C++ standard. It relies on the iterator_traits template,
+// which in turn relies on partial specialization. The class
+// reverse_bidirectional_iterator is no longer part of the draft
+// standard, but it is retained for backward compatibility.
+
+template <class _Iterator>
+class reverse_iterator :
+ public iterator<typename iterator_traits<_Iterator>::iterator_category,
+ typename iterator_traits<_Iterator>::value_type,
+ typename iterator_traits<_Iterator>::difference_type,
+ typename iterator_traits<_Iterator>::pointer,
+ typename iterator_traits<_Iterator>::reference> {
+protected:
+ _Iterator current;
+ typedef reverse_iterator<_Iterator> _Self;
+public:
+ typedef typename iterator_traits<_Iterator>::iterator_category iterator_category;
+ typedef typename iterator_traits<_Iterator>::value_type value_type;
+ typedef typename iterator_traits<_Iterator>::difference_type difference_type;
+ typedef typename iterator_traits<_Iterator>::pointer pointer;
+ typedef typename iterator_traits<_Iterator>::reference reference;
+ typedef _Iterator iterator_type;
+public:
+ reverse_iterator() {}
+ explicit reverse_iterator(iterator_type __x) : current(__x) {}
+ reverse_iterator(const _Self& __x) : current(__x.current) {}
+ _Self& operator = (const _Self& __x) { current = __x.base(); return *this; }
+# if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Iter>
+ reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) {}
+ template <class _Iter>
+ _Self& operator = (const reverse_iterator<_Iter>& __x) { current = __x.base(); return *this; }
+# endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator_type base() const { return current; }
+ reference operator*() const {
+ _Iterator __tmp = current;
+ return *--__tmp;
+ }
+ _STLP_DEFINE_ARROW_OPERATOR
+ _Self& operator++() {
+ --current;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ --current;
+ return __tmp;
+ }
+ _Self& operator--() {
+ ++current;
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ ++current;
+ return __tmp;
+ }
+
+ _Self operator+(difference_type __n) const { return _Self(current - __n); }
+ _Self& operator+=(difference_type __n) {
+ current -= __n;
+ return *this;
+ }
+ _Self operator-(difference_type __n) const { return _Self(current + __n); }
+ _Self& operator-=(difference_type __n) {
+ current += __n;
+ return *this;
+ }
+ reference operator[](difference_type __n) const { return *(*this + __n); }
+};
+
+template <class _Iterator>
+inline bool _STLP_CALL operator==(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __x.base() == __y.base(); }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator<(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __y.base() < __x.base(); }
+
+# if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _Iterator>
+inline bool _STLP_CALL operator!=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return !(__x == __y); }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator>(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __y < __x; }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator<=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return !(__y < __x); }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator>=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return !(__x < __y); }
+# endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _Iterator>
+# if defined (__SUNPRO_CC)
+inline ptrdiff_t _STLP_CALL
+# else
+inline typename reverse_iterator<_Iterator>::difference_type _STLP_CALL
+# endif
+operator-(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __y.base() - __x.base(); }
+
+template <class _Iterator, class _DifferenceType>
+inline reverse_iterator<_Iterator> _STLP_CALL
+operator+(_DifferenceType n,const reverse_iterator<_Iterator>& x)
+{ return x.operator+(n); }
+#endif
+
+template <class _Container>
+class back_insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void> {
+ typedef back_insert_iterator<_Container> _Self;
+protected:
+ //c is a Standard name (24.4.2.1), do no make it STLport naming convention compliant.
+ _Container *container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+
+ explicit back_insert_iterator(_Container& __x) : container(&__x) {}
+
+ _Self& operator=(const _Self& __other) {
+ container = __other.container;
+ return *this;
+ }
+ _Self& operator=(const typename _Container::value_type& __val) {
+ container->push_back(__val);
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self operator++(int) { return *this; }
+};
+
+template <class _Container>
+inline back_insert_iterator<_Container> _STLP_CALL back_inserter(_Container& __x)
+{ return back_insert_iterator<_Container>(__x); }
+
+template <class _Container>
+class front_insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void> {
+ typedef front_insert_iterator<_Container> _Self;
+protected:
+ //c is a Standard name (24.4.2.3), do no make it STLport naming convention compliant.
+ _Container *container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ explicit front_insert_iterator(_Container& __x) : container(&__x) {}
+
+ _Self& operator=(const _Self& __other) {
+ container = __other.container;
+ return *this;
+ }
+ _Self& operator=(const typename _Container::value_type& __val) {
+ container->push_front(__val);
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self operator++(int) { return *this; }
+};
+
+template <class _Container>
+inline front_insert_iterator<_Container> _STLP_CALL front_inserter(_Container& __x)
+{ return front_insert_iterator<_Container>(__x); }
+
+template <class _Container>
+class insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void> {
+ typedef insert_iterator<_Container> _Self;
+protected:
+ //container is a Standard name (24.4.2.5), do no make it STLport naming convention compliant.
+ _Container *container;
+ typename _Container::iterator _M_iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ insert_iterator(_Container& __x, typename _Container::iterator __i)
+ : container(&__x), _M_iter(__i) {}
+
+ _Self& operator=(_Self const& __other) {
+ container = __other.container;
+ _M_iter = __other._M_iter;
+ return *this;
+ }
+ _Self& operator=(const typename _Container::value_type& __val) {
+ _M_iter = container->insert(_M_iter, __val);
+ ++_M_iter;
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self& operator++(int) { return *this; }
+};
+
+template <class _Container, class _Iterator>
+inline insert_iterator<_Container> _STLP_CALL
+inserter(_Container& __x, _Iterator __i) {
+ typedef typename _Container::iterator __iter;
+ return insert_iterator<_Container>(__x, __iter(__i));
+}
+
+_STLP_END_NAMESPACE
+
+#if ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# include <stl/_iterator_old.h>
+#endif
+
+#endif /* _STLP_INTERNAL_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_ITERATOR_BASE_H
+#define _STLP_INTERNAL_ITERATOR_BASE_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+//# if defined (_STLP_IMPORT_VENDOR_CSTD) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
+//_STLP_BEGIN_NAMESPACE
+//using namespace _STLP_VENDOR_CSTD;
+//_STLP_END_NAMESPACE
+//#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#if !defined(_STLP_USE_OLD_HP_ITERATOR_QUERIES) && !defined(_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+struct input_iterator_tag {};
+struct output_iterator_tag {};
+struct forward_iterator_tag : public input_iterator_tag {};
+struct bidirectional_iterator_tag : public forward_iterator_tag {};
+struct random_access_iterator_tag : public bidirectional_iterator_tag {};
+
+
+template <class _Category, class _Tp, _STLP_DFL_TMPL_PARAM(_Distance,ptrdiff_t),
+ _STLP_DFL_TMPL_PARAM(_Pointer,_Tp*), _STLP_DFL_TMPL_PARAM(_Reference,_Tp&) >
+struct iterator {
+ typedef _Category iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+ typedef _Pointer pointer;
+ typedef _Reference reference;
+};
+_STLP_TEMPLATE_NULL
+struct iterator<output_iterator_tag, void, void, void, void> {
+ 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
+};
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) iterator_category(_It)
+# define _STLP_DISTANCE_TYPE(_It, _Tp) distance_type(_It)
+# define _STLP_VALUE_TYPE(_It, _Tp) value_type(_It)
+//Old HP iterator queries do not give information about the iterator
+//associated reference type so we consider that it is not a real reference.
+# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
+#else
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# define _STLP_VALUE_TYPE(_It, _Tp) (typename iterator_traits< _Tp >::value_type*)0
+# define _STLP_DISTANCE_TYPE(_It, _Tp) (typename iterator_traits< _Tp >::difference_type*)0
+# if defined (__BORLANDC__) || defined (__SUNPRO_CC) || ( defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || ( defined (__sgi) && defined (_COMPILER_VERSION)) || defined (__DMC__)
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) iterator_traits< _Tp >::iterator_category()
+# else
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) typename iterator_traits< _Tp >::iterator_category()
+# endif
+# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) _IsRefType< typename iterator_traits< _Tp >::reference >::_Ret()
+# else
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) __iterator_category(_It, _IsPtrType<_Tp>::_Ret())
+# define _STLP_DISTANCE_TYPE(_It, _Tp) (ptrdiff_t*)0
+# define _STLP_VALUE_TYPE(_It, _Tp) __value_type(_It, _IsPtrType<_Tp>::_Ret() )
+# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
+# endif
+#endif
+
+template <class _Iterator>
+struct iterator_traits {
+ typedef typename _Iterator::iterator_category iterator_category;
+ typedef typename _Iterator::value_type value_type;
+ typedef typename _Iterator::difference_type difference_type;
+ typedef typename _Iterator::pointer pointer;
+ typedef typename _Iterator::reference reference;
+};
+
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && ! defined (__SUNPRO_CC)
+# define _STLP_DIFFERENCE_TYPE(_Iterator) typename iterator_traits<_Iterator>::difference_type
+#else
+# define _STLP_DIFFERENCE_TYPE(_Iterator) ptrdiff_t
+#endif
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+
+// fbp : this order keeps gcc happy
+template <class _Tp>
+struct iterator_traits<const _Tp*> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+};
+
+template <class _Tp>
+struct iterator_traits<_Tp*> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
+};
+
+# if defined (__BORLANDC__)
+template <class _Tp>
+struct iterator_traits<_Tp* const> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+};
+# endif
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || \
+ (defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && ! defined (_STLP_NO_ARROW_OPERATOR))
+# define _STLP_POINTERS_SPECIALIZE( _TpP )
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); }
+#else
+# include <stl/_ptrs_specialize.h>
+#endif
+
+#ifndef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+// The overloaded functions iterator_category, distance_type, and
+// value_type are not part of the C++ standard. (They have been
+// replaced by struct iterator_traits.) They are included for
+// backward compatibility with the HP STL.
+// We introduce internal names for these functions.
+
+# ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+
+template <class _Iter>
+inline typename iterator_traits<_Iter>::iterator_category __iterator_category(const _Iter&) {
+ typedef typename iterator_traits<_Iter>::iterator_category _Category;
+ return _Category();
+}
+
+template <class _Iter>
+inline typename iterator_traits<_Iter>::difference_type* __distance_type(const _Iter&) {
+ typedef typename iterator_traits<_Iter>::difference_type _diff_type;
+ return __STATIC_CAST(_diff_type*,0);
+}
+
+template <class _Iter>
+inline typename iterator_traits<_Iter>::value_type* __value_type(const _Iter&) {
+ typedef typename iterator_traits<_Iter>::value_type _value_type;
+ return __STATIC_CAST(_value_type*,0);
+}
+
+# else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+template <class _Iter>
+inline random_access_iterator_tag
+__iterator_category(const _Iter&, const __true_type&) {
+ return random_access_iterator_tag();
+}
+
+template <class _Iter>
+inline _STLP_TYPENAME_ON_RETURN_TYPE iterator_traits<_Iter>::iterator_category
+__iterator_category(const _Iter&, const __false_type&) {
+ typedef typename iterator_traits<_Iter>::iterator_category _Category;
+ return _Category();
+}
+
+
+template <class _Iter>
+inline ptrdiff_t* _STLP_CALL __distance_type(const _Iter&) { return __STATIC_CAST(ptrdiff_t*, 0); }
+
+template <class _Iter>
+inline _STLP_TYPENAME_ON_RETURN_TYPE iterator_traits<_Iter>::value_type*
+__value_type(const _Iter&, const __false_type&) {
+ typedef typename iterator_traits<_Iter>::value_type _value_type;
+ return __STATIC_CAST(_value_type*,0);
+}
+
+template <class _Tp>
+inline _Tp*
+__value_type(const _Tp*, const __true_type&) {
+ return __STATIC_CAST(_Tp*, 0);
+}
+
+# endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#else /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
+inline _Category _STLP_CALL iterator_category(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return _Category(); }
+template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
+inline _Tp* _STLP_CALL value_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
+inline _Distance* _STLP_CALL distance_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Distance*, 0); }
+template <class _Tp>
+inline random_access_iterator_tag _STLP_CALL iterator_category(const _Tp*) { return random_access_iterator_tag(); }
+template <class _Tp>
+inline _Tp* _STLP_CALL value_type(const _Tp*) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp>
+inline ptrdiff_t* _STLP_CALL distance_type(const _Tp*) { return __STATIC_CAST(ptrdiff_t*, 0); }
+#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+
+# if ! defined (_STLP_NO_ANACHRONISMS)
+// The base classes input_iterator, output_iterator, forward_iterator,
+// bidirectional_iterator, and random_access_iterator are not part of
+// the C++ standard. (They have been replaced by struct iterator.)
+// They are included for backward compatibility with the HP STL.
+template <class _Tp, class _Distance> struct input_iterator :
+ public iterator <input_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+struct output_iterator : public iterator <output_iterator_tag, void, void, void, void> {};
+template <class _Tp, class _Distance> struct forward_iterator :
+ public iterator<forward_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+template <class _Tp, class _Distance> struct bidirectional_iterator :
+ public iterator<bidirectional_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+template <class _Tp, class _Distance> struct random_access_iterator :
+ public iterator<random_access_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+
+# if defined (_STLP_BASE_MATCH_BUG) && defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+template <class _Tp, class _Distance>
+inline input_iterator_tag _STLP_CALL
+iterator_category(const input_iterator<_Tp, _Distance>&) { return input_iterator_tag(); }
+inline output_iterator_tag _STLP_CALL
+iterator_category(const output_iterator&) { return output_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline forward_iterator_tag _STLP_CALL
+iterator_category(const forward_iterator<_Tp, _Distance>&) { return forward_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline bidirectional_iterator_tag _STLP_CALL
+iterator_category(const bidirectional_iterator<_Tp, _Distance>&) { return bidirectional_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline random_access_iterator_tag _STLP_CALL
+iterator_category(const random_access_iterator<_Tp, _Distance>&) { return random_access_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0);}
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
+# endif /* BASE_MATCH */
+
+#endif /* _STLP_NO_ANACHRONISMS */
+
+template <class _InputIterator, class _Distance>
+inline void _STLP_CALL __distance(const _InputIterator& __first, const _InputIterator& __last,
+ _Distance& __n, const input_iterator_tag &) {
+ _InputIterator __it(__first);
+ while (__it != __last) { ++__it; ++__n; }
+}
+
+
+# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIterator, class _Distance>
+inline void _STLP_CALL __distance(const _ForwardIterator& __first, const _ForwardIterator& __last,
+ _Distance& __n, const forward_iterator_tag &) {
+ _ForwardIterator __it(__first);
+ while (__it != __last) { ++__first; ++__n; }
+}
+
+template <class _BidirectionalIterator, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL __distance(const _BidirectionalIterator& __first,
+ const _BidirectionalIterator& __last,
+ _Distance& __n, const bidirectional_iterator_tag &) {
+ _BidirectionalIterator __it(__first);
+ while (__it != __last) { ++__it; ++__n; }
+}
+# endif
+
+template <class _RandomAccessIterator, class _Distance>
+inline void _STLP_CALL __distance(const _RandomAccessIterator& __first,
+ const _RandomAccessIterator& __last,
+ _Distance& __n, const random_access_iterator_tag &) {
+ __n += __last - __first;
+}
+
+#ifndef _STLP_NO_ANACHRONISMS
+template <class _InputIterator, class _Distance>
+inline void _STLP_CALL distance(const _InputIterator& __first,
+ const _InputIterator& __last, _Distance& __n) {
+ __distance(__first, __last, __n, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+}
+#endif
+
+template <class _InputIterator>
+inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
+__distance(const _InputIterator& __first, const _InputIterator& __last, const input_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_InputIterator) __n = 0;
+ _InputIterator __it(__first);
+ while (__it != __last) {
+ ++__it; ++__n;
+ }
+ return __n;
+}
+
+# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIterator>
+inline _STLP_DIFFERENCE_TYPE(_ForwardIterator) _STLP_CALL
+__distance(const _ForwardIterator& __first, const _ForwardIterator& __last,
+ const forward_iterator_tag &)
+{
+ _STLP_DIFFERENCE_TYPE(_ForwardIterator) __n = 0;
+ _ForwardIterator __it(__first);
+ while (__it != __last) {
+ ++__it; ++__n;
+ }
+ return __n;
+
+}
+
+template <class _BidirectionalIterator>
+_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) _STLP_CALL
+__distance(const _BidirectionalIterator& __first,
+ const _BidirectionalIterator& __last,
+ const bidirectional_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) __n = 0;
+ _BidirectionalIterator __it(__first);
+ while (__it != __last) {
+ ++__it; ++__n;
+ }
+ return __n;
+}
+# endif
+
+template <class _RandomAccessIterator>
+inline _STLP_DIFFERENCE_TYPE(_RandomAccessIterator) _STLP_CALL
+__distance(const _RandomAccessIterator& __first, const _RandomAccessIterator& __last,
+ const random_access_iterator_tag &) {
+ return __last - __first;
+}
+
+template <class _InputIterator>
+inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
+distance(_InputIterator __first, _InputIterator __last) {
+ return __distance(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+}
+
+// fbp: those are being used for iterator/const_iterator definitions everywhere
+template <class _Tp>
+struct _Nonconst_traits;
+
+template <class _Tp>
+struct _Const_traits {
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_traits<_Tp> _NonConstTraits;
+};
+
+template <class _Tp>
+struct _Nonconst_traits {
+ typedef _Tp value_type;
+ typedef _Tp& reference;
+ typedef _Tp* pointer;
+ typedef _Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_traits<_Tp> _NonConstTraits;
+};
+
+/*
+ * dums: A special iterator/const_iterator traits for set and multiset for which even
+ * the iterator is not mutable
+ */
+template <class _Tp>
+struct _Nonconst_Const_traits;
+
+template <class _Tp>
+struct _Const_Const_traits {
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Const_Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
+};
+
+template <class _Tp>
+struct _Nonconst_Const_traits {
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Const_Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
+};
+
+/*
+ * A macro to generate a new iterator traits from one of the
+ * previous one. Changing the iterator traits type make iterators
+ * from different containers not comparable.
+ */
+#define _STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \
+template <class _Tp> \
+struct _##Motif; \
+template <class _Tp> \
+struct _Const##Motif : public _STLP_STD::_Const_##Traits<_Tp> { \
+ typedef _Const##Motif<_Tp> _ConstTraits; \
+ typedef _##Motif<_Tp> _NonConstTraits; \
+}; \
+template <class _Tp> \
+struct _##Motif : public _STLP_STD::_Nonconst_##Traits<_Tp> { \
+ typedef _Const##Motif<_Tp> _ConstTraits; \
+ typedef _##Motif<_Tp> _NonConstTraits; \
+};
+
+#define _STLP_CREATE_ITERATOR_TRAITS(Motif, Traits) \
+_STLP_MOVE_TO_PRIV_NAMESPACE \
+_STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#define _STLP_CREATE_HASH_ITERATOR_TRAITS(Motif, Traits) \
+_STLP_MOVE_TO_PRIV_NAMESPACE \
+_STLP_CREATE_ITERATOR_TRAITS_BASE(NonLocal##Motif, Traits) \
+_STLP_CREATE_ITERATOR_TRAITS_BASE(Local##Motif, Traits) \
+template <class _Tp> \
+struct _##Motif { \
+ typedef _ConstNonLocal##Motif<_Tp> _ConstTraits; \
+ typedef _NonLocal##Motif<_Tp> _NonConstTraits; \
+ typedef _ConstLocal##Motif<_Tp> _ConstLocalTraits; \
+ typedef _Local##Motif<_Tp> _NonConstLocalTraits; \
+}; \
+_STLP_MOVE_TO_STD_NAMESPACE
+
+/*
+# if defined (_STLP_BASE_TYPEDEF_BUG)
+// this workaround is needed for SunPro 4.0.1
+template <class _Traits>
+struct __cnst_traits_aux : private _Traits {
+ typedef typename _Traits::value_type value_type;
+};
+# define __TRAITS_VALUE_TYPE(_Traits) __cnst_traits_aux<_Traits>::value_type
+# else
+# define __TRAITS_VALUE_TYPE(_Traits) _Traits::value_type
+# endif
+*/
+
+#if defined (_STLP_MSVC)
+// MSVC specific
+template <class _InputIterator, class _Dist>
+inline void _STLP_CALL _Distance(_InputIterator __first,
+ _InputIterator __last, _Dist& __n) {
+ __distance(__first, __last, __n, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+}
+#endif
+
+template <class _InputIter, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_InputIter& __i, _Distance __n, const input_iterator_tag &) {
+ while (__n--) ++__i;
+}
+
+// fbp : added output iterator tag variant
+template <class _InputIter, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_InputIter& __i, _Distance __n, const output_iterator_tag &) {
+ while (__n--) ++__i;
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIterator, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_ForwardIterator& i, _Distance n, const forward_iterator_tag &) {
+ while (n--) ++i;
+}
+#endif
+
+template <class _BidirectionalIterator, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_BidirectionalIterator& __i, _Distance __n,
+ const bidirectional_iterator_tag &) {
+ if (__n > 0)
+ while (__n--) ++__i;
+ else
+ while (__n++) --__i;
+}
+
+template <class _RandomAccessIterator, class _Distance>
+inline void _STLP_CALL
+__advance(_RandomAccessIterator& __i, _Distance __n,
+ const random_access_iterator_tag &) {
+ __i += __n;
+}
+
+template <class _InputIterator, class _Distance>
+inline void _STLP_CALL advance(_InputIterator& __i, _Distance __n) {
+ __advance(__i, __n, _STLP_ITERATOR_CATEGORY(__i, _InputIterator));
+}
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_H)
+# include <stl/debug/_debug.h>
+#endif
+
+#endif /* _STLP_INTERNAL_ITERATOR_BASE_H */
+
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_ITERATOR_OLD_H
+#define _STLP_INTERNAL_ITERATOR_OLD_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+
+template <class _Container>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const back_insert_iterator<_Container>&) { return output_iterator_tag(); }
+template <class _Container>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const front_insert_iterator<_Container>&) { return output_iterator_tag(); }
+template <class _Container>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const insert_iterator<_Container>&) { return output_iterator_tag(); }
+
+# endif
+
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+# define __Reference _Reference, class _Pointer
+# define Reference__ _Reference, _Pointer
+template <class _BidirectionalIterator, class _Tp,
+ _STLP_DFL_TMPL_PARAM(_Reference, _Tp& ),
+ _STLP_DFL_TMPL_PARAM(_Pointer, _Tp*),
+ _STLP_DFL_TYPE_PARAM(_Distance, ptrdiff_t)>
+# else
+# define __Reference _Reference
+# define Reference__ _Reference
+template <class _BidirectionalIterator, class _Tp, _STLP_DFL_TMPL_PARAM(_Reference, _Tp& ),
+ _STLP_DFL_TYPE_PARAM(_Distance, ptrdiff_t)>
+# endif
+class reverse_bidirectional_iterator {
+ typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
+ Reference__, _Distance> _Self;
+ // friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& x, const _Self& y);
+protected:
+ _BidirectionalIterator current;
+public:
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+ typedef _Pointer pointer;
+# else
+ typedef _Tp* pointer;
+# endif
+ typedef _Reference reference;
+
+ reverse_bidirectional_iterator() {}
+ explicit reverse_bidirectional_iterator(_BidirectionalIterator __x)
+ : current(__x) {}
+ _BidirectionalIterator base() const { return current; }
+ _Reference operator*() const {
+ _BidirectionalIterator __tmp = current;
+ return *(--__tmp);
+ }
+# if !(defined _STLP_NO_ARROW_OPERATOR)
+ _STLP_DEFINE_ARROW_OPERATOR
+# endif
+ _Self& operator++() {
+ --current;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ --current;
+ return __tmp;
+ }
+ _Self& operator--() {
+ ++current;
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ ++current;
+ return __tmp;
+ }
+};
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline bidirectional_iterator_tag _STLP_CALL
+iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
+{ return bidirectional_iterator_tag(); }
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline _Tp* _STLP_CALL
+value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
+{ return (_Tp*) 0; }
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline _Distance* _STLP_CALL
+distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
+{ return (_Distance*) 0; }
+#endif
+
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline bool _STLP_CALL operator==(
+ const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
+ Reference__, _Distance>& __y)
+{
+ return __x.base() == __y.base();
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _BiIter, class _Tp, class __Reference, class _Distance>
+inline bool _STLP_CALL operator!=(
+ const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __x,
+ const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __y)
+{
+ return !(__x == __y);
+}
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+#if ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
+
+// This is the old version of reverse_iterator, as found in the original
+// HP STL. It does not use partial specialization.
+
+template <class _RandomAccessIterator,
+# if defined (__MSL__) && (__MSL__ >= 0x2405) \
+ || defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)) //*ty 03/22/2001 - give the default to the secont param under MPW.
+ // I believe giving the default will cause any harm even though the 2nd type parameter
+ // still have to be provided for T* type iterators.
+ _STLP_DFL_TMPL_PARAM(_Tp,iterator_traits<_RandomAccessIterator>::value_type),
+# else
+ class _Tp,
+#endif
+ _STLP_DFL_TMPL_PARAM(_Reference,_Tp&),
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+ _STLP_DFL_TMPL_PARAM(_Pointer, _Tp*),
+# endif
+ _STLP_DFL_TYPE_PARAM(_Distance,ptrdiff_t)>
+class reverse_iterator {
+ typedef reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>
+ _Self;
+protected:
+ _RandomAccessIterator __current;
+public:
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+ typedef _Pointer pointer;
+# else
+ typedef _Tp* pointer;
+# endif
+ typedef _Reference reference;
+
+ reverse_iterator() {}
+ reverse_iterator(const _Self& __x) : __current(__x.base()) {}
+ explicit reverse_iterator(_RandomAccessIterator __x) : __current(__x) {}
+ _Self& operator=(const _Self& __x) {__current = __x.base(); return *this; }
+
+ _RandomAccessIterator base() const { return __current; }
+ _Reference operator*() const { return *(__current - (difference_type)1); }
+
+# if !(defined _STLP_NO_ARROW_OPERATOR)
+ _STLP_DEFINE_ARROW_OPERATOR
+# endif
+
+ _Self& operator++() {
+ --__current;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ --__current;
+ return __tmp;
+ }
+ _Self& operator--() {
+ ++__current;
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ ++__current;
+ return __tmp;
+ }
+ _Self operator+(_Distance __n) const {
+ return _Self(__current - __n);
+ }
+ _Self& operator+=(_Distance __n) {
+ __current -= __n;
+ return *this;
+ }
+ _Self operator-(_Distance __n) const {
+ return _Self(__current + __n);
+ }
+ _Self& operator-=(_Distance __n) {
+ __current += __n;
+ return *this;
+ }
+ _Reference operator[](_Distance __n) const { return *(*this + __n); }
+};
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline random_access_iterator_tag _STLP_CALL
+iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
+{ return random_access_iterator_tag(); }
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline _Tp* _STLP_CALL value_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
+{ return (_Tp*) 0; }
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline _Distance* _STLP_CALL
+distance_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
+{ return (_Distance*) 0; }
+#endif
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator==(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y)
+{
+ return __x.base() == __y.base();
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator<(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y)
+{
+ return __y.base() < __x.base();
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator!=(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return !(__x == __y);
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator>(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return __y < __x;
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator<=(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return !(__y < __x);
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator>=(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return !(__x < __y);
+}
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline _Distance _STLP_CALL
+operator-(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y)
+{
+ return __y.base() - __x.base();
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance> _STLP_CALL
+operator+(_Distance __n,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x)
+{
+ return reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>(__x.base() - __n);
+}
+
+#endif /* ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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)
+
+# define __declare_numeric_base_member(__type, __mem, _Init) \
+template <class __number> \
+ const __type _Numeric_limits_base<__number>:: __mem
+
+__declare_numeric_base_member(bool, is_specialized, false);
+__declare_numeric_base_member(int, digits, 0);
+__declare_numeric_base_member(int, digits10, 0);
+__declare_numeric_base_member(bool, is_signed, false);
+__declare_numeric_base_member(bool, is_integer, false);
+__declare_numeric_base_member(bool, is_exact, false);
+__declare_numeric_base_member(int, radix, 0);
+__declare_numeric_base_member(int, min_exponent, 0);
+__declare_numeric_base_member(int, max_exponent, 0);
+__declare_numeric_base_member(int, min_exponent10, 0);
+__declare_numeric_base_member(int, max_exponent10, 0);
+__declare_numeric_base_member(bool, has_infinity, false);
+__declare_numeric_base_member(bool, has_quiet_NaN, false);
+__declare_numeric_base_member(bool, has_signaling_NaN, false);
+__declare_numeric_base_member(float_denorm_style, has_denorm, denorm_absent);
+__declare_numeric_base_member(bool, has_denorm_loss, false);
+__declare_numeric_base_member(bool, is_iec559, false);
+__declare_numeric_base_member(bool, is_bounded, false);
+__declare_numeric_base_member(bool, is_modulo, false);
+__declare_numeric_base_member(bool, traps, false);
+__declare_numeric_base_member(bool, tinyness_before, false);
+__declare_numeric_base_member(float_round_style, round_style, round_toward_zero);
+
+# undef __declare_numeric_base_member
+
+# define __declare_integer_limits_member(__type, __mem, _Init) \
+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, true);
+__declare_integer_limits_member(int, digits, (__idigits < 0) ? \
+ ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1)) \
+ : (__idigits) );
+__declare_integer_limits_member(int, digits10, (int)(301UL * digits) /1000);
+__declare_integer_limits_member(bool, is_signed, __imin != 0);
+__declare_integer_limits_member(bool, is_integer, true);
+__declare_integer_limits_member(bool, is_exact, true);
+__declare_integer_limits_member(int, radix, 2);
+__declare_integer_limits_member(bool, is_bounded, true);
+__declare_integer_limits_member(bool, is_modulo, true);
+# undef __declare_integer_limits_member
+
+# define __declare_float_limits_member(__type, __mem, _Init) \
+template <class __number, \
+ int __Digits, int __Digits10, \
+ int __MinExp, int __MaxExp, \
+ int __MinExp10, int __MaxExp10, \
+ bool __IsIEC559, \
+ float_round_style __RoundStyle> \
+const __type _Floating_limits< __number, __Digits, __Digits10, \
+ __MinExp, __MaxExp, __MinExp10, __MaxExp10, \
+ __IsIEC559, __RoundStyle>::\
+ __mem
+
+__declare_float_limits_member(bool, is_specialized, true);
+__declare_float_limits_member(int, digits, __Digits);
+__declare_float_limits_member(int, digits10, __Digits10);
+__declare_float_limits_member(bool, is_signed, true);
+__declare_float_limits_member(int, radix, FLT_RADIX);
+__declare_float_limits_member(int, min_exponent, __MinExp);
+__declare_float_limits_member(int, max_exponent, __MaxExp);
+__declare_float_limits_member(int, min_exponent10, __MinExp10);
+__declare_float_limits_member(int, max_exponent10, __MaxExp10);
+__declare_float_limits_member(bool, has_infinity, true);
+__declare_float_limits_member(bool, has_quiet_NaN, true);
+__declare_float_limits_member(bool, has_signaling_NaN, true);
+__declare_float_limits_member(float_denorm_style, has_denorm, denorm_indeterminate);
+__declare_float_limits_member(bool, has_denorm_loss, false);
+__declare_float_limits_member(bool, is_iec559, __IsIEC559);
+__declare_float_limits_member(bool, is_bounded, true);
+__declare_float_limits_member(bool, traps, true);
+__declare_float_limits_member(bool, tinyness_before, false);
+__declare_float_limits_member(float_round_style, round_style, __RoundStyle);
+# undef __declare_float_limits_member
+
+#endif /* _STLP_STATIC_CONST_INIT_BUG */
+
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+# 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__ */
+
+# elif defined (_STLP_LITTLE_ENDIAN)
+
+# if 0 /* defined(_STLP_MSVC) || defined(__linux__) */
+// some IA-32 platform ??
+/*
+# define _STLP_FLOAT_INF_REP { 0, 0x7f80 }
+# define _STLP_FLOAT_QNAN_REP { 0, 0xffc0 }
+# define _STLP_FLOAT_SNAN_REP { 0, 0xff80 }
+
+# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
+# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 }
+# define _STLP_DOUBLE_SNAN_REP { 0, 0, 0, 0xfff0 }
+# 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, 0xFFF0, 0 } // ????
+*/
+# elif 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
+# else
+/* This is an architecture we don't know how to handle. Return some
+obviously wrong values. */
+# define _STLP_FLOAT_INF_REP { 0, 0 }
+# define _STLP_FLOAT_QNAN_REP { 0, 0 }
+# define _STLP_FLOAT_SNAN_REP { 0, 0 }
+# define _STLP_DOUBLE_INF_REP { 0, 0 }
+# define _STLP_DOUBLE_QNAN_REP { 0, 0 }
+# define _STLP_DOUBLE_SNAN_REP { 0, 0 }
+# define _STLP_LDOUBLE_INF_REP { 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0 }
+
+# endif
+
+# if 0
+/*
+# if defined(_STLP_BIG_ENDIAN)
+
+# elif defined (_STLP_LITTLE_ENDIAN)
+# else
+
+//This is an architecture we don't know how to handle. Return some
+//obviously wrong values.
+# define _STLP_FLOAT_INF_REP { 0, 0 }
+# define _STLP_FLOAT_QNAN_REP { 0, 0 }
+# define _STLP_FLOAT_SNAN_REP { 0, 0 }
+# define _STLP_DOUBLE_INF_REP { 0, 0 }
+# define _STLP_DOUBLE_QNAN_REP { 0, 0 }
+# define _STLP_DOUBLE_SNAN_REP { 0, 0 }
+# define _STLP_LDOUBLE_INF_REP { 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0 }
+# 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
+
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_inf() {
+ _F_rep _F_inf = {_STLP_FLOAT_INF_REP};
+ return _F_inf.val;
+}
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_qNaN() {
+ _F_rep _F_qNaN = {_STLP_FLOAT_QNAN_REP};
+ return _F_qNaN.val;
+}
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_sNaN() {
+ _F_rep _F_sNaN = {_STLP_FLOAT_SNAN_REP};
+ return _F_sNaN.val;
+}
+
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_inf() {
+ _D_rep _D_inf = {_STLP_DOUBLE_INF_REP};
+ return _D_inf.val;
+}
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_qNaN() {
+ _D_rep _D_qNaN = {_STLP_DOUBLE_QNAN_REP};
+ return _D_qNaN.val;
+}
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_sNaN() {
+ _D_rep _D_sNaN = {_STLP_DOUBLE_SNAN_REP};
+ return _D_sNaN.val;
+}
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_inf() {
+ _LD_rep _LD_inf = {_STLP_LDOUBLE_INF_REP};
+ return _LD_inf.val;
+}
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_qNaN() {
+ _LD_rep _LD_qNaN = {_STLP_LDOUBLE_QNAN_REP};
+ return _LD_qNaN.val;
+}
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_sNaN() {
+ _LD_rep _LD_sNaN = {_STLP_LDOUBLE_SNAN_REP};
+ return _LD_sNaN.val;
+}
+# endif /* _STLP_NO_LONG_DOUBLE */
+
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+
+#undef _STLP_LIMITS_MIN_TYPE
+#undef _STLP_LIMITS_MAX_TYPE
+
+#undef _STLP_FLOAT_INF_REP
+#undef _STLP_FLOAT_QNAN_REP
+#undef _STLP_FLOAT_SNAN_REP
+#undef _STLP_DOUBLE_INF_REP
+#undef _STLP_DOUBLE_QNAN_REP
+#undef _STLP_DOUBLE_SNAN_REP
+#undef _STLP_LDOUBLE_INF_REP
+#undef _STLP_LDOUBLE_QNAN_REP
+#undef _STLP_LDOUBLE_SNAN_REP
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_LIMITS_C_INCLUDED */
--- /dev/null
+/*
+ * 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(); }
+
+#if defined ( _STLP_STATIC_CONST_INIT_BUG)
+ enum {
+#else
+ static const int
+#endif
+
+ digits = 0,
+ digits10 = 0,
+ radix = 0,
+ min_exponent = 0,
+ min_exponent10 = 0,
+ max_exponent = 0,
+ max_exponent10 = 0
+
+#if defined ( _STLP_STATIC_CONST_INIT_BUG)
+ ,
+ has_denorm = denorm_absent,
+ round_style = round_toward_zero,
+#else
+ ;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const float_round_style round_style = round_toward_zero;
+ static const bool
+#endif
+
+ is_specialized = false,
+ is_signed = false,
+ is_integer = false,
+ is_exact = false,
+ has_infinity = false,
+ has_quiet_NaN = false,
+ has_signaling_NaN = false,
+ has_denorm_loss = false,
+ is_iec559 = false,
+ is_bounded = false,
+ is_modulo = false,
+ traps = false,
+ tinyness_before = false
+#if defined ( _STLP_STATIC_CONST_INIT_BUG)
+ }
+#endif
+ ;
+
+ 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; }
+
+#if defined (_STLP_STATIC_CONST_INIT_BUG)
+ enum {
+#else
+ static const int
+#endif
+ digits = (__idigits < 0) ?
+ ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1))
+ : (__idigits),
+ digits10 = (digits * 301UL) / 1000,
+ radix = 2
+#if !defined (_STLP_STATIC_CONST_INIT_BUG)
+ ;
+ static const bool
+#else
+ ,
+#endif
+ is_specialized = true,
+ is_signed = (__imin != 0),
+ is_integer = true,
+ is_exact = true,
+ is_bounded = true,
+ is_modulo = __ismod
+#if defined ( _STLP_STATIC_CONST_INIT_BUG)
+ }
+#endif
+ ;
+};
+
+// Base class for floating-point numbers.
+template <class __number,
+ int __Digits, int __Digits10,
+ int __MinExp, int __MaxExp,
+ int __MinExp10, int __MaxExp10,
+ bool __IsIEC559,
+ float_round_style __RoundStyle>
+class _Floating_limits : public _Numeric_limits_base<__number> {
+public:
+
+#if defined (_STLP_STATIC_CONST_INIT_BUG)
+ enum {
+#else
+ static const int
+#endif
+
+ digits = __Digits,
+ digits10 = __Digits10,
+
+ radix = ( FLT_RADIX /* 2 */ ),
+ min_exponent = __MinExp,
+ max_exponent = __MaxExp,
+ min_exponent10 = __MinExp10,
+ max_exponent10 = __MaxExp10
+
+#if defined (_STLP_STATIC_CONST_INIT_BUG)
+ ,
+ has_denorm = denorm_indeterminate,
+ round_style = __RoundStyle,
+#else
+ ;
+ static const float_denorm_style has_denorm = denorm_indeterminate;
+ static const float_round_style round_style = __RoundStyle;
+ static const bool
+#endif
+
+ is_specialized = true,
+ is_signed = true,
+
+ //IEC 559 specify the floating point representation of
+ //infinity, quiet and signaling Not a Number. Not supporting
+ //it is consider as not being able to grant those values.
+#if (defined (_STLP_MSVC) && (_STLP_MSVC < 1300))
+ //MSVC 6 do not fully support IEC 599 but grant a good infinity value.
+ has_infinity = true,
+#else
+ has_infinity = __IsIEC559,
+#endif
+ has_quiet_NaN = __IsIEC559,
+ has_signaling_NaN = __IsIEC559,
+
+ has_denorm_loss = false,
+ is_iec559 = __IsIEC559,
+ is_bounded = true,
+ traps = true,
+ tinyness_before= false
+
+#if defined (_STLP_STATIC_CONST_INIT_BUG)
+ }
+#endif
+ ;
+};
+
+_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)
+
+_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; }
+
+# if defined ( _STLP_STATIC_CONST_INIT_BUG)
+ enum {
+# else
+ static const int
+# endif
+ digits = ((int)((sizeof(_STLP_LONG_LONG) * (CHAR_BIT))) - 1),
+ digits10 = (digits * 301UL) / 1000,
+ radix = 2
+# if ! defined (_STLP_STATIC_CONST_INIT_BUG)
+ ;
+ static const bool
+# else
+ ,
+# endif
+ is_specialized = true,
+ is_signed = true,
+ is_integer = true,
+ is_exact = true,
+ is_bounded = true,
+ is_modulo = true
+# if defined (_STLP_STATIC_CONST_INIT_BUG)
+ }
+# endif
+ ;
+};
+
+_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; }
+
+# if defined (_STLP_STATIC_CONST_INIT_BUG)
+ enum {
+# else
+ static const int
+# endif
+ digits = ((int)((sizeof(unsigned _STLP_LONG_LONG) * (CHAR_BIT)))),
+ digits10 = (digits * 301UL) / 1000,
+ radix = 2
+# if ! defined (_STLP_STATIC_CONST_INIT_BUG)
+ ;
+ static const bool
+# else
+ ,
+# endif
+ is_specialized = true,
+ is_signed = false,
+ is_integer = true,
+ is_exact = true,
+ is_bounded = true,
+ is_modulo = true
+# if defined ( _STLP_STATIC_CONST_INIT_BUG)
+ }
+# endif
+ ;
+};
+
+# 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 double _STLP_CALL get_D_inf();
+ static double _STLP_CALL get_D_qNaN();
+ static double _STLP_CALL get_D_sNaN();
+
+#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();
+#endif
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _LimG<bool>;
+#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
+#if defined (_STLP_NO_IEC559_SUPPORT)
+ false, // do not conform to iec559
+#else
+ true, // conforms to iec559
+#endif
+ round_to_nearest> {
+public:
+ static float (_STLP_CALL min) () _STLP_NOTHROW { return FLT_MIN; }
+ static float _STLP_CALL denorm_min() _STLP_NOTHROW { return FLT_MIN; }
+ static float (_STLP_CALL max) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD 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(); }
+};
+
+_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
+#if defined (_STLP_NO_IEC559_SUPPORT)
+ false, // do not conform to iec559
+#else
+ true, // conforms to iec559
+#endif
+ round_to_nearest> {
+public:
+ static double (_STLP_CALL min)() _STLP_NOTHROW { return DBL_MIN; }
+ static double _STLP_CALL denorm_min() _STLP_NOTHROW { return DBL_MIN; }
+ static double (_STLP_CALL max)() _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD 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
+ round_to_nearest> {
+public:
+ static long double (_STLP_CALL min) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MIN; }
+ static long double _STLP_CALL denorm_min() _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MIN; }
+ static long double (_STLP_CALL max) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MAX; }
+ static long double _STLP_CALL epsilon() _STLP_NOTHROW { return LDBL_EPSILON; }
+ static long double _STLP_CALL round_error() _STLP_NOTHROW { return 4; } // Units: ulps.
+ static long double _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_LD_inf(); }
+ static long double _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_LD_qNaN(); }
+ static long double _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_LD_sNaN(); }
+};
+
+#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:
--- /dev/null
+/*
+ *
+ *
+ * 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_LIST_C
+#define _STLP_LIST_C
+
+#ifndef _STLP_INTERNAL_LIST_H
+# include <stl/_list.h>
+#endif
+
+#ifndef _STLP_CARRAY_H
+# include <stl/_carray.h>
+#endif
+
+#ifndef _STLP_RANGE_ERRORS_H
+# include <stl/_range_errors.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+template <class _Dummy>
+void _STLP_CALL
+_List_global<_Dummy>::_Transfer(_List_node_base* __position,
+ _List_node_base* __first, _List_node_base* __last) {
+ if (__position != __last) {
+ // Remove [first, last) from its old position.
+ __last->_M_prev->_M_next = __position;
+ __first->_M_prev->_M_next = __last;
+ __position->_M_prev->_M_next = __first;
+
+ // Splice [first, last) into its new position.
+ _Node_base* __tmp = __position->_M_prev;
+ __position->_M_prev = __last->_M_prev;
+ __last->_M_prev = __first->_M_prev;
+ __first->_M_prev = __tmp;
+ }
+}
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+
+template <class _Tp, class _Alloc>
+void _List_base<_Tp,_Alloc>::clear() {
+ _Node* __cur = __STATIC_CAST(_Node*, _M_node._M_data._M_next);
+ while (__cur != &(_M_node._M_data)) {
+ _Node* __tmp = __cur;
+ __cur = __STATIC_CAST(_Node*, __cur->_M_next);
+ _STLP_STD::_Destroy(&__tmp->_M_data);
+ this->_M_node.deallocate(__tmp, 1);
+ }
+ _M_node._M_data._M_next = &_M_node._M_data;
+ _M_node._M_data._M_prev = &_M_node._M_data;
+}
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define size_type size_t
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define list _STLP_PTR_IMPL_NAME(list)
+#elif defined (_STLP_DEBUG)
+# define list _STLP_NON_DBG_NAME(list)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc>
+void list<_Tp, _Alloc>::resize(size_type __new_size, const _Tp& __x) {
+ iterator __i = begin();
+ size_type __len = 0;
+ for ( ; __i != end() && __len < __new_size; ++__i, ++__len);
+
+ if (__len == __new_size)
+ erase(__i, end());
+ else // __i == end()
+ insert(end(), __new_size - __len, __x);
+}
+
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list<_Tp, _Alloc>& __x) {
+ if (this != &__x) {
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ const_iterator __first2 = __x.begin();
+ const_iterator __last2 = __x.end();
+ while (__first1 != __last1 && __first2 != __last2)
+ *__first1++ = *__first2++;
+ if (__first2 == __last2)
+ erase(__first1, __last1);
+ else
+ insert(__last1, __first2, __last2);
+ }
+ return *this;
+}
+
+template <class _Tp, class _Alloc>
+void list<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) {
+ iterator __i = begin();
+ for ( ; __i != end() && __n > 0; ++__i, --__n)
+ *__i = __val;
+ if (__n > 0)
+ insert(end(), __n, __val);
+ else
+ erase(__i, end());
+}
+
+#if !defined (list)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc, class _Predicate>
+void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred) {
+ typedef typename list<_Tp, _Alloc>::iterator _Literator;
+ _Literator __first = __that.begin();
+ _Literator __last = __that.end();
+ while (__first != __last) {
+ _Literator __next = __first;
+ ++__next;
+ if (__pred(*__first)) __that.erase(__first);
+ __first = __next;
+ }
+}
+
+template <class _Tp, class _Alloc, class _BinaryPredicate>
+void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred) {
+ typedef typename list<_Tp, _Alloc>::iterator _Literator;
+ _Literator __first = __that.begin();
+ _Literator __last = __that.end();
+ if (__first == __last) return;
+ _Literator __next = __first;
+ while (++__next != __last) {
+ if (__binary_pred(*__first, *__next))
+ __that.erase(__next);
+ else
+ __first = __next;
+ __next = __first;
+ }
+}
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp) {
+ typedef typename list<_Tp, _Alloc>::iterator _Literator;
+ _Literator __first1 = __that.begin();
+ _Literator __last1 = __that.end();
+ _Literator __first2 = __x.begin();
+ _Literator __last2 = __x.end();
+ if (__that.get_allocator() == __x.get_allocator()) {
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ _Literator __next = __first2;
+ _List_global_inst::_Transfer(__first1._M_node, __first2._M_node, (++__next)._M_node);
+ __first2 = __next;
+ }
+ else
+ ++__first1;
+ }
+ if (__first2 != __last2)
+ _List_global_inst::_Transfer(__last1._M_node, __first2._M_node, __last2._M_node);
+ }
+ else {
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __first1 = __that.insert(__first1, *__first2);
+ }
+ else
+ ++__first1;
+ }
+ if (__first2 != __last2) {
+ __that.insert(__first1, __first2, __last2);
+ }
+ __x.clear();
+ }
+}
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp) {
+ // Do nothing if the list has length 0 or 1.
+ if (__that._M_node._M_data._M_next == &__that._M_node._M_data ||
+ __that._M_node._M_data._M_next->_M_next == &__that._M_node._M_data)
+ return;
+
+ list<_Tp, _Alloc> __carry(__that.get_allocator());
+ const int NB = 64;
+ _STLP_PRIV _CArray<list<_Tp, _Alloc>, NB> __counter(__carry);
+ int __fill = 0;
+ while (!__that.empty()) {
+ __carry.splice(__carry.begin(), __that, __that.begin());
+ int __i = 0;
+ while (__i < __fill && !__counter[__i].empty()) {
+ _S_merge(__counter[__i], __carry, __comp);
+ __carry.swap(__counter[__i++]);
+ }
+ __carry.swap(__counter[__i]);
+ if (__i == __fill) {
+ ++__fill;
+ if (__fill >= NB) {
+ //Looks like the list has too many elements to be sorted with this algorithm:
+ __stl_throw_overflow_error("list::sort");
+ }
+ }
+ }
+
+ for (int __i = 1; __i < __fill; ++__i)
+ _S_merge(__counter[__i], __counter[__i - 1], __comp);
+ __that.swap(__counter[__fill - 1]);
+}
+
+#if defined (list)
+# undef list
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_LIST_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_LIST_IMPL_H
+#define _STLP_INTERNAL_LIST_IMPL_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
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _List_node_base {
+ _List_node_base* _M_next;
+ _List_node_base* _M_prev;
+};
+
+template <class _Dummy>
+class _List_global {
+public:
+ typedef _List_node_base _Node_base;
+ static void _STLP_CALL _Transfer(_Node_base* __pos,
+ _Node_base* __first, _Node_base* __last);
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _List_global<bool>;
+#endif
+typedef _List_global<bool> _List_global_inst;
+
+template <class _Tp>
+class _List_node : public _List_node_base {
+public:
+ _Tp _M_data;
+ __TRIVIAL_STUFF(_List_node)
+};
+
+struct _List_iterator_base {
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef bidirectional_iterator_tag iterator_category;
+
+ _List_node_base* _M_node;
+
+ _List_iterator_base(_List_node_base* __x) : _M_node(__x) {}
+
+ void _M_incr() { _M_node = _M_node->_M_next; }
+ void _M_decr() { _M_node = _M_node->_M_prev; }
+};
+
+
+template<class _Tp, class _Traits>
+struct _List_iterator : public _List_iterator_base {
+ typedef _Tp value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef typename _Traits::reference reference;
+
+ typedef _List_iterator<_Tp, _Traits> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _List_iterator<_Tp, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _List_iterator<_Tp, _ConstTraits> const_iterator;
+
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _List_node<_Tp> _Node;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ explicit _List_iterator(_List_node_base* __x) : _List_iterator_base(__x) {}
+ _List_iterator() : _List_iterator_base(0) {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _List_iterator(const iterator& __x) : _List_iterator_base(__x._M_node) {}
+
+ reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ this->_M_incr();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ this->_M_incr();
+ return __tmp;
+ }
+ _Self& operator--() {
+ this->_M_decr();
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ this->_M_decr();
+ 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 _List_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* value_type(const _STLP_PRIV _List_iterator<_Tp, _Traits>&) { return 0; }
+inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _List_iterator_base&) { return bidirectional_iterator_tag();}
+inline ptrdiff_t* distance_type(const _STLP_PRIV _List_iterator_base&) { return 0; }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// Base class that encapsulates details of allocators and helps
+// to simplify EH
+
+template <class _Tp, class _Alloc>
+class _List_base {
+protected:
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _List_node_base _Node_base;
+ typedef _List_node<_Tp> _Node;
+ typedef _List_base<_Tp, _Alloc> _Self;
+ typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _Node_allocator_type;
+public:
+ typedef _STLP_alloc_proxy<_Node_base, _Node, _Node_allocator_type> _AllocProxy;
+ typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const _Node_allocator_type&)_M_node, _Tp); }
+
+ _List_base(const allocator_type& __a) : _M_node(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base())
+ { _M_empty_initialize(); }
+ _List_base(__move_source<_Self> src) :
+ _M_node(__move_source<_AllocProxy>(src.get()._M_node)) {
+ if (src.get().empty())
+ //We force this to empty.
+ _M_empty_initialize();
+ else {
+ src.get()._M_empty_initialize();
+ _M_node._M_data._M_prev->_M_next = _M_node._M_data._M_next->_M_prev = &_M_node._M_data;
+ }
+ }
+
+ ~_List_base()
+ { clear(); }
+
+ void clear();
+ bool empty() const { return _M_node._M_data._M_next == &_M_node._M_data; }
+
+ void _M_empty_initialize() {
+ _M_node._M_data._M_next = &_M_node._M_data;
+ _M_node._M_data._M_prev = _M_node._M_data._M_next;
+ }
+
+public:
+ _AllocProxy _M_node;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define list _STLP_PTR_IMPL_NAME(list)
+#elif defined (_STLP_DEBUG)
+# define list _STLP_NON_DBG_NAME(list)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
+class list;
+
+#if !defined (list)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// helper functions to reduce code duplication
+template <class _Tp, class _Alloc, class _Predicate>
+void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred);
+
+template <class _Tp, class _Alloc, class _BinaryPredicate>
+void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp);
+
+#if !defined (list)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc>
+class list : public _STLP_PRIV _List_base<_Tp, _Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list)
+ , public __stlport_class<list<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_PRIV _List_base<_Tp, _Alloc> _Base;
+ typedef list<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV _List_node<_Tp> _Node;
+ typedef _STLP_PRIV _List_node_base _Node_base;
+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;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+ typedef bidirectional_iterator_tag _Iterator_category;
+
+public:
+ typedef _STLP_PRIV _List_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
+ typedef _STLP_PRIV _List_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+protected:
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ _Node_base* _M_create_node(const_reference __x = value_type()) {
+#else
+ _Node_base* _M_create_node(const_reference __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
+ _Node* __p = this->_M_node.allocate(1);
+ _STLP_TRY {
+ _Copy_Construct(&__p->_M_data, __x);
+ }
+ _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
+ return __p;
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ _Node_base* _M_create_node() {
+ _Node* __p = this->_M_node.allocate(1);
+ _STLP_TRY {
+ _STLP_STD::_Construct(&__p->_M_data);
+ }
+ _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
+ return __p;
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+public:
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n, const_reference __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+ const allocator_type& __a = allocator_type())
+#else
+ explicit list(size_type __n)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
+ { this->insert(begin(), __n, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+ list(size_type __n, const_reference __val)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
+ { this->insert(begin(), __n, __val); }
+ list(size_type __n, const_reference __val, const allocator_type& __a)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { this->insert(begin(), __n, __val); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because insert does all of
+ // that anyway.
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { _M_insert(begin(), __first, __last); }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
+ { _M_insert(begin(), __first, __last); }
+# endif
+#else /* _STLP_MEMBER_TEMPLATES */
+ list(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { _M_insert(begin(), __first, __last); }
+ list(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { _M_insert(begin(), __first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(const allocator_type& __a = allocator_type())
+#else
+ list()
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) {}
+ list(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) {}
+
+ list(const _Self& __x) : _STLP_PRIV _List_base<_Tp, _Alloc>(__x.get_allocator())
+ { _M_insert(begin(), __x.begin(), __x.end()); }
+
+ list(__move_source<_Self> src)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {}
+
+ ~list() {}
+
+ _Self& operator = (const _Self& __x);
+
+ iterator begin() { return iterator(this->_M_node._M_data._M_next); }
+ const_iterator begin() const { return const_iterator(this->_M_node._M_data._M_next); }
+
+ iterator end() { return iterator(&this->_M_node._M_data); }
+ const_iterator end() const { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_node._M_data)); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const {
+ size_type __result = distance(begin(), end());
+ return __result;
+ }
+ size_type max_size() const { return size_type(-1); }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(--end()); }
+ const_reference back() const { return *(--end()); }
+
+private:
+ void _M_swap_aux(_Self& __x) {
+ __x._M_node._M_swap_alloc(this->_M_node);
+ __x._M_node._M_data._M_next = this->_M_node._M_data._M_next;
+ __x._M_node._M_data._M_next->_M_prev = &__x._M_node._M_data;
+ __x._M_node._M_data._M_prev = this->_M_node._M_data._M_prev;
+ __x._M_node._M_data._M_prev->_M_next = &__x._M_node._M_data;
+ this->_M_empty_initialize();
+ }
+
+public:
+ void swap(_Self& __x) {
+ if (__x.empty()) {
+ if (this->empty()) {
+ return;
+ }
+ this->_M_swap_aux(__x);
+ } else if (this->empty()) {
+ __x._M_swap_aux(*this);
+ } else {
+ this->_M_node.swap(__x._M_node);
+ _STLP_STD::swap(this->_M_node._M_data._M_prev->_M_next, __x._M_node._M_data._M_prev->_M_next);
+ _STLP_STD::swap(this->_M_node._M_data._M_next->_M_prev, __x._M_node._M_data._M_next->_M_prev);
+ }
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const_reference __x = value_type()) {
+#else
+ iterator insert(iterator __pos, const_reference __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ _Node_base* __tmp = _M_create_node(__x);
+ _Node_base* __n = __pos._M_node;
+ _Node_base* __p = __n->_M_prev;
+ __tmp->_M_next = __n;
+ __tmp->_M_prev = __p;
+ __p->_M_next = __tmp;
+ __n->_M_prev = __tmp;
+ return iterator(__tmp);
+ }
+
+private:
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+ }
+
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template<class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_insert(__pos, __n, __x);
+ }
+ template <class _InputIter>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_insert(iterator __pos, const value_type* __first, const value_type* __last) {
+ for (; __first != __last; ++__first)
+ insert(__pos, *__first);
+ }
+ void _M_insert(iterator __pos, const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary list to avoid the auto reference troubles (infinite loop)
+ for (; __first != __last; ++__first)
+ insert(__pos, *__first);
+ }
+
+public:
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_splice_insert_dispatch(__pos, __first, __last, _Integral());
+ }
+
+private:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template<class _Integer>
+ void _M_splice_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_insert(__pos, __n, __x);
+ }
+ template <class _InputIter>
+ void _M_splice_insert_dispatch(iterator __pos,
+ _InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const value_type* __first, const value_type* __last) {
+ _Self __tmp(__first, __last, this->get_allocator());
+ splice(__pos, __tmp);
+ }
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary list to avoid the auto reference troubles (infinite loop)
+ _Self __tmp(__first, __last, this->get_allocator());
+ splice(__pos, __tmp);
+ }
+
+public:
+ void insert(iterator __pos, size_type __n, const_reference __x)
+ { _M_fill_insert(__pos, __n, __x); }
+
+private:
+ void _M_fill_insert(iterator __pos, size_type __n, const_reference __x) {
+ for ( ; __n > 0; --__n)
+ insert(__pos, __x);
+ }
+
+public:
+ void push_front(const_reference __x) { insert(begin(), __x); }
+ void push_back (const_reference __x) { insert(end(), __x); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos)
+ { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+ void push_front() {insert(begin());}
+ void push_back() {insert(end());}
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ iterator erase(iterator __pos) {
+ _Node_base* __next_node = __pos._M_node->_M_next;
+ _Node_base* __prev_node = __pos._M_node->_M_prev;
+ _Node* __n = __STATIC_CAST(_Node*, __pos._M_node);
+ __prev_node->_M_next = __next_node;
+ __next_node->_M_prev = __prev_node;
+ _STLP_STD::_Destroy(&__n->_M_data);
+ this->_M_node.deallocate(__n, 1);
+ return iterator(__next_node);
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ while (__first != __last)
+ erase(__first++);
+ return __last;
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const_reference __x = value_type());
+#else
+ void resize(size_type __new_size, const_reference __x);
+ void resize(size_type __new_size)
+ { this->resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void pop_front() { erase(begin()); }
+ void pop_back() {
+ iterator __tmp = end();
+ erase(--__tmp);
+ }
+
+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_reference __val) { _M_fill_assign(__n, __val); }
+
+ void _M_fill_assign(size_type __n, const_reference __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());
+ }
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_assign(__n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
+ const __false_type& /*_IsIntegral*/) {
+#else
+ void assign(const value_type *__first2, const value_type *__last2) {
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
+ *__first1 = *__first2;
+ if (__first2 == __last2)
+ erase(__first1, __last1);
+ else
+ insert(__last1, __first2, __last2);
+ }
+ void assign(const_iterator __first2, const_iterator __last2) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
+ *__first1 = *__first2;
+ if (__first2 == __last2)
+ erase(__first1, __last1);
+ else
+ insert(__last1, __first2, __last2);
+ }
+
+public:
+ void splice(iterator __pos, _Self& __x) {
+ if (!__x.empty()) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __x.begin()._M_node, __x.end()._M_node);
+ }
+ else {
+ insert(__pos, __x.begin(), __x.end());
+ __x.clear();
+ }
+ }
+ }
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ iterator __j = __i;
+ ++__j;
+ if (__pos == __i || __pos == __j) return;
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __i._M_node, __j._M_node);
+ }
+ else {
+ insert(__pos, *__i);
+ __x.erase(__i);
+ }
+ }
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
+ if (__first != __last) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __first._M_node, __last._M_node);
+ }
+ else {
+ insert(__pos, __first, __last);
+ __x.erase(__first, __last);
+ }
+ }
+ }
+
+ void remove(const_reference __val) {
+ iterator __first = begin();
+ iterator __last = end();
+ while (__first != __last) {
+ iterator __next = __first;
+ ++__next;
+ if (__val == *__first) erase(__first);
+ __first = __next;
+ }
+ }
+
+ void unique()
+ { _STLP_PRIV _S_unique(*this, equal_to<value_type>()); }
+
+ void merge(_Self& __x)
+ { _STLP_PRIV _S_merge(*this, __x, less<value_type>()); }
+
+ void reverse() {
+ _Node_base* __p = &this->_M_node._M_data;
+ _Node_base* __tmp = __p;
+ do {
+ _STLP_STD::swap(__tmp->_M_next, __tmp->_M_prev);
+ __tmp = __tmp->_M_prev; // Old next node is now prev.
+ } while (__tmp != __p);
+ }
+
+ void sort()
+ { _STLP_PRIV _S_sort(*this, less<value_type>()); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred)
+ { _STLP_PRIV _S_remove_if(*this, __pred); }
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __binary_pred)
+ { _STLP_PRIV _S_unique(*this, __binary_pred); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x,
+ _StrictWeakOrdering __comp) {
+ _STLP_PRIV _S_merge(*this, __x, __comp);
+ }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _STLP_PRIV _S_sort(*this, __comp); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+};
+
+#if defined (list)
+# undef list
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_list.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_list.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_list.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp, class _Alloc>
+_STLP_INLINE_LOOP bool _STLP_CALL
+operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) {
+ typedef typename list<_Tp,_Alloc>::const_iterator const_iterator;
+ const_iterator __end1 = __x.end();
+ const_iterator __end2 = __y.end();
+
+ const_iterator __i1 = __x.begin();
+ const_iterator __i2 = __y.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 list<_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)
+template <class _Tp, class _Alloc>
+struct __move_traits<list<_Tp, _Alloc> > {
+ typedef __stlp_movable implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_LIST_IMPL_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// 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_LOCALE_H
+#define _STLP_INTERNAL_LOCALE_H
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CWCHAR
+# include <stl/_cwchar.h>
+#endif
+
+#ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+#endif
+
+#ifndef _STLP_STRING_FWD_H
+# include <stl/_string_fwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class _Locale_impl; // Forward declaration of opaque type.
+class ios_base;
+class locale;
+
+template <class _CharT, class _Traits, class _Alloc>
+bool __locale_do_operator_call (const locale& __loc,
+ const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y);
+
+_STLP_DECLSPEC _Locale_impl * _STLP_CALL _get_Locale_impl( _Locale_impl *locimpl );
+_STLP_DECLSPEC _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl *locimpl );
+
+template <class _Facet>
+bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW;
+
+template <class _Facet>
+_Facet* _UseFacet(const locale& __loc, const _Facet* __facet);
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define locale _STLP_NO_MEM_T_NAME(loc)
+#endif
+
+class _STLP_CLASS_DECLSPEC locale {
+public:
+ // types:
+ class _STLP_CLASS_DECLSPEC facet : protected _Refcount_Base {
+ protected:
+ /* Here we filter __init_count user value to 0 or 1 because __init_count is a
+ * size_t instance and _Refcount_Base use __stl_atomic_t instances that might
+ * have lower sizeof and generate roll issues. 1 is enough to keep the facet
+ * alive when required.
+ */
+ explicit facet(size_t __init_count = 0) : _Refcount_Base( __init_count == 0 ? 0 : 1 ) {}
+ virtual ~facet();
+ friend class locale;
+ friend class _Locale_impl;
+ friend facet * _STLP_CALL _get_facet( facet * );
+ friend void _STLP_CALL _release_facet( facet *& );
+
+ private: // Invalidate assignment and copying.
+ facet(const facet& ) /* : _Refcount_Base(1) {} */;
+ void operator=(const facet&);
+ };
+
+#if defined (__MVS__) || defined (__OS400__)
+ struct
+#else
+ class
+#endif
+ _STLP_CLASS_DECLSPEC id {
+ friend class locale;
+ friend class _Locale_impl;
+ public:
+ size_t _M_index;
+ static size_t _S_max;
+ };
+
+ typedef int category;
+#if defined (_STLP_STATIC_CONST_INIT_BUG)
+ enum _Category {
+#else
+ static const category
+#endif
+ none = 0x000,
+ collate = 0x010,
+ ctype = 0x020,
+ monetary = 0x040,
+ numeric = 0x100,
+ time = 0x200,
+ messages = 0x400,
+ all = collate | ctype | monetary | numeric | time | messages
+#if defined (_STLP_STATIC_CONST_INIT_BUG)
+ }
+#endif
+ ;
+
+ // construct/copy/destroy:
+ locale() _STLP_NOTHROW;
+ locale(const locale&) _STLP_NOTHROW;
+ explicit locale(const char *);
+ locale(const locale&, const char*, category);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _Facet>
+ locale(const locale& __loc, _Facet* __f) {
+ if ( __f != 0 ) {
+ this->_M_impl = _get_Locale_impl( _copy_Nameless_Locale_impl( __loc._M_impl ) );
+ this->_M_insert(__f, _Facet::id);
+ } else {
+ this->_M_impl = _get_Locale_impl( __loc._M_impl );
+ }
+ }
+#endif // _STLP_MEMBER_TEMPLATES
+
+protected:
+ // those are for internal use
+ locale(_Locale_impl*);
+
+public:
+
+ locale(const locale&, const locale&, category);
+ const locale& operator=(const locale&) _STLP_NOTHROW;
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ virtual
+#endif
+ ~locale() _STLP_NOTHROW;
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) && \
+ !defined(_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _Facet>
+ locale combine(const locale& __loc) const {
+ _Facet *__facet = 0;
+ if (!_HasFacet(__loc, __facet))
+ _M_throw_runtime_error();
+
+ return locale(*this, _UseFacet(__loc, __facet));
+ }
+#endif // _STLP_MEMBER_TEMPLATES && !_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+
+ // locale operations:
+ string name() const;
+
+ bool operator==(const locale&) const;
+ bool operator!=(const locale&) const;
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || defined (_STLP_INLINE_MEMBER_TEMPLATES) || (defined(__MWERKS__) && __MWERKS__ <= 0x2301)
+ bool operator()(const string& __x, const string& __y) const;
+# ifndef _STLP_NO_WCHAR_T
+ bool operator()(const wstring& __x, const wstring& __y) const;
+# endif
+#elif !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _CharT, class _Traits, class _Alloc>
+ bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y) const
+ { return __locale_do_operator_call(*this, __x, __y); }
+#endif
+
+ // global locale objects:
+ static locale _STLP_CALL global(const locale&);
+ static const locale& _STLP_CALL classic();
+
+//protected: // Helper functions for locale globals.
+ facet* _M_get_facet(const id&) const;
+ // same, but throws
+ facet* _M_use_facet(const id&) const;
+ static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_runtime_error(const char* = 0);
+
+protected: // More helper functions.
+ void _M_insert(facet* __f, id& __id);
+
+ // friends:
+ friend class _Locale_impl;
+ friend class ios_base;
+
+protected: // Data members
+ _Locale_impl* _M_impl;
+ _Locale_impl* _M_get_impl() const { return _M_impl; }
+};
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# undef locale
+# define _Locale _STLP_NO_MEM_T_NAME(loc)
+
+class locale : public _Locale {
+public:
+
+ // construct/copy/destroy:
+ locale() _STLP_NOTHROW {}
+ locale(const locale& __loc) _STLP_NOTHROW : _Locale(__loc) {}
+ explicit locale(const char *__str) : _Locale(__str) {}
+ locale(const locale& __loc, const char* __str, category __cat)
+ : _Locale(__loc, __str, __cat) {}
+
+ template <class _Facet>
+ locale(const locale& __loc, _Facet* __f) {
+ if ( __f != 0 ) {
+ this->_M_impl = _get_Locale_impl( _copy_Nameless_Locale_impl( __loc._M_impl ) );
+ this->_M_insert(__f, _Facet::id);
+ } else {
+ this->_M_impl = _get_Locale_impl( __loc._M_impl );
+ }
+ }
+
+private:
+ // those are for internal use
+ locale(_Locale_impl* __impl) : _Locale(__impl) {}
+ locale(const _Locale& __loc) : _Locale(__loc) {}
+
+public:
+
+ locale(const locale& __loc1, const locale& __loc2, category __cat)
+ : _Locale(__loc1, __loc2, __cat) {}
+
+ const locale& operator=(const locale& __loc) _STLP_NOTHROW {
+ _Locale::operator=(__loc);
+ return *this;
+ }
+
+ template <class _Facet>
+ locale combine(const locale& __loc) const {
+ _Facet *__facet = 0;
+ if (!_HasFacet(__loc, __facet))
+ _M_throw_runtime_error();
+
+ return locale(*this, _UseFacet(__loc, __facet));
+ }
+
+ // locale operations:
+ bool operator==(const locale& __loc) const { return _Locale::operator==(__loc); }
+ bool operator!=(const locale& __loc) const { return _Locale::operator!=(__loc); }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y) const
+ { return __locale_do_operator_call(*this, __x, __y); }
+
+ // global locale objects:
+ static locale _STLP_CALL global(const locale& __loc) {
+ return _Locale::global(__loc);
+ }
+ static const locale& _STLP_CALL classic() {
+ return __STATIC_CAST(const locale&, _Locale::classic());
+ }
+
+ // friends:
+ friend class _Locale_impl;
+ friend class ios_base;
+};
+
+#endif /* _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND */
+
+//----------------------------------------------------------------------
+// locale globals
+
+#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+template <class _Facet>
+inline const _Facet&
+_Use_facet<_Facet>::operator *() const
+#else
+template <class _Facet> inline const _Facet& use_facet(const locale& __loc)
+#endif
+{
+ _Facet *__facet = 0;
+ return *_UseFacet(__loc, __facet);
+}
+
+
+#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+template <class _Facet>
+struct has_facet {
+ const locale& __loc;
+ has_facet(const locale& __p_loc) : __loc(__p_loc) {}
+ operator bool() const _STLP_NOTHROW
+#else
+template <class _Facet> inline bool has_facet(const locale& __loc) _STLP_NOTHROW
+#endif
+{
+ _Facet *__facet = 0;
+ return _HasFacet(__loc, __facet);
+}
+
+#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+}; // close class definition
+#endif
+
+template <class _Facet>
+bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW
+{ return (__loc._M_get_facet(_Facet::id) != 0); }
+
+template <class _Facet>
+_Facet* _UseFacet(const locale& __loc, const _Facet* __facet)
+{ return __STATIC_CAST(_Facet*, __loc._M_use_facet(_Facet::id)); }
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_LOCALE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ *
+ * 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_MAP_H
+#define _STLP_INTERNAL_MAP_H
+
+#ifndef _STLP_INTERNAL_TREE_H
+# include <stl/_tree.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key> ),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
+class map
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<map<_Key, _Tp, _Compare, _Alloc> >
+#endif
+{
+ typedef map<_Key, _Tp, _Compare, _Alloc> _Self;
+public:
+
+// typedefs:
+
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<const _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+
+ class value_compare
+ : public binary_function<value_type, value_type, bool> {
+ friend class map<_Key,_Tp,_Compare,_Alloc>;
+ protected :
+ //c is a Standard name (23.3.1), do no make it STLport naming convention compliant.
+ _Compare comp;
+ value_compare(_Compare __c) : comp(__c) {}
+ public:
+ bool operator()(const value_type& __x, const value_type& __y) const
+ { return comp(__x.first, __y.first); }
+ };
+
+protected:
+ typedef _STLP_PRIV _MapTraitsT<value_type> _MapTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_SELECT1ST(value_type, _Key),
+ _MapTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing map
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ // allocation/deallocation
+ map() : _M_t(_Compare(), allocator_type()) {}
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit map(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+#else
+ explicit map(const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) {}
+ explicit map(const _Compare& __comp, const allocator_type& __a)
+#endif
+ : _M_t(__comp, __a) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ map(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ template <class _InputIterator>
+ map(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ map(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); }
+# endif
+
+#else
+ map(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ map(const value_type* __first,
+ const value_type* __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+
+ map(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ map(const_iterator __first, const_iterator __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ map(const _Self& __x) : _M_t(__x._M_t) {}
+
+ map(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return value_compare(_M_t.key_comp()); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Tp& operator[](const _KT& __k) {
+ iterator __i = lower_bound(__k);
+ // __i->first is greater than or equivalent to __k.
+ if (__i == end() || key_comp()(__k, (*__i).first))
+ __i = insert(__i, value_type(__k, _STLP_DEFAULT_CONSTRUCTED(_Tp)));
+ return (*__i).second;
+ }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+
+ // insert/erase
+ pair<iterator,bool> insert(const value_type& __x)
+ { return _M_t.insert_unique(__x); }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _M_t.insert_unique(__pos, __x); }
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_unique(__first, __last); }
+#else
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_unique(__first, __last); }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void erase(iterator __pos) { _M_t.erase(__pos); }
+ size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); }
+ void clear() { _M_t.clear(); }
+
+ // map operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x)
+ { return _M_t.equal_range_unique(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator,const_iterator> equal_range(const _KT& __x) const
+ { return _M_t.equal_range_unique(__x); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MultimapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key> ),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
+class multimap
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<multimap<_Key, _Tp, _Compare, _Alloc> >
+#endif
+{
+ typedef multimap<_Key, _Tp, _Compare, _Alloc> _Self;
+public:
+
+// typedefs:
+
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<const _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+
+ class value_compare : public binary_function<value_type, value_type, bool> {
+ friend class multimap<_Key,_Tp,_Compare,_Alloc>;
+ protected:
+ //comp is a Standard name (23.3.2), do no make it STLport naming convention compliant.
+ _Compare comp;
+ value_compare(_Compare __c) : comp(__c) {}
+ public:
+ bool operator()(const value_type& __x, const value_type& __y) const
+ { return comp(__x.first, __y.first); }
+ };
+
+protected:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _MultimapTraitsT<value_type> _MultimapTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_SELECT1ST(value_type, _Key),
+ _MultimapTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing multimap
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ // allocation/deallocation
+ multimap() : _M_t(_Compare(), allocator_type()) { }
+ explicit multimap(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { }
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+ template <class _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); }
+# endif
+ template <class _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+#else
+ multimap(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+ multimap(const value_type* __first, const value_type* __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+
+ multimap(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+ multimap(const_iterator __first, const_iterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ multimap(const _Self& __x) : _M_t(__x._M_t) {}
+
+ multimap(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return value_compare(_M_t.key_comp()); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+
+ // insert/erase
+ iterator insert(const value_type& __x) { return _M_t.insert_equal(__x); }
+ iterator insert(iterator __pos, const value_type& __x) { return _M_t.insert_equal(__pos, __x); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#else
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_equal(__first, __last); }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+ void erase(iterator __pos) { _M_t.erase(__pos); }
+ size_type erase(const key_type& __x) { return _M_t.erase(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); }
+ void clear() { _M_t.clear(); }
+
+ // multimap operations:
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_t.count(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x)
+ { return _M_t.equal_range(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator,const_iterator> equal_range(const _KT& __x) const
+ { return _M_t.equal_range(__x); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _Compare, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER map<_Key,_Tp,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER multimap<_Key,_Tp,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Key, class _Tp, class _Compare, class _Alloc>
+struct __move_traits<map<_Key,_Tp,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename map<_Key,_Tp,_Compare,_Alloc>::_Rep_type>
+{};
+
+template <class _Key, class _Tp, class _Compare, class _Alloc>
+struct __move_traits<multimap<_Key,_Tp,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename multimap<_Key,_Tp,_Compare,_Alloc>::_Rep_type>
+{};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * 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 (__GNUC__) && !defined (_GLIBCPP_HAVE_MBSTATE_T)
+# define __mbstate_t_defined /* mbstate_t defined in native <cwchar>, so not defined in C! */
+#endif
+
+#if defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_NO_MBSTATE_T) && !defined (_MBSTATE_T) && !defined (__mbstate_t_defined)
+# define _STLP_USE_OWN_MBSTATE_T
+# define _MBSTATE_T
+#endif
+
+#if defined (_STLP_USE_OWN_MBSTATE_T)
+typedef int mbstate_t;
+
+# if defined (__cplusplus)
+_STLP_BEGIN_NAMESPACE
+using ::mbstate_t;
+_STLP_END_NAMESPACE
+# endif
+
+#endif /* _STLP_USE_OWN_MBSTATE_T */
+
+#endif /* _STLP_INTERNAL_MBSTATE_T */
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+
+// 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_MESSAGES_H
+#define _STLP_INTERNAL_MESSAGES_H
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// messages facets
+
+class messages_base {
+ public:
+ typedef int catalog;
+};
+
+template <class _CharT> class messages {};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+class _Messages;
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages<char> : public locale::facet, public messages_base {
+ friend class _Locale_impl;
+public:
+ typedef messages_base::catalog catalog;
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit messages(size_t __refs = 0);
+
+ catalog open(const string& __fn, const locale& __loc) const
+ { return do_open(__fn, __loc); }
+ string_type get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const
+ { return do_get(__c, __set, __msgid, __dfault); }
+ inline void close(catalog __c) const
+ { do_close(__c); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+private:
+ messages(_STLP_PRIV _Messages*);
+
+protected:
+ messages(size_t, _Locale_messages*);
+ ~messages();
+
+ virtual catalog do_open(const string& __fn, const locale& __loc) const;
+ virtual string_type do_get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const;
+ virtual void do_close(catalog __c) const;
+
+ void _M_initialize(const char* __name);
+
+private:
+ _STLP_PRIV _Messages* _M_impl;
+};
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages<wchar_t> : public locale::facet, public messages_base {
+ friend class _Locale_impl;
+public:
+ typedef messages_base::catalog catalog;
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit messages(size_t __refs = 0);
+
+ inline catalog open(const string& __fn, const locale& __loc) const
+ { return do_open(__fn, __loc); }
+ inline string_type get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const
+ { return do_get(__c, __set, __msgid, __dfault); }
+ inline void close(catalog __c) const
+ { do_close(__c); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+private:
+ messages(_STLP_PRIV _Messages*);
+
+protected:
+ messages(size_t, _Locale_messages*);
+ ~messages();
+
+ virtual catalog do_open(const string& __fn, const locale& __loc) const;
+ virtual string_type do_get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const;
+ virtual void do_close(catalog __c) const;
+
+ void _M_initialize(const char* __name);
+
+private:
+ _STLP_PRIV _Messages* _M_impl;
+};
+
+#endif
+
+template <class _CharT> class messages_byname {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages_byname<char> : public messages<char> {
+public:
+ typedef messages_base::catalog catalog;
+ typedef string string_type;
+
+ explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
+
+protected:
+ ~messages_byname();
+
+private:
+ typedef messages_byname<char> _Self;
+ //explicitely defined as private to avoid warnings:
+ messages_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+
+#if !defined (_STLP_NO_WCHAR_T)
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages_byname<wchar_t> : public messages<wchar_t> {
+public:
+ typedef messages_base::catalog catalog;
+ typedef wstring string_type;
+
+ explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
+
+protected:
+ ~messages_byname();
+
+private:
+ typedef messages_byname<wchar_t> _Self;
+ //explicitely defined as private to avoid warnings:
+ messages_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+#endif /* WCHAR_T */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_MESSAGES_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * Copyright (c) 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_MONETARY_C
+#define _STLP_MONETARY_C
+
+# ifndef _STLP_INTERNAL_MONETARY_H
+# include <stl/_monetary.h>
+# endif
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if (_STLP_STATIC_TEMPLATE_DATA > 0)
+
+# if !defined (__BORLANDC__)
+template <class _CharT, class _InputIterator>
+locale::id money_get<_CharT, _InputIterator>::id;
+
+template <class _CharT, class _OutputIterator>
+locale::id money_put<_CharT, _OutputIterator>::id;
+# endif
+
+# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \
+ defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)
+/*
+ * Under cygwin, when STLport is used as a shared library, the id needs
+ * to be specified as imported otherwise they will be duplicated in the
+ * calling executable.
+ */
+template <>
+_STLP_DECLSPEC locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
+/*
+template <>
+_STLP_DECLSPEC locale::id money_get<char, const char*>::id;
+*/
+
+template <>
+_STLP_DECLSPEC locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
+template <>
+_STLP_DECLSPEC locale::id money_put<char, char*>::id;
+
+# if !defined (_STLP_NO_WCHAR_T)
+template <>
+_STLP_DECLSPEC locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
+template <>
+_STLP_DECLSPEC locale::id money_get<wchar_t, const wchar_t*>::id;
+
+template <>
+_STLP_DECLSPEC locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
+template <>
+_STLP_DECLSPEC locale::id money_put<wchar_t, wchar_t*>::id;
+# endif
+
+# endif
+
+#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
+
+//typedef money_get<char, const char*> money_get_char;
+//typedef money_put<char, char*> money_put_char;
+typedef money_get<char, istreambuf_iterator<char, char_traits<char> > > money_get_char_2;
+typedef money_put<char, ostreambuf_iterator<char, char_traits<char> > > money_put_char_2;
+
+//__DECLARE_INSTANCE(locale::id, money_get_char::id, );
+//__DECLARE_INSTANCE(locale::id, money_put_char::id, );
+__DECLARE_INSTANCE(locale::id, money_get_char_2::id, );
+__DECLARE_INSTANCE(locale::id, money_put_char_2::id, );
+
+# ifndef _STLP_NO_WCHAR_T
+
+//typedef money_get<wchar_t, const wchar_t*> money_get_wchar_t;
+//typedef money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_get_wchar_t_2;
+typedef money_put<wchar_t, wchar_t*> money_put_wchar_t;
+typedef money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_put_wchar_t_2;
+
+//__DECLARE_INSTANCE(locale::id, money_get_wchar_t::id, );
+//__DECLARE_INSTANCE(locale::id, money_put_wchar_t::id, );
+__DECLARE_INSTANCE(locale::id, money_get_wchar_t_2::id, );
+__DECLARE_INSTANCE(locale::id, money_put_wchar_t_2::id, );
+
+# endif
+#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
+
+// money_get facets
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// helper functions for do_get
+template <class _InIt1, class _InIt2>
+pair<_InIt1, bool> __get_string( _InIt1 __first, _InIt1 __last,
+ _InIt2 __str_first, _InIt2 __str_last) {
+ while ( __first != __last && __str_first != __str_last && *__first == *__str_first ) {
+ ++__first;
+ ++__str_first;
+ }
+ return make_pair(__first, __str_first == __str_last);
+}
+
+template <class _InIt, class _OuIt, class _CharT>
+bool
+__get_monetary_value(_InIt& __first, _InIt __last, _OuIt __out_ite,
+ const ctype<_CharT>& _c_type,
+ _CharT __point, int __frac_digits, _CharT __sep,
+ const string& __grouping, bool &__syntax_ok) {
+ if (__first == __last || !_c_type.is(ctype_base::digit, *__first))
+ return false;
+
+ char __group_sizes[128];
+ char* __group_sizes_end = __grouping.empty()? 0 : __group_sizes;
+ char __current_group_size = 0;
+
+ while (__first != __last) {
+ if (_c_type.is(ctype_base::digit, *__first)) {
+ ++__current_group_size;
+ *__out_ite++ = *__first++;
+ }
+ else if (__group_sizes_end) {
+ if (*__first == __sep) {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ ++__first;
+ }
+ else break;
+ }
+ else
+ break;
+ }
+
+ if (__grouping.empty())
+ __syntax_ok = true;
+ else {
+ if (__group_sizes_end != __group_sizes)
+ *__group_sizes_end++ = __current_group_size;
+
+ __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end,
+ __grouping.data(), __grouping.data()+ __grouping.size());
+
+ if (__first == __last || *__first != __point) {
+ for (int __digits = 0; __digits != __frac_digits; ++__digits)
+ *__out_ite++ = _CharT('0');
+ return true; // OK not to have decimal point
+ }
+ }
+
+ ++__first;
+
+ int __digits = 0;
+
+ while (__first != __last && _c_type.is(ctype_base::digit, *__first)) {
+ *__out_ite++ = *__first++;
+ ++__digits;
+ }
+
+ __syntax_ok = __syntax_ok && (__digits == __frac_digits);
+
+ return true;
+}
+
+
+template <class _CharT, class _InputIter, class _StrType>
+_InputIter __money_do_get(_InputIter __s, _InputIter __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _StrType& __digits, bool &__is_positive, _CharT* /*__dummy*/) {
+ if (__s == __end) {
+ __err |= ios_base::eofbit;
+ return __s;
+ }
+
+ typedef _CharT char_type;
+ typedef _StrType string_type;
+ typedef _InputIter iter_type;
+ typedef moneypunct<char_type, false> _Punct;
+ typedef moneypunct<char_type, true> _Punct_intl;
+ typedef ctype<char_type> _Ctype;
+
+ locale __loc = __str.getloc();
+ const _Punct& __punct = use_facet<_Punct>(__loc) ;
+ const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
+ const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
+
+ money_base::pattern __format = __intl ? __punct_intl.neg_format()
+ : __punct.neg_format();
+ string_type __ns = __intl ? __punct_intl.negative_sign()
+ : __punct.negative_sign();
+ string_type __ps = __intl ? __punct_intl.positive_sign()
+ : __punct.positive_sign();
+ int __i;
+ bool __symbol_required = (__str.flags() & ios_base::showbase) != 0;
+ string_type __buf;
+ back_insert_iterator<string_type> __out_ite(__buf);
+
+ for (__i = 0; __i < 4; ++__i) {
+ switch (__format.field[__i]) {
+ case money_base::none:
+ if (__i == 3) {
+ if (__c_type.is(ctype_base::space, *__s)) {
+ __err = ios_base::failbit;
+ return __s;
+ }
+ break;
+ }
+ while (__s != __end && __c_type.is(ctype_base::space, *__s))
+ ++__s;
+ break;
+ case money_base::space:
+ if (!__c_type.is(ctype_base::space, *__s)) {
+ __err = ios_base::failbit;
+ return __s;
+ }
+ ++__s;
+ while (__s != __end && __c_type.is(ctype_base::space, *__s))
+ ++__s;
+ break;
+ case money_base::symbol: {
+ string_type __curs = __intl ? __punct_intl.curr_symbol()
+ : __punct.curr_symbol();
+ pair<iter_type, bool>
+ __result = __get_string(__s, __end, __curs.begin(), __curs.end());
+ if (!__result.second && __symbol_required)
+ __err = ios_base::failbit;
+ __s = __result.first;
+ break;
+ }
+ case money_base::sign: {
+ if (__s == __end) {
+ if (__ps.empty())
+ break;
+ if (__ns.empty()) {
+ __is_positive = false;
+ break;
+ }
+ __err = ios_base::failbit;
+ return __s;
+ }
+ else {
+ if (__ps.empty()) {
+ if (__ns.empty())
+ break;
+ if (*__s == __ns[0]) {
+ ++__s;
+ __is_positive = false;
+ }
+ break;
+ }
+ else {
+ if (*__s == __ps[0]) {
+ ++__s;
+ break;
+ }
+ if (__ns.empty())
+ break;
+ if (*__s == __ns[0]) {
+ ++__s;
+ __is_positive = false;
+ break;
+ }
+ __err = ios_base::failbit;
+ }
+ }
+ return __s;
+ }
+ case money_base::value: {
+ char_type __point = __intl ? __punct_intl.decimal_point()
+ : __punct.decimal_point();
+ int __frac_digits = __intl ? __punct_intl.frac_digits()
+ : __punct.frac_digits();
+ string __grouping = __intl ? __punct_intl.grouping()
+ : __punct.grouping();
+ bool __syntax_ok = true;
+
+ bool __result;
+
+ char_type __sep = __grouping.empty() ? char_type() :
+ __intl ? __punct_intl.thousands_sep() : __punct.thousands_sep();
+
+ __result = __get_monetary_value(__s, __end, __out_ite, __c_type,
+ __point, __frac_digits,
+ __sep,
+ __grouping, __syntax_ok);
+
+ if (!__syntax_ok)
+ __err |= ios_base::failbit;
+ if (!__result) {
+ __err = ios_base::failbit;
+ return __s;
+ }
+ break;
+
+ } // Close money_base::value case
+ } // Close switch statement
+ } // Close for loop
+
+ if (__is_positive) {
+ if (__ps.size() > 1) {
+ pair<_InputIter, bool>
+ __result = __get_string(__s, __end, __ps.begin() + 1, __ps.end());
+ __s = __result.first;
+ if (!__result.second)
+ __err |= ios::failbit;
+ }
+ if (!(__err & ios_base::failbit))
+ __digits = __buf;
+ }
+ else {
+ if (__ns.size() > 1) {
+ pair<_InputIter, bool>
+ __result = __get_string(__s, __end, __ns.begin() + 1, __ns.end());
+ __s = __result.first;
+ if (!__result.second)
+ __err |= ios::failbit;
+ }
+ if (!(__err & ios::failbit)) {
+ __digits = __c_type.widen('-');
+ __digits += __buf;
+ }
+ }
+ if (__s == __end)
+ __err |= ios::eofbit;
+
+ return __s;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//===== methods ======
+template <class _CharT, class _InputIter>
+_InputIter
+money_get<_CharT, _InputIter>::do_get(_InputIter __s, _InputIter __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _STLP_LONGEST_FLOAT_TYPE& __units) const {
+ string_type __buf;
+ bool __is_positive = true;
+ __s = _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __buf, __is_positive, (_CharT*)0);
+
+ if (__err == ios_base::goodbit || __err == ios_base::eofbit) {
+ typename string_type::iterator __b = __buf.begin(), __e = __buf.end();
+
+ if (!__is_positive) ++__b;
+ // Can't use atold, since it might be wchar_t. Don't get confused by name below :
+ // it's perfectly capable of reading long double.
+ _STLP_PRIV __get_decimal_integer(__b, __e, __units, (_CharT*)0);
+
+ if (!__is_positive) {
+ __units = -__units;
+ }
+ }
+
+ return __s;
+}
+
+template <class _CharT, class _InputIter>
+_InputIter
+money_get<_CharT, _InputIter>::do_get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ string_type& __digits) const {
+ bool __is_positive = true;
+ return _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __digits, __is_positive, (_CharT*)0);
+}
+
+// money_put facets
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT, class _OutputIter, class _Str_Type, class _Str>
+_OutputIter __money_do_put(_OutputIter __s, bool __intl, ios_base& __str,
+ _CharT __fill, const _Str& __digits, bool __check_digits,
+ _Str_Type * /*__dummy*/) {
+ typedef _CharT char_type;
+ typedef _Str_Type string_type;
+ typedef ctype<char_type> _Ctype;
+ typedef moneypunct<char_type, false> _Punct;
+ typedef moneypunct<char_type, true> _Punct_intl;
+
+ locale __loc = __str.getloc();
+ const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
+ const _Punct& __punct = use_facet<_Punct>(__loc) ;
+ const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
+
+ // some special characters
+ char_type __minus = __c_type.widen('-');
+ char_type __plus = __c_type.widen('+');
+ char_type __space = __c_type.widen(' ');
+ char_type __zero = __c_type.widen('0');
+ char_type __point = __intl ? __punct_intl.decimal_point()
+ : __punct.decimal_point();
+
+ char_type __sep = __intl ? __punct_intl.thousands_sep()
+ : __punct.thousands_sep();
+
+ string __grouping = __intl ? __punct_intl.grouping()
+ : __punct.grouping();
+
+ int __frac_digits = __intl ? __punct_intl.frac_digits()
+ : __punct.frac_digits();
+
+ string_type __curr_sym = __intl ? __punct_intl.curr_symbol()
+ : __punct.curr_symbol();
+
+ // if there are no digits we are going to return __s. If there
+ // are digits, but not enough to fill the frac_digits, we are
+ // going to add zeros. I don't know whether this is right or
+ // not.
+ if (__digits.empty())
+ return __s;
+
+ typename string_type::const_iterator __digits_first = __digits.begin();
+ typename string_type::const_iterator __digits_last = __digits.end();
+
+ bool __is_negative = *__digits_first == __minus;
+ if (__is_negative)
+ ++__digits_first;
+
+#if !defined (__BORLANDC__)
+ string_type __sign = __intl ? __is_negative ? __punct_intl.negative_sign()
+ : __punct_intl.positive_sign()
+ : __is_negative ? __punct.negative_sign()
+ : __punct.positive_sign();
+#else
+ string_type __sign;
+ if (__intl) {
+ if (__is_negative)
+ __sign = __punct_intl.negative_sign();
+ else
+ __sign = __punct_intl.positive_sign();
+ }
+ else {
+ if (__is_negative)
+ __sign = __punct.negative_sign();
+ else
+ __sign = __punct.positive_sign();
+ }
+#endif
+
+ if (__check_digits) {
+ typename string_type::const_iterator __cp = __digits_first;
+ while (__cp != __digits_last && __c_type.is(ctype_base::digit, *__cp))
+ ++__cp;
+ if (__cp == __digits_first)
+ return __s;
+ __digits_last = __cp;
+ }
+
+ // If grouping is required, we make a copy of __digits and
+ // insert the grouping.
+ _STLP_BASIC_IOSTRING(char_type) __new_digits;
+ if (!__grouping.empty()) {
+ __new_digits.assign(__digits_first, __digits_last);
+ __insert_grouping(__new_digits,
+ __new_digits.size() - __frac_digits,
+ __grouping,
+ __sep, __plus, __minus, 0);
+ __digits_first = __new_digits.begin(); // <<--
+ __digits_last = __new_digits.end(); // <<--
+ }
+
+ // Determine the amount of padding required, if any.
+ streamsize __width = __str.width();
+
+#if defined (_STLP_DEBUG) && (defined(__HP_aCC) && (__HP_aCC <= 1))
+ size_t __value_length = operator -(__digits_last, __digits_first);
+#else
+ size_t __value_length = __digits_last - __digits_first;
+#endif
+
+ size_t __length = __value_length + __sign.size();
+
+ if (__frac_digits != 0)
+ ++__length;
+
+ bool __generate_curr = (__str.flags() & ios_base::showbase) !=0;
+ if (__generate_curr)
+ __length += __curr_sym.size();
+ money_base::pattern __format = __intl ? (__is_negative ? __punct_intl.neg_format()
+ : __punct_intl.pos_format())
+ : (__is_negative ? __punct.neg_format()
+ : __punct.pos_format());
+ {
+ //For the moment the following is commented for decoding reason.
+ //No reason to add a space last if the money symbol do not have to be display
+ //if (__format.field[3] == (char) money_base::symbol && !__generate_curr) {
+ // if (__format.field[2] == (char) money_base::space) {
+ // __format.field[2] = (char) money_base::none;
+ // }
+ //}
+ //space can only be second or third and only once (22.2.6.3-1):
+ if ((__format.field[1] == (char) money_base::space) ||
+ (__format.field[2] == (char) money_base::space))
+ ++__length;
+ }
+
+ const bool __need_fill = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __length) < __width)) ||
+ ((sizeof(streamsize) <= sizeof(size_t)) && (__length < __STATIC_CAST(size_t, __width))));
+ streamsize __fill_amt = __need_fill ? __width - __length : 0;
+
+ ios_base::fmtflags __fill_pos = __str.flags() & ios_base::adjustfield;
+
+ if (__fill_amt != 0 &&
+ !(__fill_pos & (ios_base::left | ios_base::internal)))
+ __s = __fill_n(__s, __fill_amt, __fill);
+
+ for (int __i = 0; __i < 4; ++__i) {
+ char __ffield = __format.field[__i];
+ switch (__ffield) {
+ case money_base::none:
+ if (__fill_amt != 0 && __fill_pos == ios_base::internal)
+ __s = __fill_n(__s, __fill_amt, __fill);
+ break;
+ case money_base::space:
+ *__s++ = __space;
+ if (__fill_amt != 0 && __fill_pos == ios_base::internal)
+ __s = __fill_n(__s, __fill_amt, __fill);
+ break;
+ case money_base::symbol:
+ if (__generate_curr)
+ __s = copy(__curr_sym.begin(), __curr_sym.end(), __s);
+ break;
+ case money_base::sign:
+ if (!__sign.empty())
+ *__s++ = __sign[0];
+ break;
+ case money_base::value:
+ if (__frac_digits == 0) {
+ __s = copy(__digits_first, __digits_last, __s);
+ } else {
+ if ((int)__value_length <= __frac_digits) {
+ // if we see '9' here, we should out 0.09
+ *__s++ = __zero; // integer part is zero
+ *__s++ = __point; // decimal point
+ __s = __fill_n(__s, __frac_digits - __value_length, __zero); // zeros
+ __s = copy(__digits_first, __digits_last, __s); // digits
+ } else {
+ __s = copy(__digits_first, __digits_last - __frac_digits, __s);
+ if (__frac_digits != 0) {
+ *__s++ = __point;
+ __s = copy(__digits_last - __frac_digits, __digits_last, __s);
+ }
+ }
+ }
+ break;
+ } //Close for switch
+ } // Close for loop
+
+ // Ouput rest of sign if necessary.
+ if (__sign.size() > 1)
+ __s = copy(__sign.begin() + 1, __sign.end(), __s);
+ if (__fill_amt != 0 &&
+ !(__fill_pos & (ios_base::right | ios_base::internal)))
+ __s = __fill_n(__s, __fill_amt, __fill);
+
+ return __s;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+money_put<_CharT, _OutputIter>
+ ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
+ char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const {
+ _STLP_BASIC_IOSTRING(char_type) __digits;
+ _STLP_PRIV __get_money_digits(__digits, __str, __units);
+ return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, false, __STATIC_CAST(string_type*, 0));
+}
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+money_put<_CharT, _OutputIter>
+ ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
+ char_type __fill, const string_type& __digits) const {
+ return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, true, __STATIC_CAST(string_type*, 0));
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_MONETARY_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// 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_MONETARY_H
+#define _STLP_INTERNAL_MONETARY_H
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class money_base {
+public:
+ enum part {none, space, symbol, sign, value};
+ struct pattern {
+ char field[4];
+ };
+};
+
+// moneypunct facets: forward declaration
+template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool, _International, false) > class moneypunct {};
+
+// money_get facets
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _InputIter>
+#else
+template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class money_get : public locale::facet {
+ friend class _Locale_impl;
+
+public:
+ typedef _CharT char_type;
+ typedef _InputIter iter_type;
+ typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
+
+ money_get(size_t __refs = 0) : locale::facet(__refs) {}
+ iter_type get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _STLP_LONGEST_FLOAT_TYPE& __units) const
+ { return do_get(__s, __end, __intl, __str, __err, __units); }
+ iter_type get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ string_type& __digits) const
+ { return do_get(__s, __end, __intl, __str, __err, __digits); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ ~money_get() {}
+ virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _STLP_LONGEST_FLOAT_TYPE& __units) const;
+ virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ string_type& __digits) const;
+};
+
+
+// moneypunct facets: definition of specializations
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<char, true> : public locale::facet, public money_base {
+
+public:
+ typedef char char_type;
+ typedef string string_type;
+ explicit moneypunct _STLP_PSPEC2(char, true) (size_t __refs = 0);
+
+ char decimal_point() const { return do_decimal_point(); }
+ char thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+# if defined (_STLP_STATIC_CONST_INIT_BUG)
+ enum _IntlVal { intl = 1 } ;
+# else
+ static const bool intl = true;
+# endif
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(char, true) ();
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string do_curr_symbol() const;
+
+ virtual string do_positive_sign() const;
+ virtual string do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+
+ friend class _Locale_impl;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<char, false> : public locale::facet, public money_base
+{
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit moneypunct _STLP_PSPEC2(char, false) (size_t __refs = 0);
+
+ char decimal_point() const { return do_decimal_point(); }
+ char thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+# if defined (_STLP_STATIC_CONST_INIT_BUG)
+ enum _IntlVal { intl = 0 } ;
+# else
+ static const bool intl = false;
+# endif
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(char, false) ();
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string do_curr_symbol() const;
+
+ virtual string do_positive_sign() const;
+ virtual string do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+
+ friend class _Locale_impl;
+};
+
+
+# ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, true> : public locale::facet, public money_base
+{
+ friend class _Locale_impl;
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+ explicit moneypunct _STLP_PSPEC2(wchar_t, true) (size_t __refs = 0);
+ wchar_t decimal_point() const { return do_decimal_point(); }
+ wchar_t thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+# if defined (_STLP_STATIC_CONST_INIT_BUG)
+ enum _IntlVal { intl = 1 } ;
+# else
+ static const bool intl = true;
+# endif
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(wchar_t, true) ();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+};
+
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, false> : public locale::facet, public money_base
+{
+ friend class _Locale_impl;
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+ explicit moneypunct _STLP_PSPEC2(wchar_t, false) (size_t __refs = 0);
+ wchar_t decimal_point() const { return do_decimal_point(); }
+ wchar_t thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+# if defined (_STLP_STATIC_CONST_INIT_BUG)
+ enum _IntlVal { intl = 0 } ;
+# else
+ static const bool intl = false;
+# endif
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(wchar_t, false) ();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+};
+
+# endif
+
+template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool , _International , false) > class moneypunct_byname {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<char, true> : public moneypunct<char, true> {
+public:
+ typedef money_base::pattern pattern;
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(char, true) (const char * __name, size_t __refs = 0,
+ _Locale_name_hint* __hint = 0);
+
+protected:
+ _Locale_monetary* _M_monetary;
+ ~moneypunct_byname _STLP_PSPEC2(char, true) ();
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ typedef moneypunct_byname<char, true> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<char, false> : public moneypunct<char, false>
+{
+public:
+ typedef money_base::pattern pattern;
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(char, false) (const char * __name, size_t __refs = 0,
+ _Locale_name_hint* __hint = 0);
+
+protected:
+ _Locale_monetary* _M_monetary;
+ ~moneypunct_byname _STLP_PSPEC2(char, false) ();
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ typedef moneypunct_byname<char, false> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+ friend _Locale_name_hint* _Locale_extract_hint(moneypunct_byname<char, false>*);
+};
+
+#if !defined (_STLP_NO_WCHAR_T)
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, true> : public moneypunct<wchar_t, true>
+{
+public:
+ typedef money_base::pattern pattern;
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(wchar_t, true) (const char * __name, size_t __refs = 0,
+ _Locale_name_hint* __hint = 0);
+
+protected:
+ _Locale_monetary* _M_monetary;
+ ~moneypunct_byname _STLP_PSPEC2(wchar_t, true) ();
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ typedef moneypunct_byname<wchar_t, true> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, false> : public moneypunct<wchar_t, false>
+{
+public:
+ typedef money_base::pattern pattern;
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(wchar_t, false) (const char * __name, size_t __refs = 0,
+ _Locale_name_hint* __hint = 0);
+
+protected:
+ _Locale_monetary* _M_monetary;
+ ~moneypunct_byname _STLP_PSPEC2(wchar_t, false) ();
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ typedef moneypunct_byname<wchar_t, false> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+#endif
+
+//===== methods ======
+
+
+// money_put facets
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _OutputIter>
+#else
+template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class money_put : public locale::facet {
+ friend class _Locale_impl;
+
+public:
+ typedef _CharT char_type;
+ typedef _OutputIter iter_type;
+ typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
+
+ money_put(size_t __refs = 0) : locale::facet(__refs) {}
+ iter_type put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const
+ { return do_put(__s, __intl, __str, __fill, __units); }
+ iter_type put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill,
+ const string_type& __digits) const
+ { return do_put(__s, __intl, __str, __fill, __digits); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ ~money_put() {}
+ virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const;
+ virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill,
+ const string_type& __digits) const;
+};
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS money_get<char, istreambuf_iterator<char, char_traits<char> > >;
+_STLP_EXPORT_TEMPLATE_CLASS money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+//_STLP_EXPORT_TEMPLATE_CLASS money_get<char, const char* >;
+//_STLP_EXPORT_TEMPLATE_CLASS money_put<char, char* >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+_STLP_EXPORT_TEMPLATE_CLASS money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// _STLP_EXPORT_TEMPLATE_CLASS money_get<wchar_t, const wchar_t* >;
+// _STLP_EXPORT_TEMPLATE_CLASS money_put<wchar_t, wchar_t* >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_monetary.c>
+#endif
+
+#endif /* _STLP_INTERNAL_MONETARY_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
+
--- /dev/null
+/*
+ *
+ * Copyright (c) 2003
+ * François 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_MOVE_CONSTRUCT_FWK_H
+#define _STLP_MOVE_CONSTRUCT_FWK_H
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+/*************************************************************
+ * Move constructor framework
+ *************************************************************/
+
+/*************************************************************
+ *Partial move:
+ *The source HAS to be a valid instance after the move!
+ *************************************************************/
+template <class _Tp>
+class __move_source {
+public:
+ explicit __move_source (_Tp &_src) : _M_data(_src)
+ {}
+
+ _Tp& get() const
+ { return _M_data; }
+private:
+ _Tp &_M_data;
+
+ //We explicitely forbid assignment to avoid warning:
+ typedef __move_source<_Tp> _Self;
+ _Self& operator = (_Self const&);
+};
+
+//Class used to signal move constructor support, implementation and type.
+template <class _Tp>
+struct __move_traits {
+ /*
+ * implemented tells if a the special move constructor has to be called or the classic
+ * copy constructor is just fine. Most of the time the copy constructor is fine only
+ * if the following info is true.
+ */
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && \
+ !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && \
+ !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename _IsSTLportClass<_Tp>::_Ret implemented;
+#else
+ typedef __false_type implemented;
+#endif
+ /*
+ * complete tells if the move is complete or partial, that is to say, does the source
+ * needs to be destroyed once it has been moved.
+ */
+ typedef typename __type_traits<_Tp>::has_trivial_destructor complete;
+};
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+typedef __true_type __stlp_movable;
+#else
+typedef __false_type __stlp_movable;
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * This struct should never be used if the user has not explicitely stipulated
+ * that its class support the full move concept. To check that the return type
+ * in such a case will be __invalid_source<_Tp> to generate a compile error
+ * revealing the configuration problem.
+ */
+template <class _Tp>
+struct _MoveSourceTraits {
+ typedef typename __move_traits<_Tp>::implemented _MvImpRet;
+#if defined (__BORLANDC__)
+ typedef typename __selectT<_MvImpRet,
+#else
+ enum {_MvImp = __type2bool<_MvImpRet>::_Ret};
+ typedef typename __select<_MvImp,
+#endif
+ __move_source<_Tp>,
+ _Tp const&>::_Ret _Type;
+};
+
+//The helper function
+template <class _Tp>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _MoveSourceTraits<_Tp>::_Type
+_AsMoveSource (_Tp &src) {
+ typedef typename _MoveSourceTraits<_Tp>::_Type _SrcType;
+ return _SrcType(src);
+}
+
+//Helper structs used for many class.
+template <class _Tp>
+struct __move_traits_aux {
+ typedef typename __move_traits<_Tp>::implemented implemented;
+ typedef typename __move_traits<_Tp>::complete complete;
+};
+
+template <class _Tp1, class _Tp2>
+struct __move_traits_aux2 {
+ typedef __move_traits<_Tp1> _MoveTraits1;
+ typedef __move_traits<_Tp2> _MoveTraits2;
+
+ typedef typename _Lor2<typename _MoveTraits1::implemented,
+ typename _MoveTraits2::implemented>::_Ret implemented;
+ typedef typename _Land2<typename _MoveTraits1::complete,
+ typename _MoveTraits2::complete>::_Ret complete;
+};
+
+/*
+ * Most of the time a class implement a move constructor but its use depends
+ * on a third party, this is what the following struct are for.
+ */
+template <class _Tp>
+struct __move_traits_help {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Tp>::complete complete;
+};
+
+template <class _Tp1, class _Tp2>
+struct __move_traits_help1 {
+ typedef __move_traits<_Tp1> _MoveTraits1;
+ typedef __move_traits<_Tp2> _MoveTraits2;
+
+ typedef typename _Lor2<typename _MoveTraits1::implemented,
+ typename _MoveTraits2::implemented>::_Ret implemented;
+ typedef typename _Land2<typename _MoveTraits1::complete,
+ typename _MoveTraits2::complete>::_Ret complete;
+};
+
+template <class _Tp1, class _Tp2>
+struct __move_traits_help2 {
+ typedef __move_traits<_Tp1> _MoveTraits1;
+ typedef __move_traits<_Tp2> _MoveTraits2;
+
+ typedef __stlp_movable implemented;
+ typedef typename _Land2<typename _MoveTraits1::complete,
+ typename _MoveTraits2::complete>::_Ret complete;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_MOVE_CONSTRUCT_FWK_H */
--- /dev/null
+/*
+ * 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_NEW
+#define _STLP_INTERNAL_NEW
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+// size_t
+# include <stl/_cstddef.h>
+#endif
+
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x580)
+// new.h uses ::malloc ;(
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+using _STLP_VENDOR_CSTD::malloc;
+#endif
+
+#if !defined (_STLP_NO_NEW_NEW_HEADER)
+# if defined (_STLP_BROKEN_BAD_ALLOC_CLASS)
+# define bad_alloc _STLP_NULLIFIED_BROKEN_BAD_ALLOC_CLASS
+# define nothrow_t _STLP_NULLIFIED_BROKEN_BAD_NOTHROW_T_CLASS
+# define nothrow _STLP_NULLIFIED_BROKEN_BAD_NOTHROW
+# endif
+
+// eMbedded Visual C++ .NET unfortunately uses _INC_NEW for both <new.h> and <new>
+// we undefine the symbol to get the stuff in the SDK's <new>
+# if defined (_STLP_WCE_NET) && defined (_INC_NEW)
+# undef _INC_NEW
+# endif
+
+# if defined (new)
+/* STLport cannot replace native Std library new header if new is a macro,
+ * please define new macro after <new> header inclusion.
+ */
+# error Cannot include native new header as new is a macro.
+# endif
+
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new)
+
+# if defined (_STLP_BROKEN_BAD_ALLOC_CLASS)
+# undef bad_alloc
+# undef nothrow_t
+# undef nothrow
+# undef _STLP_NULLIFIED_BROKEN_BAD_ALLOC_CLASS
+# undef _STLP_NULLIFIED_BROKEN_BAD_NOTHROW_T_CLASS
+# undef _STLP_NULLIFIED_BROKEN_BAD_NOTHROW
+# endif
+#else
+# include <new.h>
+#endif
+
+#if defined (_STLP_NO_BAD_ALLOC) && !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+#endif
+
+#if defined (_STLP_USE_EXCEPTIONS) && defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+# if defined (_STLP_NO_BAD_ALLOC)
+struct nothrow_t {};
+# define nothrow nothrow_t()
+# endif
+
+/*
+ * STLport own bad_alloc exception to be used if the native C++ library
+ * do not define it or when the new operator do not throw it to avoid
+ * a useless library dependency.
+ */
+class bad_alloc : public exception {
+public:
+ bad_alloc () _STLP_NOTHROW_INHERENTLY { }
+ bad_alloc(const bad_alloc&) _STLP_NOTHROW_INHERENTLY { }
+ bad_alloc& operator=(const bad_alloc&) _STLP_NOTHROW_INHERENTLY {return *this;}
+ ~bad_alloc () _STLP_NOTHROW_INHERENTLY { }
+ const char* what() const _STLP_NOTHROW_INHERENTLY { return "bad alloc"; }
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_USE_EXCEPTIONS && (_STLP_NO_BAD_ALLOC || _STLP_NEW_DONT_THROW_BAD_ALLOC) */
+
+#if defined (_STLP_RTTI_BUG)
+_STLP_BEGIN_NAMESPACE
+
+inline void* _STLP_CALL __stl_new(size_t __n)
+{ return ::malloc(__n); }
+
+inline void _STLP_CALL __stl_delete(void* __p)
+{ ::free(__p); }
+_STLP_END_NAMESPACE
+
+#else /* _STLP_RTTI_BUG */
+
+# if defined (_STLP_USE_OWN_NAMESPACE)
+
+_STLP_BEGIN_NAMESPACE
+
+# if !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+using _STLP_VENDOR_EXCEPT_STD::bad_alloc;
+# endif
+
+# if !defined (_STLP_NO_BAD_ALLOC)
+using _STLP_VENDOR_EXCEPT_STD::nothrow_t;
+using _STLP_VENDOR_EXCEPT_STD::nothrow;
+# if defined (_STLP_GLOBAL_NEW_HANDLER)
+using ::new_handler;
+using ::set_new_handler;
+# else
+using _STLP_VENDOR_EXCEPT_STD::new_handler;
+using _STLP_VENDOR_EXCEPT_STD::set_new_handler;
+# endif
+# endif /* !_STLP_NO_BAD_ALLOC */
+
+_STLP_END_NAMESPACE
+# endif /* _STLP_USE_OWN_NAMESPACE */
+
+# if defined (_STLP_USE_EXCEPTIONS) && \
+ (defined (_STLP_NO_NEW_NEW_HEADER) || defined (_STLP_NEW_DONT_THROW_BAD_ALLOC))
+# define _STLP_CHECK_NULL_ALLOC(__x) void* __y = __x; if (__y == 0) { _STLP_THROW(_STLP_STD::bad_alloc()); } return __y
+# else
+# define _STLP_CHECK_NULL_ALLOC(__x) return __x
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+# if ((defined (__IBMCPP__) || defined (__OS400__) || defined (__xlC__) || defined (qTidyHeap)) && defined (__DEBUG_ALLOC__))
+inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator _STLP_NEW(__n, __FILE__, __LINE__)); }
+inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p, __FILE__, __LINE__); }
+# else
+inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator _STLP_NEW(__n)); }
+inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p); }
+# endif
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_RTTI_BUG */
+
+#endif /* _STLP_INTERNAL_NEW */
+
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
--- /dev/null
+/*
+ * Copyright (c) 2000
+ * 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_NULL_STREAM_H
+# define _STLP_NULL_STREAM_H
+
+_STLP_BEGIN_NAMESPACE
+
+struct __null_stream
+{
+ void flush() { }
+};
+
+template <class _Tp>
+__null_stream& operator <<(__null_stream& __x, const _Tp& )
+{
+ return __x;
+}
+
+template <class _Tp>
+__null_stream& operator >>(const _Tp&, __null_stream& __x )
+{
+ return __x;
+}
+
+extern __null_stream cin, cout, cerr, endl, ws, hex, dec;
+
+_STLP_END_NAMESPACE
+
+# endif
--- /dev/null
+/*
+ * Copyright (c) 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_NUM_GET_C
+#define _STLP_NUM_GET_C
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned);
+_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms();
+
+template < class _InputIter, class _Integer, class _CharT>
+_InputIter _STLP_CALL
+__do_get_integer(_InputIter&, _InputIter&, ios_base&, ios_base::iostate&, _Integer&, _CharT*);
+
+// __do_get_integer and its helper functions.
+
+inline bool _STLP_CALL __get_fdigit(char __c, const char*)
+{ return __c >= '0' && __c <= '9'; }
+
+inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *__digits) {
+ if (__c == __sep) {
+ __c = ',' ;
+ return true ;
+ }
+ else
+ return __get_fdigit(__c, __digits);
+}
+
+inline int _STLP_CALL
+__get_digit_from_table(unsigned __index)
+{ return (__index > 127 ? 0xFF : __digit_val_table(__index)); }
+
+template <class _InputIter, class _CharT>
+int
+__get_base_or_zero(_InputIter& __in_ite, _InputIter& __end, ios_base& __str, _CharT*) {
+ _CharT __atoms[5];
+ const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __str._M_ctype_facet());
+
+ __c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms);
+
+ bool __negative = false;
+ _CharT __c = *__in_ite;
+
+ if (__c == __atoms[1] /* __xminus_char */ ) {
+ __negative = true;
+ ++__in_ite;
+ }
+ else if (__c == __atoms[0] /* __xplus_char */ )
+ ++__in_ite;
+
+ int __base;
+ int __valid_zero = 0;
+
+ ios_base::fmtflags __basefield = __str.flags() & ios_base::basefield;
+
+ switch (__basefield) {
+ case ios_base::oct:
+ __base = 8;
+ break;
+ case ios_base::dec:
+ __base = 10;
+ break;
+ case ios_base::hex:
+ __base = 16;
+ if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
+ ++__in_ite;
+ if (__in_ite != __end &&
+ (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ ))
+ ++__in_ite;
+ else
+ __valid_zero = 1; // That zero is valid by itself.
+ }
+ break;
+ default:
+ if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
+ ++__in_ite;
+ if (__in_ite != __end &&
+ (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) {
+ ++__in_ite;
+ __base = 16;
+ }
+ else
+ {
+ __base = 8;
+ __valid_zero = 1; // That zero is still valid by itself.
+ }
+ }
+ else
+ __base = 10;
+ break;
+ }
+ return (__base << 2) | ((int)__negative << 1) | __valid_zero;
+}
+
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_integer(_InputIter& __first, _InputIter& __last,
+ int __base, _Integer& __val,
+ int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __true_type& /*_IsSigned*/) {
+ bool __ovflow = false;
+ _Integer __result = 0;
+ bool __is_group = !__grouping.empty();
+ char __group_sizes[64];
+ char __current_group_size = 0;
+ char* __group_sizes_end = __group_sizes;
+
+ _Integer __over_base = (numeric_limits<_Integer>::min)() / __STATIC_CAST(_Integer, __base);
+
+ for ( ; __first != __last ; ++__first) {
+
+ const _CharT __c = *__first;
+
+ if (__is_group && __c == __separator) {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ continue;
+ }
+
+ int __n = __get_digit_from_table(__c);
+
+ if (__n >= __base)
+ break;
+
+ ++__got;
+ ++__current_group_size;
+
+ if (__result < __over_base)
+ __ovflow = true; // don't need to keep accumulating
+ else {
+ _Integer __next = __STATIC_CAST(_Integer, __base * __result - __n);
+ if (__result != 0)
+ __ovflow = __ovflow || __next >= __result;
+ __result = __next;
+ }
+ }
+
+ if (__is_group && __group_sizes_end != __group_sizes) {
+ *__group_sizes_end++ = __current_group_size;
+ }
+
+ // fbp : added to not modify value if nothing was read
+ if (__got > 0) {
+ __val = __ovflow ? __is_negative ? (numeric_limits<_Integer>::min)()
+ : (numeric_limits<_Integer>::max)()
+ : __is_negative ? __result
+ : __STATIC_CAST(_Integer, -__result);
+ }
+ // overflow is being treated as failure
+ return ((__got > 0) && !__ovflow) &&
+ (__is_group == 0 ||
+ __valid_grouping(__group_sizes, __group_sizes_end,
+ __grouping.data(), __grouping.data()+ __grouping.size()));
+}
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_integer(_InputIter& __first, _InputIter& __last,
+ int __base, _Integer& __val,
+ int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __false_type& /*_IsSigned*/) {
+ bool __ovflow = false;
+ _Integer __result = 0;
+ bool __is_group = !__grouping.empty();
+ char __group_sizes[64];
+ char __current_group_size = 0;
+ char* __group_sizes_end = __group_sizes;
+
+ _Integer __over_base = (numeric_limits<_Integer>::max)() / __STATIC_CAST(_Integer, __base);
+
+ for ( ; __first != __last ; ++__first) {
+
+ const _CharT __c = *__first;
+
+ if (__is_group && __c == __separator) {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ continue;
+ }
+
+ int __n = __get_digit_from_table(__c);
+
+ if (__n >= __base)
+ break;
+
+ ++__got;
+ ++__current_group_size;
+
+ if (__result > __over_base)
+ __ovflow = true; //don't need to keep accumulating
+ else {
+ _Integer __next = __STATIC_CAST(_Integer, __base * __result + __n);
+ if (__result != 0)
+ __ovflow = __ovflow || __next <= __result;
+ __result = __next;
+ }
+ }
+
+ if (__is_group && __group_sizes_end != __group_sizes) {
+ *__group_sizes_end++ = __current_group_size;
+ }
+
+ // fbp : added to not modify value if nothing was read
+ if (__got > 0) {
+ __val = __ovflow ? (numeric_limits<_Integer>::max)()
+ : (__is_negative ? __STATIC_CAST(_Integer, -__result)
+ : __result);
+ }
+
+ // overflow is being treated as failure
+ return ((__got > 0) && !__ovflow) &&
+ (__is_group == 0 ||
+ __valid_grouping(__group_sizes, __group_sizes_end,
+ __grouping.data(), __grouping.data()+ __grouping.size()));
+}
+
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT* /*dummy*/) {
+ string __grp;
+ //Here there is no grouping so separator is not important, we just pass the default charater.
+ return __get_integer(__first, __last, 10, __val, 0, false, _CharT() /*separator*/, __grp, __false_type());
+}
+
+template <class _InputIter, class _Integer, class _CharT>
+_InputIter _STLP_CALL
+__do_get_integer(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
+ ios_base::iostate& __err, _Integer& __val, _CharT* __pc) {
+#if defined (__HP_aCC) && (__HP_aCC == 1)
+ bool _IsSigned = !((_Integer)(-1) > 0);
+#else
+ typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
+#endif
+
+ const numpunct<_CharT>& __numpunct = *__STATIC_CAST(const numpunct<_CharT>*, __str._M_numpunct_facet());
+ const string& __grouping = __str._M_grouping(); // cached copy
+
+ const int __base_or_zero = __get_base_or_zero(__in_ite, __end, __str, __pc);
+ int __got = __base_or_zero & 1;
+
+ bool __result;
+
+ if (__in_ite == __end) { // We may have already read a 0. If so,
+
+ if (__got > 0) { // the result is 0 even if we're at eof.
+ __val = 0;
+ __result = true;
+ }
+ else
+ __result = false;
+ }
+ else {
+ const bool __negative = (__base_or_zero & 2) != 0;
+ const int __base = __base_or_zero >> 2;
+
+#if defined (__HP_aCC) && (__HP_aCC == 1)
+ if (_IsSigned)
+ __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __true_type() );
+ else
+ __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __false_type() );
+#else
+ __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, _IsSigned());
+# endif
+ }
+
+ __err = __STATIC_CAST(ios_base::iostate, __result ? ios_base::goodbit : ios_base::failbit);
+
+ if (__in_ite == __end)
+ __err |= ios_base::eofbit;
+ return __in_ite;
+}
+
+// __read_float and its helper functions.
+template <class _InputIter, class _CharT>
+_InputIter _STLP_CALL
+__copy_sign(_InputIter __first, _InputIter __last, __iostring& __v,
+ _CharT __xplus, _CharT __xminus) {
+ if (__first != __last) {
+ _CharT __c = *__first;
+ if (__c == __xplus)
+ ++__first;
+ else if (__c == __xminus) {
+ __v.push_back('-');
+ ++__first;
+ }
+ }
+ return __first;
+}
+
+
+template <class _InputIter, class _CharT>
+bool _STLP_CALL
+__copy_digits(_InputIter& __first, _InputIter __last,
+ __iostring& __v, const _CharT* __digits) {
+ bool __ok = false;
+
+ for ( ; __first != __last; ++__first) {
+ _CharT __c = *__first;
+ if (__get_fdigit(__c, __digits)) {
+ __v.push_back((char)__c);
+ __ok = true;
+ }
+ else
+ break;
+ }
+ return __ok;
+}
+
+template <class _InputIter, class _CharT>
+bool _STLP_CALL
+__copy_grouped_digits(_InputIter& __first, _InputIter __last,
+ __iostring& __v, const _CharT * __digits,
+ _CharT __sep, const string& __grouping,
+ bool& __grouping_ok) {
+ bool __ok = false;
+ char __group_sizes[64];
+ char*__group_sizes_end = __group_sizes;
+ char __current_group_size = 0;
+
+ for ( ; __first != __last; ++__first) {
+ _CharT __c = *__first;
+ bool __tmp = __get_fdigit_or_sep(__c, __sep, __digits);
+ if (__tmp) {
+ if (__c == ',') {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ }
+ else {
+ __ok = true;
+ __v.push_back((char)__c);
+ ++__current_group_size;
+ }
+ }
+ else
+ break;
+ }
+
+ if (__group_sizes_end != __group_sizes)
+ *__group_sizes_end++ = __current_group_size;
+ __grouping_ok = __valid_grouping(__group_sizes, __group_sizes_end, __grouping.data(), __grouping.data() + __grouping.size());
+ return __ok;
+}
+
+
+template <class _InputIter, class _CharT>
+bool _STLP_CALL
+__read_float(__iostring& __buf, _InputIter& __in_ite, _InputIter& __end, ios_base& __s, _CharT*) {
+ // Create a string, copying characters of the form
+ // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)?
+
+ bool __digits_before_dot /* = false */;
+ bool __digits_after_dot = false;
+ bool __ok;
+
+ bool __grouping_ok = true;
+
+ const ctype<_CharT>& __ct = *__STATIC_CAST(const ctype<_CharT>*, __s._M_ctype_facet());
+ const numpunct<_CharT>& __numpunct = *__STATIC_CAST(const numpunct<_CharT>*, __s._M_numpunct_facet());
+ const string& __grouping = __s._M_grouping(); // cached copy
+
+ _CharT __dot = __numpunct.decimal_point();
+ _CharT __sep = __numpunct.thousands_sep();
+
+ _CharT __digits[10];
+ _CharT __xplus;
+ _CharT __xminus;
+
+ _CharT __pow_e;
+ _CharT __pow_E;
+
+ _Initialize_get_float(__ct, __xplus, __xminus, __pow_e, __pow_E, __digits);
+
+ // Get an optional sign
+ __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
+
+ // Get an optional string of digits.
+ if (!__grouping.empty())
+ __digits_before_dot = __copy_grouped_digits(__in_ite, __end, __buf, __digits,
+ __sep, __grouping, __grouping_ok);
+ else
+ __digits_before_dot = __copy_digits(__in_ite, __end, __buf, __digits);
+
+ // Get an optional decimal point, and an optional string of digits.
+ if (__in_ite != __end && *__in_ite == __dot) {
+ __buf.push_back('.');
+ ++__in_ite;
+ __digits_after_dot = __copy_digits(__in_ite, __end, __buf, __digits);
+ }
+
+ // There have to be some digits, somewhere.
+ __ok = __digits_before_dot || __digits_after_dot;
+
+ // Get an optional exponent.
+ if (__ok && __in_ite != __end && (*__in_ite == __pow_e || *__in_ite == __pow_E)) {
+ __buf.push_back('e');
+ ++__in_ite;
+ __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
+ __ok = __copy_digits(__in_ite, __end, __buf, __digits);
+ // If we have an exponent then the sign
+ // is optional but the digits aren't.
+ }
+
+ return __ok;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//
+// num_get<>, num_put<>
+//
+
+#if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
+# if !defined (__BORLANDC__)
+template <class _CharT, class _InputIterator>
+locale::id num_get<_CharT, _InputIterator>::id;
+# endif
+
+# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \
+ defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)
+/*
+ * Under cygwin, when STLport is used as a shared library, the id needs
+ * to be specified as imported otherwise they will be duplicated in the
+ * calling executable.
+ */
+template <>
+_STLP_DECLSPEC locale::id num_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
+/*
+template <>
+_STLP_DECLSPEC locale::id num_get<char, const char*>::id;
+*/
+
+# if !defined (STLP_NO_WCHAR_T)
+template <>
+_STLP_DECLSPEC locale::id num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
+/*
+template <>
+_STLP_DECLSPEC locale::id num_get<wchar_t, const wchar_t*>::id;
+*/
+# endif
+
+# endif /* __CYGWIN__ && _STLP_USE_DYNAMIC_LIB */
+
+#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
+
+//typedef num_get<char, const char*> num_get_char;
+typedef num_get<char, istreambuf_iterator<char, char_traits<char> > > num_get_char_2;
+
+//__DECLARE_INSTANCE(locale::id, num_get_char::id, );
+__DECLARE_INSTANCE(locale::id, num_get_char_2::id, );
+
+# if !defined (_STLP_NO_WCHAR_T)
+
+//typedef num_get<wchar_t, const wchar_t*> num_get_wchar_t;
+typedef num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > num_get_wchar_t_2;
+
+//__DECLARE_INSTANCE(locale::id, num_get_wchar_t::id, );
+__DECLARE_INSTANCE(locale::id, num_get_wchar_t_2::id, );
+
+# endif
+
+#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
+
+#if !defined (_STLP_NO_BOOL)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end,
+ ios_base& __s,
+ ios_base::iostate& __err, bool& __x) const {
+ if (__s.flags() & ios_base::boolalpha) {
+ locale __loc = __s.getloc();
+ const _Numpunct& __np = *__STATIC_CAST(const _Numpunct*, __s._M_numpunct_facet());
+ // const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc) ;
+// const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc) ;
+
+ const basic_string<_CharT> __truename = __np.truename();
+ const basic_string<_CharT> __falsename = __np.falsename();
+ bool __true_ok = true;
+ bool __false_ok = true;
+
+ size_t __n = 0;
+ for ( ; __in_ite != __end; ++__in_ite) {
+ _CharT __c = *__in_ite;
+ __true_ok = __true_ok && (__c == __truename[__n]);
+ __false_ok = __false_ok && (__c == __falsename[__n]);
+ ++__n;
+
+ if ((!__true_ok && !__false_ok) ||
+ (__true_ok && __n >= __truename.size()) ||
+ (__false_ok && __n >= __falsename.size())) {
+ ++__in_ite;
+ break;
+ }
+ }
+ if (__true_ok && __n < __truename.size()) __true_ok = false;
+ if (__false_ok && __n < __falsename.size()) __false_ok = false;
+
+ if (__true_ok || __false_ok) {
+ __err = ios_base::goodbit;
+ __x = __true_ok;
+ }
+ else
+ __err = ios_base::failbit;
+
+ if (__in_ite == __end)
+ __err |= ios_base::eofbit;
+
+ return __in_ite;
+ }
+
+ else {
+ long __lx;
+ _InputIter __tmp = this->do_get(__in_ite, __end, __s, __err, __lx);
+ if (!(__err & ios_base::failbit)) {
+ if (__lx == 0)
+ __x = false;
+ else if (__lx == 1)
+ __x = true;
+ else
+ __err |= ios_base::failbit;
+ }
+ return __tmp;
+ }
+}
+
+#endif /* _STLP_NO_BOOL */
+
+#if defined (_STLP_FIX_LIBRARY_ISSUES)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, short& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, int& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+#endif
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned short& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned int& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned long& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ float& __val) const {
+ _STLP_PRIV __iostring __buf ;
+ bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 );
+ _STLP_PRIV __string_to_float(__buf, __val);
+ __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
+ if (__in_ite == __end)
+ __err |= ios_base::eofbit;
+ return __in_ite;
+}
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ double& __val) const {
+ _STLP_PRIV __iostring __buf ;
+ bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 );
+ _STLP_PRIV __string_to_float(__buf, __val);
+ __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
+ if (__in_ite == __end)
+ __err |= ios_base::eofbit;
+ return __in_ite;
+}
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ long double& __val) const {
+ _STLP_PRIV __iostring __buf ;
+ bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 );
+ _STLP_PRIV __string_to_float(__buf, __val);
+ __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
+ if (__in_ite == __end)
+ __err |= ios_base::eofbit;
+ return __in_ite;
+}
+#endif /* _STLP_NO_LONG_DOUBLE */
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ void*& __p) const {
+#if defined (_STLP_LONG_LONG) && !defined (__MRC__) //*ty 12/07/2001 - MrCpp can not cast from long long to void*
+ unsigned _STLP_LONG_LONG __val;
+#else
+ unsigned long __val;
+#endif
+ iter_type __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
+ if (!(__err & ios_base::failbit))
+ __p = __REINTERPRET_CAST(void*,__val);
+ return __tmp;
+ }
+
+#if defined (_STLP_LONG_LONG)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ _STLP_LONG_LONG& __val) const {
+ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
+}
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned _STLP_LONG_LONG& __val) const {
+ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
+}
+#endif /* _STLP_LONG_LONG */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_NUMERIC_FACETS_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// 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_NUM_GET_H
+#define _STLP_INTERNAL_NUM_GET_H
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
+# include <stl/_iostream_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// num_get facets
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _InputIter>
+#else
+template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class num_get: public locale::facet {
+ friend class _Locale_impl;
+public:
+ typedef _CharT char_type;
+ typedef _InputIter iter_type;
+
+ explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
+
+#if !defined (_STLP_NO_BOOL)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, bool& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+#endif
+
+#if defined (_STLP_FIX_LIBRARY_ISSUES)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, short& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, int& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+#endif
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned short& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned int& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned long& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+#if defined (_STLP_LONG_LONG)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, _STLP_LONG_LONG& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+#endif /* _STLP_LONG_LONG */
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, float& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, double& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long double& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+# endif
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, void*& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ ~num_get() {}
+
+ typedef string string_type;
+ typedef ctype<_CharT> _Ctype;
+ typedef numpunct<_CharT> _Numpunct;
+
+#if !defined (_STLP_NO_BOOL)
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, bool& __val) const;
+#endif
+
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned short& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned int& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned long& __val) const;
+
+#if defined (_STLP_FIX_LIBRARY_ISSUES)
+ // issue 118 : those are actually not supposed to be here
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, short& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, int& __val) const;
+#endif
+
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, float& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, double& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, void*& __p) const;
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long double& __val) const;
+#endif
+
+#if defined (_STLP_LONG_LONG)
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, _STLP_LONG_LONG& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const;
+#endif
+
+};
+
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS num_get<char, istreambuf_iterator<char, char_traits<char> > >;
+// _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
+# endif
+#endif
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*);
+
+# if !defined (_STLP_NO_WCHAR_T)
+bool _STLP_DECLSPEC _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
+bool _STLP_DECLSPEC _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
+# endif
+
+inline void _STLP_CALL
+_Initialize_get_float(const ctype<char>&,
+ char& Plus, char& Minus,
+ char& pow_e, char& pow_E,
+ char*) {
+ Plus = '+';
+ Minus = '-';
+ pow_e = 'e';
+ pow_E = 'E';
+}
+
+# if !defined (_STLP_NO_WCHAR_T)
+void _STLP_DECLSPEC _STLP_CALL _Initialize_get_float(const ctype<wchar_t>&,
+ wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
+# endif
+void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, float&);
+void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, double&);
+# if !defined (_STLP_NO_LONG_DOUBLE)
+void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, long double&);
+# endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_num_get.c>
+#endif
+
+#endif /* _STLP_INTERNAL_NUM_GET_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * Copyright (c) 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_NUM_PUT_C
+#define _STLP_NUM_PUT_C
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// __do_put_float and its helper functions. Strategy: write the output
+// to a buffer of char, transform the buffer to _CharT, and then copy
+// it to the output.
+
+//----------------------------------------------------------------------
+// num_put facet
+
+template <class _CharT, class _OutputIter>
+_OutputIter _STLP_CALL
+__copy_float_and_fill(const _CharT* __first, const _CharT* __last,
+ _OutputIter __oi,
+ ios_base::fmtflags __flags,
+ streamsize __width, _CharT __fill,
+ _CharT __xplus, _CharT __xminus) {
+ if (__width <= __last - __first)
+ return copy(__first, __last, __oi);
+ else {
+ streamsize __pad = __width - (__last - __first);
+ ios_base::fmtflags __dir = __flags & ios_base::adjustfield;
+
+ if (__dir == ios_base::left) {
+ __oi = copy(__first, __last, __oi);
+ return __fill_n(__oi, __pad, __fill);
+ }
+ else if (__dir == ios_base::internal && __first != __last &&
+ (*__first == __xplus || *__first == __xminus)) {
+ *__oi++ = *__first++;
+ __oi = __fill_n(__oi, __pad, __fill);
+ return copy(__first, __last, __oi);
+ }
+ else {
+ __oi = __fill_n(__oi, __pad, __fill);
+ return copy(__first, __last, __oi);
+ }
+ }
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+// Helper routine for wchar_t
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_float(__iostring &__str, _OutputIter __oi,
+ ios_base& __f, wchar_t __fill,
+ wchar_t __decimal_point, wchar_t __sep,
+ size_t __group_pos, const string& __grouping) {
+ const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet());
+
+ __iowstring __wbuf;
+ __convert_float_buffer(__str, __wbuf, __ct, __decimal_point);
+
+ if (!__grouping.empty()) {
+ __insert_grouping(__wbuf, __group_pos, __grouping,
+ __sep, __ct.widen('+'), __ct.widen('-'), 0);
+ }
+
+ return __copy_float_and_fill(__CONST_CAST(wchar_t*, __wbuf.data()),
+ __CONST_CAST(wchar_t*, __wbuf.data()) + __wbuf.size(), __oi,
+ __f.flags(), __f.width(0), __fill, __ct.widen('+'), __ct.widen('-'));
+}
+#endif /* WCHAR_T */
+
+// Helper routine for char
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_float(__iostring &__str, _OutputIter __oi,
+ ios_base& __f, char __fill,
+ char __decimal_point, char __sep,
+ size_t __group_pos, const string& __grouping) {
+ if ((__group_pos < __str.size()) && (__str[__group_pos] == '.')) {
+ __str[__group_pos] = __decimal_point;
+ }
+
+ if (!__grouping.empty()) {
+ __insert_grouping(__str, __group_pos,
+ __grouping, __sep, '+', '-', 0);
+ }
+
+ return __copy_float_and_fill(__CONST_CAST(char*, __str.data()),
+ __CONST_CAST(char*, __str.data()) + __str.size(), __oi,
+ __f.flags(), __f.width(0), __fill, '+', '-');
+}
+
+template <class _CharT, class _OutputIter, class _Float>
+_OutputIter _STLP_CALL
+__do_put_float(_OutputIter __s, ios_base& __f,
+ _CharT __fill, _Float __x) {
+ __iostring __buf;
+
+ size_t __group_pos = __write_float(__buf, __f.flags(), (int)__f.precision(), __x);
+
+ const numpunct<_CharT>& __np = *__STATIC_CAST(const numpunct<_CharT>*, __f._M_numpunct_facet());
+
+ return __put_float(__buf, __s, __f, __fill,
+ __np.decimal_point(), __np.thousands_sep(),
+ __group_pos, __f._M_grouping());
+}
+
+inline void __get_money_digits_aux (__iostring &__buf, ios_base &, _STLP_LONGEST_FLOAT_TYPE __x)
+{ __get_floor_digits(__buf, __x); }
+
+#if !defined (_STLP_NO_WCHAR_T)
+inline void __get_money_digits_aux (__iowstring &__wbuf, ios_base &__f, _STLP_LONGEST_FLOAT_TYPE __x) {
+ __iostring __buf;
+ __get_floor_digits(__buf, __x);
+
+ const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet());
+ __convert_float_buffer(__buf, __wbuf, __ct, wchar_t(0), false);
+}
+#endif
+
+template <class _CharT>
+void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT) &__buf, ios_base& __f, _STLP_LONGEST_FLOAT_TYPE __x)
+{ __get_money_digits_aux(__buf, __f, __x); }
+
+// _M_do_put_integer and its helper functions.
+
+template <class _CharT, class _OutputIter>
+_OutputIter _STLP_CALL
+__copy_integer_and_fill(const _CharT* __buf, ptrdiff_t __len,
+ _OutputIter __oi,
+ ios_base::fmtflags __flg, streamsize __wid, _CharT __fill,
+ _CharT __xplus, _CharT __xminus) {
+ if (__len >= __wid)
+ return copy(__buf, __buf + __len, __oi);
+ else {
+ //casting numeric_limits<ptrdiff_t>::max to streamsize only works is ptrdiff_t is signed or streamsize representation
+ //is larger than ptrdiff_t one.
+ _STLP_STATIC_ASSERT(((sizeof(streamsize) > sizeof(ptrdiff_t)) ||
+ (sizeof(streamsize) == sizeof(ptrdiff_t))) && numeric_limits<ptrdiff_t>::is_signed)
+ ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()),
+ __STATIC_CAST(streamsize, __wid - __len)));
+ ios_base::fmtflags __dir = __flg & ios_base::adjustfield;
+
+ if (__dir == ios_base::left) {
+ __oi = copy(__buf, __buf + __len, __oi);
+ return __fill_n(__oi, __pad, __fill);
+ }
+ else if (__dir == ios_base::internal && __len != 0 &&
+ (__buf[0] == __xplus || __buf[0] == __xminus)) {
+ *__oi++ = __buf[0];
+ __oi = __fill_n(__oi, __pad, __fill);
+ return copy(__buf + 1, __buf + __len, __oi);
+ }
+ else if (__dir == ios_base::internal && __len >= 2 &&
+ (__flg & ios_base::showbase) &&
+ (__flg & ios_base::basefield) == ios_base::hex) {
+ *__oi++ = __buf[0];
+ *__oi++ = __buf[1];
+ __oi = __fill_n(__oi, __pad, __fill);
+ return copy(__buf + 2, __buf + __len, __oi);
+ }
+ else {
+ __oi = __fill_n(__oi, __pad, __fill);
+ return copy(__buf, __buf + __len, __oi);
+ }
+ }
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+// Helper function for wchar_t
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_integer(char* __buf, char* __iend, _OutputIter __s,
+ ios_base& __f,
+ ios_base::fmtflags __flags, wchar_t __fill) {
+ locale __loc = __f.getloc();
+ // const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__loc);
+ const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet());
+
+ wchar_t __xplus = __ct.widen('+');
+ wchar_t __xminus = __ct.widen('-');
+
+ wchar_t __wbuf[64];
+ __ct.widen(__buf, __iend, __wbuf);
+ ptrdiff_t __len = __iend - __buf;
+ wchar_t* __eend = __wbuf + __len;
+
+ // const numpunct<wchar_t>& __np = use_facet<numpunct<wchar_t> >(__loc);
+ // const string& __grouping = __np.grouping();
+
+ const numpunct<wchar_t>& __np = *__STATIC_CAST(const numpunct<wchar_t>*, __f._M_numpunct_facet());
+ const string& __grouping = __f._M_grouping();
+
+ if (!__grouping.empty()) {
+ int __basechars;
+ if (__flags & ios_base::showbase)
+ switch (__flags & ios_base::basefield) {
+ case ios_base::hex: __basechars = 2; break;
+ case ios_base::oct: __basechars = 1; break;
+ default: __basechars = 0;
+ }
+ else
+ __basechars = 0;
+
+ __len = __insert_grouping(__wbuf, __eend, __grouping, __np.thousands_sep(),
+ __xplus, __xminus, __basechars);
+ }
+
+ return __copy_integer_and_fill((wchar_t*)__wbuf, __len, __s,
+ __flags, __f.width(0), __fill, __xplus, __xminus);
+}
+#endif
+
+// Helper function for char
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_integer(char* __buf, char* __iend, _OutputIter __s,
+ ios_base& __f, ios_base::fmtflags __flags, char __fill) {
+ char __grpbuf[64];
+ ptrdiff_t __len = __iend - __buf;
+
+ // const numpunct<char>& __np = use_facet<numpunct<char> >(__f.getloc());
+ // const string& __grouping = __np.grouping();
+
+ const numpunct<char>& __np = *__STATIC_CAST(const numpunct<char>*, __f._M_numpunct_facet());
+ const string& __grouping = __f._M_grouping();
+
+ if (!__grouping.empty()) {
+ int __basechars;
+ if (__flags & ios_base::showbase)
+ switch (__flags & ios_base::basefield) {
+ case ios_base::hex: __basechars = 2; break;
+ case ios_base::oct: __basechars = 1; break;
+ default: __basechars = 0;
+ }
+ else
+ __basechars = 0;
+
+ // make sure there is room at the end of the buffer
+ // we pass to __insert_grouping
+ copy(__buf, __iend, (char *) __grpbuf);
+ __buf = __grpbuf;
+ __iend = __grpbuf + __len;
+ __len = __insert_grouping(__buf, __iend, __grouping, __np.thousands_sep(),
+ '+', '-', __basechars);
+ }
+
+ return __copy_integer_and_fill(__buf, __len, __s, __flags, __f.width(0), __fill, '+', '-');
+}
+
+#if defined (_STLP_LONG_LONG)
+typedef _STLP_LONG_LONG __max_int_t;
+typedef unsigned _STLP_LONG_LONG __umax_int_t;
+#else
+typedef long __max_int_t;
+typedef unsigned long __umax_int_t;
+#endif
+
+_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo();
+_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi();
+
+template <class _Integer>
+inline char* _STLP_CALL
+__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __true_type& /* is_signed */) {
+ const bool __negative = __x < 0 ;
+ __max_int_t __temp = __x;
+ __umax_int_t __utemp = __negative?-__temp:__temp;
+
+ for (; __utemp != 0; __utemp /= 10)
+ *--__ptr = (char)((int)(__utemp % 10) + '0');
+ // put sign if needed or requested
+ if (__negative)
+ *--__ptr = '-';
+ else if (__flags & ios_base::showpos)
+ *--__ptr = '+';
+ return __ptr;
+}
+
+template <class _Integer>
+inline char* _STLP_CALL
+__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __false_type& /* is_signed */) {
+ for (; __x != 0; __x /= 10)
+ *--__ptr = (char)((int)(__x % 10) + '0');
+ // put sign if requested
+ if (__flags & ios_base::showpos)
+ *--__ptr = '+';
+ return __ptr;
+}
+
+template <class _Integer>
+char* _STLP_CALL
+__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x) {
+ char* __ptr = __buf;
+
+ if (__x == 0) {
+ *--__ptr = '0';
+ if ((__flags & ios_base::showpos) && ((__flags & (ios_base::oct | ios_base::hex)) == 0))
+ *--__ptr = '+';
+ // oct or hex base shall not be added to the 0 value (see '#' flag in C formating strings)
+ }
+ else {
+ switch (__flags & ios_base::basefield) {
+ case ios_base::oct:
+ {
+ __umax_int_t __temp = __x;
+ // if the size of integer is less than 8, clear upper part
+ if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 )
+ __temp &= 0xFFFFFFFF;
+
+ for (; __temp != 0; __temp >>=3)
+ *--__ptr = (char)((((unsigned)__temp)& 0x7) + '0');
+
+ // put leading '0' if showbase is set
+ if (__flags & ios_base::showbase)
+ *--__ptr = '0';
+ }
+ break;
+ case ios_base::hex:
+ {
+ const char* __table_ptr = (__flags & ios_base::uppercase) ?
+ __hex_char_table_hi() : __hex_char_table_lo();
+ __umax_int_t __temp = __x;
+ // if the size of integer is less than 8, clear upper part
+ if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 )
+ __temp &= 0xFFFFFFFF;
+
+ for (; __temp != 0; __temp >>=4)
+ *--__ptr = __table_ptr[((unsigned)__temp & 0xF)];
+
+ if (__flags & ios_base::showbase) {
+ *--__ptr = __table_ptr[16];
+ *--__ptr = '0';
+ }
+ }
+ break;
+ //case ios_base::dec:
+ default:
+ {
+#if defined(__HP_aCC) && (__HP_aCC == 1)
+ bool _IsSigned = !((_Integer)-1 > 0);
+ if (_IsSigned)
+ __ptr = __write_decimal_backward(__ptr, __x, __flags, __true_type() );
+ else
+ __ptr = __write_decimal_backward(__ptr, __x, __flags, __false_type() );
+#else
+ typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
+ __ptr = __write_decimal_backward(__ptr, __x, __flags, _IsSigned());
+#endif
+ }
+ break;
+ }
+ }
+
+ // return pointer to beginning of the string
+ return __ptr;
+}
+
+template <class _CharT, class _OutputIter, class _Integer>
+_OutputIter _STLP_CALL
+__do_put_integer(_OutputIter __s, ios_base& __f, _CharT __fill, _Integer __x) {
+ // buffer size = number of bytes * number of digit necessary in the smallest Standard base (base 8, 3 digits/byte)
+ // plus the longest base representation '0x'
+ // Do not use __buf_size to define __buf static buffer, some compilers (HP aCC) do not accept const variable as
+ // the specification of a static buffer size.
+ char __buf[sizeof(_Integer) * 3 + 2];
+ const ptrdiff_t __buf_size = sizeof(__buf) / sizeof(char);
+ ios_base::fmtflags __flags = __f.flags();
+ char* __ibeg = __write_integer_backward((char*)__buf+__buf_size, __flags, __x);
+ return __put_integer(__ibeg, (char*)__buf+__buf_size, __s, __f, __flags, __fill);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//
+// num_put<>
+//
+
+#if (_STLP_STATIC_TEMPLATE_DATA > 0)
+
+# if !defined (__BORLANDC__)
+template <class _CharT, class _OutputIterator>
+locale::id num_put<_CharT, _OutputIterator>::id;
+# endif
+
+# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \
+ defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)
+/*
+ * Under cygwin, when STLport is used as a shared library, the id needs
+ * to be specified as imported otherwise they will be duplicated in the
+ * calling executable.
+ */
+template <>
+_STLP_DECLSPEC locale::id num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
+/*
+template <>
+_STLP_DECLSPEC locale::id num_put<char, char*>::id;
+*/
+
+# if !defined (_STLP_NO_WCHAR_T)
+template <>
+_STLP_DECLSPEC locale::id num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
+/*
+template <>
+_STLP_DECLSPEC locale::id num_put<wchar_t, wchar_t*>::id;
+*/
+# endif
+
+# endif /* __CYGWIN__ && _STLP_USE_DYNAMIC_LIB */
+
+#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
+
+//typedef num_put<char, char*> num_put_char;
+typedef num_put<char, ostreambuf_iterator<char, char_traits<char> > > num_put_char_2;
+
+//__DECLARE_INSTANCE(locale::id, num_put_char::id, );
+__DECLARE_INSTANCE(locale::id, num_put_char_2::id, );
+
+# if !defined (_STLP_NO_WCHAR_T)
+
+//typedef num_put<wchar_t, wchar_t*> num_put_wchar_t;
+typedef num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > num_put_wchar_t_2;
+
+//__DECLARE_INSTANCE(locale::id, num_put_wchar_t::id, );
+__DECLARE_INSTANCE(locale::id, num_put_wchar_t_2::id, );
+
+# endif
+
+#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
+
+// issue 118
+
+#if !defined (_STLP_NO_BOOL)
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f,
+ char_type __fill, bool __val) const {
+ if (!(__f.flags() & ios_base::boolalpha))
+ return this->do_put(__s, __f, __fill, __STATIC_CAST(long,__val));
+
+ locale __loc = __f.getloc();
+ // typedef numpunct<_CharT> _Punct;
+ // const _Punct& __np = use_facet<_Punct>(__loc);
+
+ const numpunct<_CharT>& __np = *__STATIC_CAST(const numpunct<_CharT>*, __f._M_numpunct_facet());
+
+ basic_string<_CharT> __str = __val ? __np.truename() : __np.falsename();
+
+ // Reuse __copy_integer_and_fill. Since internal padding makes no
+ // sense for bool, though, make sure we use something else instead.
+ // The last two argument to __copy_integer_and_fill are dummies.
+ ios_base::fmtflags __flags = __f.flags();
+ if ((__flags & ios_base::adjustfield) == ios_base::internal)
+ __flags = (__flags & ~ios_base::adjustfield) | ios_base::right;
+
+ return _STLP_PRIV __copy_integer_and_fill(__str.c_str(), __str.size(), __s,
+ __flags, __f.width(0), __fill,
+ (_CharT) 0, (_CharT) 0);
+}
+
+#endif
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ long __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ unsigned long __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ double __val) const
+{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ long double __val) const
+{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); }
+#endif
+
+#if defined (_STLP_LONG_LONG)
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ _STLP_LONG_LONG __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ unsigned _STLP_LONG_LONG __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+#endif /* _STLP_LONG_LONG */
+
+
+// lib.facet.num.put.virtuals "12 For conversion from void* the specifier is %p."
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT /*__fill*/,
+ const void* __val) const {
+ const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __f._M_ctype_facet());
+ ios_base::fmtflags __save_flags = __f.flags();
+
+ __f.setf(ios_base::hex, ios_base::basefield);
+ __f.setf(ios_base::showbase);
+ __f.setf(ios_base::internal, ios_base::adjustfield);
+ __f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix
+# if defined(_STLP_LONG_LONG) && !defined(__MRC__) //*ty 11/24/2001 - MrCpp can not cast from void* to long long
+ _OutputIter result = this->do_put(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned _STLP_LONG_LONG,__val));
+# else
+ _OutputIter result = this->do_put(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned long,__val));
+# endif
+ __f.flags(__save_flags);
+ return result;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_NUM_PUT_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// 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_NUM_PUT_H
+#define _STLP_INTERNAL_NUM_PUT_H
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
+# include <stl/_iostream_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// num_put facet
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _OutputIter>
+#else
+template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class num_put: public locale::facet {
+ friend class _Locale_impl;
+public:
+ typedef _CharT char_type;
+ typedef _OutputIter iter_type;
+
+ explicit num_put(size_t __refs = 0) : locale::facet(__refs) {}
+
+#if !defined (_STLP_NO_BOOL)
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ bool __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+#endif
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ long __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ unsigned long __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+#if defined (_STLP_LONG_LONG)
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ _STLP_LONG_LONG __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ unsigned _STLP_LONG_LONG __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+#endif
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ double __val) const {
+ return do_put(__s, __f, __fill, (double)__val);
+ }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ long double __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+#endif
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ const void * __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ ~num_put() {}
+#if !defined (_STLP_NO_BOOL)
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const;
+#endif
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long __val) const;
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, unsigned long __val) const;
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, double __val) const;
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long double __val) const;
+#endif
+
+#if defined (_STLP_LONG_LONG)
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, _STLP_LONG_LONG __val) const;
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ unsigned _STLP_LONG_LONG __val) const ;
+#endif
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const;
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+// _STLP_EXPORT_TEMPLATE_CLASS num_put<char, char*>;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// _STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, wchar_t*>;
+# endif
+#endif
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Integer>
+char* _STLP_CALL
+__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x);
+
+/*
+ * Returns the position on the right of the digits that has to be considered
+ * for the application of the grouping policy.
+ */
+extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, double);
+# if !defined (_STLP_NO_LONG_DOUBLE)
+extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, long double);
+# endif
+
+/*
+ * Gets the digits of the integer part.
+ */
+void _STLP_CALL __get_floor_digits(__iostring&, _STLP_LONGEST_FLOAT_TYPE);
+
+template <class _CharT>
+void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT)&, ios_base&, _STLP_LONGEST_FLOAT_TYPE);
+
+# if !defined (_STLP_NO_WCHAR_T)
+extern void _STLP_CALL __convert_float_buffer(__iostring const&, __iowstring&, const ctype<wchar_t>&, wchar_t, bool = true);
+# endif
+extern void _STLP_CALL __adjust_float_buffer(__iostring&, char);
+
+extern char* _STLP_CALL
+__write_integer(char* buf, ios_base::fmtflags flags, long x);
+
+extern ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int);
+extern void _STLP_CALL __insert_grouping(__iostring&, size_t, const string&, char, char, char, int);
+# if !defined (_STLP_NO_WCHAR_T)
+extern ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int);
+extern void _STLP_CALL __insert_grouping(__iowstring&, size_t, const string&, wchar_t, wchar_t, wchar_t, int);
+# endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_num_put.c>
+#endif
+
+#endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ *
+ * 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_NUMERIC_C
+#define _STLP_NUMERIC_C
+
+#ifndef _STLP_INTERNAL_NUMERIC_H
+# include <stl/_numeric.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator, class _Tp,
+ class _BinaryOperation>
+_OutputIterator
+__partial_sum(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _Tp*, _BinaryOperation __binary_op) {
+ _STLP_DEBUG_CHECK(__check_range(__first, __last))
+ if (__first == __last) return __result;
+ *__result = *__first;
+
+ _Tp __val = *__first;
+ while (++__first != __last) {
+ __val = __binary_op(__val, *__first);
+ *++__result = __val;
+ }
+ return ++__result;
+}
+
+template <class _InputIterator, class _OutputIterator, class _Tp,
+ class _BinaryOperation>
+_OutputIterator
+__adjacent_difference(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _Tp*,
+ _BinaryOperation __binary_op) {
+ _STLP_DEBUG_CHECK(__check_range(__first, __last))
+ if (__first == __last) return __result;
+ *__result = *__first;
+ _Tp __val = *__first;
+ while (++__first != __last) {
+ _Tp __tmp = *__first;
+ *++__result = __binary_op(__tmp, __val);
+ __val = __tmp;
+ }
+ return ++__result;
+}
+
+
+template <class _Tp, class _Integer, class _MonoidOperation>
+_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr) {
+ _STLP_MPWFIX_TRY
+ if (__n == 0)
+ return __identity_element(__opr);
+ else {
+ while ((__n & 1) == 0) {
+ __n >>= 1;
+ __x = __opr(__x, __x);
+ }
+ _Tp __result = __x;
+ _STLP_MPWFIX_TRY
+ __n >>= 1;
+ while (__n != 0) {
+ __x = __opr(__x, __x);
+ if ((__n & 1) != 0)
+ __result = __opr(__result, __x);
+ __n >>= 1;
+ }
+ return __result;
+ _STLP_MPWFIX_CATCH
+ }
+ _STLP_MPWFIX_CATCH_ACTION(__x = _Tp())
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_NUMERIC_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_NUMERIC_H
+#define _STLP_INTERNAL_NUMERIC_H
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _InputIterator, class _Tp>
+_STLP_INLINE_LOOP
+_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ _Init = _Init + *__first;
+ return _Init;
+}
+
+template <class _InputIterator, class _Tp, class _BinaryOperation>
+_STLP_INLINE_LOOP
+_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init,
+ _BinaryOperation __binary_op) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ _Init = __binary_op(_Init, *__first);
+ return _Init;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _Tp>
+_STLP_INLINE_LOOP
+_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _Tp _Init) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ _Init = _Init + (*__first1 * *__first2);
+ return _Init;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _Tp,
+ class _BinaryOperation1, class _BinaryOperation2>
+_STLP_INLINE_LOOP
+_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _Tp _Init,
+ _BinaryOperation1 __binary_op1,
+ _BinaryOperation2 __binary_op2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ _Init = __binary_op1(_Init, __binary_op2(*__first1, *__first2));
+ return _Init;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator, class _Tp,
+ class _BinaryOperation>
+_OutputIterator
+__partial_sum(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _Tp*, _BinaryOperation __binary_op);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator>
+inline _OutputIterator
+partial_sum(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result) {
+ return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator),
+ _STLP_PRIV __plus(_STLP_VALUE_TYPE(__first, _InputIterator)));
+}
+
+template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
+inline _OutputIterator
+partial_sum(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _BinaryOperation __binary_op) {
+ return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator),
+ __binary_op);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator, class _Tp,
+ class _BinaryOperation>
+_OutputIterator
+__adjacent_difference(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _Tp*,
+ _BinaryOperation __binary_op);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator>
+inline _OutputIterator
+adjacent_difference(_InputIterator __first,
+ _InputIterator __last, _OutputIterator __result) {
+ return _STLP_PRIV __adjacent_difference(__first, __last, __result,
+ _STLP_VALUE_TYPE(__first, _InputIterator),
+ _STLP_PRIV __minus(_STLP_VALUE_TYPE(__first, _InputIterator)));
+}
+
+template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
+_OutputIterator
+adjacent_difference(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _BinaryOperation __binary_op) {
+ return _STLP_PRIV __adjacent_difference(__first, __last, __result,
+ _STLP_VALUE_TYPE(__first, _InputIterator),
+ __binary_op);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Integer, class _MonoidOperation>
+_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if !defined (_STLP_NO_EXTENSIONS)
+
+// Returns __x ** __n, where __n >= 0. _Note that "multiplication"
+// is required to be associative, but not necessarily commutative.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Integer>
+inline _Tp __power(_Tp __x, _Integer __n) {
+ return __power(__x, __n, multiplies<_Tp>());
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Alias for the internal name __power. Note that power is an extension,
+// not part of the C++ standard.
+template <class _Tp, class _Integer, class _MonoidOperation>
+inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __opr) {
+ return _STLP_PRIV __power(__x, __n, __opr);
+}
+
+template <class _Tp, class _Integer>
+inline _Tp power(_Tp __x, _Integer __n) {
+ return _STLP_PRIV __power(__x, __n, multiplies<_Tp>());
+}
+
+// iota is not part of the C++ standard. It is an extension.
+
+template <class _ForwardIterator, class _Tp>
+_STLP_INLINE_LOOP
+void iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ while (__first != __last)
+ *__first++ = __val++;
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_numeric.c>
+#endif
+
+#endif /* _STLP_INTERNAL_NUMERIC_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// 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_NUMPUNCT_H
+#define _STLP_INTERNAL_NUMPUNCT_H
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+# ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+# endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// numpunct facets
+
+template <class _CharT> class numpunct {};
+template <class _CharT> class numpunct_byname {};
+template <class _Ch, class _InIt> class num_get;
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
+{
+ friend class _Locale_impl;
+
+#ifndef _STLP_NO_FRIEND_TEMPLATES
+ template <class _Ch, class _InIt> friend class num_get;
+#endif
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit numpunct(size_t __refs = 0)
+ : locale::facet(__refs), _M_truename("true"), _M_falsename("false") {}
+
+ char decimal_point() const { return do_decimal_point(); }
+ char thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string truename() const { return do_truename(); }
+ string falsename() const { return do_falsename(); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+#ifndef _STLP_NO_FRIEND_TEMPLATES
+protected:
+#endif
+ ~numpunct();
+
+ string _M_truename;
+ string _M_falsename;
+ string _M_grouping;
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual string do_truename() const;
+ virtual string do_falsename() const;
+};
+
+# if ! defined (_STLP_NO_WCHAR_T)
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
+{
+ friend class _Locale_impl;
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit numpunct(size_t __refs = 0)
+ : locale::facet(__refs), _M_truename(L"true"), _M_falsename(L"false") {}
+
+ wchar_t decimal_point() const { return do_decimal_point(); }
+ wchar_t thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ wstring truename() const { return do_truename(); }
+ wstring falsename() const { return do_falsename(); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ wstring _M_truename;
+ wstring _M_falsename;
+ string _M_grouping;
+
+ ~numpunct();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual wstring do_truename() const;
+ virtual wstring do_falsename() const;
+};
+
+# endif /* WCHAR_T */
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
+
+protected:
+
+ ~numpunct_byname();
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+private:
+ _Locale_numeric* _M_numeric;
+
+ //explicitely defined as private to avoid warnings:
+ typedef numpunct_byname<char> _Self;
+ numpunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+ friend _Locale_name_hint* _Locale_extract_hint(numpunct_byname<char>*);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
+
+protected:
+
+ ~numpunct_byname();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+private:
+ _Locale_numeric* _M_numeric;
+
+ //explicitely defined as private to avoid warnings:
+ typedef numpunct_byname<wchar_t> _Self;
+ numpunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+
+# endif /* WCHAR_T */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_NUMPUNCT_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * Copyright (c) 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_OSTREAM_C
+#define _STLP_OSTREAM_C
+
+#ifndef _STLP_INTERNAL_OSTREAM_H
+# include <stl/_ostream.h>
+#endif
+
+#if !defined (_STLP_INTERNAL_NUM_PUT_H)
+# include <stl/_num_put.h> // For basic_streambuf and iterators
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Definitions of non-inline member functions.
+
+// Constructor, destructor
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<_CharT, _Traits>* __buf)
+ : basic_ios<_CharT, _Traits>() {
+ this->init(__buf);
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::~basic_ostream()
+{}
+
+// Output directly from a streambuf.
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<_CharT, _Traits>* __from) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ if (__from) {
+ bool __any_inserted = __from->gptr() != __from->egptr()
+ ? this->_M_copy_buffered(__from, this->rdbuf())
+ : this->_M_copy_unbuffered(__from, this->rdbuf());
+ if (!__any_inserted)
+ this->setstate(ios_base::failbit);
+ }
+ else
+ this->setstate(ios_base::badbit);
+ }
+
+ return *this;
+}
+
+// Helper functions for the streambuf version of operator<<. The
+// exception-handling code is complicated because exceptions thrown
+// while extracting characters are treated differently than exceptions
+// thrown while inserting characters.
+
+template <class _CharT, class _Traits>
+bool basic_ostream<_CharT, _Traits>
+ ::_M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to) {
+ bool __any_inserted = false;
+
+ while (__from->egptr() != __from->gptr()) {
+ const ptrdiff_t __avail = __from->egptr() - __from->gptr();
+
+ streamsize __nwritten;
+ _STLP_TRY {
+ __nwritten = __to->sputn(__from->gptr(), __avail);
+ __from->gbump((int)__nwritten);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ return __any_inserted;
+ }
+
+ if (__nwritten == __avail) {
+ _STLP_TRY {
+ if (this->_S_eof(__from->sgetc()))
+ return true;
+ else
+ __any_inserted = true;
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::failbit);
+ return false;
+ }
+ }
+ else if (__nwritten != 0)
+ return true;
+ else
+ return __any_inserted;
+ }
+
+ // No characters are in the buffer, but we aren't at EOF. Switch to
+ // unbuffered mode.
+ return __any_inserted || this->_M_copy_unbuffered(__from, __to);
+}
+
+/*
+ * Helper struct (guard) to put back a character in a streambuf
+ * whenever an exception or an eof occur.
+ */
+template <class _CharT, class _Traits>
+struct _SPutBackC {
+ typedef basic_streambuf<_CharT, _Traits> _StreamBuf;
+ typedef typename _StreamBuf::int_type int_type;
+ _SPutBackC(_StreamBuf *pfrom)
+ : __pfrom(pfrom), __c(0), __do_guard(false) {}
+ ~_SPutBackC() {
+ if (__do_guard) {
+ __pfrom->sputbackc(_Traits::to_char_type(__c));
+ }
+ }
+
+ void guard(int_type c) {
+ __c = c;
+ __do_guard = true;
+ }
+ void release() {
+ __do_guard = false;
+ }
+
+private:
+ _StreamBuf *__pfrom;
+ int_type __c;
+ bool __do_guard;
+};
+
+template <class _CharT, class _Traits>
+bool basic_ostream<_CharT, _Traits>
+ ::_M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to) {
+ typedef _SPutBackC<_CharT, _Traits> _SPutBackCGuard;
+ bool __any_inserted = false;
+ int_type __c;
+
+ _STLP_TRY {
+ _SPutBackCGuard __cguard(__from);
+ for (;;) {
+ _STLP_TRY {
+ __c = __from->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::failbit);
+ return __any_inserted;
+ }
+
+ if ( this->_S_eof(__c) )
+ return __any_inserted;
+
+ __cguard.guard(__c);
+ if ( this->_S_eof( __to->sputc(_Traits::to_char_type(__c)) ) ) {
+ return __any_inserted;
+ }
+
+ __cguard.release();
+ __any_inserted = true;
+ }
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ return __any_inserted;
+ }
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper function for numeric output.
+template <class _CharT, class _Traits, class _Number>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+__put_num(basic_ostream<_CharT, _Traits>& __os, _Number __x) {
+ typedef typename basic_ostream<_CharT, _Traits>::sentry _Sentry;
+ _Sentry __sentry(__os);
+ bool __failed = true;
+
+ if (__sentry) {
+ _STLP_TRY {
+ typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > _NumPut;
+ __failed = (use_facet<_NumPut>(__os.getloc())).put(ostreambuf_iterator<_CharT, _Traits>(__os.rdbuf()),
+ __os, __os.fill(),
+ __x).failed();
+ }
+ _STLP_CATCH_ALL {
+ __os._M_handle_exception(ios_base::badbit);
+ }
+ }
+ if (__failed)
+ __os.setstate(ios_base::badbit);
+ return __os;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+/*
+ * In the following operators we try to limit code bloat by limiting the
+ * number of __put_num instanciations.
+ */
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __x) {
+ _STLP_STATIC_ASSERT( sizeof(short) <= sizeof(long) )
+ long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ?
+ __STATIC_CAST(long, __STATIC_CAST(unsigned short, __x)): __x;
+ return _STLP_PRIV __put_num(*this, __tmp);
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __x) {
+ _STLP_STATIC_ASSERT( sizeof(unsigned short) <= sizeof(unsigned long) )
+ return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x));
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __x) {
+ _STLP_STATIC_ASSERT( sizeof(int) <= sizeof(long) )
+ long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ?
+ __STATIC_CAST(long, __STATIC_CAST(unsigned int, __x)): __x;
+ return _STLP_PRIV __put_num(*this, __tmp);
+}
+
+template <class _CharT, class _Traits>
+#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300)
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __x) {
+ _STLP_STATIC_ASSERT( sizeof(unsigned int) <= sizeof(unsigned long) )
+#else
+/* We define this operator with size_t rather than unsigned int to avoid
+ * 64 bits warning.
+ */
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(size_t __x) {
+ _STLP_STATIC_ASSERT( sizeof(size_t) <= sizeof(unsigned long) )
+#endif
+ return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x));
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+#ifdef _STLP_LONG_LONG
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (_STLP_LONG_LONG __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (unsigned _STLP_LONG_LONG __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+#endif
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __x)
+{ return _STLP_PRIV __put_num(*this, __STATIC_CAST(double,__x)); }
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+#ifndef _STLP_NO_LONG_DOUBLE
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+#endif
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+#ifndef _STLP_NO_BOOL
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+#endif
+
+template <class _CharT, class _Traits>
+void basic_ostream<_CharT, _Traits>::_M_put_char(_CharT __c) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ bool __failed = true;
+ _STLP_TRY {
+ streamsize __npad = this->width() > 0 ? this->width() - 1 : 0;
+ // if (__npad <= 1)
+ if (__npad == 0)
+ __failed = this->_S_eof(this->rdbuf()->sputc(__c));
+ else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
+ __failed = this->_S_eof(this->rdbuf()->sputc(__c));
+ __failed = __failed ||
+ this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ }
+ else {
+ __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ __failed = __failed || this->_S_eof(this->rdbuf()->sputc(__c));
+ }
+
+ this->width(0);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__failed)
+ this->setstate(ios_base::badbit);
+ }
+}
+
+template <class _CharT, class _Traits>
+void basic_ostream<_CharT, _Traits>::_M_put_nowiden(const _CharT* __s) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ bool __failed = true;
+ streamsize __n = _Traits::length(__s);
+ streamsize __npad = this->width() > __n ? this->width() - __n : 0;
+
+ _STLP_TRY {
+ if (__npad == 0)
+ __failed = this->rdbuf()->sputn(__s, __n) != __n;
+ else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
+ __failed = this->rdbuf()->sputn(__s, __n) != __n;
+ __failed = __failed ||
+ this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ }
+ else {
+ __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ __failed = __failed || this->rdbuf()->sputn(__s, __n) != __n;
+ }
+
+ this->width(0);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__failed)
+ this->setstate(ios_base::failbit);
+ }
+}
+
+template <class _CharT, class _Traits>
+void basic_ostream<_CharT, _Traits>::_M_put_widen(const char* __s) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ bool __failed = true;
+ streamsize __n = char_traits<char>::length(__s);
+ streamsize __npad = this->width() > __n ? this->width() - __n : 0;
+
+ _STLP_TRY {
+ if (__npad == 0)
+ __failed = !this->_M_put_widen_aux(__s, __n);
+ else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
+ __failed = !this->_M_put_widen_aux(__s, __n);
+ __failed = __failed ||
+ this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ }
+ else {
+ __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ __failed = __failed || !this->_M_put_widen_aux(__s, __n);
+ }
+
+ this->width(0);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__failed)
+ this->setstate(ios_base::failbit);
+ }
+}
+
+template <class _CharT, class _Traits>
+bool basic_ostream<_CharT, _Traits>::_M_put_widen_aux(const char* __s,
+ streamsize __n) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+
+ for ( ; __n > 0 ; --__n)
+ if (this->_S_eof(__buf->sputc(this->widen(*__s++))))
+ return false;
+ return true;
+}
+
+// Unformatted output of a single character.
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::put(char_type __c) {
+ sentry __sentry(*this);
+ bool __failed = true;
+
+ if (__sentry) {
+ _STLP_TRY {
+ __failed = this->_S_eof(this->rdbuf()->sputc(__c));
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ }
+
+ if (__failed)
+ this->setstate(ios_base::badbit);
+
+ return *this;
+}
+
+// Unformatted output of a single character.
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) {
+ sentry __sentry(*this);
+ bool __failed = true;
+
+ if (__sentry) {
+ _STLP_TRY {
+ __failed = this->rdbuf()->sputn(__s, __n) != __n;
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ }
+
+ if (__failed)
+ this->setstate(ios_base::badbit);
+
+ return *this;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_OSTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_OSTREAM_H
+#define _STLP_INTERNAL_OSTREAM_H
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h> // For basic_ios<>. Includes <iosfwd>.
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) && !defined (_STLP_INTERNAL_EXCEPTION)
+# include <stl/_exception.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+template <class _CharT, class _Traits>
+class _Osentry;
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT, class _Traits>
+bool __init_bostr(basic_ostream<_CharT, _Traits>& __str);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//----------------------------------------------------------------------
+// class basic_ostream<>
+
+template <class _CharT, class _Traits>
+class basic_ostream : virtual public basic_ios<_CharT, _Traits> {
+ typedef basic_ostream<_CharT, _Traits> _Self;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ //explicitely defined as private to avoid warnings:
+ basic_ostream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+
+public: // Constructor and destructor.
+ explicit basic_ostream(basic_streambuf<_CharT, _Traits>* __buf);
+ ~basic_ostream();
+
+public: // Hooks for manipulators.
+ typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&);
+ typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&);
+ typedef _Self& (_STLP_CALL *__ostream_fn)(_Self&);
+ _Self& operator<< (__ostream_fn __f) { return __f(*this); }
+ _Self & operator<< (__ios_base_fn __f) { __f(*this); return *this; }
+ _Self& operator<< (__ios_fn __ff) { __ff(*this); return *this; }
+
+private:
+ bool _M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to);
+ bool _M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to);
+
+public:
+ void _M_put_char(_CharT __c);
+
+ void _M_put_nowiden(const _CharT* __s);
+ void _M_put_widen(const char* __s);
+ bool _M_put_widen_aux(const char* __s, streamsize __n);
+
+public: // Unformatted output.
+ _Self& put(char_type __c);
+ _Self& write(const char_type* __s, streamsize __n);
+
+public: // Formatted output.
+ // Formatted output from a streambuf.
+ _Self& operator<<(basic_streambuf<_CharT, _Traits>* __buf);
+# ifndef _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+ // this is needed for compiling with option char = unsigned
+ _Self& operator<<(unsigned char __x) { _M_put_char(__x); return *this; }
+# endif
+ _Self& operator<<(short __x);
+ _Self& operator<<(unsigned short __x);
+ _Self& operator<<(int __x);
+#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300)
+ _Self& operator<<(unsigned int __x);
+#else
+/* We define this operator with size_t rather than unsigned int to avoid
+ * 64 bits warning.
+ */
+ _Self& operator<<(size_t __x);
+#endif
+ _Self& operator<<(long __x);
+ _Self& operator<<(unsigned long __x);
+#ifdef _STLP_LONG_LONG
+ _Self& operator<< (_STLP_LONG_LONG __x);
+ _Self& operator<< (unsigned _STLP_LONG_LONG __x);
+#endif
+ _Self& operator<<(float __x);
+ _Self& operator<<(double __x);
+# ifndef _STLP_NO_LONG_DOUBLE
+ _Self& operator<<(long double __x);
+# endif
+ _Self& operator<<(const void* __x);
+# ifndef _STLP_NO_BOOL
+ _Self& operator<<(bool __x);
+# endif
+
+public: // Buffer positioning and manipulation.
+ _Self& flush() {
+ if (this->rdbuf())
+ if (this->rdbuf()->pubsync() == -1)
+ this->setstate(ios_base::badbit);
+ return *this;
+ }
+
+ pos_type tellp() {
+ return this->rdbuf() && !this->fail()
+ ? this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out)
+ : pos_type(-1);
+ }
+
+ _Self& seekp(pos_type __pos) {
+ if (this->rdbuf() && !this->fail()) {
+ if (this->rdbuf()->pubseekpos(__pos) == pos_type(-1)) {
+ this->setstate(ios_base::failbit);
+ }
+ }
+ return *this;
+ }
+
+ _Self& seekp(off_type __off, ios_base::seekdir __dir) {
+ if (this->rdbuf() && !this->fail())
+ this->rdbuf()->pubseekoff(__off, __dir);
+ return *this;
+ }
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+ // If we are using DLL specs, we have not to use inner classes
+ // end class declaration here
+ typedef _Osentry<_CharT, _Traits> sentry;
+};
+# define sentry _Osentry
+ template <class _CharT, class _Traits>
+ class _Osentry {
+ typedef _Osentry<_CharT, _Traits> _Self;
+#else
+ class sentry {
+ typedef sentry _Self;
+#endif
+ private:
+ basic_ostream<_CharT, _Traits>& _M_str;
+ // basic_streambuf<_CharT, _Traits>* _M_buf;
+ bool _M_ok;
+ public:
+ explicit sentry(basic_ostream<_CharT, _Traits>& __str)
+ : _M_str(__str), /* _M_buf(__str.rdbuf()), */ _M_ok(_STLP_PRIV __init_bostr(__str))
+ {}
+
+ ~sentry() {
+ if (_M_str.flags() & ios_base::unitbuf)
+#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
+ if (!uncaught_exception())
+#endif
+ _M_str.flush();
+ }
+
+ operator bool() const { return _M_ok; }
+ private: // Disable assignment and copy constructor.
+ //Implementation is here only to avoid warning with some compilers.
+ sentry(const _Self& __s) : _M_str(__s._M_str) {}
+ _Self& operator=(const _Self&) { return *this; }
+ };
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+# undef sentry
+#else
+ // close basic_ostream class definition here
+};
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostream<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Osentry<char, char_traits<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostream<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Osentry<wchar_t, char_traits<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper functions for istream<>::sentry constructor.
+template <class _CharT, class _Traits>
+bool __init_bostr(basic_ostream<_CharT, _Traits>& __str) {
+ if (__str.good()) {
+ // boris : check if this is needed !
+ if (!__str.rdbuf())
+ __str.setstate(ios_base::badbit);
+ if (__str.tie())
+ __str.tie()->flush();
+ return __str.good();
+ }
+ else
+ return false;
+}
+
+template <class _CharT, class _Traits>
+inline basic_streambuf<_CharT, _Traits>* _STLP_CALL
+__get_ostreambuf(basic_ostream<_CharT, _Traits>& __St)
+{ return __St.rdbuf(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Non-member functions.
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c){
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __s) {
+ __os._M_put_nowiden(__s);
+ return __os;
+}
+
+#if defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER)
+// some specializations
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, signed char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, unsigned char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, const char* __s) {
+ __os._M_put_nowiden(__s);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, const signed char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >&
+operator<<(basic_ostream<char, char_traits<char> >& __os, const unsigned char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+
+#else
+
+// also for compilers who might use that
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, char __c) {
+ __os._M_put_char(__os.widen(__c));
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, signed char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __s) {
+ __os._M_put_widen(__s);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, const char* __s) {
+ __os._M_put_nowiden(__s);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, const signed char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>&
+operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+#endif /* _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER */
+
+//----------------------------------------------------------------------
+// basic_ostream manipulators.
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+endl(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(__os.widen('\n'));
+ __os.flush();
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+ends(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(_STLP_DEFAULT_CONSTRUCTED(_CharT));
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+flush(basic_ostream<_CharT, _Traits>& __os) {
+ __os.flush();
+ return __os;
+}
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_ostream.c>
+#endif
+
+#endif /* _STLP_INTERNAL_OSTREAM_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// 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_OSTREAMBUF_ITERATOR_H
+#define _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template<class _CharT, class _Traits>
+extern basic_streambuf<_CharT, _Traits>* _STLP_CALL __get_ostreambuf(basic_ostream<_CharT, _Traits>&);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// The default template argument is declared in iosfwd
+template <class _CharT, class _Traits>
+class ostreambuf_iterator :
+ public iterator<output_iterator_tag, void, void, void, void> {
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::int_type int_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+public:
+ ostreambuf_iterator(streambuf_type* __buf) _STLP_NOTHROW : _M_buf(__buf), _M_ok(__buf!=0) {}
+ // ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW : _M_buf(__get_ostreambuf(__o)), _M_ok(_M_buf != 0) {}
+ inline ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW;
+
+ ostreambuf_iterator<_CharT, _Traits>& operator=(char_type __c) {
+ _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c),
+ traits_type::eof());
+ return *this;
+ }
+
+ ostreambuf_iterator<_CharT, _Traits>& operator*() { return *this; }
+ ostreambuf_iterator<_CharT, _Traits>& operator++() { return *this; }
+ ostreambuf_iterator<_CharT, _Traits>& operator++(int) { return *this; }
+
+ bool failed() const { return !_M_ok; }
+
+private:
+ streambuf_type* _M_buf;
+ bool _M_ok;
+};
+
+template <class _CharT, class _Traits>
+inline ostreambuf_iterator<_CharT, _Traits>::ostreambuf_iterator(basic_ostream<_CharT, _Traits>& __o) _STLP_NOTHROW
+ : _M_buf(_STLP_PRIV __get_ostreambuf(__o)), _M_ok(_M_buf != 0) {}
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS ostreambuf_iterator<char, char_traits<char> >;
+# if defined (INSTANTIATE_WIDE_STREAMS)
+_STLP_EXPORT_TEMPLATE_CLASS ostreambuf_iterator<wchar_t, char_traits<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+template <class _CharT, class _Traits>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const ostreambuf_iterator<_CharT, _Traits>&) { return output_iterator_tag(); }
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ *
+ * 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_PAIR_H
+#define _STLP_INTERNAL_PAIR_H
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# include <stl/type_traits.h>
+#endif
+
+#ifndef _STLP_MOVE_CONSTRUCT_FWK_H
+# include <stl/_move_construct_fwk.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _T1, class _T2>
+struct pair {
+ typedef _T1 first_type;
+ typedef _T2 second_type;
+
+ _T1 first;
+ _T2 second;
+#if defined (_STLP_CONST_CONSTRUCTOR_BUG)
+ pair() {}
+#else
+ pair() : first(_T1()), second(_T2()) {}
+#endif
+ pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200))
+ template <class _U1, class _U2>
+ pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
+
+ pair(const pair<_T1,_T2>& __o) : first(__o.first), second(__o.second) {}
+#endif
+
+ pair(__move_source<pair<_T1, _T2> > src) : first(_STLP_PRIV _AsMoveSource(src.get().first)),
+ second(_STLP_PRIV _AsMoveSource(src.get().second))
+ {}
+
+ __TRIVIAL_DESTRUCTOR(pair)
+};
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return __x.first == __y.first && __x.second == __y.second; }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
+ return __x.first < __y.first ||
+ (!(__y.first < __x.first) && __x.second < __y.second);
+}
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return !(__x == __y); }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return __y < __x; }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return !(__y < __x); }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return !(__x < __y); }
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_EXTENSIONS)
+template <class _T1, class _T2, int _Sz>
+inline pair<_T1, _T2 const*> make_pair(_T1 const& __x,
+ _T2 const (&__y)[_Sz])
+{ return pair<_T1, _T2 const*>(__x, static_cast<_T2 const*>(__y)); }
+
+template <class _T1, class _T2, int _Sz>
+inline pair<_T1 const*, _T2> make_pair(_T1 const (&__x)[_Sz],
+ _T2 const& __y)
+{ return pair<_T1 const*, _T2>(static_cast<_T1 const*>(__x), __y); }
+
+template <class _T1, class _T2, int _Sz1, int _Sz2>
+inline pair<_T1 const*, _T2 const*> make_pair(_T1 const (&__x)[_Sz1],
+ _T2 const (&__y)[_Sz2]) {
+ return pair<_T1 const*, _T2 const*>(static_cast<_T1 const*>(__x),
+ static_cast<_T2 const*>(__y));
+}
+#endif
+
+template <class _T1, class _T2>
+inline pair<_T1, _T2> _STLP_CALL make_pair(_T1 __x, _T2 __y)
+{ return pair<_T1, _T2>(__x, __y); }
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_USE_NAMESPACES) || !defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+_STLP_BEGIN_RELOPS_NAMESPACE
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y)
+{ return !(__x == __y); }
+
+template <class _Tp>
+inline bool _STLP_CALL operator>(const _Tp& __x, const _Tp& __y)
+{ return __y < __x; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator<=(const _Tp& __x, const _Tp& __y)
+{ return !(__y < __x); }
+
+template <class _Tp>
+inline bool _STLP_CALL operator>=(const _Tp& __x, const _Tp& __y)
+{ return !(__x < __y); }
+
+_STLP_END_RELOPS_NAMESPACE
+#endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_BEGIN_NAMESPACE
+
+template <class _T1, class _T2>
+struct __type_traits<pair<_T1, _T2> > {
+ typedef __type_traits<_T1> _T1Traits;
+ typedef __type_traits<_T2> _T2Traits;
+ typedef typename _Land2<typename _T1Traits::has_trivial_default_constructor,
+ typename _T2Traits::has_trivial_default_constructor>::_Ret has_trivial_default_constructor;
+ typedef typename _Land2<typename _T1Traits::has_trivial_copy_constructor,
+ typename _T2Traits::has_trivial_copy_constructor>::_Ret has_trivial_copy_constructor;
+ typedef typename _Land2<typename _T1Traits::has_trivial_assignment_operator,
+ typename _T2Traits::has_trivial_assignment_operator>::_Ret has_trivial_assignment_operator;
+ typedef typename _Land2<typename _T1Traits::has_trivial_destructor,
+ typename _T2Traits::has_trivial_destructor>::_Ret has_trivial_destructor;
+ typedef __false_type is_POD_type;
+
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
+ // disable incorrect "dependent type qualifier" error
+ typedef __false_type implemented;
+#endif
+};
+
+template <class _T1, class _T2>
+struct __move_traits<pair<_T1, _T2> >
+ : _STLP_PRIV __move_traits_help1<_T1, _T2> {};
+
+_STLP_END_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#endif /* _STLP_INTERNAL_PAIR_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/* NOTE : this header has no guards and is MEANT for multiple inclusion!
+ * If you are using "header protection" option with your compiler,
+ * please also find #pragma which disables it and put it here, to
+ * allow reentrancy of this header.
+ */
+
+#ifdef std
+# undef std /* We undef "std" on entry , as STLport headers may include native ones. */
+#endif
+
+#ifdef _STLP_PROLOG_HEADER_INCLUDED
+# error STlport prolog header can not be reincluded as long as epilog has not be included.
+#endif
+
+#define _STLP_PROLOG_HEADER_INCLUDED
+
+#ifndef _STLP_FEATURES_H
+# include <stl/config/features.h>
+#endif
+
+/* If the platform provides any specific prolog actions,
+ * like #pragmas, do include platform-specific prolog file */
+#if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG)
+# include <stl/config/_prolog.h>
+#endif
--- /dev/null
+/*
+ *
+ * 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_PTHREAD_ALLOC_H
+#define _STLP_PTHREAD_ALLOC_H
+
+/*
+ * Pthread-specific node allocator.
+ * This is similar to the default allocator, except that free-list
+ * information is kept separately for each thread, avoiding locking.
+ * This should be reasonably fast even in the presence of threads.
+ * The down side is that storage may not be well-utilized.
+ * It is not an error to allocate memory in thread A and deallocate
+ * it in thread B. But this effectively transfers ownership of the memory,
+ * so that it can only be reallocated by thread B. Thus this can effectively
+ * result in a storage leak if it's done on a regular basis.
+ * It can also result in frequent sharing of
+ * cache lines among processors, with potentially serious performance
+ * consequences.
+ */
+
+#if !defined (_STLP_PTHREADS)
+# error POSIX specific allocator implementation. Your system do not seems to \
+have this interface so please comment the _STLP_USE_PERTHREAD_ALLOC macro \
+or report to the STLport forum.
+#endif
+
+#if defined (_STLP_USE_NO_IOSTREAMS)
+# error You cannot use per thread allocator implementation without building \
+STLport libraries.
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _Pthread_alloc_per_thread_state;
+
+// Pthread-specific allocator.
+class _STLP_CLASS_DECLSPEC _Pthread_alloc {
+public: // but only for internal use:
+ typedef _Pthread_alloc_per_thread_state __state_type;
+ typedef char value_type;
+
+public:
+ // Return a recycled or new per thread state.
+ static __state_type * _STLP_CALL _S_get_per_thread_state();
+
+ /* n must be > 0 */
+ static void * _STLP_CALL allocate(size_t& __n);
+
+ /* p may not be 0 */
+ static void _STLP_CALL deallocate(void *__p, size_t __n);
+
+ // boris : versions for per_thread_allocator
+ /* n must be > 0 */
+ static void * _STLP_CALL allocate(size_t& __n, __state_type* __a);
+
+ /* p may not be 0 */
+ static void _STLP_CALL deallocate(void *__p, size_t __n, __state_type* __a);
+
+ static void * _STLP_CALL reallocate(void *__p, size_t __old_sz, size_t& __new_sz);
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+typedef _STLP_PRIV _Pthread_alloc __pthread_alloc;
+typedef __pthread_alloc pthread_alloc;
+
+template <class _Tp>
+class pthread_allocator : public __stlport_class<pthread_allocator<_Tp> > {
+ typedef pthread_alloc _S_Alloc; // The underlying allocator.
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef pthread_allocator<_NewType> other;
+ };
+#endif
+
+ pthread_allocator() _STLP_NOTHROW {}
+ pthread_allocator(const pthread_allocator<_Tp>& a) _STLP_NOTHROW {}
+
+#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */
+ template <class _OtherType> pthread_allocator(const pthread_allocator<_OtherType>&)
+ _STLP_NOTHROW {}
+#endif
+
+ ~pthread_allocator() _STLP_NOTHROW {}
+
+ pointer address(reference __x) const { return &__x; }
+ const_pointer address(const_reference __x) const { return &__x; }
+
+ // __n is permitted to be 0. The C++ standard says nothing about what
+ // the return value is when __n == 0.
+ _Tp* allocate(size_type __n, const void* = 0) {
+ if (__n > max_size()) {
+ __THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ if (__ret != 0) {
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+ }
+#endif
+ return __ret;
+ }
+ else
+ return 0;
+ }
+
+ void deallocate(pointer __p, size_type __n) {
+ _STLP_ASSERT( (__p == 0) == (__n == 0) )
+ if (__p != 0) {
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
+#endif
+ _S_Alloc::deallocate(__p, __n * sizeof(value_type));
+ }
+ }
+
+ size_type max_size() const _STLP_NOTHROW
+ { return size_t(-1) / sizeof(_Tp); }
+
+ void construct(pointer __p, const _Tp& __val) { _STLP_PLACEMENT_NEW (__p) _Tp(__val); }
+ void destroy(pointer _p) { _p->~_Tp(); }
+
+#if defined (_STLP_NO_EXTENSIONS)
+ /* STLport extension giving rounded size of an allocated memory buffer
+ * This method do not have to be part of a user defined allocator implementation
+ * and won't even be called if such a function was granted.
+ */
+protected:
+#endif
+ _Tp* allocate(size_type __n, size_type& __allocated_n) {
+ if (__n > max_size()) {
+ __THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ if (__ret != 0) {
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+ }
+#endif
+ __allocated_n = __buf_size / sizeof(value_type);
+ return __ret;
+ }
+ else
+ return 0;
+ }
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC pthread_allocator<void> {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+ typedef void value_type;
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef pthread_allocator<_NewType> other;
+ };
+#endif
+};
+
+template <class _T1, class _T2>
+inline bool operator==(const pthread_allocator<_T1>&,
+ const pthread_allocator<_T2>& a2)
+{ return true; }
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+template <class _T1, class _T2>
+inline bool operator!=(const pthread_allocator<_T1>&,
+ const pthread_allocator<_T2>&)
+{ return false; }
+#endif
+
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+
+# if defined (_STLP_USE_RAW_SGI_ALLOCATORS)
+template <class _Tp>
+struct _Alloc_traits<_Tp, _Pthread_alloc>
+{ typedef __allocator<_Tp, _Pthread_alloc> allocator_type; };
+# endif
+
+template <class _Tp, class _Atype>
+struct _Alloc_traits<_Tp, pthread_allocator<_Atype> >
+{ typedef pthread_allocator<_Tp> allocator_type; };
+
+#endif
+
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+
+template <class _Tp1, class _Tp2>
+inline pthread_allocator<_Tp2>&
+__stl_alloc_rebind(pthread_allocator<_Tp1>& __x, const _Tp2*)
+{ return (pthread_allocator<_Tp2>&)__x; }
+
+template <class _Tp1, class _Tp2>
+inline pthread_allocator<_Tp2>
+__stl_alloc_create(pthread_allocator<_Tp1>&, const _Tp2*)
+{ return pthread_allocator<_Tp2>(); }
+
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct __pthread_alloc_type_traits {
+ typedef typename _IsSTLportClass<pthread_allocator<_Tp> >::_Ret _STLportAlloc;
+ //The default allocator implementation which is recognize thanks to the
+ //__stlport_class inheritance is a stateless object so:
+ typedef _STLportAlloc has_trivial_default_constructor;
+ typedef _STLportAlloc has_trivial_copy_constructor;
+ typedef _STLportAlloc has_trivial_assignment_operator;
+ typedef _STLportAlloc has_trivial_destructor;
+ typedef _STLportAlloc is_POD_type;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<pthread_allocator<_Tp> > : _STLP_PRIV __pthread_alloc_type_traits<_Tp> {};
+#else
+_STLP_TEMPLATE_NULL
+struct __type_traits<pthread_allocator<char> > : _STLP_PRIV __pthread_alloc_type_traits<char> {};
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct __type_traits<pthread_allocator<wchar_t> > : _STLP_PRIV __pthread_alloc_type_traits<wchar_t> {};
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_TEMPLATE_NULL
+struct __type_traits<pthread_allocator<void*> > : _STLP_PRIV __pthread_alloc_type_traits<void*> {};
+# endif
+#endif
+
+//
+// per_thread_allocator<> : this allocator always return memory to the same thread
+// it was allocated from.
+//
+
+template <class _Tp>
+class per_thread_allocator {
+ typedef pthread_alloc _S_Alloc; // The underlying allocator.
+ typedef pthread_alloc::__state_type __state_type;
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef per_thread_allocator<_NewType> other;
+ };
+#endif
+
+ per_thread_allocator() _STLP_NOTHROW {
+ _M_state = _S_Alloc::_S_get_per_thread_state();
+ }
+ per_thread_allocator(const per_thread_allocator<_Tp>& __a) _STLP_NOTHROW : _M_state(__a._M_state){}
+
+#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */
+ template <class _OtherType> per_thread_allocator(const per_thread_allocator<_OtherType>& __a)
+ _STLP_NOTHROW : _M_state(__a._M_state) {}
+#endif
+
+ ~per_thread_allocator() _STLP_NOTHROW {}
+
+ pointer address(reference __x) const { return &__x; }
+ const_pointer address(const_reference __x) const { return &__x; }
+
+ // __n is permitted to be 0. The C++ standard says nothing about what
+ // the return value is when __n == 0.
+ _Tp* allocate(size_type __n, const void* = 0) {
+ if (__n > max_size()) {
+ __THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(_Tp*, _S_Alloc::allocate(__buf_size, _M_state));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ if (__ret != 0) {
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+ }
+#endif
+ return __ret;
+ }
+ else
+ return 0;
+ }
+
+ void deallocate(pointer __p, size_type __n) {
+ _STLP_ASSERT( (__p == 0) == (__n == 0) )
+ if (__p != 0) {
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
+#endif
+ _S_Alloc::deallocate(__p, __n * sizeof(value_type), _M_state);
+ }
+ }
+
+ size_type max_size() const _STLP_NOTHROW
+ { return size_t(-1) / sizeof(_Tp); }
+
+ void construct(pointer __p, const _Tp& __val) { _STLP_PLACEMENT_NEW (__p) _Tp(__val); }
+ void destroy(pointer _p) { _p->~_Tp(); }
+
+ // state is being kept here
+ __state_type* _M_state;
+
+#if defined (_STLP_NO_EXTENSIONS)
+ /* STLport extension giving rounded size of an allocated memory buffer
+ * This method do not have to be part of a user defined allocator implementation
+ * and won't even be called if such a function was granted.
+ */
+protected:
+#endif
+ _Tp* allocate(size_type __n, size_type& __allocated_n) {
+ if (__n > max_size()) {
+ __THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size, _M_state));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ if (__ret != 0) {
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+ }
+#endif
+ __allocated_n = __buf_size / sizeof(value_type);
+ return __ret;
+ }
+ else
+ return 0;
+ }
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC per_thread_allocator<void> {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+ typedef void value_type;
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef per_thread_allocator<_NewType> other;
+ };
+#endif
+};
+
+template <class _T1, class _T2>
+inline bool operator==(const per_thread_allocator<_T1>& __a1,
+ const per_thread_allocator<_T2>& __a2)
+{ return __a1._M_state == __a2._M_state; }
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+template <class _T1, class _T2>
+inline bool operator!=(const per_thread_allocator<_T1>& __a1,
+ const per_thread_allocator<_T2>& __a2)
+{ return __a1._M_state != __a2._M_state; }
+#endif
+
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+
+template <class _Tp, class _Atype>
+struct _Alloc_traits<_Tp, per_thread_allocator<_Atype> >
+{ typedef per_thread_allocator<_Tp> allocator_type; };
+
+#endif
+
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+
+template <class _Tp1, class _Tp2>
+inline per_thread_allocator<_Tp2>&
+__stl_alloc_rebind(per_thread_allocator<_Tp1>& __x, const _Tp2*)
+{ return (per_thread_allocator<_Tp2>&)__x; }
+
+template <class _Tp1, class _Tp2>
+inline per_thread_allocator<_Tp2>
+__stl_alloc_create(per_thread_allocator<_Tp1>&, const _Tp2*)
+{ return per_thread_allocator<_Tp2>(); }
+
+#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct __perthread_alloc_type_traits {
+ typedef typename _IsSTLportClass<per_thread_allocator<_Tp> >::_Ret _STLportAlloc;
+ //The default allocator implementation which is recognize thanks to the
+ //__stlport_class inheritance is a stateless object so:
+ typedef __false_type has_trivial_default_constructor;
+ typedef _STLportAlloc has_trivial_copy_constructor;
+ typedef _STLportAlloc has_trivial_assignment_operator;
+ typedef _STLportAlloc has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<per_thread_allocator<_Tp> > : _STLP_PRIV __perthread_alloc_type_traits<_Tp> {};
+#else
+_STLP_TEMPLATE_NULL
+struct __type_traits<per_thread_allocator<char> > : _STLP_PRIV __perthread_alloc_type_traits<char> {};
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct __type_traits<per_thread_allocator<wchar_t> > : _STLP_PRIV __perthread_alloc_type_traits<wchar_t> {};
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_TEMPLATE_NULL
+struct __type_traits<per_thread_allocator<void*> > : _STLP_PRIV __perthread_alloc_type_traits<void*> {};
+# endif
+#endif
+
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_PTHREAD_ALLOC */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+#ifndef _STLP_PTRS_SPECIALIZE_H
+#define _STLP_PTRS_SPECIALIZE_H
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+// the following is a workaround for arrow operator problems
+#if defined ( _STLP_NO_ARROW_OPERATOR )
+// User wants to disable proxy -> operators
+# define _STLP_DEFINE_ARROW_OPERATOR
+# define _STLP_ARROW_SPECIALIZE_WITH_PTRS(_Tp)
+#else
+// Compiler can handle generic -> operator.
+# define _STLP_ARROW_SPECIALIZE_WITH_PTRS(_Tp)
+# if defined (__BORLANDC__)
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(*(*this)); }
+# elif defined(__WATCOMC__)
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { reference x = operator*(); return &x; }
+# else
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); }
+# endif
+#endif /* _STLP_NO_ARROW_OPERATOR */
+
+// Important pointers specializations
+
+#ifdef _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type)
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type)
+#else
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type) _STLP_TEMPLATE_NULL struct __type_traits<_Type> : __type_traits_aux<1> {};
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type*) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type*) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type**) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type* const *) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type**) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type***) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type***)
+#endif
+
+# define _STLP_POINTERS_SPECIALIZE(_Type) _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) _STLP_ARROW_SPECIALIZE_WITH_PTRS(_Type)
+
+_STLP_BEGIN_NAMESPACE
+
+# if !defined ( _STLP_NO_BOOL )
+_STLP_POINTERS_SPECIALIZE( bool )
+# endif
+_STLP_TYPE_TRAITS_POD_SPECIALIZE_V(void)
+# ifndef _STLP_NO_SIGNED_BUILTINS
+ _STLP_POINTERS_SPECIALIZE( signed char )
+# endif
+ _STLP_POINTERS_SPECIALIZE( char )
+ _STLP_POINTERS_SPECIALIZE( unsigned char )
+ _STLP_POINTERS_SPECIALIZE( short )
+ _STLP_POINTERS_SPECIALIZE( unsigned short )
+ _STLP_POINTERS_SPECIALIZE( int )
+ _STLP_POINTERS_SPECIALIZE( unsigned int )
+ _STLP_POINTERS_SPECIALIZE( long )
+ _STLP_POINTERS_SPECIALIZE( unsigned long )
+ _STLP_POINTERS_SPECIALIZE( float )
+ _STLP_POINTERS_SPECIALIZE( double )
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+ _STLP_POINTERS_SPECIALIZE( long double )
+# endif
+# if defined ( _STLP_LONG_LONG)
+ _STLP_POINTERS_SPECIALIZE( _STLP_LONG_LONG )
+ _STLP_POINTERS_SPECIALIZE( unsigned _STLP_LONG_LONG )
+# endif
+#if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
+ _STLP_POINTERS_SPECIALIZE( wchar_t )
+# endif
+
+_STLP_END_NAMESPACE
+
+# undef _STLP_ARROW_SPECIALIZE
+# undef _STLP_ARROW_SPECIALIZE_WITH_PTRS
+# undef _STLP_TYPE_TRAITS_POD_SPECIALIZE_V
+
+#endif
--- /dev/null
+/*
+ *
+ * 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
+
+#if defined(__SC__) && !defined(__DMC__) //*ty 12/07/2001 - since "comp" is a built-in type and reserved under SCpp
+# define comp _Comp
+#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) {}
+
+ queue(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)) {}
+
+ 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; }
+};
+
+#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); }
+
+ priority_queue(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)),
+ comp(_STLP_PRIV _AsMoveSource(src.get().comp)) {}
+
+#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_CLASS_PARTIAL_SPECIALIZATION)
+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_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_QUEUE_ARGS
+#undef _STLP_QUEUE_HEADER_ARGS
+#undef comp
+
+#endif /* _STLP_INTERNAL_QUEUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics
+ *
+ * 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_RANGE_ERRORS_H
+#define _STLP_RANGE_ERRORS_H
+
+// A few places in the STL throw range errors, using standard exception
+// classes defined in <stdexcept>. This header file provides functions
+// to throw those exception objects.
+
+// _STLP_DONT_THROW_RANGE_ERRORS is a hook so that users can disable
+// this exception throwing.
+#if defined (_STLP_CAN_THROW_RANGE_ERRORS) && defined (_STLP_USE_EXCEPTIONS) && \
+ !defined (_STLP_DONT_THROW_RANGE_ERRORS)
+# define _STLP_THROW_RANGE_ERRORS
+#endif
+
+// For the STLport iostreams, only declaration here, definition is in the lib
+#if !defined (_STLP_USE_NO_IOSTREAMS) && \
+ !defined (_STLP_USE_NO_EXTERN_RANGE_ERRORS) && \
+ !defined (_STLP_EXTERN_RANGE_ERRORS)
+# define _STLP_EXTERN_RANGE_ERRORS
+#endif
+
+_STLP_BEGIN_NAMESPACE
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg);
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_EXTERN_RANGE_ERRORS)
+
+# if defined(_STLP_THROW_RANGE_ERRORS)
+# ifndef _STLP_INTERNAL_STDEXCEPT
+# include <stl/_stdexcept.h>
+# endif
+# ifndef _STLP_STRING
+# include <string>
+# endif
+# define _STLP_THROW_MSG(ex,msg) throw ex(string(msg))
+# else
+# if defined (_STLP_RTTI_BUG)
+# define _STLP_THROW_MSG(ex,msg) TerminateProcess(GetCurrentProcess(), 0)
+# else
+# ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+# endif
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+# define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT()
+# endif
+# endif
+
+// For mode without library and throwing range errors, include the
+// stdexcept header and throw the appropriate exceptions directly.
+
+_STLP_BEGIN_NAMESPACE
+
+inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg)
+{ _STLP_THROW_MSG(runtime_error, __msg); }
+
+inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg)
+{ _STLP_THROW_MSG(range_error, __msg); }
+
+inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg)
+{ _STLP_THROW_MSG(out_of_range, __msg); }
+
+inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg)
+{ _STLP_THROW_MSG(length_error, __msg); }
+
+inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg)
+{ _STLP_THROW_MSG(invalid_argument, __msg); }
+
+inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg)
+{ _STLP_THROW_MSG(overflow_error, __msg); }
+
+_STLP_END_NAMESPACE
+
+# undef _STLP_THROW_MSG
+
+#endif /* EXTERN_RANGE_ERRORS */
+
+#endif /* _STLP_RANGE_ERRORS_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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:
--- /dev/null
+// This is an implementation file which
+// is intended to be included multiple times with different _STLP_ASSOCIATIVE_CONTAINER
+// setting
+
+#if !defined (_STLP_EQUAL_OPERATOR_SPECIALIZED)
+_STLP_TEMPLATE_HEADER
+inline bool _STLP_CALL operator==(const _STLP_TEMPLATE_CONTAINER& __x,
+ const _STLP_TEMPLATE_CONTAINER& __y) {
+ return __x.size() == __y.size() &&
+ equal(__x.begin(), __x.end(), __y.begin());
+}
+#endif /* _STLP_EQUAL_OPERATOR_SPECIALIZED */
+
+_STLP_TEMPLATE_HEADER
+inline bool _STLP_CALL operator<(const _STLP_TEMPLATE_CONTAINER& __x,
+ const _STLP_TEMPLATE_CONTAINER& __y) {
+ return lexicographical_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end());
+}
+
+_STLP_RELOPS_OPERATORS( _STLP_TEMPLATE_HEADER , _STLP_TEMPLATE_CONTAINER )
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+_STLP_TEMPLATE_HEADER
+inline void _STLP_CALL swap(_STLP_TEMPLATE_CONTAINER& __x,
+ _STLP_TEMPLATE_CONTAINER& __y) {
+ __x.swap(__y);
+}
+#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
--- /dev/null
+/* 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 */
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
+// if necessary. Assumes path_end[leaf_index] and leaf_pos are correct.
+// Results in a valid buf_ptr if the iterator can be legitimately
+// dereferenced.
+#ifndef _STLP_ROPEIMPL_H
+#define _STLP_ROPEIMPL_H
+
+#ifndef _STLP_INTERNAL_ROPE_H
+# include <stl/_rope.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+#endif
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+# ifndef _STLP_IOSTREAM
+# include <iostream>
+# endif
+#endif
+
+#include <stl/_range_errors.h>
+
+_STLP_BEGIN_NAMESPACE
+
+# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+# define __allocator__ _Alloc
+# else
+# define __allocator__ allocator_type
+# endif
+
+template<class _CharT, class _Alloc>
+_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos)
+ : _Rope_iterator_base<_CharT,_Alloc>(__r->_M_tree_ptr._M_data, __pos),
+ _M_root_rope(__r) { _RopeRep::_S_ref(this->_M_root); }
+
+template<class _CharT, class _Alloc>
+_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos):
+ _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos),
+ _M_root_rope(&__r) {
+#if !defined (__DMC__)
+ _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*this);
+#else
+ _Rope_iterator_base<_CharT, _Alloc>* __x = this;
+ _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*__x);
+#endif
+}
+
+template<class _CharT, class _Alloc>
+void _Rope_RopeRep<_CharT, _Alloc>::_M_free_c_string() {
+ _CharT* __cstr = _M_c_string;
+ if (0 != __cstr) {
+ size_t _p_size = _M_size._M_data + 1;
+ _STLP_STD::_Destroy_Range(__cstr, __cstr + _p_size);
+ _M_size.deallocate(__cstr, _p_size);
+ }
+}
+
+// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
+// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct.
+// Results in a valid buf_ptr if the iterator can be legitimately
+// dereferenced.
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf(
+ _Rope_iterator_base<_CharT,_Alloc>& __x) {
+ const _RopeRep* __leaf = __x._M_path_end._M_data[__x._M_leaf_index];
+ size_t __leaf_pos = __x._M_leaf_pos;
+ size_t __pos = __x._M_current_pos;
+
+ switch(__leaf->_M_tag) {
+ case _RopeRep::_S_leaf:
+ typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;
+ __x._M_buf_start = __STATIC_CAST(const _RopeLeaf*, __leaf)->_M_data;
+ __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos);
+ __x._M_buf_end = __x._M_buf_start + __leaf->_M_size._M_data;
+ break;
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ size_t __len = _S_iterator_buf_len;
+ size_t __buf_start_pos = __leaf_pos;
+ size_t __leaf_end = __leaf_pos + __leaf->_M_size._M_data;
+ typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;
+ char_producer<_CharT>* __fn = __STATIC_CAST(const _RopeFunction*, __leaf)->_M_fn;
+
+ if (__buf_start_pos + __len <= __pos) {
+ __buf_start_pos = __pos - __len/4;
+ if (__buf_start_pos + __len > __leaf_end) {
+ __buf_start_pos = __leaf_end - __len;
+ }
+ }
+ if (__buf_start_pos + __len > __leaf_end) {
+ __len = __leaf_end - __buf_start_pos;
+ }
+ (*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf._M_data);
+ __x._M_buf_ptr = __x._M_tmp_buf._M_data + (__pos - __buf_start_pos);
+ __x._M_buf_start = __x._M_tmp_buf._M_data;
+ __x._M_buf_end = __x._M_tmp_buf._M_data + __len;
+ }
+ break;
+ default:
+ _STLP_ASSERT(0)
+ ;
+ }
+}
+
+// Set path and buffer inside a rope iterator. We assume that
+// pos and root are already set.
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache(
+ _Rope_iterator_base<_CharT,_Alloc>& __x) {
+ const _RopeRep* __path[_RopeRep::_S_max_rope_depth+1];
+ const _RopeRep* __curr_rope;
+ int __curr_depth = -1; /* index into path */
+ size_t __curr_start_pos = 0;
+ size_t __pos = __x._M_current_pos;
+ unsigned char __dirns = 0; // Bit vector marking right turns in the path
+
+ _STLP_ASSERT(__pos <= __x._M_root->_M_size._M_data)
+ if (__pos >= __x._M_root->_M_size._M_data) {
+ __x._M_buf_ptr = 0;
+ return;
+ }
+ __curr_rope = __x._M_root;
+ if (0 != __curr_rope->_M_c_string) {
+ /* Treat the root as a leaf. */
+ __x._M_buf_start = __curr_rope->_M_c_string;
+ __x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size._M_data;
+ __x._M_buf_ptr = __curr_rope->_M_c_string + __pos;
+ __x._M_path_end._M_data[0] = __curr_rope;
+ __x._M_leaf_index = 0;
+ __x._M_leaf_pos = 0;
+ return;
+ }
+ for(;;) {
+ ++__curr_depth;
+ _STLP_ASSERT(__curr_depth <= _RopeRep::_S_max_rope_depth)
+ __path[__curr_depth] = __curr_rope;
+ switch(__curr_rope->_M_tag) {
+ case _RopeRep::_S_leaf:
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ __x._M_leaf_pos = __curr_start_pos;
+ goto done;
+ case _RopeRep::_S_concat:
+ {
+ const _RopeConcat* __c = __STATIC_CAST(const _RopeConcat*, __curr_rope);
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+
+ __dirns <<= 1;
+ if (__pos >= __curr_start_pos + __left_len) {
+ __dirns |= 1;
+ __curr_rope = __c->_M_right;
+ __curr_start_pos += __left_len;
+ } else {
+ __curr_rope = __left;
+ }
+ }
+ break;
+ }
+ }
+done:
+ // Copy last section of path into _M_path_end.
+ {
+ int __i = -1;
+ int __j = __curr_depth + 1 - _S_path_cache_len;
+
+ if (__j < 0) __j = 0;
+ while (__j <= __curr_depth) {
+ __x._M_path_end._M_data[++__i] = __path[__j++];
+ }
+ __x._M_leaf_index = __i;
+ }
+ __x._M_path_directions = __dirns;
+ _S_setbuf(__x);
+}
+
+// Specialized version of the above. Assumes that
+// the path cache is valid for the previous position.
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache_for_incr(
+_Rope_iterator_base<_CharT,_Alloc>& __x) {
+ int __current_index = __x._M_leaf_index;
+ const _RopeRep* __current_node = __x._M_path_end._M_data[__current_index];
+ size_t __len = __current_node->_M_size._M_data;
+ size_t __node_start_pos = __x._M_leaf_pos;
+ unsigned char __dirns = __x._M_path_directions;
+ const _RopeConcat* __c;
+
+ _STLP_ASSERT(__x._M_current_pos <= __x._M_root->_M_size._M_data)
+ if (__x._M_current_pos - __node_start_pos < __len) {
+ /* More stuff in this leaf, we just didn't cache it. */
+ _S_setbuf(__x);
+ return;
+ }
+ _STLP_ASSERT(__node_start_pos + __len == __x._M_current_pos)
+ // node_start_pos is starting position of last_node.
+ while (--__current_index >= 0) {
+ if (!(__dirns & 1) /* Path turned left */)
+ break;
+ __current_node = __x._M_path_end._M_data[__current_index];
+ __c = __STATIC_CAST(const _RopeConcat*, __current_node);
+ // Otherwise we were in the right child. Thus we should pop
+ // the concatenation node.
+ __node_start_pos -= __c->_M_left->_M_size._M_data;
+ __dirns >>= 1;
+ }
+ if (__current_index < 0) {
+ // We underflowed the cache. Punt.
+ _S_setcache(__x);
+ return;
+ }
+ __current_node = __x._M_path_end._M_data[__current_index];
+ __c = __STATIC_CAST(const _RopeConcat*, __current_node);
+ // current_node is a concatenation node. We are positioned on the first
+ // character in its right child.
+ // node_start_pos is starting position of current_node.
+ __node_start_pos += __c->_M_left->_M_size._M_data;
+ __current_node = __c->_M_right;
+ __x._M_path_end._M_data[++__current_index] = __current_node;
+ __dirns |= 1;
+ while (_RopeRep::_S_concat == __current_node->_M_tag) {
+ ++__current_index;
+ if (_S_path_cache_len == __current_index) {
+ int __i;
+ for (__i = 0; __i < _S_path_cache_len-1; ++__i) {
+ __x._M_path_end._M_data[__i] = __x._M_path_end._M_data[__i+1];
+ }
+ --__current_index;
+ }
+ __current_node = __STATIC_CAST(const _RopeConcat*, __current_node)->_M_left;
+ __x._M_path_end._M_data[__current_index] = __current_node;
+ __dirns <<= 1;
+ // node_start_pos is unchanged.
+ }
+ __x._M_leaf_index = __current_index;
+ __x._M_leaf_pos = __node_start_pos;
+ __x._M_path_directions = __dirns;
+ _S_setbuf(__x);
+}
+
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_M_incr(size_t __n) {
+ _M_current_pos += __n;
+ if (0 != _M_buf_ptr) {
+ size_t __chars_left = _M_buf_end - _M_buf_ptr;
+ if (__chars_left > __n) {
+ _M_buf_ptr += __n;
+ } else if (__chars_left == __n) {
+ _M_buf_ptr += __n;
+ _S_setcache_for_incr(*this);
+ } else {
+ _M_buf_ptr = 0;
+ }
+ }
+}
+
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_M_decr(size_t __n) {
+ if (0 != _M_buf_ptr) {
+ size_t __chars_left = _M_buf_ptr - _M_buf_start;
+ if (__chars_left >= __n) {
+ _M_buf_ptr -= __n;
+ } else {
+ _M_buf_ptr = 0;
+ }
+ }
+ _M_current_pos -= __n;
+}
+
+template <class _CharT, class _Alloc>
+void _Rope_iterator<_CharT,_Alloc>::_M_check() {
+ if (_M_root_rope->_M_tree_ptr._M_data != this->_M_root) {
+ // _Rope was modified. Get things fixed up.
+ _RopeRep::_S_unref(this->_M_root);
+ this->_M_root = _M_root_rope->_M_tree_ptr._M_data;
+ _RopeRep::_S_ref(this->_M_root);
+ this->_M_buf_ptr = 0;
+ }
+}
+
+// There are several reasons for not doing this with virtual destructors
+// and a class specific delete operator:
+// - A class specific delete operator can't easily get access to
+// allocator instances if we need them.
+// - Any virtual function would need a 4 or byte vtable pointer;
+// this only requires a one byte tag per object.
+template <class _CharT, class _Alloc>
+void _Rope_RopeRep<_CharT,_Alloc>::_M_free_tree() {
+ switch (_M_tag) {
+ case _S_leaf:
+ {
+ typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, this);
+ _STLP_STD::_Destroy(__l); // ->_Rope_RopeLeaf<_CharT,_Alloc>::~_Rope_RopeLeaf();
+ _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size,
+ _RopeLeaf).deallocate(__l, 1);
+ break;
+ }
+ case _S_concat:
+ {
+ typedef _Rope_RopeConcatenation<_CharT, _Alloc> _RopeConcatenation;
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, this);
+ _STLP_STD::_Destroy(__c);
+ _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size,
+ _RopeConcatenation).deallocate(__c, 1);
+ break;
+ }
+ case _S_function:
+ {
+ typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, this);
+ _STLP_STD::_Destroy(__f);
+ _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size,
+ _RopeFunction).deallocate(__f, 1);
+ break;
+ }
+ case _S_substringfn:
+ {
+ typedef _Rope_RopeSubstring<_CharT, _Alloc> _RopeSubstring;
+ _RopeSubstring* __rss = __STATIC_CAST(_RopeSubstring*, this);
+ _STLP_STD::_Destroy(__rss);
+ _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size,
+ _RopeSubstring).deallocate(__rss, 1);
+ break;
+ }
+ }
+}
+
+# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+# define __RopeLeaf__ _Rope_RopeLeaf<_CharT,_Alloc>
+# define __RopeRep__ _Rope_RopeRep<_CharT,_Alloc>
+# define _RopeLeaf _Rope_RopeLeaf<_CharT,_Alloc>
+# define _RopeRep _Rope_RopeRep<_CharT,_Alloc>
+# define size_type size_t
+# else
+# define __RopeLeaf__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeLeaf
+# define __RopeRep__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeRep
+# endif
+
+template <class _CharT, class _Alloc>
+void rope<_CharT, _Alloc>::_M_throw_out_of_range() const {
+ __stl_throw_out_of_range("rope");
+}
+
+// Concatenate a C string onto a leaf rope by copying the rope data.
+// Used for short ropes.
+template <class _CharT, class _Alloc>
+__RopeLeaf__*
+rope<_CharT,_Alloc>::_S_leaf_concat_char_iter (
+ _RopeLeaf* __r, const _CharT* __iter, size_t __len) {
+ size_t __old_len = __r->_M_size._M_data;
+ _CharT* __new_data = __r->_M_size.allocate(_S_rounded_up_size(__old_len + __len));
+ _RopeLeaf* __result;
+
+ _STLP_PRIV __ucopy_n(__r->_M_data, __old_len, __new_data);
+ _STLP_PRIV __ucopy_n(__iter, __len, __new_data + __old_len);
+ _S_construct_null(__new_data + __old_len + __len);
+ _STLP_TRY {
+ __result = _S_new_RopeLeaf(__new_data, __old_len + __len, __r->get_allocator());
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__new_data, __old_len + __len,
+ __r->get_allocator()))
+ return __result;
+}
+
+template <class _CharT, class _Alloc>
+void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r,
+ size_t __size, const __true_type& /*basic char type*/) {
+ _S_construct_null(__r->_M_data + __size);
+ _STLP_ASSERT(__r->_M_c_string == __r->_M_data)
+}
+
+template <class _CharT, class _Alloc>
+void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r,
+ size_t, const __false_type& /*basic char type*/) {
+ if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) {
+ __r->_M_free_c_string();
+ __r->_M_c_string = 0;
+ }
+}
+
+// As above, but it's OK to clobber original if refcount is 1
+template <class _CharT, class _Alloc>
+__RopeLeaf__*
+rope<_CharT,_Alloc>::_S_destr_leaf_concat_char_iter (_RopeLeaf* __r, const _CharT* __iter, size_t __len) {
+ //_STLP_ASSERT(__r->_M_ref_count >= 1)
+ if ( /* __r->_M_ref_count > 1 */ __r->_M_incr() > 2 ) { // - ptr
+ __r->_M_decr(); // - ptr
+ return _S_leaf_concat_char_iter(__r, __iter, __len);
+ }
+ __r->_M_decr(); // - ptr, __r->_M_ref_count == 1 or 0
+ size_t __old_len = __r->_M_size._M_data;
+ if (_S_rounded_up_size(__old_len) == _S_rounded_up_size(__old_len + __len)) {
+ // The space has been partially initialized for the standard
+ // character types. But that doesn't matter for those types.
+ _STLP_PRIV __ucopy_n(__iter, __len, __r->_M_data + __old_len);
+ _Terminate_RopeLeaf(__r, __old_len + __len, _IsBasicCharType());
+ __r->_M_size._M_data = __old_len + __len;
+ // _STLP_ASSERT(__r->_M_ref_count == 1)
+ // __r->_M_ref_count = 2;
+ __r->_M_incr(); // i.e. __r->_M_ref_count = 2
+ return __r;
+ } else {
+ _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len);
+ //_STLP_ASSERT(__result->_M_ref_count == 1)
+ return __result;
+ }
+}
+
+// Assumes left and right are not 0.
+// Does not increment (nor decrement on exception) child reference counts.
+// Result has ref count 1.
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right) {
+ _RopeConcatenation* __result =
+ _S_new_RopeConcatenation(__left, __right, __left->get_allocator());
+ size_t __depth = __result->_M_depth;
+
+ _STLP_ASSERT(__left->get_allocator() == __right->get_allocator())
+ if (__depth > 20 && (__result->_M_size._M_data < 1000 ||
+ __depth > _RopeRep::_S_max_rope_depth)) {
+ _RopeRep* __balanced;
+
+ _STLP_TRY {
+ __balanced = _S_balance(__result);
+ // _STLP_ASSERT(__result == __balanced ||
+ // 1 == __result->_M_ref_count &&
+ // 1 == __balanced->_M_ref_count)
+ __result->_M_unref_nonnil();
+ }
+ _STLP_UNWIND((_STLP_CREATE_ALLOCATOR(allocator_type,(allocator_type&)__left->_M_size,
+ _RopeConcatenation).deallocate(__result,1)))
+ // In case of exception, we need to deallocate
+ // otherwise dangling result node. But caller
+ // still owns its children. Thus unref is
+ // inappropriate.
+ return __balanced;
+ } else {
+ return __result;
+ }
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_concat_char_iter (_RopeRep* __r,
+ const _CharT*__s, size_t __slen) {
+ _RopeRep* __result;
+ if (0 == __slen) {
+ _S_ref(__r);
+ return __r;
+ }
+ if (0 == __r)
+ return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
+ if (_RopeRep::_S_leaf == __r->_M_tag &&
+ __r->_M_size._M_data + __slen <= _S_copy_max) {
+ __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+ }
+ if (_RopeRep::_S_concat == __r->_M_tag &&
+ _RopeRep::_S_leaf == ((_RopeConcatenation*)__r)->_M_right->_M_tag) {
+ _RopeLeaf* __right = (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right);
+ if (__right->_M_size._M_data + __slen <= _S_copy_max) {
+ _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left;
+ _RopeRep* __nright = _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);
+ __left->_M_ref_nonnil();
+ _STLP_TRY {
+ __result = _S_tree_concat(__left, __nright);
+ }
+ _STLP_UNWIND(_S_unref(__left); _S_unref(__nright))
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+ }
+ }
+ _RopeRep* __nright =
+ _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
+ _STLP_TRY {
+ __r->_M_ref_nonnil();
+ __result = _S_tree_concat(__r, __nright);
+ }
+ _STLP_UNWIND(_S_unref(__r); _S_unref(__nright))
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_destr_concat_char_iter(
+ _RopeRep* __r, const _CharT* __s, size_t __slen) {
+ _RopeRep* __result;
+ if (0 == __r)
+ return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen,
+ __r->get_allocator());
+ // size_t __count = __r->_M_ref_count;
+ size_t __orig_size = __r->_M_size._M_data;
+ // _STLP_ASSERT(__count >= 1)
+ if ( /* __count > 1 */ __r->_M_incr() > 2 ) {
+ __r->_M_decr();
+ return _S_concat_char_iter(__r, __s, __slen);
+ }
+ if (0 == __slen) {
+ return __r;
+ }
+ __r->_M_decr();
+ if (__orig_size + __slen <= _S_copy_max && _RopeRep::_S_leaf == __r->_M_tag) {
+ return _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
+ }
+ if (_RopeRep::_S_concat == __r->_M_tag) {
+ _RopeLeaf* __right = __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __r)->_M_right);
+ if (_RopeRep::_S_leaf == __right->_M_tag &&
+ __right->_M_size._M_data + __slen <= _S_copy_max) {
+ _RopeRep* __new_right = _S_destr_leaf_concat_char_iter(__right, __s, __slen);
+ if (__right == __new_right) {
+ // _STLP_ASSERT(__new_right->_M_ref_count == 2)
+ // __new_right->_M_ref_count = 1;
+ __new_right->_M_decr();
+ } else {
+ // _STLP_ASSERT(__new_right->_M_ref_count >= 1)
+ __right->_M_unref_nonnil();
+ }
+ // _STLP_ASSERT(__r->_M_ref_count == 1)
+ // __r->_M_ref_count = 2; // One more than before.
+ __r->_M_incr();
+ __STATIC_CAST(_RopeConcatenation*, __r)->_M_right = __new_right;
+ // E.Musser : moved below
+ // __r->_M_size._M_data = __orig_size + __slen;
+ if (0 != __r->_M_c_string) {
+ __r->_M_free_c_string();
+ __r->_M_c_string = 0;
+ }
+ __r->_M_size._M_data = __orig_size + __slen;
+ return __r;
+ }
+ }
+ _RopeRep* __right =
+ _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
+ __r->_M_ref_nonnil();
+ _STLP_TRY {
+ __result = _S_tree_concat(__r, __right);
+ }
+ _STLP_UNWIND(_S_unref(__r); _S_unref(__right))
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_concat_rep(_RopeRep* __left, _RopeRep* __right) {
+ if (0 == __left) {
+ _S_ref(__right);
+ return __right;
+ }
+ if (0 == __right) {
+ __left->_M_ref_nonnil();
+ return __left;
+ }
+ if (_RopeRep::_S_leaf == __right->_M_tag) {
+ if (_RopeRep::_S_leaf == __left->_M_tag) {
+ if (__right->_M_size._M_data + __left->_M_size._M_data <= _S_copy_max) {
+ return _S_leaf_concat_char_iter(__STATIC_CAST(_RopeLeaf*, __left),
+ __STATIC_CAST(_RopeLeaf*, __right)->_M_data,
+ __right->_M_size._M_data);
+ }
+ } else if (_RopeRep::_S_concat == __left->_M_tag &&
+ _RopeRep::_S_leaf == __STATIC_CAST(_RopeConcatenation*, __left)->_M_right->_M_tag) {
+ _RopeLeaf* __leftright =
+ __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __left)->_M_right);
+ if (__leftright->_M_size._M_data + __right->_M_size._M_data <= _S_copy_max) {
+ _RopeRep* __leftleft = __STATIC_CAST(_RopeConcatenation*, __left)->_M_left;
+ _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright,
+ __STATIC_CAST(_RopeLeaf*, __right)->_M_data,
+ __right->_M_size._M_data);
+ __leftleft->_M_ref_nonnil();
+ _STLP_TRY {
+ return _S_tree_concat(__leftleft, __rest);
+ }
+ _STLP_UNWIND(_S_unref(__leftleft); _S_unref(__rest))
+ }
+ }
+ }
+ __left->_M_ref_nonnil();
+ __right->_M_ref_nonnil();
+ _STLP_TRY {
+ return _S_tree_concat(__left, __right);
+ }
+ _STLP_UNWIND(_S_unref(__left); _S_unref(__right))
+ _STLP_RET_AFTER_THROW(0)
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_substring(_RopeRep* __base,
+ size_t __start, size_t __endp1) {
+ if (0 == __base) return 0;
+ size_t __len = __base->_M_size._M_data;
+ size_t __adj_endp1;
+ const size_t __lazy_threshold = 128;
+
+ if (__endp1 >= __len) {
+ if (0 == __start) {
+ __base->_M_ref_nonnil();
+ return __base;
+ } else {
+ __adj_endp1 = __len;
+ }
+ } else {
+ __adj_endp1 = __endp1;
+ }
+ switch(__base->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __base);
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+ size_t __left_len = __left->_M_size._M_data;
+ _RopeRep* __result;
+
+ if (__adj_endp1 <= __left_len) {
+ return _S_substring(__left, __start, __endp1);
+ } else if (__start >= __left_len) {
+ return _S_substring(__right, __start - __left_len,
+ __adj_endp1 - __left_len);
+ }
+ _Self_destruct_ptr __left_result(_S_substring(__left, __start, __left_len));
+ _Self_destruct_ptr __right_result(_S_substring(__right, 0, __endp1 - __left_len));
+ _STLP_MPWFIX_TRY //*TY 06/01/2000 - mpw forgets to call dtor on __left_result and __right_result without this try block
+ __result = _S_concat_rep(__left_result, __right_result);
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+ _STLP_MPWFIX_CATCH //*TY 06/01/2000 -
+ }
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __base);
+ _RopeLeaf* __result;
+ size_t __result_len;
+ if (__start >= __adj_endp1) return 0;
+ __result_len = __adj_endp1 - __start;
+ if (__result_len > __lazy_threshold) goto lazy;
+ const _CharT* __section = __l->_M_data + __start;
+ // We should sometimes create substring node instead.
+ __result = _S_RopeLeaf_from_unowned_char_ptr(__section, __result_len,
+ __base->get_allocator());
+ return __result;
+ }
+ case _RopeRep::_S_substringfn:
+ // Avoid introducing multiple layers of substring nodes.
+ {
+ _RopeSubstring* __old = __STATIC_CAST(_RopeSubstring*, __base);
+ size_t __result_len;
+ if (__start >= __adj_endp1) return 0;
+ __result_len = __adj_endp1 - __start;
+ if (__result_len > __lazy_threshold) {
+ _RopeSubstring* __result = _S_new_RopeSubstring(__old->_M_base,
+ __start + __old->_M_start,
+ __adj_endp1 - __start,
+ __base->get_allocator());
+ return __result;
+ } // *** else fall through: ***
+ }
+ case _RopeRep::_S_function:
+ {
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __base);
+ if (__start >= __adj_endp1) return 0;
+ size_t __result_len = __adj_endp1 - __start;
+
+ if (__result_len > __lazy_threshold) goto lazy;
+ _CharT* __section = __base->_M_size.allocate(_S_rounded_up_size(__result_len));
+ _STLP_TRY {
+ (*(__f->_M_fn))(__start, __result_len, __section);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__section,
+ __result_len, __base->get_allocator()))
+ _S_construct_null(__section + __result_len);
+ return _S_new_RopeLeaf(__section, __result_len,
+ __base->get_allocator());
+ }
+ }
+ /*NOTREACHED*/
+ _STLP_ASSERT(false)
+ lazy:
+ {
+ // Create substring node.
+ return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start,
+ __base->get_allocator());
+ }
+}
+
+template<class _CharT>
+class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> {
+private:
+ _CharT* _M_buf_ptr;
+public:
+ _Rope_flatten_char_consumer(_CharT* __buffer) {
+ _M_buf_ptr = __buffer;
+ }
+ ~_Rope_flatten_char_consumer() {}
+ bool operator() (const _CharT* __leaf, size_t __n) {
+ _STLP_PRIV __ucopy_n(__leaf, __n, _M_buf_ptr);
+ _M_buf_ptr += __n;
+ return true;
+ }
+};
+
+template<class _CharT>
+class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> {
+private:
+ _CharT _M_pattern;
+public:
+ size_t _M_count; // Number of nonmatching characters
+ _Rope_find_char_char_consumer(_CharT __p)
+ : _M_pattern(__p), _M_count(0) {}
+ ~_Rope_find_char_char_consumer() {}
+ bool operator() (const _CharT* __leaf, size_t __n) {
+ size_t __i;
+ for (__i = 0; __i < __n; ++__i) {
+ if (__leaf[__i] == _M_pattern) {
+ _M_count += __i; return false;
+ }
+ }
+ _M_count += __n; return true;
+ }
+};
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+template<class _CharT, class _Traits>
+// Here _CharT is both the stream and rope character type.
+class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> {
+private:
+ typedef basic_ostream<_CharT,_Traits> _Insert_ostream;
+ typedef _Rope_insert_char_consumer<_CharT,_Traits> _Self;
+ _Insert_ostream& _M_o;
+
+ //explicitely defined as private to avoid warnings:
+ _Self& operator = (_Self const&);
+public:
+ _Rope_insert_char_consumer(_Insert_ostream& __writer)
+ : _M_o(__writer) {}
+# if defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)) //*TY 05/23/2000 - added support for mpw compiler's trigger function approach to generate vtable
+ ~_Rope_insert_char_consumer(); //*TY 05/23/2000 -
+# else //*TY 05/23/2000 -
+ ~_Rope_insert_char_consumer() {}
+# endif //*TY 05/23/2000 -
+ // Caller is presumed to own the ostream
+ bool operator() (const _CharT* __leaf, size_t __n);
+ // Returns true to continue traversal.
+};
+
+# if defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)) //*TY 05/23/2000 - added support for mpw compiler's trigger function approach to generate vtable
+template<class _CharT, class _Traits>
+_Rope_insert_char_consumer<_CharT, _Traits>:: ~_Rope_insert_char_consumer() {}
+# endif //*TY 05/23/2000 -
+
+template<class _CharT, class _Traits>
+bool _Rope_insert_char_consumer<_CharT, _Traits>::operator()
+ (const _CharT* __leaf, size_t __n) {
+ size_t __i;
+ // We assume that formatting is set up correctly for each element.
+ for (__i = 0; __i < __n; ++__i) _M_o.put(__leaf[__i]);
+ return true;
+}
+#endif /* !_STLP_USE_NO_IOSTREAMS */
+
+template <class _CharT, class _Alloc, class _CharConsumer>
+bool _S_apply_to_pieces(_CharConsumer& __c,
+ _Rope_RopeRep<_CharT, _Alloc> * __r,
+ size_t __begin, size_t __end) {
+ typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
+ typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation;
+ typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
+ typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
+
+ if (0 == __r) return true;
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __conc = __STATIC_CAST(_RopeConcatenation*, __r);
+ _RopeRep* __left = __conc->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+ if (__begin < __left_len) {
+ size_t __left_end = (min) (__left_len, __end);
+ if (!_S_apply_to_pieces(__c, __left, __begin, __left_end))
+ return false;
+ }
+ if (__end > __left_len) {
+ _RopeRep* __right = __conc->_M_right;
+ size_t __right_start = (max)(__left_len, __begin);
+ if (!_S_apply_to_pieces(__c, __right,
+ __right_start - __left_len,
+ __end - __left_len)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r);
+ return __c(__l->_M_data + __begin, __end - __begin);
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r);
+ size_t __len = __end - __begin;
+ bool __result;
+ _CharT* __buffer = __r->get_allocator().allocate(__len);
+ _STLP_TRY {
+ (*(__f->_M_fn))(__begin, __len, __buffer);
+ __result = __c(__buffer, __len);
+ __r->get_allocator().deallocate(__buffer, __len);
+ }
+ _STLP_UNWIND((__r->get_allocator().deallocate(__buffer, __len)))
+ return __result;
+ }
+ default:
+ _STLP_ASSERT(false)
+ /*NOTREACHED*/
+ return false;
+ }
+}
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+template<class _CharT, class _Traits>
+inline void _Rope_fill(basic_ostream<_CharT, _Traits>& __o, streamsize __n) {
+ char __f = __o.fill();
+ for (streamsize __i = 0; __i < __n; ++__i) __o.put(__f);
+}
+
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r, const __true_type& /*_IsBasicCharType*/) {
+ streamsize __w = __o.width();
+ const bool __left = (__o.flags() & ios::left) != 0;
+ size_t __rope_len = __r.size();
+ _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
+
+ const bool __need_pad = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __rope_len) < __w)) ||
+ ((sizeof(streamsize) <= sizeof(size_t)) && (__rope_len < __STATIC_CAST(size_t, __w))));
+ streamsize __pad_len = __need_pad ? __w - __rope_len : 0;
+
+ if (!__left && __pad_len > 0) {
+ _Rope_fill(__o, __pad_len);
+ }
+ __r.apply_to_pieces(0, __rope_len, __c);
+ if (__left && __pad_len > 0) {
+ _Rope_fill(__o, __pad_len);
+ }
+ return __o;
+}
+
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r, const __false_type& /*_IsBasicCharType*/) {
+ streamsize __w = __o.width();
+ size_t __rope_len = __r.size();
+ _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
+
+ __o.width(__w /__rope_len);
+ _STLP_TRY {
+ __r.apply_to_pieces(0, __rope_len, __c);
+ __o.width(__w);
+ }
+ _STLP_UNWIND(__o.width(__w))
+ return __o;
+}
+
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r) {
+ typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral;
+ return _S_io_get(__o, __r, _Char_Is_Integral());
+}
+#endif /* NO_IOSTREAMS */
+
+template <class _CharT, class _Alloc>
+_CharT* rope<_CharT,_Alloc>::_S_flatten(_RopeRep* __r,
+ size_t __start, size_t __len,
+ _CharT* __buffer) {
+ _Rope_flatten_char_consumer<_CharT> __c(__buffer);
+ _S_apply_to_pieces(__c, __r, __start, __start + __len);
+ return(__buffer + __len);
+}
+
+template <class _CharT, class _Alloc>
+size_t rope<_CharT,_Alloc>::find(_CharT __pattern, size_t __start) const {
+ _Rope_find_char_char_consumer<_CharT> __c(__pattern);
+ _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __start, size());
+ size_type __result_pos = __start + __c._M_count;
+#ifndef _STLP_OLD_ROPE_SEMANTICS
+ if (__result_pos == size()) __result_pos = npos;
+#endif
+ return __result_pos;
+}
+
+template <class _CharT, class _Alloc>
+_CharT*
+rope<_CharT,_Alloc>::_S_flatten(_Rope_RopeRep<_CharT, _Alloc>* __r, _CharT* __buffer) {
+ if (0 == __r) return __buffer;
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r);
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+ _CharT* __rest = _S_flatten(__left, __buffer);
+ return _S_flatten(__right, __rest);
+ }
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r);
+ return _STLP_PRIV __ucopy_n(__l->_M_data, __l->_M_size._M_data, __buffer).second;
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ // We dont yet do anything with substring nodes.
+ // This needs to be fixed before ropefiles will work well.
+ {
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r);
+ (*(__f->_M_fn))(0, __f->_M_size._M_data, __buffer);
+ return __buffer + __f->_M_size._M_data;
+ }
+ default:
+ _STLP_ASSERT(false)
+ /*NOTREACHED*/
+ return 0;
+ }
+}
+
+#ifdef _STLP_DEBUG
+// This needs work for _CharT != char
+template <class _CharT, class _Alloc>
+void rope<_CharT,_Alloc>::_S_dump(_RopeRep* __r, int __indent) {
+ for (int __i = 0; __i < __indent; ++__i) putchar(' ');
+ if (0 == __r) {
+ printf("NULL\n"); return;
+ }
+ if (_RopeRep::_S_concat == __r->_M_tag) {
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r);
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+ printf("Concatenation %p (rc = %ld, depth = %d, len = %ld, %s balanced)\n",
+ __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data,
+ __r->_M_is_balanced? "" : "not");
+ _S_dump(__left, __indent + 2);
+ _S_dump(__right, __indent + 2);
+ return;
+ }
+ else {
+ const char* __kind;
+
+ switch (__r->_M_tag) {
+ case _RopeRep::_S_leaf:
+ __kind = "Leaf";
+ break;
+ case _RopeRep::_S_function:
+ __kind = "Function";
+ break;
+ case _RopeRep::_S_substringfn:
+ __kind = "Function representing substring";
+ break;
+ default:
+ __kind = "(corrupted kind field!)";
+ }
+ printf("%s %p (rc = %ld, depth = %d, len = %ld) ",
+ __kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data);
+ if (sizeof(_CharT) == 1) {
+ const int __max_len = 40;
+ _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len));
+ _CharT __buffer[__max_len + 1];
+ bool __too_big = __r->_M_size._M_data > __prefix->_M_size._M_data;
+
+ _S_flatten(__prefix, __buffer);
+ __buffer[__prefix->_M_size._M_data] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ printf("%s%s\n", (char*)__buffer, __too_big? "...\n" : "\n");
+ } else {
+ printf("\n");
+ }
+ }
+}
+#endif /* _STLP_DEBUG */
+
+# define __ROPE_TABLE_BODY = { \
+/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21, \
+/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377, \
+/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181, \
+/* 18 */6765ul, /* 19 */10946ul, /* 20 */17711ul, /* 21 */28657ul, /* 22 */46368ul, \
+/* 23 */75025ul, /* 24 */121393ul, /* 25 */196418ul, /* 26 */317811ul, \
+/* 27 */514229ul, /* 28 */832040ul, /* 29 */1346269ul, /* 30 */2178309ul, \
+/* 31 */3524578ul, /* 32 */5702887ul, /* 33 */9227465ul, /* 34 */14930352ul, \
+/* 35 */24157817ul, /* 36 */39088169ul, /* 37 */63245986ul, /* 38 */102334155ul, \
+/* 39 */165580141ul, /* 40 */267914296ul, /* 41 */433494437ul, \
+/* 42 */701408733ul, /* 43 */1134903170ul, /* 44 */1836311903ul, \
+/* 45 */2971215073ul }
+
+# if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
+template <class _CharT, class _Alloc>
+const unsigned long
+rope<_CharT,_Alloc>::_S_min_len[__ROPE_DEPTH_SIZE] __ROPE_TABLE_BODY;
+# else
+__DECLARE_INSTANCE(const unsigned long,
+ crope::_S_min_len[__ROPE_DEPTH_SIZE],
+ __ROPE_TABLE_BODY);
+# ifndef _STLP_NO_WCHAR_T
+__DECLARE_INSTANCE(const unsigned long,
+ wrope::_S_min_len[__ROPE_DEPTH_SIZE],
+ __ROPE_TABLE_BODY);
+# endif
+# endif
+# undef __ROPE_DEPTH_SIZE
+# undef __ROPE_MAX_DEPTH
+# undef __ROPE_TABLE_BODY
+
+// These are Fibonacci numbers < 2**32.
+
+template <class _CharT, class _Alloc>
+__RopeRep__* rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r) {
+ _RopeRep* __forest[_RopeRep::_S_max_rope_depth + 1] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0};
+ _RopeRep* __result = 0;
+ int __i;
+ // Invariant:
+ // The concatenation of forest in descending order is equal to __r.
+ // __forest[__i]._M_size._M_data >= _S_min_len[__i]
+ // __forest[__i]._M_depth = __i
+ // References from forest are included in refcount.
+
+ _STLP_TRY {
+ _S_add_to_forest(__r, __forest);
+ for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
+ if (0 != __forest[__i]) {
+ _Self_destruct_ptr __old(__result);
+ __result = _S_concat_rep(__forest[__i], __result);
+ __forest[__i]->_M_unref_nonnil();
+# ifdef _STLP_USE_EXCEPTIONS
+ __forest[__i] = 0;
+# endif
+ }
+ }
+ _STLP_UNWIND(for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
+ _S_unref(__forest[__i]))
+ if (__result->_M_depth > _RopeRep::_S_max_rope_depth) {
+ __stl_throw_range_error("rope too long");
+ }
+ return(__result);
+}
+
+
+template <class _CharT, class _Alloc>
+void
+rope<_CharT,_Alloc>::_S_add_to_forest(_RopeRep* __r, _RopeRep** __forest)
+{
+ if (__r -> _M_is_balanced) {
+ _S_add_leaf_to_forest(__r, __forest);
+ return;
+ }
+ _STLP_ASSERT(__r->_M_tag == _RopeRep::_S_concat)
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+
+ _S_add_to_forest(__c->_M_left, __forest);
+ _S_add_to_forest(__c->_M_right, __forest);
+ }
+}
+
+
+template <class _CharT, class _Alloc>
+void
+rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest)
+{
+ _RopeRep* __insertee; // included in refcount
+ _RopeRep* __too_tiny = 0; // included in refcount
+ int __i; // forest[0..__i-1] is empty
+ size_t __s = __r->_M_size._M_data;
+
+ for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i) {
+ if (0 != __forest[__i]) {
+ _Self_destruct_ptr __old(__too_tiny);
+ __too_tiny = _S_concat_and_set_balanced(__forest[__i], __too_tiny);
+ __forest[__i]->_M_unref_nonnil();
+ __forest[__i] = 0;
+ }
+ }
+ {
+ _Self_destruct_ptr __old(__too_tiny);
+ __insertee = _S_concat_and_set_balanced(__too_tiny, __r);
+ }
+ // Too_tiny dead, and no longer included in refcount.
+ // Insertee is live and included.
+ _STLP_ASSERT(_S_is_almost_balanced(__insertee))
+ _STLP_ASSERT(__insertee->_M_depth <= __r->_M_depth + 1)
+ for (;; ++__i) {
+ if (0 != __forest[__i]) {
+ _Self_destruct_ptr __old(__insertee);
+ __insertee = _S_concat_and_set_balanced(__forest[__i], __insertee);
+ __forest[__i]->_M_unref_nonnil();
+ __forest[__i] = 0;
+ _STLP_ASSERT(_S_is_almost_balanced(__insertee))
+ }
+ _STLP_ASSERT(_S_min_len[__i] <= __insertee->_M_size._M_data)
+ _STLP_ASSERT(__forest[__i] == 0)
+ if (__i == _RopeRep::_S_max_rope_depth ||
+ __insertee->_M_size._M_data < _S_min_len[__i+1]) {
+ __forest[__i] = __insertee;
+ // refcount is OK since __insertee is now dead.
+ return;
+ }
+ }
+}
+
+template <class _CharT, class _Alloc>
+_CharT
+rope<_CharT,_Alloc>::_S_fetch(_RopeRep* __r, size_type __i)
+{
+ _CharT* __cstr = __r->_M_c_string;
+
+ _STLP_ASSERT(__i < __r->_M_size._M_data)
+ if (0 != __cstr) return __cstr[__i];
+ for(;;) {
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+
+ if (__i >= __left_len) {
+ __i -= __left_len;
+ __r = __c->_M_right;
+ } else {
+ __r = __left;
+ }
+ }
+ break;
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = (_RopeLeaf*)__r;
+ return __l->_M_data[__i];
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ _RopeFunction* __f = (_RopeFunction*)__r;
+ _CharT __result;
+
+ (*(__f->_M_fn))(__i, 1, &__result);
+ return __result;
+ }
+ }
+ }
+#if defined(_STLP_NEED_UNREACHABLE_RETURN)
+ return 0;
+#endif
+}
+
+// Return a uniquely referenced character slot for the given
+// position, or 0 if that's not possible.
+template <class _CharT, class _Alloc>
+_CharT*
+rope<_CharT,_Alloc>::_S_fetch_ptr(_RopeRep* __r, size_type __i)
+{
+ _RopeRep* __clrstack[_RopeRep::_S_max_rope_depth];
+ size_t __csptr = 0;
+
+ for(;;) {
+ // if (__r->_M_ref_count > 1) return 0;
+ if ( __r->_M_incr() > 2 ) {
+ __r->_M_decr();
+ return 0;
+ }
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+
+ if (__c->_M_c_string != 0) __clrstack[__csptr++] = __c;
+ if (__i >= __left_len) {
+ __i -= __left_len;
+ __r = __c->_M_right;
+ } else {
+ __r = __left;
+ }
+ }
+ break;
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = (_RopeLeaf*)__r;
+ if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0)
+ __clrstack[__csptr++] = __l;
+ while (__csptr > 0) {
+ -- __csptr;
+ _RopeRep* __d = __clrstack[__csptr];
+ __d->_M_free_c_string();
+ __d->_M_c_string = 0;
+ }
+ return __l->_M_data + __i;
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ return 0;
+ }
+ }
+#if defined(_STLP_NEED_UNREACHABLE_RETURN)
+ return 0;
+#endif
+
+}
+
+// The following could be implemented trivially using
+// lexicographical_compare_3way.
+// We do a little more work to avoid dealing with rope iterators for
+// flat strings.
+template <class _CharT, class _Alloc>
+int
+rope<_CharT,_Alloc>::_S_compare (const _RopeRep* __left,
+ const _RopeRep* __right) {
+ size_t __left_len;
+ size_t __right_len;
+
+ if (0 == __right) return 0 != __left;
+ if (0 == __left) return -1;
+ __left_len = __left->_M_size._M_data;
+ __right_len = __right->_M_size._M_data;
+ if (_RopeRep::_S_leaf == __left->_M_tag) {
+ const _RopeLeaf* __l = __STATIC_CAST(const _RopeLeaf*, __left);
+ if (_RopeRep::_S_leaf == __right->_M_tag) {
+ const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right);
+ return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len,
+ __r->_M_data, __r->_M_data + __right_len);
+ }
+ else {
+ const_iterator __rstart(__right, 0);
+ const_iterator __rend(__right, __right_len);
+ return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len,
+ __rstart, __rend);
+ }
+ }
+ else {
+ const_iterator __lstart(__left, 0);
+ const_iterator __lend(__left, __left_len);
+ if (_RopeRep::_S_leaf == __right->_M_tag) {
+ const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right);
+ return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend,
+ __r->_M_data, __r->_M_data + __right_len);
+ }
+ else {
+ const_iterator __rstart(__right, 0);
+ const_iterator __rend(__right, __right_len);
+ return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend, __rstart, __rend);
+ }
+ }
+}
+
+// Assignment to reference proxies.
+template <class _CharT, class _Alloc>
+_Rope_char_ref_proxy<_CharT, _Alloc>&
+_Rope_char_ref_proxy<_CharT, _Alloc>::operator= (_CharT __c) {
+ _RopeRep* __old = _M_root->_M_tree_ptr._M_data;
+ // First check for the case in which everything is uniquely
+ // referenced. In that case we can do this destructively.
+ _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos);
+ if (0 != __ptr) {
+ *__ptr = __c;
+ return *this;
+ }
+ _Self_destruct_ptr __left(
+ _My_rope::_S_substring(__old, 0, _M_pos));
+ _Self_destruct_ptr __right(
+ _My_rope::_S_substring(__old, _M_pos+1, __old->_M_size._M_data));
+ _Self_destruct_ptr __result_left(
+ _My_rope::_S_destr_concat_char_iter(__left, &__c, 1));
+
+ // _STLP_ASSERT(__left == __result_left || 1 == __result_left->_M_ref_count)
+ _RopeRep* __result =
+ _My_rope::_S_concat_rep(__result_left, __right);
+ // _STLP_ASSERT(1 <= __result->_M_ref_count)
+ _RopeRep::_S_unref(__old);
+ _M_root->_M_tree_ptr._M_data = __result;
+ return *this;
+}
+
+template <class _CharT, class _Alloc>
+_Rope_char_ptr_proxy<_CharT, _Alloc>
+_Rope_char_ref_proxy<_CharT, _Alloc>::operator& () const {
+ return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this);
+}
+
+# if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
+template<class _CharT, class _Alloc>
+_CharT rope<_CharT,_Alloc>::_S_empty_c_str[1] = { _CharT() };
+# else
+__DECLARE_INSTANCE(char, crope::_S_empty_c_str[1], ={0});
+# ifdef _STLP_HAS_WCHAR_T
+__DECLARE_INSTANCE(wchar_t, wrope::_S_empty_c_str[1], ={0});
+# endif /* _STLP_HAS_WCHAR_T */
+# endif /* _STLP_STATIC_TEMPLATE_DATA */
+// # endif
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG)
+# if !defined (__GNUC__) || (__GNUC__ != 2) || (__GNUC_MINOR__ != 96)
+template <class _CharT, class _Alloc>
+const size_t rope<_CharT, _Alloc>::npos;
+# endif
+#endif
+
+template<class _CharT, class _Alloc>
+const _CharT* rope<_CharT,_Alloc>::c_str() const {
+ if (0 == _M_tree_ptr._M_data) {
+ // Possibly redundant, but probably fast.
+ _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ return _S_empty_c_str;
+ }
+ _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string;
+ if (0 != __old_c_string) return __old_c_string;
+ size_t __s = size();
+ _CharT* __result = _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).allocate(__s + 1);
+ _S_flatten(_M_tree_ptr._M_data, __result);
+ _S_construct_null(__result + __s);
+ __old_c_string = __STATIC_CAST(_CharT*, _Atomic_swap_ptr(__REINTERPRET_CAST(void* _STLP_VOLATILE*, &(_M_tree_ptr._M_data->_M_c_string)),
+ __result));
+ if (0 != __old_c_string) {
+ // It must have been added in the interim. Hence it had to have been
+ // separately allocated. Deallocate the old copy, since we just
+ // replaced it.
+ _STLP_STD::_Destroy_Range(__old_c_string, __old_c_string + __s + 1);
+ _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).deallocate(__old_c_string, __s + 1);
+ }
+ return __result;
+}
+
+template<class _CharT, class _Alloc>
+const _CharT* rope<_CharT,_Alloc>::replace_with_c_str() {
+ if (0 == _M_tree_ptr._M_data) {
+ _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ return _S_empty_c_str;
+ }
+ _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string;
+ if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag && 0 != __old_c_string) {
+ return __old_c_string;
+ }
+ size_t __s = size();
+ _CharT* __result = _M_tree_ptr.allocate(_S_rounded_up_size(__s));
+ _S_flatten(_M_tree_ptr._M_data, __result);
+ _S_construct_null(__result + __s);
+ _M_tree_ptr._M_data->_M_unref_nonnil();
+ _M_tree_ptr._M_data = _S_new_RopeLeaf(__result, __s, _M_tree_ptr);
+ return __result;
+}
+
+// Algorithm specializations. More should be added.
+
+#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)) && \
+ (!defined (__DMC__) || defined (__PUT_STATIC_DATA_MEMBERS_HERE))
+// I couldn't get this to work with VC++
+template<class _CharT,class _Alloc>
+void _Rope_rotate(_Rope_iterator<_CharT,_Alloc> __first,
+ _Rope_iterator<_CharT,_Alloc> __middle,
+ _Rope_iterator<_CharT,_Alloc> __last) {
+ _STLP_ASSERT(__first.container() == __middle.container() &&
+ __middle.container() == __last.container())
+ rope<_CharT,_Alloc>& __r(__first.container());
+ rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index());
+ rope<_CharT,_Alloc> __suffix =
+ __r.substr(__last.index(), __r.size() - __last.index());
+ rope<_CharT,_Alloc> __part1 =
+ __r.substr(__middle.index(), __last.index() - __middle.index());
+ rope<_CharT,_Alloc> __part2 =
+ __r.substr(__first.index(), __middle.index() - __first.index());
+ __r = __prefix;
+ __r += __part1;
+ __r += __part2;
+ __r += __suffix;
+}
+
+
+# if 0
+// Probably not useful for several reasons:
+// - for SGIs 7.1 compiler and probably some others,
+// this forces lots of rope<wchar_t, ...> instantiations, creating a
+// code bloat and compile time problem. (Fixed in 7.2.)
+// - wchar_t is 4 bytes wide on most UNIX platforms, making it unattractive
+// for unicode strings. Unsigned short may be a better character
+// type.
+inline void rotate(
+ _Rope_iterator<wchar_t,_STLP_DEFAULT_ALLOCATOR(char) > __first,
+ _Rope_iterator<wchar_t,_STLP_DEFAULT_ALLOCATOR(char) > __middle,
+ _Rope_iterator<wchar_t,_STLP_DEFAULT_ALLOCATOR(char) > __last) {
+ _Rope_rotate(__first, __middle, __last);
+}
+# endif
+#endif /* _STLP_MSVC */
+
+# undef __RopeLeaf__
+# undef __RopeRep__
+# undef __RopeLeaf
+# undef __RopeRep
+# undef size_type
+
+_STLP_END_NAMESPACE
+
+# endif /* ROPEIMPL_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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.
+ */
+
+// rope<_CharT,_Alloc> is a sequence of _CharT.
+// Ropes appear to be mutable, but update operations
+// really copy enough of the data structure to leave the original
+// valid. Thus ropes can be logically copied by just copying
+// a pointer value.
+
+#ifndef _STLP_INTERNAL_ROPE_H
+#define _STLP_INTERNAL_ROPE_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_IOSFWD
+# include <iosfwd>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMERIC_H
+# include <stl/_numeric.h>
+#endif
+
+#ifndef _STLP_INTERNAL_HASH_FUN_H
+# include <stl/_hash_fun.h>
+#endif
+
+#ifndef _STLP_CHAR_TRAITS_H
+# include <stl/char_traits.h>
+#endif
+
+#ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+#endif
+
+#ifdef _STLP_SGI_THREADS
+# include <mutex.h>
+#endif
+
+#ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE
+# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) (_Alloc_traits<_Tp,__atype>::create_allocator(__a))
+#elif defined(__MRC__)||defined(__SC__)
+# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) __stl_alloc_create<_Tp,__atype>(__a,(_Tp*)0)
+#else
+# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// First a lot of forward declarations. The standard seems to require
+// much stricter "declaration before use" than many of the implementations
+// that preceded it.
+template<class _CharT, _STLP_DEFAULT_ALLOCATOR_SELECT(_CharT) > class rope;
+template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation;
+template<class _CharT, class _Alloc> struct _Rope_RopeRep;
+template<class _CharT, class _Alloc> struct _Rope_RopeLeaf;
+template<class _CharT, class _Alloc> struct _Rope_RopeFunction;
+template<class _CharT, class _Alloc> struct _Rope_RopeSubstring;
+template<class _CharT, class _Alloc> class _Rope_iterator;
+template<class _CharT, class _Alloc> class _Rope_const_iterator;
+template<class _CharT, class _Alloc> class _Rope_char_ref_proxy;
+template<class _CharT, class _Alloc> class _Rope_char_ptr_proxy;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Some helpers, so we can use the power algorithm on ropes.
+// See below for why this isn't local to the implementation.
+
+// This uses a nonstandard refcount convention.
+// The result has refcount 0.
+template<class _CharT, class _Alloc>
+struct _Rope_Concat_fn
+ : public binary_function<rope<_CharT,_Alloc>, rope<_CharT,_Alloc>,
+ rope<_CharT,_Alloc> > {
+ rope<_CharT,_Alloc> operator() (const rope<_CharT,_Alloc>& __x,
+ const rope<_CharT,_Alloc>& __y) {
+ return __x + __y;
+ }
+};
+
+template <class _CharT, class _Alloc>
+inline
+rope<_CharT,_Alloc>
+__identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
+{ return rope<_CharT,_Alloc>(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Store an eos
+template <class _CharT>
+inline void _S_construct_null_aux(_CharT *__p, const __true_type&)
+{ *__p = 0; }
+
+template <class _CharT>
+inline void _S_construct_null_aux(_CharT *__p, const __false_type&)
+{ _STLP_STD::_Construct(__p); }
+
+template <class _CharT>
+inline void _S_construct_null(_CharT *__p) {
+ typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral;
+ _S_construct_null_aux(__p, _Char_Is_Integral());
+}
+
+// char_producers are logically functions that generate a section of
+// a string. These can be converted to ropes. The resulting rope
+// invokes the char_producer on demand. This allows, for example,
+// files to be viewed as ropes without reading the entire file.
+template <class _CharT>
+class char_producer {
+public:
+ virtual ~char_producer() {}
+ virtual void operator()(size_t __start_pos, size_t __len,
+ _CharT* __buffer) = 0;
+ // Buffer should really be an arbitrary output iterator.
+ // That way we could flatten directly into an ostream, etc.
+ // This is thoroughly impossible, since iterator types don't
+ // have runtime descriptions.
+};
+
+// Sequence buffers:
+//
+// Sequence must provide an append operation that appends an
+// array to the sequence. Sequence buffers are useful only if
+// appending an entire array is cheaper than appending element by element.
+// This is true for many string representations.
+// This should perhaps inherit from ostream<sequence::value_type>
+// and be implemented correspondingly, so that they can be used
+// for formatted. For the sake of portability, we don't do this yet.
+//
+// For now, sequence buffers behave as output iterators. But they also
+// behave a little like basic_ostringstream<sequence::value_type> and a
+// little like containers.
+
+template<class _Sequence
+# if !(defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) || \
+ defined ( _STLP_NO_DEFAULT_NON_TYPE_PARAM ))
+ , size_t _Buf_sz = 100
+# if defined(__sgi) && !defined(__GNUC__)
+# define __TYPEDEF_WORKAROUND
+ ,class _V = typename _Sequence::value_type
+# endif /* __sgi */
+# endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+ >
+// The 3rd parameter works around a common compiler bug.
+class sequence_buffer : public iterator <output_iterator_tag, void, void, void, void> {
+public:
+# ifndef __TYPEDEF_WORKAROUND
+ typedef typename _Sequence::value_type value_type;
+ typedef sequence_buffer<_Sequence
+# if !(defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) || \
+ defined ( _STLP_NO_DEFAULT_NON_TYPE_PARAM ))
+ , _Buf_sz
+ > _Self;
+# else /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+ > _Self;
+ enum { _Buf_sz = 100};
+# endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+ // # endif
+# else /* __TYPEDEF_WORKAROUND */
+ typedef _V value_type;
+ typedef sequence_buffer<_Sequence, _Buf_sz, _V> _Self;
+# endif /* __TYPEDEF_WORKAROUND */
+protected:
+ _Sequence* _M_prefix;
+ value_type _M_buffer[_Buf_sz];
+ size_t _M_buf_count;
+public:
+ void flush() {
+ _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count);
+ _M_buf_count = 0;
+ }
+ ~sequence_buffer() { flush(); }
+ sequence_buffer() : _M_prefix(0), _M_buf_count(0) {}
+ sequence_buffer(const _Self& __x) {
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = __x._M_buf_count;
+ copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
+ }
+ sequence_buffer(_Self& __x) {
+ __x.flush();
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = 0;
+ }
+ sequence_buffer(_Sequence& __s) : _M_prefix(&__s), _M_buf_count(0) {}
+ _Self& operator= (_Self& __x) {
+ __x.flush();
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = 0;
+ return *this;
+ }
+ _Self& operator= (const _Self& __x) {
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = __x._M_buf_count;
+ copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
+ return *this;
+ }
+ void push_back(value_type __x) {
+ if (_M_buf_count < _Buf_sz) {
+ _M_buffer[_M_buf_count] = __x;
+ ++_M_buf_count;
+ } else {
+ flush();
+ _M_buffer[0] = __x;
+ _M_buf_count = 1;
+ }
+ }
+ void append(const value_type *__s, size_t __len) {
+ if (__len + _M_buf_count <= _Buf_sz) {
+ size_t __i = _M_buf_count;
+ size_t __j = 0;
+ for (; __j < __len; __i++, __j++) {
+ _M_buffer[__i] = __s[__j];
+ }
+ _M_buf_count += __len;
+ } else if (0 == _M_buf_count) {
+ _M_prefix->append(__s, __s + __len);
+ } else {
+ flush();
+ append(__s, __len);
+ }
+ }
+ _Self& write(const value_type *__s, size_t __len) {
+ append(__s, __len);
+ return *this;
+ }
+ _Self& put(value_type __x) {
+ push_back(__x);
+ return *this;
+ }
+ _Self& operator=(const value_type& __rhs) {
+ push_back(__rhs);
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self& operator++(int) { return *this; }
+};
+
+// The following should be treated as private, at least for now.
+template<class _CharT>
+class _Rope_char_consumer {
+#if !defined (_STLP_MEMBER_TEMPLATES)
+public:
+ //Without member templates we have to use run-time parameterization.
+ // The symmetry with char_producer is accidental and temporary.
+ virtual ~_Rope_char_consumer() {}
+ virtual bool operator()(const _CharT* __buffer, size_t __len) = 0;
+#endif
+};
+
+//
+// What follows should really be local to rope. Unfortunately,
+// that doesn't work, since it makes it impossible to define generic
+// equality on rope iterators. According to the draft standard, the
+// template parameters for such an equality operator cannot be inferred
+// from the occurence of a member class as a parameter.
+// (SGI compilers in fact allow this, but the __result wouldn't be
+// portable.)
+// Similarly, some of the static member functions are member functions
+// only to avoid polluting the global namespace, and to circumvent
+// restrictions on type inference for template functions.
+//
+
+//
+// The internal data structure for representing a rope. This is
+// private to the implementation. A rope is really just a pointer
+// to one of these.
+//
+// A few basic functions for manipulating this data structure
+// are members of _RopeRep. Most of the more complex algorithms
+// are implemented as rope members.
+//
+// Some of the static member functions of _RopeRep have identically
+// named functions in rope that simply invoke the _RopeRep versions.
+//
+
+template<class _CharT, class _Alloc>
+struct _Rope_RopeRep
+ : public _Refcount_Base
+{
+ typedef _Rope_RopeRep<_CharT, _Alloc> _Self;
+public:
+ //
+ // GAB: 11/09/05
+ //
+ // "__ROPE_DEPTH_SIZE" is set to one more then the "__ROPE_MAX_DEPTH".
+ // This was originally just an addition of "__ROPE_MAX_DEPTH + 1"
+ // but this addition causes the sunpro compiler to complain about
+ // multiple declarations during the initialization of "_S_min_len".
+ // Changed to be a fixed value and the sunpro compiler appears to
+ // be happy???
+ //
+# define __ROPE_MAX_DEPTH 45
+# define __ROPE_DEPTH_SIZE 46 // __ROPE_MAX_DEPTH + 1
+ enum { _S_max_rope_depth = __ROPE_MAX_DEPTH };
+ enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
+ // Apparently needed by VC++
+ // The data fields of leaves are allocated with some
+ // extra space, to accomodate future growth and for basic
+ // character types, to hold a trailing eos character.
+ enum { _S_alloc_granularity = 8 };
+
+ _Tag _M_tag:8;
+ bool _M_is_balanced:8;
+
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _Alloc_traits<_CharT,_Alloc>::allocator_type allocator_type;
+
+ allocator_type get_allocator() const { return allocator_type(_M_size); }
+
+ unsigned char _M_depth;
+ _CharT* _STLP_VOLATILE _M_c_string;
+ _STLP_PRIV _STLP_alloc_proxy<size_t, _CharT, allocator_type> _M_size;
+
+# ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeRep() : _Refcount_Base(1), _M_size(allocator_type(), 0) {}
+# endif
+
+ /* Flattened version of string, if needed. */
+ /* typically 0. */
+ /* If it's not 0, then the memory is owned */
+ /* by this node. */
+ /* In the case of a leaf, this may point to */
+ /* the same memory as the data field. */
+ _Rope_RopeRep(_Tag __t, unsigned char __d, bool __b, size_t _p_size,
+ allocator_type __a) :
+ _Refcount_Base(1),
+ _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0), _M_size(__a, _p_size)
+ { }
+
+ typedef typename _AreSameUnCVTypes<_CharT, char>::_Ret _IsChar;
+# ifdef _STLP_HAS_WCHAR_T
+ typedef typename _AreSameUnCVTypes<_CharT, wchar_t>::_Ret _IsWCharT;
+# else
+ typedef __false_type _IsWCharT;
+# endif
+
+ typedef typename _Lor2<_IsChar, _IsWCharT>::_Ret _IsBasicCharType;
+
+#if 0
+ /* Please tell why this code is necessary if you uncomment it.
+ * Problem with it is that rope implementation expect that _S_rounded_up_size(n)
+ * returns a size > n in order to store the terminating null charater. When
+ * instanciation type is not a char or wchar_t this is not guaranty resulting in
+ * memory overrun.
+ */
+ static size_t _S_rounded_up_size_aux(size_t __n, __true_type const& /*_IsBasicCharType*/) {
+ // Allow slop for in-place expansion.
+ return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1);
+ }
+
+ static size_t _S_rounded_up_size_aux(size_t __n, __false_type const& /*_IsBasicCharType*/) {
+ // Allow slop for in-place expansion.
+ return (__n + _S_alloc_granularity - 1) & ~(_S_alloc_granularity - 1);
+ }
+#endif
+ // fbp : moved from RopeLeaf
+ static size_t _S_rounded_up_size(size_t __n)
+ //{ return _S_rounded_up_size_aux(__n, _IsBasicCharType()); }
+ { return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1); }
+
+ static void _S_free_string( _CharT* __s, size_t __len,
+ allocator_type __a) {
+ _STLP_STD::_Destroy_Range(__s, __s + __len);
+ // This has to be a static member, so this gets a bit messy
+# ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE
+ __a.deallocate(__s, _S_rounded_up_size(__len)); //*ty 03/24/2001 - restored not to use __stl_alloc_rebind() since it is not defined under _STLP_MEMBER_TEMPLATE_CLASSES
+# else
+ __stl_alloc_rebind (__a, (_CharT*)0).deallocate(__s, _S_rounded_up_size(__len));
+# endif
+ }
+
+ // Deallocate data section of a leaf.
+ // This shouldn't be a member function.
+ // But its hard to do anything else at the
+ // moment, because it's templatized w.r.t.
+ // an allocator.
+ // Does nothing if __GC is defined.
+ void _M_free_c_string();
+ void _M_free_tree();
+ // Deallocate t. Assumes t is not 0.
+ void _M_unref_nonnil() {
+ if (_M_decr() == 0) _M_free_tree();
+ }
+ void _M_ref_nonnil() {
+ _M_incr();
+ }
+ static void _S_unref(_Self* __t) {
+ if (0 != __t) {
+ __t->_M_unref_nonnil();
+ }
+ }
+ static void _S_ref(_Self* __t) {
+ if (0 != __t) __t->_M_incr();
+ }
+ //static void _S_free_if_unref(_Self* __t) {
+ // if (0 != __t && 0 == __t->_M_ref_count) __t->_M_free_tree();
+ //}
+};
+
+template<class _CharT, class _Alloc>
+struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> {
+public:
+ _CharT* _M_data; /* Not necessarily 0 terminated. */
+ /* The allocated size is */
+ /* _S_rounded_up_size(size), except */
+ /* in the GC case, in which it */
+ /* doesn't matter. */
+private:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType;
+ void _M_init(__true_type const& /*_IsBasicCharType*/) {
+ this->_M_c_string = _M_data;
+ }
+ void _M_init(__false_type const& /*_IsBasicCharType*/) {}
+
+public:
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _RopeRep::allocator_type allocator_type;
+
+ _Rope_RopeLeaf( _CharT* __d, size_t _p_size, allocator_type __a)
+ : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_leaf, 0, true, _p_size, __a),
+ _M_data(__d) {
+ _STLP_ASSERT(_p_size > 0)
+ _M_init(_IsBasicCharType());
+ }
+
+# ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeLeaf() {}
+ _Rope_RopeLeaf(const _Rope_RopeLeaf<_CharT, _Alloc>& ) {}
+# endif
+
+// The constructor assumes that d has been allocated with
+ // the proper allocator and the properly padded size.
+ // In contrast, the destructor deallocates the data:
+ ~_Rope_RopeLeaf() {
+ if (_M_data != this->_M_c_string) {
+ this->_M_free_c_string();
+ }
+ _RopeRep::_S_free_string(_M_data, this->_M_size._M_data, this->get_allocator());
+ }
+};
+
+template<class _CharT, class _Alloc>
+struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT, _Alloc> {
+private:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+
+public:
+ _RopeRep* _M_left;
+ _RopeRep* _M_right;
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _RopeRep::allocator_type allocator_type;
+ _Rope_RopeConcatenation(_RopeRep* __l, _RopeRep* __r, allocator_type __a)
+ : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_concat,
+ (max)(__l->_M_depth, __r->_M_depth) + 1, false,
+ __l->_M_size._M_data + __r->_M_size._M_data, __a), _M_left(__l), _M_right(__r)
+ {}
+# ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeConcatenation() {}
+ _Rope_RopeConcatenation(const _Rope_RopeConcatenation<_CharT, _Alloc>&) {}
+# endif
+
+ ~_Rope_RopeConcatenation() {
+ this->_M_free_c_string();
+ _M_left->_M_unref_nonnil();
+ _M_right->_M_unref_nonnil();
+ }
+};
+
+template <class _CharT, class _Alloc>
+struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT, _Alloc> {
+private:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+public:
+ char_producer<_CharT>* _M_fn;
+ /*
+ * Char_producer is owned by the
+ * rope and should be explicitly
+ * deleted when the rope becomes
+ * inaccessible.
+ */
+ bool _M_delete_when_done;
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _Rope_RopeRep<_CharT,_Alloc>::allocator_type allocator_type;
+# ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeFunction() {}
+ _Rope_RopeFunction(const _Rope_RopeFunction<_CharT, _Alloc>& ) {}
+# endif
+
+ _Rope_RopeFunction(char_producer<_CharT>* __f, size_t _p_size,
+ bool __d, allocator_type __a)
+ : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_function, 0, true, _p_size, __a), _M_fn(__f)
+ , _M_delete_when_done(__d)
+ { _STLP_ASSERT(_p_size > 0) }
+
+ ~_Rope_RopeFunction() {
+ this->_M_free_c_string();
+ if (_M_delete_when_done) {
+ delete _M_fn;
+ }
+ }
+};
+
+/*
+ * Substring results are usually represented using just
+ * concatenation nodes. But in the case of very long flat ropes
+ * or ropes with a functional representation that isn't practical.
+ * In that case, we represent the __result as a special case of
+ * RopeFunction, whose char_producer points back to the rope itself.
+ * In all cases except repeated substring operations and
+ * deallocation, we treat the __result as a RopeFunction.
+ */
+template<class _CharT, class _Alloc>
+struct _Rope_RopeSubstring : public char_producer<_CharT>, public _Rope_RopeFunction<_CharT,_Alloc> {
+public:
+ // XXX this whole class should be rewritten.
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ _RopeRep *_M_base; // not 0
+ size_t _M_start;
+ /* virtual */ void operator()(size_t __start_pos, size_t __req_len,
+ _CharT* __buffer) {
+ typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
+ typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
+ switch (_M_base->_M_tag) {
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ char_producer<_CharT>* __fn =
+ __STATIC_CAST(_RopeFunction*, _M_base)->_M_fn;
+ _STLP_ASSERT(__start_pos + __req_len <= this->_M_size._M_data)
+ _STLP_ASSERT(_M_start + this->_M_size._M_data <= _M_base->_M_size._M_data)
+ (*__fn)(__start_pos + _M_start, __req_len, __buffer);
+ }
+ break;
+ case _RopeRep::_S_leaf:
+ {
+ _CharT* __s =
+ __STATIC_CAST(_RopeLeaf*, _M_base)->_M_data;
+ _STLP_PRIV __ucopy_n(__s + __start_pos + _M_start, __req_len, __buffer);
+ }
+ break;
+ default:
+ _STLP_ASSERT(false)
+ ;
+ }
+ }
+
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _RopeRep::allocator_type allocator_type;
+
+ _Rope_RopeSubstring(_RopeRep* __b, size_t __s, size_t __l, allocator_type __a)
+ : _Rope_RopeFunction<_CharT,_Alloc>(this, __l, false, __a),
+ _M_base(__b), _M_start(__s) {
+ _STLP_ASSERT(__l > 0)
+ _STLP_ASSERT(__s + __l <= __b->_M_size._M_data)
+ _M_base->_M_ref_nonnil();
+ this->_M_tag = _RopeRep::_S_substringfn;
+ }
+ virtual ~_Rope_RopeSubstring()
+ { _M_base->_M_unref_nonnil(); }
+};
+
+/*
+ * Self-destructing pointers to Rope_rep.
+ * These are not conventional smart pointers. Their
+ * only purpose in life is to ensure that unref is called
+ * on the pointer either at normal exit or if an exception
+ * is raised. It is the caller's responsibility to
+ * adjust reference counts when these pointers are initialized
+ * or assigned to. (This convention significantly reduces
+ * the number of potentially expensive reference count
+ * updates.)
+ */
+template<class _CharT, class _Alloc>
+struct _Rope_self_destruct_ptr {
+ _Rope_RopeRep<_CharT,_Alloc>* _M_ptr;
+ ~_Rope_self_destruct_ptr()
+ { _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); }
+# ifdef _STLP_USE_EXCEPTIONS
+ _Rope_self_destruct_ptr() : _M_ptr(0) {}
+# else
+ _Rope_self_destruct_ptr() {}
+# endif
+ _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {}
+ _Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; }
+ _Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; }
+ operator _Rope_RopeRep<_CharT,_Alloc>*() { return _M_ptr; }
+ _Rope_self_destruct_ptr<_CharT, _Alloc>&
+ operator= (_Rope_RopeRep<_CharT,_Alloc>* __x)
+ { _M_ptr = __x; return *this; }
+};
+
+/*
+ * Dereferencing a nonconst iterator has to return something
+ * that behaves almost like a reference. It's not possible to
+ * return an actual reference since assignment requires extra
+ * work. And we would get into the same problems as with the
+ * CD2 version of basic_string.
+ */
+template<class _CharT, class _Alloc>
+class _Rope_char_ref_proxy {
+ typedef _Rope_char_ref_proxy<_CharT, _Alloc> _Self;
+ friend class rope<_CharT,_Alloc>;
+ friend class _Rope_iterator<_CharT,_Alloc>;
+ friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
+ typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ typedef rope<_CharT,_Alloc> _My_rope;
+ size_t _M_pos;
+ _CharT _M_current;
+ bool _M_current_valid;
+ _My_rope* _M_root; // The whole rope.
+public:
+ _Rope_char_ref_proxy(_My_rope* __r, size_t __p) :
+ _M_pos(__p), _M_current_valid(false), _M_root(__r) {}
+ _Rope_char_ref_proxy(const _Self& __x) :
+ _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {}
+ // Don't preserve cache if the reference can outlive the
+ // expression. We claim that's not possible without calling
+ // a copy constructor or generating reference to a proxy
+ // reference. We declare the latter to have undefined semantics.
+ _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c)
+ : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {}
+ inline operator _CharT () const;
+ _Self& operator= (_CharT __c);
+ _Rope_char_ptr_proxy<_CharT, _Alloc> operator& () const;
+ _Self& operator= (const _Self& __c) {
+ return operator=((_CharT)__c);
+ }
+};
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+template<class _CharT, class __Alloc>
+inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,
+ _Rope_char_ref_proxy <_CharT, __Alloc > __b) {
+ _CharT __tmp = __a;
+ __a = __b;
+ __b = __tmp;
+}
+#else
+// There is no really acceptable way to handle this. The default
+// definition of swap doesn't work for proxy references.
+// It can't really be made to work, even with ugly hacks, since
+// the only unusual operation it uses is the copy constructor, which
+// is needed for other purposes. We provide a macro for
+// full specializations, and instantiate the most common case.
+# define _ROPE_SWAP_SPECIALIZATION(_CharT, __Alloc) \
+ inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, \
+ _Rope_char_ref_proxy <_CharT, __Alloc > __b) { \
+ _CharT __tmp = __a; \
+ __a = __b; \
+ __b = __tmp; \
+ }
+
+_ROPE_SWAP_SPECIALIZATION(char,_STLP_DEFAULT_ALLOCATOR(char) )
+
+# ifndef _STLP_NO_WCHAR_T
+_ROPE_SWAP_SPECIALIZATION(wchar_t,_STLP_DEFAULT_ALLOCATOR(wchar_t) )
+# endif
+
+#endif /* !_STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+template<class _CharT, class _Alloc>
+class _Rope_char_ptr_proxy {
+ // XXX this class should be rewritten.
+public:
+ typedef _Rope_char_ptr_proxy<_CharT, _Alloc> _Self;
+ friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
+ size_t _M_pos;
+ rope<_CharT,_Alloc>* _M_root; // The whole rope.
+
+ _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
+ : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
+ _Rope_char_ptr_proxy(const _Self& __x)
+ : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
+ _Rope_char_ptr_proxy() {}
+ _Rope_char_ptr_proxy(_CharT* __x) : _M_pos(0), _M_root(0) {
+ _STLP_ASSERT(0 == __x)
+ }
+ _Self& operator= (const _Self& __x) {
+ _M_pos = __x._M_pos;
+ _M_root = __x._M_root;
+ return *this;
+ }
+
+ _Rope_char_ref_proxy<_CharT,_Alloc> operator*() const {
+ return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos);
+ }
+};
+
+
+/*
+ * Rope iterators:
+ * Unlike in the C version, we cache only part of the stack
+ * for rope iterators, since they must be efficiently copyable.
+ * When we run out of cache, we have to reconstruct the iterator
+ * value.
+ * Pointers from iterators are not included in reference counts.
+ * Iterators are assumed to be thread private. Ropes can
+ * be shared.
+ */
+template<class _CharT, class _Alloc>
+class _Rope_iterator_base
+/* : public random_access_iterator<_CharT, ptrdiff_t> */
+{
+ friend class rope<_CharT,_Alloc>;
+ typedef _Rope_iterator_base<_CharT, _Alloc> _Self;
+ typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcat;
+public:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+
+ enum { _S_path_cache_len = 4 }; // Must be <= 9 because of _M_path_direction.
+ enum { _S_iterator_buf_len = 15 };
+ size_t _M_current_pos;
+ // The whole rope.
+ _RopeRep* _M_root;
+ // Starting position for current leaf
+ size_t _M_leaf_pos;
+ // Buffer possibly containing current char.
+ _CharT* _M_buf_start;
+ // Pointer to current char in buffer, != 0 ==> buffer valid.
+ _CharT* _M_buf_ptr;
+ // One past __last valid char in buffer.
+ _CharT* _M_buf_end;
+
+ // What follows is the path cache. We go out of our
+ // way to make this compact.
+ // Path_end contains the bottom section of the path from
+ // the root to the current leaf.
+ struct {
+# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
+ _RopeRep const*_M_data[4];
+# else
+ _RopeRep const*_M_data[_S_path_cache_len];
+# endif
+ } _M_path_end;
+ // Last valid __pos in path_end;
+ // _M_path_end[0] ... _M_path_end[_M_leaf_index-1]
+ // point to concatenation nodes.
+ int _M_leaf_index;
+ // (_M_path_directions >> __i) & 1 is 1
+ // if we got from _M_path_end[leaf_index - __i - 1]
+ // to _M_path_end[leaf_index - __i] by going to the
+ // __right. Assumes path_cache_len <= 9.
+ unsigned char _M_path_directions;
+ // Short buffer for surrounding chars.
+ // This is useful primarily for
+ // RopeFunctions. We put the buffer
+ // here to avoid locking in the
+ // multithreaded case.
+ // The cached path is generally assumed to be valid
+ // only if the buffer is valid.
+ struct {
+# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
+ _CharT _M_data[15];
+# else
+ _CharT _M_data[_S_iterator_buf_len];
+# endif
+ } _M_tmp_buf;
+
+ // Set buffer contents given path cache.
+ static void _S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x);
+ // Set buffer contents and path cache.
+ static void _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x);
+ // As above, but assumes path cache is valid for previous posn.
+ static void _S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x);
+ _Rope_iterator_base() {}
+ _Rope_iterator_base(_RopeRep* __root, size_t __pos)
+ : _M_current_pos(__pos),_M_root(__root), _M_buf_ptr(0) {}
+ void _M_incr(size_t __n);
+ void _M_decr(size_t __n);
+public:
+ size_t index() const { return _M_current_pos; }
+private:
+ void _M_copy_buf(const _Self& __x) {
+ _M_tmp_buf = __x._M_tmp_buf;
+ if (__x._M_buf_start == __x._M_tmp_buf._M_data) {
+ _M_buf_start = _M_tmp_buf._M_data;
+ _M_buf_end = _M_buf_start + (__x._M_buf_end - __x._M_buf_start);
+ _M_buf_ptr = _M_buf_start + (__x._M_buf_ptr - __x._M_buf_start);
+ } else {
+ _M_buf_end = __x._M_buf_end;
+ }
+ }
+
+public:
+ _Rope_iterator_base(const _Self& __x) :
+ _M_current_pos(__x._M_current_pos),
+ _M_root(__x._M_root),
+ _M_leaf_pos( __x._M_leaf_pos ),
+ _M_buf_start(__x._M_buf_start),
+ _M_buf_ptr(__x._M_buf_ptr),
+ _M_path_end(__x._M_path_end),
+ _M_leaf_index(__x._M_leaf_index),
+ _M_path_directions(__x._M_path_directions)
+ {
+ if (0 != __x._M_buf_ptr) {
+ _M_copy_buf(__x);
+ }
+ }
+ _Self& operator = (const _Self& __x)
+ {
+ _M_current_pos = __x._M_current_pos;
+ _M_root = __x._M_root;
+ _M_buf_start = __x._M_buf_start;
+ _M_buf_ptr = __x._M_buf_ptr;
+ _M_path_end = __x._M_path_end;
+ _M_leaf_index = __x._M_leaf_index;
+ _M_path_directions = __x._M_path_directions;
+ _M_leaf_pos = __x._M_leaf_pos;
+ if (0 != __x._M_buf_ptr) {
+ _M_copy_buf(__x);
+ }
+ return *this;
+ }
+};
+
+template<class _CharT, class _Alloc> class _Rope_iterator;
+
+template<class _CharT, class _Alloc>
+class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
+ friend class rope<_CharT,_Alloc>;
+ typedef _Rope_const_iterator<_CharT, _Alloc> _Self;
+ typedef _Rope_iterator_base<_CharT,_Alloc> _Base;
+ // protected:
+public:
+# ifndef _STLP_HAS_NO_NAMESPACES
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ // The one from the base class may not be directly visible.
+# endif
+ _Rope_const_iterator(const _RopeRep* __root, size_t __pos):
+ _Rope_iterator_base<_CharT,_Alloc>(__CONST_CAST(_RopeRep*,__root), __pos)
+ // Only nonconst iterators modify root ref count
+ {}
+public:
+ typedef _CharT reference; // Really a value. Returning a reference
+ // Would be a mess, since it would have
+ // to be included in refcount.
+ typedef const _CharT* pointer;
+ typedef _CharT value_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag iterator_category;
+
+public:
+ _Rope_const_iterator() {}
+ _Rope_const_iterator(const _Self& __x) :
+ _Rope_iterator_base<_CharT,_Alloc>(__x) { }
+ _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x):
+ _Rope_iterator_base<_CharT,_Alloc>(__x) {}
+ _Rope_const_iterator(const rope<_CharT,_Alloc>& __r, size_t __pos) :
+ _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos) {}
+ _Self& operator= (const _Self& __x) {
+ _Base::operator=(__x);
+ return *this;
+ }
+ reference operator*() {
+ if (0 == this->_M_buf_ptr)
+#if !defined (__DMC__)
+ _S_setcache(*this);
+#else
+ { _Rope_iterator_base<_CharT, _Alloc>* __x = this; _S_setcache(*__x); }
+#endif
+ return *(this->_M_buf_ptr);
+ }
+ _Self& operator++() {
+ _CharT* __next;
+ if (0 != this->_M_buf_ptr && (__next = this->_M_buf_ptr + 1) < this->_M_buf_end) {
+ this->_M_buf_ptr = __next;
+ ++this->_M_current_pos;
+ } else {
+ this->_M_incr(1);
+ }
+ return *this;
+ }
+ _Self& operator+=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_incr(__n);
+ } else {
+ this->_M_decr(-__n);
+ }
+ return *this;
+ }
+ _Self& operator--() {
+ this->_M_decr(1);
+ return *this;
+ }
+ _Self& operator-=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_decr(__n);
+ } else {
+ this->_M_incr(-__n);
+ }
+ return *this;
+ }
+ _Self operator++(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_incr(1);
+ return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
+ // This makes a subsequent dereference expensive.
+ // Perhaps we should instead copy the iterator
+ // if it has a valid cache?
+ }
+ _Self operator--(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_decr(1);
+ return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
+ }
+ inline reference operator[](size_t __n);
+};
+
+template<class _CharT, class _Alloc>
+class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
+ friend class rope<_CharT,_Alloc>;
+ typedef _Rope_iterator<_CharT, _Alloc> _Self;
+ typedef _Rope_iterator_base<_CharT,_Alloc> _Base;
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+
+public:
+ rope<_CharT,_Alloc>* _M_root_rope;
+ // root is treated as a cached version of this,
+ // and is used to detect changes to the underlying
+ // rope.
+ // Root is included in the reference count.
+ // This is necessary so that we can detect changes reliably.
+ // Unfortunately, it requires careful bookkeeping for the
+ // nonGC case.
+ _Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos);
+
+ void _M_check();
+public:
+ typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
+ typedef _Rope_char_ref_proxy<_CharT,_Alloc>* pointer;
+ typedef _CharT value_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag iterator_category;
+public:
+ ~_Rope_iterator() { //*TY 5/6/00 - added dtor to balance reference count
+ _RopeRep::_S_unref(this->_M_root);
+ }
+
+ rope<_CharT,_Alloc>& container() { return *_M_root_rope; }
+ _Rope_iterator() {
+ this->_M_root = 0; // Needed for reference counting.
+ }
+ _Rope_iterator(const _Self& __x) :
+ _Rope_iterator_base<_CharT,_Alloc>(__x) {
+ _M_root_rope = __x._M_root_rope;
+ _RopeRep::_S_ref(this->_M_root);
+ }
+ _Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos);
+ _Self& operator= (const _Self& __x) {
+ _RopeRep* __old = this->_M_root;
+ _RopeRep::_S_ref(__x._M_root);
+ _Base::operator=(__x);
+ _M_root_rope = __x._M_root_rope;
+ _RopeRep::_S_unref(__old);
+ return *this;
+ }
+ reference operator*() {
+ _M_check();
+ if (0 == this->_M_buf_ptr) {
+ return reference(_M_root_rope, this->_M_current_pos);
+ } else {
+ return reference(_M_root_rope, this->_M_current_pos, *(this->_M_buf_ptr));
+ }
+ }
+ _Self& operator++() {
+ this->_M_incr(1);
+ return *this;
+ }
+ _Self& operator+=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_incr(__n);
+ } else {
+ this->_M_decr(-__n);
+ }
+ return *this;
+ }
+ _Self& operator--() {
+ this->_M_decr(1);
+ return *this;
+ }
+ _Self& operator-=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_decr(__n);
+ } else {
+ this->_M_incr(-__n);
+ }
+ return *this;
+ }
+ _Self operator++(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_incr(1);
+ return _Self(_M_root_rope, __old_pos);
+ }
+ _Self operator--(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_decr(1);
+ return _Self(_M_root_rope, __old_pos);
+ }
+ reference operator[](ptrdiff_t __n) {
+ return reference(_M_root_rope, this->_M_current_pos + __n);
+ }
+};
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _CharT, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _Rope_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag();}
+template <class _CharT, class _Alloc>
+inline _CharT* value_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; }
+template <class _CharT, class _Alloc>
+inline ptrdiff_t* distance_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; }
+template <class _CharT, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _Rope_const_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag(); }
+template <class _CharT, class _Alloc>
+inline _CharT* value_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; }
+template <class _CharT, class _Alloc>
+inline ptrdiff_t* distance_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; }
+#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+
+template <class _CharT, class _Alloc, class _CharConsumer>
+bool _S_apply_to_pieces(_CharConsumer& __c,
+ _Rope_RopeRep<_CharT, _Alloc> *__r,
+ size_t __begin, size_t __end);
+ // begin and end are assumed to be in range.
+
+template <class _CharT, class _Alloc>
+class rope
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<rope<_CharT, _Alloc> >
+#endif
+{
+ typedef rope<_CharT,_Alloc> _Self;
+public:
+ typedef _CharT value_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef _CharT const_reference;
+ typedef const _CharT* const_pointer;
+ typedef _Rope_iterator<_CharT,_Alloc> iterator;
+ typedef _Rope_const_iterator<_CharT,_Alloc> const_iterator;
+ typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
+ typedef _Rope_char_ptr_proxy<_CharT,_Alloc> pointer;
+
+ friend class _Rope_iterator<_CharT,_Alloc>;
+ friend class _Rope_const_iterator<_CharT,_Alloc>;
+ friend struct _Rope_RopeRep<_CharT,_Alloc>;
+ friend class _Rope_iterator_base<_CharT,_Alloc>;
+ friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
+ friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
+ friend struct _Rope_RopeSubstring<_CharT,_Alloc>;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+protected:
+ typedef _CharT* _Cstrptr;
+
+ static _CharT _S_empty_c_str[1];
+
+ enum { _S_copy_max = 23 };
+ // For strings shorter than _S_copy_max, we copy to
+ // concatenate.
+
+ typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
+ typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType;
+
+public:
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _Alloc_traits<_CharT,_Alloc>::allocator_type allocator_type;
+
+public:
+ // The only data member of a rope:
+ _STLP_PRIV _STLP_alloc_proxy<_RopeRep*, _CharT, allocator_type> _M_tree_ptr;
+
+public:
+ allocator_type get_allocator() const { return allocator_type(_M_tree_ptr); }
+
+public:
+ typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation;
+ typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
+ typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
+ typedef _Rope_RopeSubstring<_CharT,_Alloc> _RopeSubstring;
+
+ // Retrieve a character at the indicated position.
+ static _CharT _S_fetch(_RopeRep* __r, size_type __pos);
+
+ // Obtain a pointer to the character at the indicated position.
+ // The pointer can be used to change the character.
+ // If such a pointer cannot be produced, as is frequently the
+ // case, 0 is returned instead.
+ // (Returns nonzero only if all nodes in the path have a refcount
+ // of 1.)
+ static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos);
+
+ static void _S_unref(_RopeRep* __t) {
+ _RopeRep::_S_unref(__t);
+ }
+ static void _S_ref(_RopeRep* __t) {
+ _RopeRep::_S_ref(__t);
+ }
+
+ typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
+
+ // _Result is counted in refcount.
+ static _RopeRep* _S_substring(_RopeRep* __base,
+ size_t __start, size_t __endp1);
+
+ static _RopeRep* _S_concat_char_iter(_RopeRep* __r,
+ const _CharT* __iter, size_t __slen);
+ // Concatenate rope and char ptr, copying __s.
+ // Should really take an arbitrary iterator.
+ // Result is counted in refcount.
+ static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,
+ const _CharT* __iter, size_t __slen);
+ // As above, but one reference to __r is about to be
+ // destroyed. Thus the pieces may be recycled if all
+ // relevent reference counts are 1.
+
+ // General concatenation on _RopeRep. _Result
+ // has refcount of 1. Adjusts argument refcounts.
+ static _RopeRep* _S_concat_rep(_RopeRep* __left, _RopeRep* __right);
+
+public:
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _CharConsumer>
+#else
+ typedef _Rope_char_consumer<_CharT> _CharConsumer;
+#endif
+ void apply_to_pieces(size_t __begin, size_t __end,
+ _CharConsumer& __c) const
+ { _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __begin, __end); }
+
+protected:
+
+ static size_t _S_rounded_up_size(size_t __n)
+ { return _RopeRep::_S_rounded_up_size(__n); }
+
+ // Allocate and construct a RopeLeaf using the supplied allocator
+ // Takes ownership of s instead of copying.
+ static _RopeLeaf* _S_new_RopeLeaf(_CharT *__s,
+ size_t _p_size, allocator_type __a) {
+ _RopeLeaf* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeLeaf).allocate(1);
+ _STLP_TRY {
+ _STLP_PLACEMENT_NEW(__space) _RopeLeaf(__s, _p_size, __a);
+ }
+ _STLP_UNWIND(_STLP_CREATE_ALLOCATOR(allocator_type,__a,
+ _RopeLeaf).deallocate(__space, 1))
+ return __space;
+ }
+
+ static _RopeConcatenation* _S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right,
+ allocator_type __a) {
+ _RopeConcatenation* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeConcatenation).allocate(1);
+ return _STLP_PLACEMENT_NEW(__space) _RopeConcatenation(__left, __right, __a);
+ }
+
+ static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f,
+ size_t _p_size, bool __d, allocator_type __a) {
+ _RopeFunction* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeFunction).allocate(1);
+ return _STLP_PLACEMENT_NEW(__space) _RopeFunction(__f, _p_size, __d, __a);
+ }
+
+ static _RopeSubstring* _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
+ size_t __l, allocator_type __a) {
+ _RopeSubstring* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeSubstring).allocate(1);
+ return _STLP_PLACEMENT_NEW(__space) _RopeSubstring(__b, __s, __l, __a);
+ }
+
+ static
+ _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
+ size_t _p_size, allocator_type __a) {
+ if (0 == _p_size) return 0;
+
+ _CharT* __buf = _STLP_CREATE_ALLOCATOR(allocator_type,__a, _CharT).allocate(_S_rounded_up_size(_p_size));
+
+ _STLP_PRIV __ucopy_n(__s, _p_size, __buf);
+ _S_construct_null(__buf + _p_size);
+
+ _STLP_TRY {
+ return _S_new_RopeLeaf(__buf, _p_size, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__buf, _p_size, __a))
+ _STLP_RET_AFTER_THROW(0)
+ }
+
+
+ // Concatenation of nonempty strings.
+ // Always builds a concatenation node.
+ // Rebalances if the result is too deep.
+ // Result has refcount 1.
+ // Does not increment left and right ref counts even though
+ // they are referenced.
+ static _RopeRep*
+ _S_tree_concat(_RopeRep* __left, _RopeRep* __right);
+
+ // Concatenation helper functions
+ static _RopeLeaf*
+ _S_leaf_concat_char_iter(_RopeLeaf* __r,
+ const _CharT* __iter, size_t __slen);
+ // Concatenate by copying leaf.
+ // should take an arbitrary iterator
+ // result has refcount 1.
+ static _RopeLeaf* _S_destr_leaf_concat_char_iter
+ (_RopeLeaf* __r, const _CharT* __iter, size_t __slen);
+ // A version that potentially clobbers __r if __r->_M_ref_count == 1.
+
+
+ // A helper function for exponentiating strings.
+ // This uses a nonstandard refcount convention.
+ // The result has refcount 0.
+ typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn;
+#if !defined (__GNUC__) || (__GNUC__ < 3)
+ friend _Concat_fn;
+#else
+ friend struct _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc>;
+#endif
+
+public:
+ static size_t _S_char_ptr_len(const _CharT* __s) {
+ return char_traits<_CharT>::length(__s);
+ }
+
+public: /* for operators */
+ rope(_RopeRep* __t, const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, __t) { }
+private:
+ // Copy __r to the _CharT buffer.
+ // Returns __buffer + __r->_M_size._M_data.
+ // Assumes that buffer is uninitialized.
+ static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer);
+
+ // Again, with explicit starting position and length.
+ // Assumes that buffer is uninitialized.
+ static _CharT* _S_flatten(_RopeRep* __r,
+ size_t __start, size_t __len,
+ _CharT* __buffer);
+
+ // fbp : HP aCC prohibits access to protected min_len from within static methods ( ?? )
+public:
+ static const unsigned long _S_min_len[__ROPE_DEPTH_SIZE];
+protected:
+ static bool _S_is_balanced(_RopeRep* __r)
+ { return (__r->_M_size._M_data >= _S_min_len[__r->_M_depth]); }
+
+ static bool _S_is_almost_balanced(_RopeRep* __r) {
+ return (__r->_M_depth == 0 ||
+ __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 1]);
+ }
+
+ static bool _S_is_roughly_balanced(_RopeRep* __r) {
+ return (__r->_M_depth <= 1 ||
+ __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 2]);
+ }
+
+ // Assumes the result is not empty.
+ static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left,
+ _RopeRep* __right) {
+ _RopeRep* __result = _S_concat_rep(__left, __right);
+ if (_S_is_balanced(__result)) __result->_M_is_balanced = true;
+ return __result;
+ }
+
+ // The basic rebalancing operation. Logically copies the
+ // rope. The result has refcount of 1. The client will
+ // usually decrement the reference count of __r.
+ // The result is within height 2 of balanced by the above
+ // definition.
+ static _RopeRep* _S_balance(_RopeRep* __r);
+
+ // Add all unbalanced subtrees to the forest of balanceed trees.
+ // Used only by balance.
+ static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest);
+
+ // Add __r to forest, assuming __r is already balanced.
+ static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest);
+
+#ifdef _STLP_DEBUG
+ // Print to stdout, exposing structure
+ static void _S_dump(_RopeRep* __r, int __indent = 0);
+#endif
+
+ // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp.
+ static int _S_compare(const _RopeRep* __x, const _RopeRep* __y);
+
+ void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
+
+ void _M_reset(_RopeRep* __r) {
+ //if (__r != _M_tree_ptr._M_data) {
+ _S_unref(_M_tree_ptr._M_data);
+ _M_tree_ptr._M_data = __r;
+ //}
+ }
+
+public:
+ bool empty() const { return 0 == _M_tree_ptr._M_data; }
+
+ // Comparison member function. This is public only for those
+ // clients that need a ternary comparison. Others
+ // should use the comparison operators below.
+ int compare(const _Self& __y) const {
+ return _S_compare(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data);
+ }
+
+ rope(const _CharT* __s, const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, _S_char_ptr_len(__s),__a))
+ {}
+
+ rope(const _CharT* __s, size_t __len,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_S_RopeLeaf_from_unowned_char_ptr(__s, __len, __a)))
+ {}
+
+ // Should perhaps be templatized with respect to the iterator type
+ // and use Sequence_buffer. (It should perhaps use sequence_buffer
+ // even now.)
+ rope(const _CharT *__s, const _CharT *__e,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, __e - __s, __a))
+ {}
+
+ rope(const const_iterator& __s, const const_iterator& __e,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos,
+ __e._M_current_pos))
+ {}
+
+ rope(const iterator& __s, const iterator& __e,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos,
+ __e._M_current_pos))
+ {}
+
+ rope(_CharT __c, const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_RopeRep*)0) {
+ _CharT* __buf = _M_tree_ptr.allocate(_S_rounded_up_size(1));
+
+ _Copy_Construct(__buf, __c);
+ _S_construct_null(__buf + 1);
+
+ _STLP_TRY {
+ _M_tree_ptr._M_data = _S_new_RopeLeaf(__buf, 1, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__buf, 1, __a))
+ }
+
+ rope(size_t __n, _CharT __c,
+ const allocator_type& __a = allocator_type()):
+ _M_tree_ptr(__a, (_RopeRep*)0) {
+ if (0 == __n)
+ return;
+
+ rope<_CharT,_Alloc> __result;
+# define __exponentiate_threshold size_t(32)
+ _RopeRep* __remainder;
+ rope<_CharT,_Alloc> __remainder_rope;
+
+ // gcc-2.7.2 bugs
+ typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn;
+
+ size_t __exponent = __n / __exponentiate_threshold;
+ size_t __rest = __n % __exponentiate_threshold;
+ if (0 == __rest) {
+ __remainder = 0;
+ } else {
+ _CharT* __rest_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__rest));
+ uninitialized_fill_n(__rest_buffer, __rest, __c);
+ _S_construct_null(__rest_buffer + __rest);
+ _STLP_TRY {
+ __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__rest_buffer, __rest, __a))
+ }
+ __remainder_rope._M_tree_ptr._M_data = __remainder;
+ if (__exponent != 0) {
+ _CharT* __base_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__exponentiate_threshold));
+ _RopeLeaf* __base_leaf;
+ rope<_CharT,_Alloc> __base_rope;
+ uninitialized_fill_n(__base_buffer, __exponentiate_threshold, __c);
+ _S_construct_null(__base_buffer + __exponentiate_threshold);
+ _STLP_TRY {
+ __base_leaf = _S_new_RopeLeaf(__base_buffer,
+ __exponentiate_threshold, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__base_buffer,
+ __exponentiate_threshold, __a))
+ __base_rope._M_tree_ptr._M_data = __base_leaf;
+ if (1 == __exponent) {
+ __result = __base_rope;
+ // One each for base_rope and __result
+ //_STLP_ASSERT(2 == __result._M_tree_ptr._M_data->_M_ref_count)
+ } else {
+ __result = _STLP_PRIV __power(__base_rope, __exponent, _Concat_fn());
+ }
+ if (0 != __remainder) {
+ __result += __remainder_rope;
+ }
+ } else {
+ __result = __remainder_rope;
+ }
+ _M_tree_ptr._M_data = __result._M_tree_ptr._M_data;
+ _M_tree_ptr._M_data->_M_ref_nonnil();
+# undef __exponentiate_threshold
+ }
+
+ rope(const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_RopeRep*)0) {}
+
+ // Construct a rope from a function that can compute its members
+ rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_RopeRep*)0) {
+ _M_tree_ptr._M_data = (0 == __len) ?
+ 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
+ }
+
+ rope(const _Self& __x)
+ : _M_tree_ptr(__x._M_tree_ptr, __x._M_tree_ptr._M_data) {
+ _S_ref(_M_tree_ptr._M_data);
+ }
+
+ rope(__move_source<_Self> __src)
+ : _M_tree_ptr(__src.get()._M_tree_ptr, __src.get()._M_tree_ptr._M_data) {
+ __src.get()._M_tree_ptr._M_data = 0;
+ }
+
+ ~rope() {
+ _S_unref(_M_tree_ptr._M_data);
+ }
+
+ _Self& operator=(const _Self& __x) {
+ _STLP_ASSERT(get_allocator() == __x.get_allocator())
+ _S_ref(__x._M_tree_ptr._M_data);
+ _M_reset(__x._M_tree_ptr._M_data);
+ return *this;
+ }
+
+ void clear() {
+ _S_unref(_M_tree_ptr._M_data);
+ _M_tree_ptr._M_data = 0;
+ }
+ void push_back(_CharT __x) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__x, 1));
+ }
+
+ void pop_back() {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _M_tree_ptr._M_data =
+ _S_substring(_M_tree_ptr._M_data, 0, _M_tree_ptr._M_data->_M_size._M_data - 1);
+ _S_unref(__old);
+ }
+
+ _CharT back() const {
+ return _S_fetch(_M_tree_ptr._M_data, _M_tree_ptr._M_data->_M_size._M_data - 1);
+ }
+
+ void push_front(_CharT __x) {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _RopeRep* __left =
+ _S_RopeLeaf_from_unowned_char_ptr(&__x, 1, _M_tree_ptr);
+ _STLP_TRY {
+ _M_tree_ptr._M_data = _S_concat_rep(__left, _M_tree_ptr._M_data);
+ _S_unref(__old);
+ _S_unref(__left);
+ }
+ _STLP_UNWIND(_S_unref(__left))
+ }
+
+ void pop_front() {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _M_tree_ptr._M_data = _S_substring(_M_tree_ptr._M_data, 1, _M_tree_ptr._M_data->_M_size._M_data);
+ _S_unref(__old);
+ }
+
+ _CharT front() const {
+ return _S_fetch(_M_tree_ptr._M_data, 0);
+ }
+
+ void balance() {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _M_tree_ptr._M_data = _S_balance(_M_tree_ptr._M_data);
+ _S_unref(__old);
+ }
+
+ void copy(_CharT* __buffer) const {
+ _STLP_STD::_Destroy_Range(__buffer, __buffer + size());
+ _S_flatten(_M_tree_ptr._M_data, __buffer);
+ }
+
+ /*
+ * This is the copy function from the standard, but
+ * with the arguments reordered to make it consistent with the
+ * rest of the interface.
+ * Note that this guaranteed not to compile if the draft standard
+ * order is assumed.
+ */
+ size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const {
+ size_t _p_size = size();
+ size_t __len = (__pos + __n > _p_size? _p_size - __pos : __n);
+
+ _STLP_STD::_Destroy_Range(__buffer, __buffer + __len);
+ _S_flatten(_M_tree_ptr._M_data, __pos, __len, __buffer);
+ return __len;
+ }
+
+# ifdef _STLP_DEBUG
+ // Print to stdout, exposing structure. May be useful for
+ // performance debugging.
+ void dump() {
+ _S_dump(_M_tree_ptr._M_data);
+ }
+# endif
+
+ // Convert to 0 terminated string in new allocated memory.
+ // Embedded 0s in the input do not terminate the copy.
+ const _CharT* c_str() const;
+
+ // As above, but also use the flattened representation as the
+ // the new rope representation.
+ const _CharT* replace_with_c_str();
+
+ // Reclaim memory for the c_str generated flattened string.
+ // Intentionally undocumented, since it's hard to say when this
+ // is safe for multiple threads.
+ void delete_c_str () {
+ if (0 == _M_tree_ptr._M_data) return;
+ if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag &&
+ ((_RopeLeaf*)_M_tree_ptr._M_data)->_M_data ==
+ _M_tree_ptr._M_data->_M_c_string) {
+ // Representation shared
+ return;
+ }
+ _M_tree_ptr._M_data->_M_free_c_string();
+ _M_tree_ptr._M_data->_M_c_string = 0;
+ }
+
+ _CharT operator[] (size_type __pos) const {
+ return _S_fetch(_M_tree_ptr._M_data, __pos);
+ }
+
+ _CharT at(size_type __pos) const {
+ if (__pos >= size()) _M_throw_out_of_range();
+ return (*this)[__pos];
+ }
+
+ const_iterator begin() const {
+ return(const_iterator(_M_tree_ptr._M_data, 0));
+ }
+
+ // An easy way to get a const iterator from a non-const container.
+ const_iterator const_begin() const {
+ return(const_iterator(_M_tree_ptr._M_data, 0));
+ }
+
+ const_iterator end() const {
+ return(const_iterator(_M_tree_ptr._M_data, size()));
+ }
+
+ const_iterator const_end() const {
+ return(const_iterator(_M_tree_ptr._M_data, size()));
+ }
+
+ size_type size() const {
+ return(0 == _M_tree_ptr._M_data? 0 : _M_tree_ptr._M_data->_M_size._M_data);
+ }
+
+ size_type length() const {
+ return size();
+ }
+
+ size_type max_size() const {
+ return _S_min_len[__ROPE_MAX_DEPTH-1] - 1;
+ // Guarantees that the result can be sufficiently
+ // balanced. Longer ropes will probably still work,
+ // but it's harder to make guarantees.
+ }
+
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+
+ const_reverse_iterator const_rbegin() const {
+ return const_reverse_iterator(end());
+ }
+
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ const_reverse_iterator const_rend() const {
+ return const_reverse_iterator(begin());
+ }
+ // The symmetric cases are intentionally omitted, since they're presumed
+ // to be less common, and we don't handle them as well.
+
+ // The following should really be templatized.
+ // The first argument should be an input iterator or
+ // forward iterator with value_type _CharT.
+ _Self& append(const _CharT* __iter, size_t __n) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __iter, __n));
+ return *this;
+ }
+
+ _Self& append(const _CharT* __c_string) {
+ size_t __len = _S_char_ptr_len(__c_string);
+ append(__c_string, __len);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s, const _CharT* __e) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __s, __e - __s));
+ return *this;
+ }
+
+ _Self& append(const_iterator __s, const_iterator __e) {
+ _STLP_ASSERT(__s._M_root == __e._M_root)
+ _STLP_ASSERT(get_allocator() == __s._M_root->get_allocator())
+ _Self_destruct_ptr __appendee(_S_substring(__s._M_root, __s._M_current_pos, __e._M_current_pos));
+ _M_reset(_S_concat_rep(_M_tree_ptr._M_data, (_RopeRep*)__appendee));
+ return *this;
+ }
+
+ _Self& append(_CharT __c) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__c, 1));
+ return *this;
+ }
+
+ _Self& append() { return append(_CharT()); } // XXX why?
+
+ _Self& append(const _Self& __y) {
+ _STLP_ASSERT(__y.get_allocator() == get_allocator())
+ _M_reset(_S_concat_rep(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data));
+ return *this;
+ }
+
+ _Self& append(size_t __n, _CharT __c) {
+ rope<_CharT,_Alloc> __last(__n, __c);
+ return append(__last);
+ }
+
+ void swap(_Self& __b) {
+ _M_tree_ptr.swap(__b._M_tree_ptr);
+ }
+
+protected:
+ // Result is included in refcount.
+ static _RopeRep* replace(_RopeRep* __old, size_t __pos1,
+ size_t __pos2, _RopeRep* __r) {
+ if (0 == __old) { _S_ref(__r); return __r; }
+ _Self_destruct_ptr __left(_S_substring(__old, 0, __pos1));
+ _Self_destruct_ptr __right(_S_substring(__old, __pos2, __old->_M_size._M_data));
+ _STLP_MPWFIX_TRY //*TY 06/01/2000 -
+ _RopeRep* __result;
+
+ if (0 == __r) {
+ __result = _S_concat_rep(__left, __right);
+ } else {
+ _STLP_ASSERT(__old->get_allocator() == __r->get_allocator())
+ _Self_destruct_ptr __left_result(_S_concat_rep(__left, __r));
+ __result = _S_concat_rep(__left_result, __right);
+ }
+ return __result;
+ _STLP_MPWFIX_CATCH //*TY 06/01/2000 -
+ }
+
+public:
+ void insert(size_t __p, const _Self& __r) {
+ if (__p > size()) _M_throw_out_of_range();
+ _STLP_ASSERT(get_allocator() == __r.get_allocator())
+ _M_reset(replace(_M_tree_ptr._M_data, __p, __p, __r._M_tree_ptr._M_data));
+ }
+
+ void insert(size_t __p, size_t __n, _CharT __c) {
+ rope<_CharT,_Alloc> __r(__n,__c);
+ insert(__p, __r);
+ }
+
+ void insert(size_t __p, const _CharT* __i, size_t __n) {
+ if (__p > size()) _M_throw_out_of_range();
+ _Self_destruct_ptr __left(_S_substring(_M_tree_ptr._M_data, 0, __p));
+ _Self_destruct_ptr __right(_S_substring(_M_tree_ptr._M_data, __p, size()));
+ _Self_destruct_ptr __left_result(
+ _S_concat_char_iter(__left, __i, __n));
+ // _S_ destr_concat_char_iter should be safe here.
+ // But as it stands it's probably not a win, since __left
+ // is likely to have additional references.
+ _M_reset(_S_concat_rep(__left_result, __right));
+ }
+
+ void insert(size_t __p, const _CharT* __c_string) {
+ insert(__p, __c_string, _S_char_ptr_len(__c_string));
+ }
+
+ void insert(size_t __p, _CharT __c) {
+ insert(__p, &__c, 1);
+ }
+
+ void insert(size_t __p) {
+ _CharT __c = _CharT();
+ insert(__p, &__c, 1);
+ }
+
+ void insert(size_t __p, const _CharT* __i, const _CharT* __j) {
+ _Self __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ void insert(size_t __p, const const_iterator& __i,
+ const const_iterator& __j) {
+ _Self __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ void insert(size_t __p, const iterator& __i,
+ const iterator& __j) {
+ _Self __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ // (position, length) versions of replace operations:
+ void replace(size_t __p, size_t __n, const _Self& __r) {
+ if (__p > size()) _M_throw_out_of_range();
+ _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, __r._M_tree_ptr._M_data));
+ }
+
+ void replace(size_t __p, size_t __n,
+ const _CharT* __i, size_t __i_len) {
+ _Self __r(__i, __i_len);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n, _CharT __c) {
+ _Self __r(__c);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n, const _CharT* __c_string) {
+ _Self __r(__c_string);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n,
+ const _CharT* __i, const _CharT* __j) {
+ _Self __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n,
+ const const_iterator& __i, const const_iterator& __j) {
+ _Self __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n,
+ const iterator& __i, const iterator& __j) {
+ _Self __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ // Single character variants:
+ void replace(size_t __p, _CharT __c) {
+ if (__p > size()) _M_throw_out_of_range();
+ iterator __i(this, __p);
+ *__i = __c;
+ }
+
+ void replace(size_t __p, const _Self& __r) {
+ replace(__p, 1, __r);
+ }
+
+ void replace(size_t __p, const _CharT* __i, size_t __i_len) {
+ replace(__p, 1, __i, __i_len);
+ }
+
+ void replace(size_t __p, const _CharT* __c_string) {
+ replace(__p, 1, __c_string);
+ }
+
+ void replace(size_t __p, const _CharT* __i, const _CharT* __j) {
+ replace(__p, 1, __i, __j);
+ }
+
+ void replace(size_t __p, const const_iterator& __i,
+ const const_iterator& __j) {
+ replace(__p, 1, __i, __j);
+ }
+
+ void replace(size_t __p, const iterator& __i,
+ const iterator& __j) {
+ replace(__p, 1, __i, __j);
+ }
+
+ // Erase, (position, size) variant.
+ void erase(size_t __p, size_t __n) {
+ if (__p > size()) _M_throw_out_of_range();
+ _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, 0));
+ }
+
+ // Erase, single character
+ void erase(size_t __p) {
+ erase(__p, __p + 1);
+ }
+
+ // Insert, iterator variants.
+ iterator insert(const iterator& __p, const _Self& __r)
+ { insert(__p.index(), __r); return __p; }
+ iterator insert(const iterator& __p, size_t __n, _CharT __c)
+ { insert(__p.index(), __n, __c); return __p; }
+ iterator insert(const iterator& __p, _CharT __c)
+ { insert(__p.index(), __c); return __p; }
+ iterator insert(const iterator& __p )
+ { insert(__p.index()); return __p; }
+ iterator insert(const iterator& __p, const _CharT* c_string)
+ { insert(__p.index(), c_string); return __p; }
+ iterator insert(const iterator& __p, const _CharT* __i, size_t __n)
+ { insert(__p.index(), __i, __n); return __p; }
+ iterator insert(const iterator& __p, const _CharT* __i,
+ const _CharT* __j)
+ { insert(__p.index(), __i, __j); return __p; }
+ iterator insert(const iterator& __p,
+ const const_iterator& __i, const const_iterator& __j)
+ { insert(__p.index(), __i, __j); return __p; }
+ iterator insert(const iterator& __p,
+ const iterator& __i, const iterator& __j)
+ { insert(__p.index(), __i, __j); return __p; }
+
+ // Replace, range variants.
+ void replace(const iterator& __p, const iterator& __q,
+ const _Self& __r)
+ { replace(__p.index(), __q.index() - __p.index(), __r); }
+ void replace(const iterator& __p, const iterator& __q, _CharT __c)
+ { replace(__p.index(), __q.index() - __p.index(), __c); }
+ void replace(const iterator& __p, const iterator& __q,
+ const _CharT* __c_string)
+ { replace(__p.index(), __q.index() - __p.index(), __c_string); }
+ void replace(const iterator& __p, const iterator& __q,
+ const _CharT* __i, size_t __n)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __n); }
+ void replace(const iterator& __p, const iterator& __q,
+ const _CharT* __i, const _CharT* __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+ void replace(const iterator& __p, const iterator& __q,
+ const const_iterator& __i, const const_iterator& __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+ void replace(const iterator& __p, const iterator& __q,
+ const iterator& __i, const iterator& __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+
+ // Replace, iterator variants.
+ void replace(const iterator& __p, const _Self& __r)
+ { replace(__p.index(), __r); }
+ void replace(const iterator& __p, _CharT __c)
+ { replace(__p.index(), __c); }
+ void replace(const iterator& __p, const _CharT* __c_string)
+ { replace(__p.index(), __c_string); }
+ void replace(const iterator& __p, const _CharT* __i, size_t __n)
+ { replace(__p.index(), __i, __n); }
+ void replace(const iterator& __p, const _CharT* __i, const _CharT* __j)
+ { replace(__p.index(), __i, __j); }
+ void replace(const iterator& __p, const_iterator __i,
+ const_iterator __j)
+ { replace(__p.index(), __i, __j); }
+ void replace(const iterator& __p, iterator __i, iterator __j)
+ { replace(__p.index(), __i, __j); }
+
+ // Iterator and range variants of erase
+ iterator erase(const iterator& __p, const iterator& __q) {
+ size_t __p_index = __p.index();
+ erase(__p_index, __q.index() - __p_index);
+ return iterator(this, __p_index);
+ }
+ iterator erase(const iterator& __p) {
+ size_t __p_index = __p.index();
+ erase(__p_index, 1);
+ return iterator(this, __p_index);
+ }
+
+ _Self substr(size_t __start, size_t __len = 1) const {
+ if (__start > size()) _M_throw_out_of_range();
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start, __start + __len));
+ }
+
+ _Self substr(iterator __start, iterator __end) const {
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index()));
+ }
+
+ _Self substr(iterator __start) const {
+ size_t __pos = __start.index();
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1));
+ }
+
+ _Self substr(const_iterator __start, const_iterator __end) const {
+ // This might eventually take advantage of the cache in the
+ // iterator.
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index()));
+ }
+
+ rope<_CharT,_Alloc> substr(const_iterator __start) {
+ size_t __pos = __start.index();
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1));
+ }
+
+#include <stl/_string_npos.h>
+
+ size_type find(const _Self& __s, size_type __pos = 0) const {
+ if (__pos >= size())
+# ifndef _STLP_OLD_ROPE_SEMANTICS
+ return npos;
+# else
+ return size();
+# endif
+
+ size_type __result_pos;
+ const_iterator __result = search(const_begin() + (ptrdiff_t)__pos, const_end(), __s.begin(), __s.end() );
+ __result_pos = __result.index();
+# ifndef _STLP_OLD_ROPE_SEMANTICS
+ if (__result_pos == size()) __result_pos = npos;
+# endif
+ return __result_pos;
+ }
+ size_type find(_CharT __c, size_type __pos = 0) const;
+ size_type find(const _CharT* __s, size_type __pos = 0) const {
+ size_type __result_pos;
+ const_iterator __result = search(const_begin() + (ptrdiff_t)__pos, const_end(),
+ __s, __s + _S_char_ptr_len(__s));
+ __result_pos = __result.index();
+# ifndef _STLP_OLD_ROPE_SEMANTICS
+ if (__result_pos == size()) __result_pos = npos;
+# endif
+ return __result_pos;
+ }
+
+ iterator mutable_begin() {
+ return(iterator(this, 0));
+ }
+
+ iterator mutable_end() {
+ return(iterator(this, size()));
+ }
+
+ reverse_iterator mutable_rbegin() {
+ return reverse_iterator(mutable_end());
+ }
+
+ reverse_iterator mutable_rend() {
+ return reverse_iterator(mutable_begin());
+ }
+
+ reference mutable_reference_at(size_type __pos) {
+ return reference(this, __pos);
+ }
+
+# ifdef __STD_STUFF
+ reference operator[] (size_type __pos) {
+ return reference(this, __pos);
+ }
+
+ reference at(size_type __pos) {
+ if (__pos >= size()) _M_throw_out_of_range();
+ return (*this)[__pos];
+ }
+
+ void resize(size_type, _CharT) {}
+ void resize(size_type) {}
+ void reserve(size_type = 0) {}
+ size_type capacity() const {
+ return max_size();
+ }
+
+ // Stuff below this line is dangerous because it's error prone.
+ // I would really like to get rid of it.
+ // copy function with funny arg ordering.
+ size_type copy(_CharT* __buffer, size_type __n,
+ size_type __pos = 0) const {
+ return copy(__pos, __n, __buffer);
+ }
+
+ iterator end() { return mutable_end(); }
+
+ iterator begin() { return mutable_begin(); }
+
+ reverse_iterator rend() { return mutable_rend(); }
+
+ reverse_iterator rbegin() { return mutable_rbegin(); }
+
+# else
+
+ const_iterator end() { return const_end(); }
+
+ const_iterator begin() { return const_begin(); }
+
+ const_reverse_iterator rend() { return const_rend(); }
+
+ const_reverse_iterator rbegin() { return const_rbegin(); }
+
+# endif
+}; //class rope
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG)
+# if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
+template <class _CharT, class _Alloc>
+const size_t rope<_CharT, _Alloc>::npos = ~(size_t) 0;
+# endif
+#endif
+
+template <class _CharT, class _Alloc>
+inline _CharT
+_Rope_const_iterator< _CharT, _Alloc>::operator[](size_t __n)
+{ return rope<_CharT,_Alloc>::_S_fetch(this->_M_root, this->_M_current_pos + __n); }
+
+template <class _CharT, class _Alloc>
+inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y) {
+ return (__x._M_current_pos == __y._M_current_pos &&
+ __x._M_root == __y._M_root);
+}
+
+template <class _CharT, class _Alloc>
+inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return (__x._M_current_pos < __y._M_current_pos); }
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _CharT, class _Alloc>
+inline bool operator!= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return !(__x == __y); }
+
+template <class _CharT, class _Alloc>
+inline bool operator> (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return __y < __x; }
+
+template <class _CharT, class _Alloc>
+inline bool operator<= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return !(__y < __x); }
+
+template <class _CharT, class _Alloc>
+inline bool operator>= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return !(__x < __y); }
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _CharT, class _Alloc>
+inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
+
+#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug.
+template <class _CharT, class _Alloc>
+inline _Rope_const_iterator<_CharT,_Alloc>
+operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n)
+{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos - __n); }
+# endif
+
+template <class _CharT, class _Alloc>
+inline _Rope_const_iterator<_CharT,_Alloc>
+operator+(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n)
+{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); }
+
+template <class _CharT, class _Alloc>
+inline _Rope_const_iterator<_CharT,_Alloc>
+operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x)
+{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); }
+
+template <class _CharT, class _Alloc>
+inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y) {
+ return (__x._M_current_pos == __y._M_current_pos &&
+ __x._M_root_rope == __y._M_root_rope);
+}
+
+template <class _CharT, class _Alloc>
+inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return (__x._M_current_pos < __y._M_current_pos); }
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _CharT, class _Alloc>
+inline bool operator!= (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return !(__x == __y); }
+
+template <class _CharT, class _Alloc>
+inline bool operator> (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return __y < __x; }
+
+template <class _CharT, class _Alloc>
+inline bool operator<= (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return !(__y < __x); }
+
+template <class _CharT, class _Alloc>
+inline bool operator>= (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return !(__x < __y); }
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _CharT, class _Alloc>
+inline ptrdiff_t operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
+
+#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug.
+template <class _CharT, class _Alloc>
+inline _Rope_iterator<_CharT,_Alloc>
+operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
+ ptrdiff_t __n) {
+ return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos - __n);
+}
+# endif
+
+template <class _CharT, class _Alloc>
+inline _Rope_iterator<_CharT,_Alloc>
+operator+(const _Rope_iterator<_CharT,_Alloc>& __x,
+ ptrdiff_t __n) {
+ return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n);
+}
+
+template <class _CharT, class _Alloc>
+inline _Rope_iterator<_CharT,_Alloc>
+operator+(ptrdiff_t __n, const _Rope_iterator<_CharT,_Alloc>& __x) {
+ return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n);
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>
+operator+ (const rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ _STLP_ASSERT(__left.get_allocator() == __right.get_allocator())
+ return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_rep(__left._M_tree_ptr._M_data, __right._M_tree_ptr._M_data));
+ // Inlining this should make it possible to keep __left and __right in registers.
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>&
+operator+= (rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ __left.append(__right);
+ return __left;
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>
+operator+ (const rope<_CharT,_Alloc>& __left,
+ const _CharT* __right) {
+ size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right);
+ return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, __right, __rlen));
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>&
+operator+= (rope<_CharT,_Alloc>& __left,
+ const _CharT* __right) {
+ __left.append(__right);
+ return __left;
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>
+operator+ (const rope<_CharT,_Alloc>& __left, _CharT __right) {
+ return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, &__right, 1));
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>&
+operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) {
+ __left.append(__right);
+ return __left;
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator< (const rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ return __left.compare(__right) < 0;
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator== (const rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ return __left.compare(__right) == 0;
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _CharT, class _Alloc>
+inline bool
+operator!= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator> (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return __y < __x;
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator<= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return !(__y < __x);
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator>= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return !(__x < __y);
+}
+
+template <class _CharT, class _Alloc>
+inline bool operator!= (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
+ const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _CharT, class _Alloc>
+inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
+ const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) {
+ return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root);
+}
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r);
+#endif
+
+typedef rope<char, _STLP_DEFAULT_ALLOCATOR(char) > crope;
+#if defined (_STLP_HAS_WCHAR_T)
+typedef rope<wchar_t, _STLP_DEFAULT_ALLOCATOR(wchar_t) > wrope;
+#endif
+
+inline crope::reference __mutable_reference_at(crope& __c, size_t __i)
+{ return __c.mutable_reference_at(__i); }
+
+#if defined (_STLP_HAS_WCHAR_T)
+inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i)
+{ return __c.mutable_reference_at(__i); }
+#endif
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _CharT, class _Alloc>
+inline void swap(rope<_CharT,_Alloc>& __x, rope<_CharT,_Alloc>& __y)
+{ __x.swap(__y); }
+#else
+
+inline void swap(crope& __x, crope& __y) { __x.swap(__y); }
+# ifdef _STLP_HAS_WCHAR_T // dwa 8/21/97
+inline void swap(wrope& __x, wrope& __y) { __x.swap(__y); }
+# endif
+
+#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+
+// Hash functions should probably be revisited later:
+_STLP_TEMPLATE_NULL struct hash<crope> {
+ size_t operator()(const crope& __str) const {
+ size_t _p_size = __str.size();
+
+ if (0 == _p_size) return 0;
+ return 13*__str[0] + 5*__str[_p_size - 1] + _p_size;
+ }
+};
+
+#if defined (_STLP_HAS_WCHAR_T) // dwa 8/21/97
+_STLP_TEMPLATE_NULL struct hash<wrope> {
+ size_t operator()(const wrope& __str) const {
+ size_t _p_size = __str.size();
+
+ if (0 == _p_size) return 0;
+ return 13*__str[0] + 5*__str[_p_size - 1] + _p_size;
+ }
+};
+#endif
+
+#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310))
+// I couldn't get this to work with VC++
+template<class _CharT,class _Alloc>
+# if defined (__DMC__) && !defined (__PUT_STATIC_DATA_MEMBERS_HERE)
+extern
+# endif
+void _Rope_rotate(_Rope_iterator<_CharT, _Alloc> __first,
+ _Rope_iterator<_CharT, _Alloc> __middle,
+ _Rope_iterator<_CharT, _Alloc> __last);
+
+inline void rotate(_Rope_iterator<char, _STLP_DEFAULT_ALLOCATOR(char) > __first,
+ _Rope_iterator<char, _STLP_DEFAULT_ALLOCATOR(char) > __middle,
+ _Rope_iterator<char, _STLP_DEFAULT_ALLOCATOR(char) > __last)
+{ _Rope_rotate(__first, __middle, __last); }
+#endif
+
+template <class _CharT, class _Alloc>
+inline _Rope_char_ref_proxy<_CharT, _Alloc>::operator _CharT () const {
+ if (_M_current_valid) {
+ return _M_current;
+ } else {
+ return _My_rope::_S_fetch(_M_root->_M_tree_ptr._M_data, _M_pos);
+ }
+}
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _CharT, class _Alloc>
+struct __move_traits<rope<_CharT, _Alloc> > {
+ typedef __stlp_movable implemented;
+ //Completness depends on the allocator:
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_rope.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ROPE_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_SET_H
+#define _STLP_INTERNAL_SET_H
+
+#ifndef _STLP_INTERNAL_TREE_H
+# include <stl/_tree.h>
+#endif
+
+#if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, Const_traits)
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) >
+class set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<set<_Key, _Compare, _Alloc> >
+#endif
+{
+ typedef set<_Key, _Compare, _Alloc> _Self;
+public:
+// typedefs:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _SetTraitsT<value_type> _SetTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _SetTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing set
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+
+ // allocation/deallocation
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit set(const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+#else
+ set()
+ : _M_t(_Compare(), allocator_type()) {}
+ explicit set(const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) {}
+ set(const _Compare& __comp, const allocator_type& __a)
+#endif
+ : _M_t(__comp, __a) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); }
+# endif
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+#else
+ set(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ set(const value_type* __first,
+ const value_type* __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+
+ set(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ set(const_iterator __first, const_iterator __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ set(const _Self& __x) : _M_t(__x._M_t) {}
+
+ set(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+
+ // insert/erase
+ pair<iterator,bool> insert(const value_type& __x)
+ { return _M_t.insert_unique(__x); }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _M_t.insert_unique( __pos , __x); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_unique(__first, __last); }
+#else
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_unique(__first, __last); }
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+ void erase(iterator __pos) { _M_t.erase( __pos ); }
+ size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last ); }
+ void clear() { _M_t.clear(); }
+
+ // set operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const
+ { return _M_t.find(__x) == _M_t.end() ? 0 : 1 ; }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x)
+ { return _M_t.equal_range_unique(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const
+ { return _M_t.equal_range_unique(__x); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, Const_traits)
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) >
+class multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<multiset<_Key, _Compare, _Alloc> >
+#endif
+{
+ typedef multiset<_Key, _Compare, _Alloc> _Self;
+public:
+ // typedefs:
+
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _MultisetTraitsT<value_type> _MultisetTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _MultisetTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing multiset
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit multiset(const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+#else
+ multiset()
+ : _M_t(_Compare(), allocator_type()) {}
+ explicit multiset(const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) {}
+ multiset(const _Compare& __comp, const allocator_type& __a)
+#endif
+ : _M_t(__comp, __a) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); }
+# endif
+#else
+ multiset(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+
+ multiset(const value_type* __first, const value_type* __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+
+ multiset(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+
+ multiset(const_iterator __first, const_iterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ multiset(const _Self& __x) : _M_t(__x._M_t) {}
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ multiset(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+
+ // insert/erase
+ iterator insert(const value_type& __x)
+ { return _M_t.insert_equal(__x); }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _M_t.insert_equal(__pos, __x); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#else
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_equal(__first, __last); }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+ void erase(iterator __pos) { _M_t.erase( __pos ); }
+ size_type erase(const key_type& __x) { return _M_t.erase(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase( __first, __last ); }
+ void clear() { _M_t.clear(); }
+
+ // multiset operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_t.count(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x) { return _M_t.equal_range(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const { return _M_t.equal_range(__x); }
+};
+
+#else
+# include <stl/pointers/_set.h>
+_STLP_BEGIN_NAMESPACE
+#endif /* _STLP_USE_PTR_SPECIALIZATIONS */
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Compare, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER set<_Key,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER multiset<_Key,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Key, class _Compare, class _Alloc>
+struct __move_traits<set<_Key,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename set<_Key,_Compare,_Alloc>::_Rep_type>
+{};
+
+template <class _Key, class _Compare, class _Alloc>
+struct __move_traits<multiset<_Key,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename multiset<_Key,_Compare,_Alloc>::_Rep_type>
+{};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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:
--- /dev/null
+/*
+ *
+ * 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 typename _Alloc_traits<_Tp,_Alloc>::allocator_type 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;
+ }
+ _Slist_base(__move_source<_Self> src) :
+ _M_head(__move_source<_AllocProxy>(src.get()._M_head)) {
+ src.get()._M_head._M_data._M_next = 0;
+ }
+ ~_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_DEFAULT_ALLOCATOR_SELECT(_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()); }
+
+ slist(__move_source<_Self> src)
+ : _STLP_PRIV _Slist_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {}
+
+ _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);
+ }
+
+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)
+template <class _Tp, class _Alloc>
+struct __move_traits<slist<_Tp, _Alloc> > {
+ typedef __stlp_movable implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+
+// 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:
--- /dev/null
+/*
+ *
+ *
+ * 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:
--- /dev/null
+/*
+ *
+ * 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:
--- /dev/null
+
+// Currently, SUN CC requires object file
+
+#if defined (__GNUC__)
+
+/*
+** int _STLP_atomic_exchange (__stl_atomic_t *pvalue, __stl_atomic_t value)
+*/
+
+# if defined(__sparc_v9__) || defined (__sparcv9)
+
+# ifdef __arch64__
+
+# define _STLP_EXCH_ASM asm volatile ("casx [%3], %4, %0 ; membar #LoadLoad | #LoadStore " : \
+ "=r" (_L_value2), "=m" (*_L_pvalue1) : \
+ "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) )
+
+# else /* __arch64__ */
+
+# define _STLP_EXCH_ASM asm volatile ("cas [%3], %4, %0" : \
+ "=r" (_L_value2), "=m" (*_L_pvalue1) : \
+ "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) )
+# endif
+
+# else /* __sparc_v9__ */
+
+# define _STLP_EXCH_ASM asm volatile ("swap [%3], %0 " : \
+ "=r" (_L_value2), "=m" (*_L_pvalue1) : \
+ "m" (*_L_pvalue1), "r" (_L_pvalue1), "0" (_L_value2) )
+# endif
+
+
+# define _STLP_ATOMIC_EXCHANGE(__pvalue1, __value2) \
+ ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
+ register __stl_atomic_t _L_value1, _L_value2 = __value2 ; \
+ do { _L_value1 = *_L_pvalue1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
+ _L_value1; })
+
+# define _STLP_ATOMIC_INCREMENT(__pvalue1) \
+ ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
+ register __stl_atomic_t _L_value1, _L_value2; \
+ do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1+1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
+ (_L_value2 + 1); })
+
+# define _STLP_ATOMIC_DECREMENT(__pvalue1) \
+ ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
+ register __stl_atomic_t _L_value1, _L_value2; \
+ do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1-1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
+ (_L_value2 - 1); })
+
+# elif ! defined (_STLP_NO_EXTERN_INLINE)
+
+extern "C" __stl_atomic_t _STLP_atomic_exchange(__stl_atomic_t * __x, __stl_atomic_t __v);
+extern "C" void _STLP_atomic_decrement(__stl_atomic_t* i);
+extern "C" void _STLP_atomic_increment(__stl_atomic_t* i);
+
+# define _STLP_ATOMIC_INCREMENT(__x) _STLP_atomic_increment((__stl_atomic_t*)__x)
+# define _STLP_ATOMIC_DECREMENT(__x) _STLP_atomic_decrement((__stl_atomic_t*)__x)
+# define _STLP_ATOMIC_EXCHANGE(__x, __y) _STLP_atomic_exchange((__stl_atomic_t*)__x, (__stl_atomic_t)__y)
+
+# endif
+
--- /dev/null
+/*
+ * Copyright (c) 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_SSTREAM_C
+#define _STLP_SSTREAM_C
+
+#ifndef _STLP_INTERNAL_SSTREAM
+# include <stl/_sstream.h>
+#endif
+
+#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+// no wint_t is supported for this mode
+# define __BSB_int_type__ int
+# define __BSB_pos_type__ streampos
+#else
+# define __BSB_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
+# define __BSB_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Non-inline stringbuf member functions.
+
+// Constructors. Note that the base class constructor sets all of the
+// get and area pointers to null.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::basic_stringbuf(ios_base::openmode __mode)
+ : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str()
+{}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::basic_stringbuf(const basic_string<_CharT, _Traits, _Alloc>& __s, ios_base::openmode __mode)
+ : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str(__s)
+{
+ _M_set_ptrs();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringbuf<_CharT, _Traits, _Alloc>::~basic_stringbuf()
+{}
+
+// Set the underlying string to a new value.
+template <class _CharT, class _Traits, class _Alloc>
+void
+basic_stringbuf<_CharT, _Traits, _Alloc>::str(const basic_string<_CharT, _Traits, _Alloc>& __s)
+{
+ _M_str = __s;
+ _M_set_ptrs();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void
+basic_stringbuf<_CharT, _Traits, _Alloc>::_M_set_ptrs() {
+ _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
+ _CharT* __data_end = __data_ptr + _M_str.size();
+ // The initial read position is the beginning of the string.
+ if (_M_mode & ios_base::in) {
+ if (_M_mode & ios_base::ate)
+ this->setg(__data_ptr, __data_end, __data_end);
+ else
+ this->setg(__data_ptr, __data_ptr, __data_end);
+ }
+
+ // The initial write position is the beginning of the string.
+ if (_M_mode & ios_base::out) {
+ if (_M_mode & (ios_base::app | ios_base::ate))
+ this->setp(__data_end, __data_end);
+ else
+ this->setp(__data_ptr, __data_end);
+ }
+}
+
+// Precondition: gptr() >= egptr(). Returns a character, if one is available.
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>::underflow() {
+ return this->gptr() != this->egptr()
+ ? _Traits::to_int_type(*this->gptr())
+ : _Traits::eof();
+}
+
+// Precondition: gptr() >= egptr().
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>::uflow() {
+ if (this->gptr() != this->egptr()) {
+ int_type __c = _Traits::to_int_type(*this->gptr());
+ this->gbump(1);
+ return __c;
+ }
+ else
+ return _Traits::eof();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>::pbackfail(int_type __c) {
+ if (this->gptr() != this->eback()) {
+ if (!_Traits::eq_int_type(__c, _Traits::eof())) {
+ if (_Traits::eq(_Traits::to_char_type(__c), this->gptr()[-1])) {
+ this->gbump(-1);
+ return __c;
+ }
+ else if (_M_mode & ios_base::out) {
+ this->gbump(-1);
+ *this->gptr() = _Traits::to_char_type(__c);
+ return __c;
+ }
+ else
+ return _Traits::eof();
+ }
+ else {
+ this->gbump(-1);
+ return _Traits::not_eof(__c);
+ }
+ }
+ else
+ return _Traits::eof();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>::overflow(int_type __c) {
+ // fbp : reverse order of "ifs" to pass Dietmar's test.
+ // Apparently, standard allows overflow with eof even for read-only streams.
+ if (!_Traits::eq_int_type(__c, _Traits::eof())) {
+ if (_M_mode & ios_base::out) {
+ if (!(_M_mode & ios_base::in)) {
+ // It's a write-only streambuf, so we can use special append buffer.
+ if (this->pptr() == this->epptr())
+ this->_M_append_buffer();
+
+ if (this->pptr() != this->epptr()) {
+ *this->pptr() = _Traits::to_char_type(__c);
+ this->pbump(1);
+ return __c;
+ }
+ else
+ return _Traits::eof();
+ }
+ else {
+ // We're not using a special append buffer, just the string itself.
+ if (this->pptr() == this->epptr()) {
+ ptrdiff_t __offset = this->gptr() - this->eback();
+ _M_str.push_back(_Traits::to_char_type(__c));
+
+ _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
+ size_t __data_size = _M_str.size();
+
+ this->setg(__data_ptr, __data_ptr + __offset, __data_ptr+__data_size);
+ this->setp(__data_ptr, __data_ptr + __data_size);
+ this->pbump((int)__data_size);
+ return __c;
+ }
+ else {
+ *this->pptr() = _Traits::to_char_type(__c);
+ this->pbump(1);
+ return __c;
+ }
+ }
+ }
+ else // Overflow always fails if it's read-only
+ return _Traits::eof();
+ }
+ else // __c is EOF, so we don't have to do anything
+ return _Traits::not_eof(__c);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+streamsize
+basic_stringbuf<_CharT, _Traits, _Alloc>::xsputn(const char_type* __s,
+ streamsize __n) {
+ streamsize __nwritten = 0;
+
+ if ((_M_mode & ios_base::out) && __n > 0) {
+ // If the put pointer is somewhere in the middle of the string,
+ // then overwrite instead of append.
+ if (this->pbase() == _M_str.data() ) {
+ ptrdiff_t __avail = _M_str.data() + _M_str.size() - this->pptr();
+ if (__avail > __n) {
+ _Traits::copy(this->pptr(), __s, __STATIC_CAST(size_t, __n));
+ this->pbump((int)__n);
+ return __n;
+ }
+ else {
+ _Traits::copy(this->pptr(), __s, __avail);
+ __nwritten += __avail;
+ __n -= __avail;
+ __s += __avail;
+ this->setp(_M_Buf, _M_Buf + __STATIC_CAST(int,_S_BufSiz));
+ }
+ }
+
+ // At this point we know we're appending.
+ if (_M_mode & ios_base::in) {
+ ptrdiff_t __get_offset = this->gptr() - this->eback();
+ _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n));
+
+ _CharT* __data_ptr = __CONST_CAST(_CharT*, _M_str.data());
+ size_t __data_size = _M_str.size();
+
+ this->setg(__data_ptr, __data_ptr + __get_offset, __data_ptr + __data_size);
+ this->setp(__data_ptr, __data_ptr + __data_size);
+ this->pbump((int)__data_size);
+ }
+ else {
+ _M_append_buffer();
+ _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n));
+ }
+
+ __nwritten += __n;
+ }
+
+ return __nwritten;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+streamsize
+basic_stringbuf<_CharT, _Traits, _Alloc>::_M_xsputnc(char_type __c,
+ streamsize __n) {
+ streamsize __nwritten = 0;
+
+ if ((_M_mode & ios_base::out) && __n > 0) {
+ // If the put pointer is somewhere in the middle of the string,
+ // then overwrite instead of append.
+ if (this->pbase() == _M_str.data()) {
+ ptrdiff_t __avail = _M_str.data() + _M_str.size() - this->pptr();
+ if (__avail > __n) {
+ _Traits::assign(this->pptr(), __STATIC_CAST(size_t, __n), __c);
+ this->pbump(__STATIC_CAST(int, __n));
+ return __n;
+ }
+ else {
+ _Traits::assign(this->pptr(), __avail, __c);
+ __nwritten += __avail;
+ __n -= __avail;
+ this->setp(_M_Buf, _M_Buf + __STATIC_CAST(int,_S_BufSiz));
+ }
+ }
+
+ // At this point we know we're appending.
+ size_t __app_size = sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
+ : __STATIC_CAST(size_t, __n);
+ if (this->_M_mode & ios_base::in) {
+ ptrdiff_t __get_offset = this->gptr() - this->eback();
+ _M_str.append(__app_size, __c);
+
+ _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
+ size_t __data_size = _M_str.size();
+
+ this->setg(__data_ptr, __data_ptr + __get_offset, __data_ptr + __data_size);
+ this->setp(__data_ptr, __data_ptr + __data_size);
+ this->pbump((int)__data_size);
+ }
+ else {
+ _M_append_buffer();
+ _M_str.append(__app_size, __c);
+ }
+
+ __nwritten += __app_size;
+ }
+
+ return __nwritten;
+}
+
+// According to the C++ standard the effects of setbuf are implementation
+// defined, except that setbuf(0, 0) has no effect. In this implementation,
+// setbuf(<anything>, n), for n > 0, calls reserve(n) on the underlying
+// string.
+template <class _CharT, class _Traits, class _Alloc>
+basic_streambuf<_CharT, _Traits>*
+basic_stringbuf<_CharT, _Traits, _Alloc>::setbuf(_CharT*, streamsize __n) {
+ if (__n > 0) {
+ bool __do_get_area = false;
+ bool __do_put_area = false;
+ ptrdiff_t __offg = 0;
+ ptrdiff_t __offp = 0;
+
+ if (this->pbase() == _M_str.data()) {
+ __do_put_area = true;
+ __offp = this->pptr() - this->pbase();
+ }
+
+ if (this->eback() == _M_str.data()) {
+ __do_get_area = true;
+ __offg = this->gptr() - this->eback();
+ }
+
+ if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))
+ _M_append_buffer();
+
+ _M_str.reserve(sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
+ : __STATIC_CAST(size_t, __n));
+
+ _CharT* __data_ptr = __CONST_CAST(_CharT*, _M_str.data());
+ size_t __data_size = _M_str.size();
+
+ if (__do_get_area) {
+ this->setg(__data_ptr, __data_ptr + __offg, __data_ptr + __data_size);
+ }
+
+ if (__do_put_area) {
+ this->setp(__data_ptr, __data_ptr + __data_size);
+ this->pbump((int)__offp);
+ }
+ }
+
+ return this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_pos_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::seekoff(off_type __off,
+ ios_base::seekdir __dir,
+ ios_base::openmode __mode) {
+ __mode &= _M_mode;
+
+ bool __imode = (__mode & ios_base::in) != 0;
+ bool __omode = (__mode & ios_base::out) != 0;
+
+ if ( !(__imode || __omode) )
+ return pos_type(off_type(-1));
+
+ if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )
+ return pos_type(off_type(-1));
+
+ if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))
+ _M_append_buffer();
+
+ streamoff __newoff;
+ switch(__dir) {
+ case ios_base::beg:
+ __newoff = 0;
+ break;
+ case ios_base::end:
+ __newoff = _M_str.size();
+ break;
+ case ios_base::cur:
+ __newoff = __imode ? this->gptr() - this->eback() : this->pptr() - this->pbase();
+ break;
+ default:
+ return pos_type(off_type(-1));
+ }
+
+ __off += __newoff;
+
+ if (__imode) {
+ ptrdiff_t __n = this->egptr() - this->eback();
+
+ if (__off < 0 || __off > __n)
+ return pos_type(off_type(-1));
+ this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __off),
+ this->eback() + __STATIC_CAST(ptrdiff_t, __n));
+ }
+
+ if (__omode) {
+ ptrdiff_t __n = this->epptr() - this->pbase();
+
+ if (__off < 0 || __off > __n)
+ return pos_type(off_type(-1));
+ this->setp(this->pbase(), this->pbase() + __n);
+ this->pbump((int)__off);
+ }
+
+ return pos_type(__off);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_pos_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::seekpos(pos_type __pos, ios_base::openmode __mode) {
+ __mode &= _M_mode;
+
+ bool __imode = (__mode & ios_base::in) != 0;
+ bool __omode = (__mode & ios_base::out) != 0;
+
+ if ( !(__imode || __omode) )
+ return pos_type(off_type(-1));
+
+ if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )
+ return pos_type(off_type(-1));
+
+ const off_type __n = __pos - pos_type(off_type(0));
+ if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))
+ _M_append_buffer();
+
+ if (__imode) {
+ if (__n < 0 || __n > this->egptr() - this->eback())
+ return pos_type(off_type(-1));
+ this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __n), this->egptr());
+ }
+
+ if (__omode) {
+ if (__n < 0 || size_t(__n) > _M_str.size())
+ return pos_type(off_type(-1));
+
+ _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
+ size_t __data_size = _M_str.size();
+
+ this->setp(__data_ptr, __data_ptr+__data_size);
+ this->pbump((int)__n);
+ }
+
+ return __pos;
+}
+
+// This is declared as a const member function because it is
+// called by basic_stringbuf<>::str(). Precondition: this is a
+// write-only stringbuf. We can't use an output buffer for read-
+// write stringbufs. Postcondition: pptr is reset to the beginning
+// of the buffer.
+template <class _CharT, class _Traits, class _Alloc>
+void basic_stringbuf<_CharT, _Traits, _Alloc>::_M_append_buffer() const {
+ // Do we have a buffer to append?
+ if (this->pbase() == this->_M_Buf && this->pptr() != this->_M_Buf) {
+ basic_stringbuf<_CharT, _Traits, _Alloc>* __this = __CONST_CAST(_Self*,this);
+ __this->_M_str.append((const _CharT*)this->pbase(), (const _CharT*)this->pptr());
+#ifndef __MWERKS__
+ __this->setp(__CONST_CAST(_CharT*,_M_Buf),
+ __CONST_CAST(_CharT*,_M_Buf + __STATIC_CAST(int,_S_BufSiz)));
+#else // CodeWarrior treat const char * and const char [8] as different types
+ __this->setp((_CharT*)_M_Buf,
+ (_CharT*)(_M_Buf + __STATIC_CAST(int,_S_BufSiz)));
+#endif
+ }
+
+ // Have we run off the end of the string?
+ else if (this->pptr() == this->epptr()) {
+ basic_stringbuf<_CharT, _Traits, _Alloc>* __this = __CONST_CAST(_Self*,this);
+#ifndef __MWERKS__
+ __this->setp(__CONST_CAST(_CharT*,_M_Buf),
+ __CONST_CAST(_CharT*,_M_Buf + __STATIC_CAST(int,_S_BufSiz)));
+#else // CodeWarrior treat const char * and const char [8] as different types
+ __this->setp((_CharT*)_M_Buf,
+ (_CharT*)(_M_Buf + __STATIC_CAST(int,_S_BufSiz)));
+#endif
+ }
+}
+
+//----------------------------------------------------------------------
+// Non-inline istringstream member functions.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istringstream<_CharT, _Traits, _Alloc>
+ ::basic_istringstream(ios_base::openmode __mode)
+ : basic_istream<_CharT, _Traits>(0),
+ _M_buf(__mode | ios_base::in) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istringstream<_CharT, _Traits, _Alloc>
+ ::basic_istringstream(const _String& __str,ios_base::openmode __mode)
+ : basic_istream<_CharT, _Traits>(0),
+ _M_buf(__str, __mode | ios_base::in) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istringstream<_CharT, _Traits, _Alloc>::~basic_istringstream()
+{}
+
+//----------------------------------------------------------------------
+// Non-inline ostringstream member functions.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostringstream<_CharT, _Traits, _Alloc>
+ ::basic_ostringstream(ios_base::openmode __mode)
+ : basic_ostream<_CharT, _Traits>(0),
+ _M_buf(__mode | ios_base::out) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostringstream<_CharT, _Traits, _Alloc>
+ ::basic_ostringstream(const _String& __str, ios_base::openmode __mode)
+ : basic_ostream<_CharT, _Traits>(0),
+ _M_buf(__str, __mode | ios_base::out) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostringstream<_CharT, _Traits, _Alloc>::~basic_ostringstream()
+{}
+
+//----------------------------------------------------------------------
+// Non-inline stringstream member functions.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringstream<_CharT, _Traits, _Alloc>
+ ::basic_stringstream(ios_base::openmode __mode)
+ : basic_iostream<_CharT, _Traits>(0), _M_buf(__mode) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringstream<_CharT, _Traits, _Alloc>
+ ::basic_stringstream(const _String& __str, ios_base::openmode __mode)
+ : basic_iostream<_CharT, _Traits>(0), _M_buf(__str, __mode) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringstream<_CharT, _Traits, _Alloc>::~basic_stringstream()
+{}
+
+_STLP_END_NAMESPACE
+
+# undef __BSB_int_type__
+# undef __BSB_pos_type__
+
+#endif /* _STLP_SSTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+
+
+// This header defines classes basic_stringbuf, basic_istringstream,
+// basic_ostringstream, and basic_stringstream. These classes
+// represent streamsbufs and streams whose sources or destinations are
+// C++ strings.
+
+#ifndef _STLP_INTERNAL_SSTREAM
+#define _STLP_INTERNAL_SSTREAM
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h> // Includes <ostream>, <ios>, <iosfwd>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// This version of basic_stringbuf relies on the internal details of
+// basic_string. It relies on the fact that, in this implementation,
+// basic_string's iterators are pointers. It also assumes (as allowed
+// by the standard) that _CharT is a POD type.
+
+// We have a very small buffer for the put area, just so that we don't
+// have to use append() for every sputc. Conceptually, the buffer
+// immediately follows the end of the underlying string. We use this
+// buffer when appending to write-only streambufs, but we don't use it
+// for read-write streambufs.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_stringbuf : public basic_streambuf<_CharT, _Traits> {
+public: // Typedefs.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_streambuf<_CharT, _Traits> _Base;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Self;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+
+public: // Constructors, destructor.
+ explicit basic_stringbuf(ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ explicit basic_stringbuf(const _String& __s, ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ virtual ~basic_stringbuf();
+
+public: // Get or set the string.
+ _String str() const { _M_append_buffer(); return _M_str; }
+ void str(const _String& __s);
+
+protected: // Overridden virtual member functions.
+ virtual int_type underflow();
+ virtual int_type uflow();
+ virtual int_type pbackfail(int_type __c);
+ virtual int_type overflow(int_type __c);
+ int_type pbackfail() {return pbackfail(_Traits::eof());}
+ int_type overflow() {return overflow(_Traits::eof());}
+
+ virtual streamsize xsputn(const char_type* __s, streamsize __n);
+ virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
+
+ virtual _Base* setbuf(_CharT* __buf, streamsize __n);
+ virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
+ ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+
+private: // Helper functions.
+ // Append the internal buffer to the string if necessary.
+ void _M_append_buffer() const;
+ void _M_set_ptrs();
+
+private:
+ ios_base::openmode _M_mode;
+ mutable basic_string<_CharT, _Traits, _Alloc> _M_str;
+
+ enum _JustName { _S_BufSiz = 8 };
+ _CharT _M_Buf[ 8 /* _S_BufSiz */];
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf<char, char_traits<char>, allocator<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+//----------------------------------------------------------------------
+// Class basic_istringstream, an input stream that uses a stringbuf.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_istringstream : public basic_istream<_CharT, _Traits> {
+public: // Typedefs
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_istream<_CharT, _Traits> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
+
+public: // Constructors, destructor.
+ basic_istringstream(ios_base::openmode __mode = ios_base::in);
+ basic_istringstream(const _String& __str,
+ ios_base::openmode __mode = ios_base::in);
+ ~basic_istringstream();
+
+public: // Member functions
+
+ basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ _String str() const { return _M_buf.str(); }
+ void str(const _String& __s) { _M_buf.str(__s); }
+
+private:
+ basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_istringstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_istringstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_ostringstream, an output stream that uses a stringbuf.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_ostringstream : public basic_ostream<_CharT, _Traits> {
+public: // Typedefs
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_ostream<_CharT, _Traits> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
+
+public: // Constructors, destructor.
+ basic_ostringstream(ios_base::openmode __mode = ios_base::out);
+ basic_ostringstream(const _String& __str,
+ ios_base::openmode __mode = ios_base::out);
+ ~basic_ostringstream();
+
+public: // Member functions.
+
+ basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ _String str() const { return _M_buf.str(); }
+ void str(const _String& __s) { _M_buf.str(__s); } // dwa 02/07/00 - BUG STOMPER DAVE
+
+
+private:
+ basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_ostringstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_ostringstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_stringstream, a bidirectional stream that uses a stringbuf.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_stringstream : public basic_iostream<_CharT, _Traits> {
+public: // Typedefs
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_iostream<_CharT, _Traits> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
+
+ typedef ios_base::openmode openmode;
+
+public: // Constructors, destructor.
+ basic_stringstream(openmode __mod = ios_base::in | ios_base::out);
+ basic_stringstream(const _String& __str,
+ openmode __mod = ios_base::in | ios_base::out);
+ ~basic_stringstream();
+
+public: // Member functions.
+
+ basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ _String str() const { return _M_buf.str(); }
+ void str(const _String& __s) { _M_buf.str(__s); }
+
+private:
+ basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_stringstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_stringstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream<char, char_traits<char>, allocator<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream<char, char_traits<char>, allocator<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream<char, char_traits<char>, allocator<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_sstream.c>
+#endif
+
+#endif /* _STLP_INTERNAL_SSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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) {}
+
+ stack(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)) {}
+
+ 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; }
+};
+
+#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)
+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:
--- /dev/null
+/*
+ * 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_INTERNAL_STDEXCEPT
+#define _STLP_INTERNAL_STDEXCEPT
+
+#ifndef _STLP_INTERNAL_STDEXCEPT_BASE
+# include <stl/_stdexcept_base.h>
+#endif
+
+#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
+
+# if defined(_STLP_USE_EXCEPTIONS) || \
+ !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32))
+
+_STLP_BEGIN_NAMESPACE
+
+class _STLP_CLASS_DECLSPEC logic_error : public __Named_exception {
+public:
+ logic_error(const string& __s) : __Named_exception(__s) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~logic_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC runtime_error : public __Named_exception {
+public:
+ runtime_error(const string& __s) : __Named_exception(__s) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~runtime_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC domain_error : public logic_error {
+public:
+ domain_error(const string& __arg) : logic_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~domain_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC invalid_argument : public logic_error {
+public:
+ invalid_argument(const string& __arg) : logic_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~invalid_argument() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC length_error : public logic_error {
+public:
+ length_error(const string& __arg) : logic_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~length_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC out_of_range : public logic_error {
+public:
+ out_of_range(const string& __arg) : logic_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~out_of_range() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC range_error : public runtime_error {
+public:
+ range_error(const string& __arg) : runtime_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~range_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC overflow_error : public runtime_error {
+public:
+ overflow_error(const string& __arg) : runtime_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~overflow_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC underflow_error : public runtime_error {
+public:
+ underflow_error(const string& __arg) : runtime_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~underflow_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+_STLP_END_NAMESPACE
+
+# endif
+#endif
+
+#endif /* _STLP_INTERNAL_STDEXCEPT */
--- /dev/null
+/*
+ * 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_INTERNAL_STDEXCEPT_BASE
+#define _STLP_INTERNAL_STDEXCEPT_BASE
+
+#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
+
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+
+# if defined(_STLP_USE_EXCEPTIONS) || \
+ !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32))
+
+# ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+# endif
+
+# ifndef _STLP_STRING_FWD_H
+# include <stl/_string_fwd.h>
+# endif
+
+# ifndef _STLP_USE_NO_IOSTREAMS
+# define _STLP_OWN_STDEXCEPT 1
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+/* We disable the 4275 warning for
+ * - WinCE where there are only static version of the native C++ runtime.
+ * - The MSVC compilers when the STLport user wants to make an STLport dll linked to
+ * the static C++ native runtime. In this case the std::exception base class is no more
+ * exported from native dll but is used as a base class for the exported __Named_exception
+ * class.
+ */
+# if defined (_STLP_WCE_NET) || \
+ defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# define _STLP_DO_WARNING_POP
+# pragma warning (push)
+# pragma warning (disable: 4275) // Non dll interface class 'exception' used as base
+ // for dll-interface class '__Named_exception'
+# endif
+
+# if !defined (_STLP_NO_EXCEPTION_HEADER)
+# if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \
+ defined (_STLP_USE_NAMESPACES) && defined (_STLP_USE_OWN_NAMESPACE)
+using _STLP_VENDOR_EXCEPT_STD::exception;
+# endif
+# endif
+# define _STLP_EXCEPTION_BASE exception
+
+class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE {
+public:
+ __Named_exception(const string& __str)
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ;
+ const char* what() const _STLP_NOTHROW_INHERENTLY;
+ ~__Named_exception() _STLP_NOTHROW_INHERENTLY;
+# else
+ {
+# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ strncpy(_M_name, _STLP_PRIV __get_c_string(__str), _S_bufsize);
+ _M_name[_S_bufsize - 1] = '\0';
+# else
+ strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), _STLP_PRIV __get_c_string(__str), _TRUNCATE);
+# endif
+ }
+ const char* what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
+# endif
+
+private:
+ enum { _S_bufsize = 256 };
+ char _M_name[_S_bufsize];
+};
+
+# if defined (_STLP_DO_WARNING_POP)
+# pragma warning (pop)
+# undef _STLP_DO_WARNING_POP
+# endif
+
+_STLP_END_NAMESPACE
+
+# endif /* Not o32, and no exceptions */
+#endif /* _STLP_STDEXCEPT_SEEN */
+
+#endif /* _STLP_INTERNAL_STDEXCEPT_BASE */
--- /dev/null
+ /*
+ *
+ * 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.
+ *
+ */
+
+#ifndef _STLP_STLPORT_VERSION_H
+#define _STLP_STLPORT_VERSION_H
+
+/* The last SGI STL release we merged with */
+#define __SGI_STL 0x330
+
+/* STLport version */
+#define _STLPORT_MAJOR 5
+#define _STLPORT_MINOR 1
+#define _STLPORT_PATCHLEVEL 4
+
+#define _STLPORT_VERSION 0x514
+
+#endif /* _STLP_STLPORT_VERSION_H */
--- /dev/null
+/*
+ *
+ * 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.
+ */
+
+#if !defined (_STLP_INTERNAL_STREAM_ITERATOR_H) && !defined (_STLP_USE_NO_IOSTREAMS)
+#define _STLP_INTERNAL_STREAM_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+// streambuf_iterators predeclarations must appear first
+#ifndef _STLP_IOSFWD
+# include <iosfwd>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+// istream_iterator and ostream_iterator look very different if we're
+// using new, templatized iostreams than if we're using the old cfront
+// version.
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _CharT, class _Traits, class _Dist
+# define __ISI_TMPL_ARGUMENTS _Tp, _CharT, _Traits, _Dist
+template <class _Tp,
+ class _CharT = _STLP_DEFAULTCHAR, class _Traits = char_traits<_CharT>,
+ class _Dist = ptrdiff_t>
+class istream_iterator : public iterator<input_iterator_tag, _Tp , _Dist,
+ const _Tp*, const _Tp& > {
+#else
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
+# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp
+# define __ISI_TMPL_ARGUMENTS _Tp
+template <class _Tp>
+class istream_iterator : public iterator<input_iterator_tag, _Tp , ptrdiff_t,
+ const _Tp*, const _Tp& > {
+# else
+# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _Dist
+# define __ISI_TMPL_ARGUMENTS _Tp, _Dist
+template <class _Tp, _STLP_DFL_TYPE_PARAM(_Dist, ptrdiff_t)>
+class istream_iterator : public iterator<input_iterator_tag, _Tp, _Dist ,
+ const _Tp*, const _Tp& > {
+# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */
+#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+ typedef char _CharT;
+ typedef char_traits<char> _Traits;
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
+ typedef ptrdiff_t _Dist;
+# endif
+#endif
+
+ typedef istream_iterator< __ISI_TMPL_ARGUMENTS > _Self;
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
+ typedef input_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Dist difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+
+ istream_iterator() : _M_stream(0), _M_ok(false), _M_read_done(true) {}
+ istream_iterator(istream_type& __s) : _M_stream(&__s), _M_ok(false), _M_read_done(false) {}
+
+ reference operator*() const {
+ if (!_M_read_done) {
+ _M_read();
+ }
+ return _M_value;
+ }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ _M_read();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ _M_read();
+ return __tmp;
+ }
+
+ bool _M_equal(const _Self& __x) const {
+ if (!_M_read_done) {
+ _M_read();
+ }
+ if (!__x._M_read_done) {
+ __x._M_read();
+ }
+ return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream);
+ }
+
+private:
+ istream_type* _M_stream;
+ mutable _Tp _M_value;
+ mutable bool _M_ok;
+ mutable bool _M_read_done;
+
+ void _M_read() const {
+ _M_ok = ((_M_stream != 0) && !_M_stream->fail());
+ if (_M_ok) {
+ *_M_stream >> _M_value;
+ _M_ok = !_M_stream->fail();
+ }
+ _M_read_done = true;
+ }
+};
+
+#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _TpP,
+ class _CharT = _STLP_DEFAULTCHAR, class _Traits = char_traits<_CharT> >
+#else
+template <class _TpP>
+#endif
+class ostream_iterator: public iterator<output_iterator_tag, void, void, void, void> {
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+ typedef char _CharT;
+ typedef char_traits<char> _Traits;
+ typedef ostream_iterator<_TpP> _Self;
+#else
+ typedef ostream_iterator<_TpP, _CharT, _Traits> _Self;
+#endif
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+
+ typedef output_iterator_tag iterator_category;
+
+ ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {}
+ ostream_iterator(ostream_type& __s, const _CharT* __c)
+ : _M_stream(&__s), _M_string(__c) {}
+ _Self& operator=(const _TpP& __val) {
+ *_M_stream << __val;
+ if (_M_string) *_M_stream << _M_string;
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self& operator++(int) { return *this; }
+private:
+ ostream_type* _M_stream;
+ const _CharT* _M_string;
+};
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _TpP>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const ostream_iterator<_TpP>&) { return output_iterator_tag(); }
+# else
+template <class _TpP, class _CharT, class _Traits>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const ostream_iterator<_TpP, _CharT, _Traits>&) { return output_iterator_tag(); }
+# endif
+#endif
+
+_STLP_END_NAMESPACE
+
+// form-independent definiotion of stream iterators
+_STLP_BEGIN_NAMESPACE
+
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline bool _STLP_CALL
+operator==(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x,
+ const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y)
+{ return __x._M_equal(__y); }
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline bool _STLP_CALL
+operator!=(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x,
+ const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y)
+{ return !__x._M_equal(__y); }
+#endif
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline input_iterator_tag _STLP_CALL
+iterator_category(const istream_iterator< __ISI_TMPL_ARGUMENTS >&)
+{ return input_iterator_tag(); }
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline _Tp* _STLP_CALL
+value_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Tp*) 0; }
+
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline ptrdiff_t* _STLP_CALL
+distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (ptrdiff_t*)0; }
+# else
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline _Dist* _STLP_CALL
+distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Dist*)0; }
+# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef __ISI_TMPL_HEADER_ARGUMENTS
+#undef __ISI_TMPL_ARGUMENTS
+
+#endif /* _STLP_INTERNAL_STREAM_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_STREAMBUF_C
+#define _STLP_STREAMBUF_C
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+//----------------------------------------------------------------------
+// Non-inline basic_streambuf<> member functions.
+
+#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1300) || !defined (_STLP_USE_STATIC_LIB)
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>::basic_streambuf()
+ : _M_gbegin(0), _M_gnext(0), _M_gend(0),
+ _M_pbegin(0), _M_pnext(0), _M_pend(0),
+ _M_locale() {
+ // _M_lock._M_initialize();
+}
+#endif
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>::~basic_streambuf()
+{}
+
+template <class _CharT, class _Traits>
+locale
+basic_streambuf<_CharT, _Traits>::pubimbue(const locale& __loc) {
+ this->imbue(__loc);
+ locale __tmp = _M_locale;
+ _M_locale = __loc;
+ return __tmp;
+}
+
+template <class _CharT, class _Traits>
+streamsize
+basic_streambuf<_CharT, _Traits>::xsgetn(_CharT* __s, streamsize __n) {
+ streamsize __result = 0;
+ const int_type __eof = _Traits::eof();
+
+ while (__result < __n) {
+ if (_M_gnext < _M_gend) {
+ size_t __chunk = (min) (__STATIC_CAST(size_t,_M_gend - _M_gnext),
+ __STATIC_CAST(size_t,__n - __result));
+ _Traits::copy(__s, _M_gnext, __chunk);
+ __result += __chunk;
+ __s += __chunk;
+ _M_gnext += __chunk;
+ }
+ else {
+ int_type __c = this->sbumpc();
+ if (!_Traits::eq_int_type(__c, __eof)) {
+ *__s = _Traits::to_char_type(__c);
+ ++__result;
+ ++__s;
+ }
+ else
+ break;
+ }
+ }
+
+ return __result;
+}
+
+template <class _CharT, class _Traits>
+streamsize
+basic_streambuf<_CharT, _Traits>::xsputn(const _CharT* __s, streamsize __n)
+{
+ streamsize __result = 0;
+ const int_type __eof = _Traits::eof();
+
+ while (__result < __n) {
+ if (_M_pnext < _M_pend) {
+ size_t __chunk = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext),
+ __STATIC_CAST(size_t,__n - __result));
+ _Traits::copy(_M_pnext, __s, __chunk);
+ __result += __chunk;
+ __s += __chunk;
+ _M_pnext += __chunk;
+ }
+
+ else if (!_Traits::eq_int_type(this->overflow(_Traits::to_int_type(*__s)),
+ __eof)) {
+ ++__result;
+ ++__s;
+ }
+ else
+ break;
+ }
+ return __result;
+}
+
+template <class _CharT, class _Traits>
+streamsize
+basic_streambuf<_CharT, _Traits>::_M_xsputnc(_CharT __c, streamsize __n)
+{
+ streamsize __result = 0;
+ const int_type __eof = _Traits::eof();
+
+ while (__result < __n) {
+ if (_M_pnext < _M_pend) {
+ size_t __chunk = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext),
+ __STATIC_CAST(size_t,__n - __result));
+ _Traits::assign(_M_pnext, __chunk, __c);
+ __result += __chunk;
+ _M_pnext += __chunk;
+ }
+
+ else if (!_Traits::eq_int_type(this->overflow(_Traits::to_int_type(__c)),
+ __eof))
+ ++__result;
+ else
+ break;
+ }
+ return __result;
+}
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::_M_snextc_aux()
+{
+ int_type __eof = _Traits::eof();
+ if (_M_gend == _M_gnext)
+ return _Traits::eq_int_type(this->uflow(), __eof) ? __eof : this->sgetc();
+ else {
+ _M_gnext = _M_gend;
+ return this->underflow();
+ }
+}
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::pbackfail(int_type) {
+ return _Traits::eof();
+}
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::overflow(int_type) {
+ return _Traits::eof();
+}
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::uflow() {
+ return ( _Traits::eq_int_type(this->underflow(),_Traits::eof()) ?
+ _Traits::eof() :
+ _Traits::to_int_type(*_M_gnext++));
+}
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::underflow()
+{ return _Traits::eof(); }
+
+template <class _CharT, class _Traits>
+streamsize
+basic_streambuf<_CharT, _Traits>::showmanyc()
+{ return 0; }
+
+template <class _CharT, class _Traits>
+void
+basic_streambuf<_CharT, _Traits>::imbue(const locale&) {}
+
+template <class _CharT, class _Traits>
+int
+basic_streambuf<_CharT, _Traits>::sync() { return 0; }
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::pos_type
+basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode)
+{ return pos_type(-1); }
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::pos_type
+basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode)
+{ return pos_type(-1); }
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>*
+basic_streambuf<_CharT, _Traits>:: setbuf(char_type*, streamsize)
+{ return this; }
+
+_STLP_END_NAMESPACE
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_STREAMBUF
+#define _STLP_INTERNAL_STREAMBUF
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h> // Needed for ios_base bitfield members.
+#endif // <ios_base> includes <iosfwd>.
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Class basic_streambuf<>, the base class of the streambuf hierarchy.
+
+// A basic_streambuf<> manages an input (get) area and an output (put)
+// area. Each is described by three pointers: a beginning, an end, and a
+// current position. basic_streambuf<> contains some very simple member
+// functions that manipulate those six pointers, but almost all of the real
+// functionality gets delegated to protected virtual member functions.
+// All of the public member functions are inline, and most of the protected
+// member functions are virtual.
+
+// Although basic_streambuf<> is not abstract, it is useful only as a base
+// class. Its virtual member functions have default definitions such that
+// reading from a basic_streambuf<> will always yield EOF, and writing to a
+// basic_streambuf<> will always fail.
+
+// The second template parameter, _Traits, defaults to char_traits<_CharT>.
+// The default is declared in header <iosfwd>, and it isn't declared here
+// because C++ language rules do not allow it to be declared twice.
+
+template <class _CharT, class _Traits>
+class basic_streambuf {
+ friend class basic_istream<_CharT, _Traits>;
+ friend class basic_ostream<_CharT, _Traits>;
+
+public: // Typedefs.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+private: // Data members.
+
+ char_type* _M_gbegin; // Beginning of get area
+ char_type* _M_gnext; // Current position within the get area
+ char_type* _M_gend; // End of get area
+
+ char_type* _M_pbegin; // Beginning of put area
+ char_type* _M_pnext; // Current position within the put area
+ char_type* _M_pend; // End of put area
+
+ locale _M_locale; // The streambuf's locale object
+
+//public: // Extension: locking, for thread safety.
+// _STLP_mutex _M_lock;
+
+public: // Destructor.
+ virtual ~basic_streambuf();
+
+protected: // The default constructor.
+ basic_streambuf()
+#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && defined (_STLP_USE_STATIC_LIB)
+ //We make it inline to avoid unresolved symbol.
+ : _M_gbegin(0), _M_gnext(0), _M_gend(0),
+ _M_pbegin(0), _M_pnext(0), _M_pend(0),
+ _M_locale()
+ {}
+#else
+ ;
+#endif
+
+protected: // Protected interface to the get area.
+ char_type* eback() const { return _M_gbegin; } // Beginning
+ char_type* gptr() const { return _M_gnext; } // Current position
+ char_type* egptr() const { return _M_gend; } // End
+
+ void gbump(int __n) { _M_gnext += __n; }
+ void setg(char_type* __gbegin, char_type* __gnext, char_type* __gend) {
+ _M_gbegin = __gbegin;
+ _M_gnext = __gnext;
+ _M_gend = __gend;
+ }
+
+public:
+ // An alternate public interface to the above functions
+ // which allows us to avoid using templated friends which
+ // are not supported on some compilers.
+ char_type* _M_eback() const { return eback(); }
+ char_type* _M_gptr() const { return gptr(); }
+ char_type* _M_egptr() const { return egptr(); }
+ void _M_gbump(int __n) { gbump(__n); }
+ void _M_setg(char_type* __gbegin, char_type* __gnext, char_type* __gend)
+ { this->setg(__gbegin, __gnext, __gend); }
+
+protected: // Protected interface to the put area
+
+ char_type* pbase() const { return _M_pbegin; } // Beginning
+ char_type* pptr() const { return _M_pnext; } // Current position
+ char_type* epptr() const { return _M_pend; } // End
+
+ void pbump(int __n) { _M_pnext += __n; }
+ void setp(char_type* __pbegin, char_type* __pend) {
+ _M_pbegin = __pbegin;
+ _M_pnext = __pbegin;
+ _M_pend = __pend;
+ }
+
+protected: // Virtual buffer management functions.
+
+ virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize);
+
+ // Alters the stream position, using an integer offset. In this
+ // class seekoff does nothing; subclasses are expected to override it.
+ virtual pos_type seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode = ios_base::in | ios_base::out);
+
+ // Alters the stream position, using a previously obtained streampos. In
+ // this class seekpos does nothing; subclasses are expected to override it.
+ virtual pos_type
+ seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
+
+ // Synchronizes (i.e. flushes) the buffer. All subclasses are expected to
+ // override this virtual member function.
+ virtual int sync();
+
+
+public: // Buffer management.
+ basic_streambuf<_CharT, _Traits>* pubsetbuf(char_type* __s, streamsize __n)
+ { return this->setbuf(__s, __n); }
+
+ pos_type pubseekoff(off_type __offset, ios_base::seekdir __way,
+ ios_base::openmode __mod = ios_base::in | ios_base::out)
+ { return this->seekoff(__offset, __way, __mod); }
+
+ pos_type pubseekpos(pos_type __sp,
+ ios_base::openmode __mod = ios_base::in | ios_base::out)
+ { return this->seekpos(__sp, __mod); }
+
+ int pubsync() { return this->sync(); }
+
+protected: // Virtual get area functions, as defined in
+ // 17.5.2.4.3 and 17.5.2.4.4 of the standard.
+ // Returns a lower bound on the number of characters that we can read,
+ // with underflow, before reaching end of file. (-1 is a special value:
+ // it means that underflow will fail.) Most subclasses should probably
+ // override this virtual member function.
+ virtual streamsize showmanyc();
+
+ // Reads up to __n characters. Return value is the number of
+ // characters read.
+ virtual streamsize xsgetn(char_type* __s, streamsize __n);
+
+ // Called when there is no read position, i.e. when gptr() is null
+ // or when gptr() >= egptr(). Subclasses are expected to override
+ // this virtual member function.
+ virtual int_type underflow();
+
+ // Similar to underflow(), but used for unbuffered input. Most
+ // subclasses should probably override this virtual member function.
+ virtual int_type uflow();
+
+ // Called when there is no putback position, i.e. when gptr() is null
+ // or when gptr() == eback(). All subclasses are expected to override
+ // this virtual member function.
+ virtual int_type pbackfail(int_type = traits_type::eof());
+
+protected: // Virtual put area functions, as defined in
+ // 27.5.2.4.5 of the standard.
+
+ // Writes up to __n characters. Return value is the number of characters
+ // written.
+ virtual streamsize xsputn(const char_type* __s, streamsize __n);
+
+ // Extension: writes up to __n copies of __c. Return value is the number
+ // of characters written.
+ virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
+
+ // Called when there is no write position. All subclasses are expected to
+ // override this virtual member function.
+ virtual int_type overflow(int_type = traits_type::eof());
+
+public: // Public members for writing characters.
+ // Write a single character.
+ int_type sputc(char_type __c) {
+ return ((_M_pnext < _M_pend) ? _Traits::to_int_type(*_M_pnext++ = __c)
+ : this->overflow(_Traits::to_int_type(__c)));
+ }
+
+ // Write __n characters.
+ streamsize sputn(const char_type* __s, streamsize __n)
+ { return this->xsputn(__s, __n); }
+
+ // Extension: write __n copies of __c.
+ streamsize _M_sputnc(char_type __c, streamsize __n)
+ { return this->_M_xsputnc(__c, __n); }
+
+private: // Helper functions.
+ int_type _M_snextc_aux();
+
+public: // Public members for reading characters.
+ streamsize in_avail() {
+ return (_M_gnext < _M_gend) ? (_M_gend - _M_gnext) : this->showmanyc();
+ }
+
+ // Advance to the next character and return it.
+ int_type snextc() {
+ return ( _M_gend - _M_gnext > 1 ?
+ _Traits::to_int_type(*++_M_gnext) :
+ this->_M_snextc_aux());
+ }
+
+ // Return the current character and advance to the next.
+ int_type sbumpc() {
+ return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext++)
+ : this->uflow();
+ }
+
+ // Return the current character without advancing to the next.
+ int_type sgetc() {
+ return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext)
+ : this->underflow();
+ }
+
+ streamsize sgetn(char_type* __s, streamsize __n)
+ { return this->xsgetn(__s, __n); }
+
+ int_type sputbackc(char_type __c) {
+ return ((_M_gbegin < _M_gnext) && _Traits::eq(__c, *(_M_gnext - 1)))
+ ? _Traits::to_int_type(*--_M_gnext)
+ : this->pbackfail(_Traits::to_int_type(__c));
+ }
+
+ int_type sungetc() {
+ return (_M_gbegin < _M_gnext)
+ ? _Traits::to_int_type(*--_M_gnext)
+ : this->pbackfail();
+ }
+
+protected: // Virtual locale functions.
+
+ // This is a hook, called by pubimbue() just before pubimbue()
+ // sets the streambuf's locale to __loc. Note that imbue should
+ // not (and cannot, since it has no access to streambuf's private
+ // members) set the streambuf's locale itself.
+ virtual void imbue(const locale&);
+
+public: // Locale-related functions.
+ locale pubimbue(const locale&);
+ locale getloc() const { return _M_locale; }
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+ void stossc() { this->sbumpc(); }
+#endif
+#if defined (__MVS__) || defined (__OS400__)
+private: // Data members.
+
+ char_type* _M_gbegin; // Beginning of get area
+ char_type* _M_gnext; // Current position within the get area
+ char_type* _M_gend; // End of get area
+
+ char_type* _M_pbegin; // Beginning of put area
+ char_type* _M_pnext; // Current position within the put area
+ char_type* _M_pend; // End of put area
+#endif
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf<char, char_traits<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf<wchar_t, char_traits<wchar_t> >;
+# endif // _STLP_NO_WCHAR_T
+#endif // _STLP_USE_TEMPLATE_EXPORT
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_streambuf.c>
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ *
+ * 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
+
+#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;
+ }
+};
+
+// ------------------------------------------------------------
+// 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 <= capacity() + 1)
+ return;
+
+ pointer __new_start = this->_M_end_of_storage.allocate(__n, __n);
+ pointer __new_finish = __new_start;
+
+ _STLP_TRY {
+ __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start);
+ _M_construct_null(__new_finish);
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start, __new_finish),
+ this->_M_end_of_storage.deallocate(__new_start, __n)))
+
+ this->_M_destroy_range();
+ 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 > max_size() || size() > max_size() - __n)
+ this->_M_throw_length_error();
+ if (size() + __n > capacity())
+ reserve(size() + (max)(size(), __n));
+ if (__n > 0) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _Traits::assign(this->_M_finish + 1, __n - 1, __c);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - 1, __c);
+ _STLP_TRY {
+ _M_construct_null(this->_M_finish + __n);
+ }
+ _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_finish + 1, 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) {
+ const size_type __old_size = size();
+ ptrdiff_t __n = __last - __first;
+ if ((size_type)__n > max_size() || __old_size > max_size() - __n)
+ this->_M_throw_length_error();
+ if (__old_size + __n > capacity()) {
+ size_type __len = __old_size + (max)(__old_size, (size_t) __n) + 1;
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __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);
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ this->_M_destroy_range();
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ const _CharT* __f1 = __first;
+ ++__f1;
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copy(__f1, __last, this->_M_Finish() + 1);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ _STLP_PRIV __ucopy(__f1, __last, this->_M_finish + 1);
+ _STLP_TRY {
+ _M_construct_null(this->_M_finish + __n);
+ }
+ _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_finish + 1, 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_finish + 1 < this->_M_end_of_storage._M_data) {
+ _M_construct_null(this->_M_finish + 1);
+ _Traits::move(__p + 1, __p, this->_M_finish - __p);
+ _Traits::assign(*__p, __c);
+ ++this->_M_finish;
+ }
+ else {
+ const size_type __old_len = size();
+ size_type __len = __old_len + (max)(__old_len, __STATIC_CAST(size_type,1)) + 1;
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __new_pos = _STLP_PRIV __ucopy(this->_M_Start(), __p, __new_start);
+ _Copy_Construct(__new_pos, __c);
+ __new_finish = __new_pos + 1;
+ __new_finish = _STLP_PRIV __ucopy(__p, this->_M_finish, __new_finish);
+ _M_construct_null(__new_finish);
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ this->_M_destroy_range();
+ 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 (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n + 1) {
+ const size_type __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after >= __n) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ _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 {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _Traits::assign(this->_M_finish + 1, __n - __elems_after - 1, __c);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - __elems_after - 1, __c);
+ this->_M_finish += __n - __elems_after;
+ _STLP_TRY {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copy(__pos, __old_finish + 1, this->_M_finish);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
+ this->_M_finish += __elems_after;
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__old_finish + 1, this->_M_finish),
+ this->_M_finish = __old_finish))
+ _Traits::assign(__pos, __elems_after + 1, __c);
+ }
+ }
+ else {
+ const size_type __old_size = size();
+ size_type __len = __old_size + (max)(__old_size, __n) + 1;
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __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);
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ this->_M_destroy_range();
+ 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 ptrdiff_t __n = __last - __first;
+ if (this->_M_end_of_storage._M_data - this->_M_finish >= __n + 1) {
+ const ptrdiff_t __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after >= __n) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ _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;
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copy(__mid, __last, this->_M_finish + 1);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ _STLP_PRIV __ucopy(__mid, __last, this->_M_finish + 1);
+ this->_M_finish += __n - __elems_after;
+ _STLP_TRY {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copy(__pos, __old_finish + 1, this->_M_finish);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
+ this->_M_finish += __elems_after;
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__old_finish + 1, this->_M_finish),
+ this->_M_finish = __old_finish))
+ if (!__self_ref)
+ _M_copy(__first, __mid, __pos);
+ else
+ _M_move(__first, __mid, __pos);
+ }
+ }
+ else {
+ const size_type __old_size = size();
+ size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(const size_type,__n)) + 1;
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __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);
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ this->_M_destroy_range();
+ 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, false );
+ }
+ else {
+ //we have to take care of overlaping
+ if (__f < __first) {
+ 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)
+ return npos;
+ else {
+ 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;
+ else {
+ 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;
+ const_pointer __result = 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 __find_first_of(begin() + __pos, end(),
+ __s, __s + __n,
+ _STLP_PRIV _Eq_traits<_Traits>());
+ 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 __find_first_of(const_reverse_iterator(__last), rend(),
+ __s, __s + __n,
+ _STLP_PRIV _Eq_traits<_Traits>());
+ 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_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
+ _STLP_PRIV _Not_within_traits<_Traits>(__CONST_CAST(const _CharType*, __s),
+ __CONST_CAST(const _CharType*, __s) + __n));
+ 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_STD::find_if(__rlast, rend(),
+ _STLP_PRIV _Not_within_traits<_Traits>((const _CharType*)__s,
+ (const _CharType*)__s + __n));
+ 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_buffers._M_dynamic_buf = _M_end_of_storage.allocate(__n, __n);
+ this->_M_finish = this->_M_buffers._M_dynamic_buf;
+ this->_M_end_of_storage._M_data = this->_M_finish + __n;
+ }
+#else
+ this->_M_start = _M_end_of_storage.allocate(__n, __n);
+ this->_M_finish = this->_M_start;
+ this->_M_end_of_storage._M_data = this->_M_finish + __n;
+#endif /*_STLP_USE_SHORT_STRING_OPTIM */
+ } 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
+#else
+/* If basic_string is defined it means that it won't be the basic_string class
+ * exposed to STLport users so npos do not need external linkage.
+ */
+# if !defined (_STLP_STATIC_CONST_INIT_BUG)
+# if !defined (__GNUC__) || (__GNUC__ != 2) || (__GNUC_MINOR__ != 96)
+template <class _CharT, class _Traits, class _Alloc>
+const size_t basic_string<_CharT, _Traits, _Alloc>::npos;
+# endif
+# endif
+#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:
--- /dev/null
+/*
+ * 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 can always stores a null character
+ * at the end (macro dependent); 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.
+
+ * Additionally, the C++ standard imposes a major restriction: according
+ * to the standard, the character type _CharT must be a POD type. This
+ * implementation weakens that restriction, and allows _CharT to be a
+ * a user-defined non-POD type. However, _CharT must still have a
+ * default constructor.
+ */
+
+#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.
+
+struct _String_reserve_t {};
+
+#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
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_string : protected _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
+{
+protected: // Protected members inherited from base.
+ typedef _STLP_PRIV _String_base<_CharT,_Alloc> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _Self;
+ // fbp : used to optimize char/wchar_t cases, and to simplify
+ // _STLP_DEF_CONST_PLCT_NEW_BUG problem workaround
+ typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral;
+ typedef typename _IsPOD<_CharT>::_Type _Char_Is_POD;
+ typedef random_access_iterator_tag r_a_i_t;
+
+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 _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_end_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) {
+# if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf()) {
+ _Traits::assign(this->_M_Start(), __n, __c);
+ this->_M_finish = this->_M_Start() + __n;
+ }
+ else
+# endif
+ 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) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf()) {
+ _Traits::assign(this->_M_Start(), __n, __c);
+ this->_M_finish = this->_M_Start() + __n;
+ }
+ else
+#endif
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c);
+ _M_terminate_string();
+ }
+
+ basic_string(__move_source<_Self> src)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__move_source<_Base>(src.get())) {}
+
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+#if defined (_STLP_MEMBER_TEMPLATES) && !(defined (__MRC__) || (defined(__SC__) && !defined(__DMC__))) //*ty 04/30/2001 - mpw compilers choke on this ctor
+# if !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
+ /* 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) {}
+public:
+# endif /* _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND */
+#endif /* !__MRC__ || (__SC__ && !__DMC__) */
+
+#if !(defined (_STLP_MEMBER_TEMPLATES) && !(defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)))) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) || \
+ 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 /* _STLP_MEMBER_TEMPLATES */
+
+private:
+ 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());
+ _STLP_TRY {
+ _M_appendT(__f, __l, __tag);
+ }
+ _STLP_UNWIND(this->_M_destroy_range())
+ }
+
+ template <class _ForwardIter>
+ void _M_range_initialize(_ForwardIter __f, _ForwardIter __l,
+ const forward_iterator_tag &) {
+ difference_type __n = distance(__f, __l);
+ this->_M_allocate_block(__n + 1);
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf()) {
+ _M_copyT(__f, __l, this->_M_Start());
+ this->_M_finish = this->_M_Start() + __n;
+ }
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ 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);
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf()) {
+ _Traits::assign(this->_M_Start(), __n, __x);
+ this->_M_finish = this->_M_Start() + __n;
+ }
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ 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:
+ ~basic_string()
+ { this->_M_destroy_range(); }
+
+ _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); }
+
+protected:
+
+ static _CharT _STLP_CALL _M_null()
+ { return _STLP_DEFAULT_CONSTRUCTED(_CharT); }
+
+protected: // Helper functions used by constructors
+ // and elsewhere.
+ // fbp : simplify integer types (char, wchar)
+ void _M_construct_null_aux(_CharT* __p, const __false_type& /*_Is_Integral*/) const {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _Traits::assign(*__p, _M_null());
+ else
+#endif /*_STLP_USE_SHORT_STRING_OPTIM*/
+ _STLP_STD::_Construct(__p);
+ }
+ void _M_construct_null_aux(_CharT* __p, const __true_type& /*_Is_Integral*/) const
+ { *__p = 0; }
+
+ void _M_force_construct_null(_CharT*, const __true_type& /* _Is_POD */) const
+ { /*Nothing to do*/ }
+ void _M_force_construct_null(_CharT* __p, const __false_type& /* _Is_POD */) const
+ { _M_construct_null_aux(__p, _Char_Is_Integral()); }
+
+ void _M_construct_null(_CharT* __p) const {
+ typedef __false_type _Answer;
+
+ _M_force_construct_null(__p, _Answer());
+ }
+
+protected:
+ // Helper functions used by constructors. It is a severe error for
+ // any of them to be called anywhere except from within constructors.
+ void _M_terminate_string_aux(const __false_type& __is_integral) {
+ _STLP_TRY {
+ _M_construct_null_aux(this->_M_Finish(), __is_integral);
+ }
+ _STLP_UNWIND(this->_M_destroy_range(0,0))
+ }
+
+ void _M_terminate_string_aux(const __true_type& __is_integral)
+ { _M_construct_null_aux(this->_M_Finish(), __is_integral); }
+
+ void _M_force_terminate_string(const __true_type& /* _Is_POD */)
+ { /*Nothing to do*/ }
+ void _M_force_terminate_string(const __false_type& /* _Is_POD */)
+ { _M_terminate_string_aux(_Char_Is_Integral()); }
+
+ void _M_terminate_string() {
+ typedef __false_type _Answer;
+
+ _M_force_terminate_string(_Answer());
+ }
+
+ 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);
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf()) {
+ _M_copy(__f, __l, this->_M_Start());
+ this->_M_finish = this->_M_Start() + __n;
+ }
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ 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_t 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()); }
+
+ void reserve(size_type = 0);
+
+ size_type capacity() const
+ { return (this->_M_end_of_storage._M_data - this->_M_Start()) - 1; }
+
+ void clear() {
+ if (!empty()) {
+ _Traits::assign(*(this->_M_Start()), _M_null());
+ this->_M_destroy_range(1);
+ 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; }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+private: // Helper functions for append.
+ 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) {
+ const size_type __old_size = this->size();
+ difference_type __n = distance(__first, __last);
+ if (__STATIC_CAST(size_type,__n) > this->max_size() || __old_size > this->max_size() - __STATIC_CAST(size_type,__n))
+ this->_M_throw_length_error();
+ if (__old_size + __n > this->capacity()) {
+ size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __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);
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start, __len)))
+ this->_M_destroy_range();
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _ForwardIter __f1 = __first;
+ ++__f1;
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copyT(__f1, __last, this->_M_Finish() + 1);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ uninitialized_copy(__f1, __last, this->_M_Finish() + 1);
+ _STLP_TRY {
+ _M_construct_null(this->_M_Finish() + __n);
+ }
+ _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_Finish() + 1, this->_M_Finish() + __n))
+ _Traits::assign(*this->_M_finish, *__first);
+ 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());
+ }
+# endif
+#endif
+
+protected:
+ _Self& _M_append(const _CharT* __first, const _CharT* __last);
+
+public:
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ _Self& append(const _CharT* __first, const _CharT* __last) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ return _M_append(__first, __last);
+ }
+# endif
+#endif
+
+ _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_Finish() + 1 == this->_M_end_of_storage._M_data)
+ reserve(size() + (max)(size(), __STATIC_CAST(size_type,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_destroy_back();
+ --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);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+private: // 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());
+ }
+# endif
+#endif
+
+protected:
+ _Self& _M_assign(const _CharT* __f, const _CharT* __l);
+
+public:
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ _Self& assign(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ return _M_assign(__f, __l);
+ }
+# endif
+#endif
+
+public: // Insert
+
+ _Self& insert(size_type __pos, const _Self& __s) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ if (size() > max_size() - __s.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 (size() > max_size() - __len)
+ 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 (size() > max_size() - __n)
+ 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 (size() > max_size() - __len)
+ 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 (size() > max_size() - __n)
+ 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);
+
+protected: // 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,
+ difference_type __n) {
+ const size_type __old_size = this->size();
+ size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __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);
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start, __len)))
+ this->_M_destroy_range();
+ 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) {
+ difference_type __n = distance(__first, __last);
+ if (this->_M_end_of_storage._M_data - this->_M_finish >= __n + 1) {
+ const difference_type __elems_after = this->_M_finish - __pos;
+ if (__elems_after >= __n) {
+# if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
+ else
+# endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ 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;
+ advance(__mid, __elems_after + 1);
+# if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copyT(__mid, __last, this->_M_Finish() + 1);
+ else
+# endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ uninitialized_copy(__mid, __last, this->_M_Finish() + 1);
+ this->_M_finish += __n - __elems_after;
+ _STLP_TRY {
+# if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copy(__pos, __old_finish + 1, this->_M_Finish());
+ else
+# endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ uninitialized_copy(__pos, __old_finish + 1, this->_M_Finish());
+ this->_M_finish += __elems_after;
+ }
+ _STLP_UNWIND((this->_M_destroy_ptr_range(__old_finish + 1, this->_M_Finish()),
+ this->_M_finish = __old_finish))
+ _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)
+ /*
+ * Within the basic_string implementation we are only going to check for
+ * self referencing if iterators are string iterators or _CharT pointers.
+ * A user could encapsulate those iterator within their own iterator interface
+ * and in this case lead to a bad behavior, this is a known limitation.
+ */
+ typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator;
+ typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
+ typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside;
+ _M_insert_aux(__p, __first, __last, _CheckInside());
+ }
+
+ template <class _RandomIter>
+ void _M_insert_aux (iterator __p, _RandomIter __first, _RandomIter __last,
+ const __true_type& /*_CheckInside*/) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ _M_insert(__p, &(*__first), &(*__last), _M_inside(&(*__first)));
+ }
+
+ template<class _InputIter>
+ void _M_insert_aux (iterator __p, _InputIter __first, _InputIter __last,
+ const __false_type& /*_CheckInside*/) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ _M_insertT(__p, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+ }
+
+ 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
+
+public:
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ 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_destroy_back();
+ --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);
+ pointer __new_finish = this->_M_Finish() - (__last - __first);
+ this->_M_destroy_ptr_range(__new_finish + 1, this->_M_Finish() + 1);
+ this->_M_finish = __new_finish;
+ }
+ return __first;
+ }
+
+public: // Replace. (Conceptually equivalent
+ // to erase followed by insert.)
+ _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n, size() - __pos);
+ if (size() - __len >= max_size() - __s.size())
+ 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) {
+ if (__pos1 > size() || __pos2 > __s.size())
+ this->_M_throw_out_of_range();
+ const size_type __len1 = (min) (__n1, size() - __pos1);
+ const size_type __len2 = (min) (__n2, __s.size() - __pos2);
+ if (size() - __len1 >= max_size() - __len2)
+ 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)
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n1, size() - __pos);
+ if (__n2 > max_size() || size() - __len >= max_size() - __n2)
+ 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)
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n1, size() - __pos);
+ const size_type __n2 = _Traits::length(__s);
+ if (__n2 > max_size() || size() - __len >= max_size() - __n2)
+ this->_M_throw_length_error();
+ return _M_replace(begin() + __pos, begin() + __pos + __len,
+ __s, __s + _Traits::length(__s), _M_inside(__s));
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ size_type __n2, _CharT __c) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n1, size() - __pos);
+ if (__n2 > max_size() || size() - __len >= max_size() - __n2)
+ 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);
+
+protected: // Helper functions for replace.
+ _Self& _M_replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l, bool __self_ref);
+
+public:
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if !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)
+ typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator;
+ typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
+ typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside;
+ return _M_replace_aux(__first, __last, __f, __l, _CheckInside());
+ }
+
+ template <class _RandomIter>
+ _Self& _M_replace_aux(iterator __first, iterator __last,
+ _RandomIter __f, _RandomIter __l, __true_type const& /*_CheckInside*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return _M_replace(__first, __last, &(*__f), &(*__l), _M_inside(&(*__f)));
+ }
+
+ template <class _InputIter>
+ _Self& _M_replace_aux(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l, __false_type const& /*_CheckInside*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return _M_replaceT(__first, __last, __f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ }
+
+ template <class _InputIter>
+ _Self& _M_replaceT(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l, const input_iterator_tag&__ite_tag) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ for ( ; __first != __last && __f != __l; ++__first, ++__f)
+ _Traits::assign(*__first, *__f);
+ if (__f == __l)
+ erase(__first, __last);
+ else
+ _M_insertT(__last, __f, __l, __ite_tag);
+ return *this;
+ }
+
+ template <class _ForwardIter>
+ _Self& _M_replaceT(iterator __first, iterator __last,
+ _ForwardIter __f, _ForwardIter __l, const forward_iterator_tag &__ite_tag) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ difference_type __n = distance(__f, __l);
+ const difference_type __len = __last - __first;
+ if (__len >= __n) {
+ _M_copyT(__f, __l, __first);
+ erase(__first + __n, __last);
+ }
+ else {
+ _ForwardIter __m = __f;
+ advance(__m, __len);
+ _M_copyT(__f, __m, __first);
+ _M_insertT(__last, __m, __l, __ite_tag);
+ }
+ return *this;
+ }
+
+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
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ _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
+#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);
+ }
+
+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 /* _STLP_USE_TEMPLATE_EXPRESSION */
+};
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG)
+# 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
+#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); }
+#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _CharT, class _Traits, class _Alloc>
+struct __move_traits<basic_string<_CharT, _Traits, _Alloc> > {
+ typedef __stlp_movable 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:
+ */
--- /dev/null
+/*
+ * 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_data - _M_start.
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#ifndef _STLP_SHORT_STRING_SZ
+# define _STLP_SHORT_STRING_SZ 16
+#endif
+
+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 = _STLP_SHORT_STRING_SZ};
+ //This is needed by the full move framework
+ typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type 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_dynamic_buf;
+ _Tp _M_static_buf[_DEFAULT_SIZE];
+ } _M_buffers;
+#else
+ _Tp* _M_start;
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+protected:
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ bool _M_using_static_buf() const {
+ return (_M_end_of_storage._M_data == _M_buffers._M_static_buf + _DEFAULT_SIZE);
+ }
+ _Tp const* _M_Start() const {
+ return _M_using_static_buf()?_M_buffers._M_static_buf:_M_buffers._M_dynamic_buf;
+ }
+ _Tp* _M_Start() {
+ return _M_using_static_buf()?_M_buffers._M_static_buf:_M_buffers._M_dynamic_buf;
+ }
+#else
+ _Tp const* _M_Start() const {return _M_start;}
+ _Tp* _M_Start() {return _M_start;}
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+
+ _Tp* _M_finish;
+ _AllocProxy _M_end_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_buffers._M_dynamic_buf != 0))
+ _M_end_of_storage.deallocate(_M_buffers._M_dynamic_buf, _M_end_of_storage._M_data - _M_buffers._M_dynamic_buf);
+#else
+ if (_M_start != 0)
+ _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start);
+#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_end_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_end_of_storage(__a, _M_buffers._M_static_buf + _DEFAULT_SIZE)
+#else
+ : _M_start(0), _M_finish(0), _M_end_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_end_of_storage(__a, _M_buffers._M_static_buf + _DEFAULT_SIZE) {
+#else
+ : _M_start(0), _M_finish(0), _M_end_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_buffers._M_static_buf);
+ _M_end_of_storage._M_data = _M_buffers._M_static_buf + _DEFAULT_SIZE;
+ }
+ else {
+ _M_buffers._M_dynamic_buf = src._M_buffers._M_dynamic_buf;
+ _M_finish = src._M_finish;
+ _M_end_of_storage._M_data = src._M_end_of_storage._M_data;
+ src._M_buffers._M_dynamic_buf = 0;
+ }
+ }
+#endif
+
+ _String_base(__move_source<_Self> src)
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ : _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) {
+ _M_move_src(src.get());
+#else
+ : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
+ _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) {
+ src.get()._M_start = 0;
+#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_dynamic_buf = __start;
+#else
+ _M_start = __start;
+#endif
+ _M_finish = __finish;
+ _M_end_of_storage._M_data = __end_of_storage;
+ }
+
+ void _M_destroy_back () {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (!_M_using_static_buf())
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ _STLP_STD::_Destroy(_M_finish);
+ }
+
+ void _M_destroy_range(size_t __from_off = 0, size_t __to_off = 1) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (!_M_using_static_buf())
+ _STLP_STD::_Destroy_Range(_M_buffers._M_dynamic_buf + __from_off, _M_finish + __to_off);
+#else
+ _STLP_STD::_Destroy_Range(_M_start + __from_off, _M_finish + __to_off);
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ }
+
+ void _M_destroy_ptr_range(_Tp *__f, _Tp *__l) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (!_M_using_static_buf())
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ _STLP_STD::_Destroy_Range(__f, __l);
+ }
+
+ 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_buffers._M_static_buf + (__s._M_finish - __s._M_buffers._M_static_buf);
+ __s._M_finish = __s._M_buffers._M_static_buf + (__tmp - _M_buffers._M_static_buf);
+ //We need to swap _M_end_of_storage for allocators with state:
+ _M_end_of_storage.swap(__s._M_end_of_storage);
+ _M_end_of_storage._M_data = _M_buffers._M_static_buf + _DEFAULT_SIZE;
+ __s._M_end_of_storage._M_data = __s._M_buffers._M_static_buf + _DEFAULT_SIZE;
+ } else {
+ __s._M_Swap(*this);
+ return;
+ }
+ }
+ else if (__s._M_using_static_buf()) {
+ _Tp *__tmp = _M_buffers._M_dynamic_buf;
+ _Tp *__tmp_finish = _M_finish;
+ _Tp *__tmp_end_data = _M_end_of_storage._M_data;
+ _M_buffers = __s._M_buffers;
+ //We need to swap _M_end_of_storage for allocators with state:
+ _M_end_of_storage.swap(__s._M_end_of_storage);
+ _M_end_of_storage._M_data = _M_buffers._M_static_buf + _DEFAULT_SIZE;
+ _M_finish = _M_buffers._M_static_buf + (__s._M_finish - __s._M_buffers._M_static_buf);
+ __s._M_buffers._M_dynamic_buf = __tmp;
+ __s._M_end_of_storage._M_data = __tmp_end_data;
+ __s._M_finish = __tmp_finish;
+ }
+ else {
+ _STLP_STD::swap(_M_buffers._M_dynamic_buf, __s._M_buffers._M_dynamic_buf);
+ _M_end_of_storage.swap(__s._M_end_of_storage);
+ _STLP_STD::swap(_M_finish, __s._M_finish);
+ }
+#else
+ _STLP_STD::swap(_M_start, __s._M_start);
+ _M_end_of_storage.swap(__s._M_end_of_storage);
+ _STLP_STD::swap(_M_finish, __s._M_finish);
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ }
+
+ void _STLP_FUNCTION_THROWS _M_throw_length_error() const;
+ void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
+};
+
+#undef _STLP_SHORT_STRING_SZ
+
+#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:
+ */
--- /dev/null
+/*
+ * 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_IOSFWD
+# include <iosfwd>
+#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:
--- /dev/null
+/*
+ * 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)
+
+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
--- /dev/null
+#ifndef _STLP_STRING_IO_C
+#define _STLP_STRING_IO_C
+
+#ifndef _STLP_STRING_IO_H
+# include <stl/_string_io.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _Traits>
+bool _STLP_CALL
+__stlp_string_fill(basic_ostream<_CharT, _Traits>& __os,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize __n) {
+ _CharT __f = __os.fill();
+ for (streamsize __i = 0; __i < __n; ++__i) {
+ if (_Traits::eq_int_type(__buf->sputc(__f), _Traits::eof()))
+ return false;
+ }
+ return true;
+}
+
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator << (basic_ostream<_CharT, _Traits>& __os,
+ const basic_string<_CharT,_Traits,_Alloc>& __s) {
+ typedef basic_ostream<_CharT, _Traits> __ostream;
+ typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type;
+
+ // The hypothesis of this implementation is that size_type is unsigned:
+ _STLP_STATIC_ASSERT(__STATIC_CAST(size_type, -1) > 0)
+
+ typename __ostream::sentry __sentry(__os);
+ bool __ok = false;
+
+ if (__sentry) {
+ __ok = true;
+ size_type __n = __s.size();
+ const bool __left = (__os.flags() & __ostream::left) != 0;
+ const streamsize __w = __os.width(0);
+ basic_streambuf<_CharT, _Traits>* __buf = __os.rdbuf();
+
+ const bool __need_pad = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __n) < __w)) ||
+ ((sizeof(streamsize) <= sizeof(size_t)) && (__n < __STATIC_CAST(size_t, __w))));
+ streamsize __pad_len = __need_pad ? __w - __n : 0;
+
+ if (!__left)
+ __ok = __stlp_string_fill(__os, __buf, __pad_len);
+
+ __ok = __ok && (__buf->sputn(__s.data(), streamsize(__n)) == streamsize(__n));
+
+ if (__left)
+ __ok = __ok && __stlp_string_fill(__os, __buf, __pad_len);
+ }
+
+ if (!__ok)
+ __os.setstate(__ostream::failbit);
+
+ return __os;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator >> (basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT,_Traits, _Alloc>& __s) {
+ typedef basic_istream<_CharT, _Traits> __istream;
+ typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type;
+
+ // The hypothesis of this implementation is that size_type is unsigned:
+ _STLP_STATIC_ASSERT(__STATIC_CAST(size_type, -1) > 0)
+
+ typename __istream::sentry __sentry(__is);
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();
+ typedef ctype<_CharT> _C_type;
+
+ const locale& __loc = __is.getloc();
+ const _C_type& _Ctype = use_facet<_C_type>(__loc);
+ __s.clear();
+ streamsize __width = __is.width(0);
+ size_type __n;
+ if (__width <= 0)
+ __n = __s.max_size();
+ /* __width can only overflow size_type if sizeof(streamsize) > sizeof(size_type)
+ * because here we know that __width is positive and the stattic assertion check
+ * that size_type is unsigned.
+ */
+ else if (sizeof(streamsize) > sizeof(size_type) &&
+ (__width > __STATIC_CAST(streamsize, __s.max_size())))
+ __n = 0;
+ else {
+ __n = __STATIC_CAST(size_type, __width);
+ __s.reserve(__n);
+ }
+
+ while (__n-- > 0) {
+ typename _Traits::int_type __c1 = __buf->sbumpc();
+ if (_Traits::eq_int_type(__c1, _Traits::eof())) {
+ __is.setstate(__istream::eofbit);
+ break;
+ }
+ else {
+ _CharT __c = _Traits::to_char_type(__c1);
+
+ if (_Ctype.is(_C_type::space, __c)) {
+ if (_Traits::eq_int_type(__buf->sputbackc(__c), _Traits::eof()))
+ __is.setstate(__istream::failbit);
+ break;
+ }
+ else
+ __s.push_back(__c);
+ }
+ }
+
+ // If we have read no characters, then set failbit.
+ if (__s.empty())
+ __is.setstate(__istream::failbit);
+ }
+ else
+ __is.setstate(__istream::failbit);
+
+ return __is;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+getline(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT,_Traits,_Alloc>& __s,
+ _CharT __delim) {
+ typedef basic_istream<_CharT, _Traits> __istream;
+ typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type;
+ size_type __nread = 0;
+ typename basic_istream<_CharT, _Traits>::sentry __sentry(__is, true);
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();
+ __s.clear();
+
+ while (__nread < __s.max_size()) {
+ int __c1 = __buf->sbumpc();
+ if (_Traits::eq_int_type(__c1, _Traits::eof())) {
+ __is.setstate(__istream::eofbit);
+ break;
+ }
+ else {
+ ++__nread;
+ _CharT __c = _Traits::to_char_type(__c1);
+ if (!_Traits::eq(__c, __delim))
+ __s.push_back(__c);
+ else
+ break; // Character is extracted but not appended.
+ }
+ }
+ }
+ if (__nread == 0 || __nread >= __s.max_size())
+ __is.setstate(__istream::failbit);
+
+ return __is;
+}
+
+_STLP_END_NAMESPACE
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_IO_H
+#define _STLP_STRING_IO_H
+
+#ifndef _STLP_INTERNAL_OSTREAM_H
+# include <stl/_ostream.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+// I/O.
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const basic_string<_CharT,_Traits,_Alloc>& __s);
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __sum) {
+ basic_string<_CharT, _Traits, _Alloc> __tmp(__sum);
+ return __os << __tmp;
+}
+
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT,_Traits,_Alloc>& __s);
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+getline(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT,_Traits,_Alloc>& __s,
+ _CharT __delim);
+
+#if !(defined (__BORLANDC__) && !defined (_STLP_USE_OWN_NAMESPACE))
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+getline(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT,_Traits,_Alloc>& __s) {
+ return getline(__is, __s, __is.widen('\n'));
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_string_io.c>
+#endif
+
+#endif /* _STLP_STRING_IO_H */
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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 */
+
--- /dev/null
+/*
+ * 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_SUM_H
+#define _STLP_STRING_SUM_H
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*char wrapper to simulate basic_string*/
+template <class _CharT>
+struct __char_wrapper {
+ typedef const _CharT& const_reference;
+
+ __char_wrapper(_CharT __val) : _Val(__val) {}
+
+ _CharT getValue() const { return _Val; }
+ size_t size() const { return 1; }
+
+ const_reference operator[] (size_t __n) const {
+ //To avoid a check on __n we use this strange implementation
+ return (&_Val)[__n];
+ }
+
+private:
+ _CharT _Val;
+};
+
+/*C string wrapper to simulate basic_string*/
+template <class _CharT>
+struct __cstr_wrapper {
+ typedef const _CharT& const_reference;
+
+ __cstr_wrapper(const _CharT *__cstr, size_t __size) :
+ _CStr(__cstr), _Size(__size) {}
+
+ const _CharT* c_str() const { return _CStr; }
+
+ size_t size() const { return _Size; }
+
+ const_reference operator[] (size_t __n) const { return _CStr[__n]; }
+
+private:
+ const _CharT *_CStr;
+ size_t _Size;
+};
+
+/*basic_string wrapper to ensure that we only store a reference to the original string and not copy it*/
+template <class _CharT, class _Traits, class _Alloc>
+struct __bstr_wrapper {
+ typedef const _CharT& const_reference;
+ typedef basic_string<_CharT, _Traits, _Alloc> _BString;
+
+ __bstr_wrapper (_BString const& __s) :
+ _BStr(__s) {}
+
+ size_t size() const { return _BStr.size(); }
+
+ const_reference operator[] (size_t __n) const { return _BStr[__n]; }
+
+ _BString const& b_str() const { return _BStr; }
+
+private:
+ _BString const& _BStr;
+};
+
+struct __on_left {};
+struct __on_right {};
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Left, class _Right,
+ class _StorageDirection>
+class __bstr_sum {
+public:
+ typedef basic_string<_CharT, _Traits, _Alloc> _BString;
+ typedef typename _BString::const_reference const_reference;
+ typedef typename _BString::const_iterator const_iterator;
+ typedef typename _BString::const_reverse_iterator const_reverse_iterator;
+ typedef typename _BString::size_type size_type;
+ typedef typename _BString::allocator_type allocator_type;
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDirection> _Self;
+
+ __bstr_sum (_Left const& lhs, _Right const& rhs) :
+ _lhs(lhs), _rhs(rhs) {}
+
+ _Left const& getLhs() const { return _lhs; }
+ _Right const& getRhs() const { return _rhs; }
+
+ allocator_type get_allocator() const { return _M_get_storage(false).get_allocator(); }
+
+ const_iterator begin() const { return _M_get_storage().begin(); }
+ const_iterator end() const { return _M_get_storage().end(); }
+ const_reverse_iterator rbegin() const { return _M_get_storage().rbegin(); }
+ const_reverse_iterator rend() const { return _M_get_storage().rend(); }
+
+ size_type size() const { return _lhs.size() + _rhs.size(); }
+ size_type length() const { return size(); }
+
+ size_t max_size() const { return _M_get_storage().max_size(); }
+ size_type capacity() const { return size(); }
+ bool empty() const { return size() == 0; }
+
+ const_reference operator[](size_t __n) const
+ { return (__n < _lhs.size())?_lhs[__n]:_rhs[__n - _lhs.size()]; }
+
+ const_reference at(size_type __n) const
+ { return _M_get_storage().at(__n); }
+
+ //operator +=
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __bstr_wrapper<_CharT, _Traits, _Alloc>, __on_left> _BStrOnLeft;
+ _BStrOnLeft operator += (const _BString& __s) { return append(__s); }
+
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __cstr_wrapper<_CharT>, __on_left> _CStrOnLeft;
+ _CStrOnLeft operator += (const _CharT* __s) { return append(__s); }
+
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __char_wrapper<_CharT>, __on_left> _CharOnLeft;
+ _CharOnLeft operator += (_CharT __c) { return _CharOnLeft(*this, __c); }
+
+ //append
+ _BStrOnLeft append (const _BString& __s)
+ { return _BStrOnLeft(*this, __s); }
+ _BString& append(const _BString& __s, size_type __pos, size_type __n)
+ { return _M_get_storage().append(__s, __pos, __n); }
+ _CStrOnLeft append(const _CharT* __s) {
+ const size_type __n = _Traits::length(__s);
+ return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n));
+ }
+ _CStrOnLeft append(const _CharT* __s, size_type __n)
+ { return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n)); }
+ _BString& append(size_type __n, _CharT __c)
+ {return _M_get_storage().append(__n, __c);}
+ template <class _InputIter>
+ _BString& append(_InputIter __first, _InputIter __last)
+ {return _M_get_storage().append(__first, __last);}
+
+ //assign
+ _BString& assign(const _BString& __s) {return _M_get_storage().assign(__s);}
+ _BString& assign(const _BString& __s, size_type __pos, size_type __n) {return _M_get_storage().assign(__s, __pos, __n);}
+ _BString& assign(const _CharT* __s, size_type __n) {return _M_get_storage().assign(__s, __n);}
+ _BString& assign(const _CharT* __s) {return _M_get_storage().assign(__s); }
+ _BString& assign(size_type __n, _CharT __c) {return _M_get_storage().assign(__n, __c);}
+
+ //insert
+ _BString& insert(size_type __pos, const _BString& __s) {return _M_get_storage().insert(__pos, __s);}
+ _BString& insert(size_type __pos, const _BString& __s, size_type __beg, size_type __n)
+ {return _M_get_storage().insert(__pos, __s, __beg, __n);}
+ _BString& insert(size_type __pos, const _CharT* __s, size_type __n) {return _M_get_storage().insert(__pos, __s, __n);}
+ _BString& insert(size_type __pos, const _CharT* __s) {return _M_get_storage().insert(__pos, __s);}
+ _BString& insert(size_type __pos, size_type __n, _CharT __c) {return _M_get_storage().insert(__pos, __n, __c);}
+
+ //erase
+ _BString& erase(size_type __pos = 0, size_type __n =_BString::npos) {return _M_get_storage().erase(__pos, __n);}
+
+ //replace
+ _BString& replace(size_type __pos, size_type __n, const _BString& __s)
+ {return _M_get_storage().replace(__pos, __n, __s);}
+ _BString& replace(size_type __pos1, size_type __n1, const _BString& __s, size_type __pos2, size_type __n2)
+ {return _M_get_storage().replace(__pos1, __n1, __s, __pos2, __n2);}
+ _BString& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2)
+ {return _M_get_storage().replace(__pos, __n1, __s, __n2);}
+ _BString& replace(size_type __pos, size_type __n1, const _CharT* __s)
+ {return _M_get_storage().replace(__pos, __n1, __s);}
+ _BString& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
+ {return _M_get_storage().replace(__pos, __n1, __n2, __c);}
+
+ size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
+ {return _M_get_storage().copy(__s, __n, __pos);}
+
+ void swap(_BString& __s)
+ {_M_get_storage().swap(__s);}
+
+ const _CharT* c_str() const { return _M_get_storage().c_str(); }
+ const _CharT* data() const { return _M_get_storage().data(); }
+
+ //find family
+ size_type find(const _BString& __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
+ size_type find(const _CharT* __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
+ size_type find(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().find(__s, __pos, __n); }
+ size_type find(_CharT __c, size_type __pos = 0) const { return _M_get_storage().find(__c, __pos); }
+
+ size_type rfind(const _BString& __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
+ size_type rfind(const _CharT* __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
+ size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().rfind(__s, __pos, __n); }
+ size_type rfind(_CharT __c, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__c, __pos); }
+
+ size_type find_first_of(const _BString& __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_of(__s, __pos); }
+ size_type find_first_of(const _CharT* __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_of(__s, __pos); }
+ size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_first_of(__s, __pos, __n); }
+ size_type find_first_of(_CharT __c, size_type __pos = 0) const
+ { return _M_get_storage().find(__c, __pos); }
+
+ size_type find_last_of(const _BString& __s, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_of(__s, __pos); }
+ size_type find_last_of(const _CharT* __s, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_of(__s, __pos); }
+ size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_last_of(__s, __pos, __n); }
+ size_type find_last_of(_CharT __c, size_type __pos = _BString::npos) const
+ { return _M_get_storage().rfind(__c, __pos); }
+
+ size_type find_first_not_of(const _BString& __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_not_of(__s, __pos); }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_not_of(__s, __pos); }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_first_not_of(__s, __pos, __n); }
+ size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
+ { return _M_get_storage().find_first_not_of(__c, __pos); }
+
+ size_type find_last_not_of(const _BString& __s, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_not_of(__s, __pos); }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos =_BString:: npos) const
+ { return _M_get_storage().find_last_not_of(__s, __pos); }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_last_not_of(__s, __pos, __n); }
+ size_type find_last_not_of(_CharT __c, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_not_of(__c, __pos); }
+
+ _BString substr(size_type __pos = 0, size_type __n = _BString::npos) const
+ { return _M_get_storage().substr(__pos, __n); }
+
+ //compare
+ int compare(const _BString& __s) const
+ { return _M_get_storage().compare(__s); }
+ int compare(size_type __pos1, size_type __n1, const _Self& __s) const
+ { return _M_get_storage().compare(__pos1, __n1, __s); }
+ int compare(size_type __pos1, size_type __n1, const _Self& __s, size_type __pos2, size_type __n2) const
+ { return _M_get_storage().compare(__pos1, __n1, __s, __pos2, __n2); }
+ int compare(const _CharT* __s) const
+ { return _M_get_storage().compare(__s); }
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
+ { return _M_get_storage().compare(__pos1, __n1, __s); }
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
+ { return _M_get_storage().compare(__pos1, __n1, __s, __n2); }
+
+ //Returns the underlying basic_string representation of the template expression
+ //The non const method will always initialise it.
+ _BString& _M_get_storage()
+ { return _rhs._M_get_storage(*this, _StorageDirection()); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ __on_left const& /*StorageDir*/)
+ { return _lhs._M_get_storage(__ref); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ __on_right const& /*StorageDir*/)
+ { return _rhs._M_get_storage(__ref); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref)
+ { return _M_get_storage(__ref, _StorageDirection()); }
+
+ //The const method can be invoked without initialising the basic_string so avoiding dynamic allocation.
+ _BString const& _M_get_storage(bool __do_init = true) const
+ { return _M_get_storage(*this, __do_init, _StorageDirection()); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ bool __do_init, __on_left const& /*StorageDir*/) const
+ { return _lhs._M_get_storage(__ref, __do_init); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ bool __do_init, __on_right const& /*StorageDir*/) const
+ { return _rhs._M_get_storage(__ref, __do_init); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ bool __do_init) const
+ { return _M_get_storage(__ref, __do_init, _StorageDirection()); }
+
+private:
+ _Left _lhs;
+ _Right _rhs;
+};
+
+/*
+ * For this operator we choose to use the right part as the storage part
+ */
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline __bstr_sum<_CharT, _Traits, _Alloc,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
+ __on_right> _STLP_CALL
+operator + (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) {
+ return __bstr_sum<_CharT, _Traits, _Alloc,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
+ __on_right>(__lhs, __rhs);
+}
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator == (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return (__lhs.size() == __rhs.size()) && (__lhs._M_get_storage() == __rhs._M_get_storage()); }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator < (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return __lhs._M_get_storage() < __rhs._M_get_storage(); }
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator != (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return !(__lhs == __rhs); }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator > (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return __rhs < __lhs; }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator <= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return !(__rhs < __lhs); }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator >= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return !(__lhs < __rhs); }
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+
+/*
+ * This class will be used to simulate a temporary string that is required for
+ * a call to the c_str method on the __bstr_sum class.
+ */
+
+template <class _CharT, class _Traits, class _Alloc>
+struct __sum_storage_elem {
+ typedef basic_string<_CharT, _Traits, _Alloc> _BString;
+
+ __sum_storage_elem(_Alloc __alloc) : _M_init(false), _M_storage(__alloc)
+ {}
+
+ template <class _Left, class _Right, class _StorageDir>
+ void _M_Init(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) const {
+ if (!_M_init) {
+ _M_storage = __ref;
+ _M_init = true;
+ }
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref,
+ bool __do_init) const {
+ if (__do_init) {
+ _M_Init(__ref);
+ }
+ return _M_storage;
+ }
+ template <class _Left, class _Right, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) {
+ _M_Init(__ref);
+ return _M_storage;
+ }
+
+ size_t size() const { return 0; }
+ _CharT const& operator[](size_t __n) const
+ { return __STATIC_CAST(_CharT*, 0)[__n]; }
+
+private:
+ mutable bool _M_init;
+ mutable basic_string<_CharT, _Traits, _Alloc> _M_storage;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /*_STLP_STRING_SUM_H*/
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/*
+ * All the necessary methods used for template expressions with basic_string
+ * This file do not have to be macro guarded as it is only used in the _string.h
+ * file and it is a part of the basic_string definition.
+ */
+
+public:
+ template <class _Left, class _Right, class _StorageDir>
+ basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s)
+ : _STLP_STRING_SUM_BASE(_Reserve_t(), __s.size(), __s.get_allocator())
+ { _M_append_sum(__s); }
+
+ template <class _Left, class _Right, class _StorageDir>
+ basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+ : _STLP_STRING_SUM_BASE(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a) {
+ size_type __size = __s.size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ else
+ _M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos));
+ }
+
+private:
+ _CharT* _M_append_fast(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf) {
+ _STLP_STD::_Copy_Construct(__buf, __c.getValue());
+ return __buf + 1;
+ }
+ _CharT* _M_append_fast(_CharT const* __s, size_type __s_size, _CharT *__buf)
+ { return uninitialized_copy(__s, __s + __s_size, __buf); }
+ _CharT* _M_append_fast(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf)
+ { return _M_append_fast(__s.c_str(), __s.size(), __buf); }
+ _CharT* _M_append_fast(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf)
+ { return _M_append_fast(__s.b_str(), __buf); }
+ _CharT* _M_append_fast(_Self const& __s, _CharT *__buf)
+ { return _M_append_fast(__s.data(), __s.size(), __buf); }
+ _CharT* _M_append_fast(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf)
+ { return __buf; }
+ template <class _Left, class _Right, class _StorageDir>
+ _CharT* _M_append_fast(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, _CharT *__buf)
+ { return _M_append_fast(__s.getRhs(), _M_append_fast(__s.getLhs(), __buf)); }
+
+ _CharT* _M_append_fast_pos(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf, size_type /*__pos*/, size_type __n) {
+ if (__n == 0)
+ return __buf;
+ _STLP_STD::_Copy_Construct(__buf, __c.getValue());
+ return __buf + 1;
+ }
+ _CharT* _M_append_fast_pos(_CharT const* __s, size_type __s_size, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return uninitialized_copy(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos), __buf); }
+ _CharT* _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.c_str(), __s.size(), __buf, __pos, __n); }
+ _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.b_str(), __buf, __pos, __n); }
+ _CharT* _M_append_fast_pos(_Self const& __s, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.data(), __s.size(), __buf, __pos, __n); }
+ _CharT* _M_append_fast_pos(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf,
+ size_type, size_type)
+ { return __buf; }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ _CharT *__buf, size_type __pos, size_type __n) {
+ if (__n == 0) {
+ return __buf;
+ }
+ size_type __lhs_size = __s.getLhs().size();
+ if (__pos < __lhs_size) {
+ if (__n < (__lhs_size - __pos)) {
+ return _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n);
+ } else {
+ return _M_append_fast_pos(__s.getRhs(), _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n),
+ 0, __n - (__lhs_size - __pos));
+ }
+ } else {
+ return _M_append_fast_pos(__s.getRhs(), __buf, __pos - __lhs_size, __n);
+ }
+ }
+
+ /* Note: We always force use of dynamic buffer if the short string optim option is activated
+ * to avoid complicated code if the basic_string was instanciated with a non POD type.
+ * In such a case we should use assignment for objects in the static array something that we
+ * do not do.
+ */
+ size_type _M_get_additional_size(size_type __new_size, const __false_type& /*_Char_Is_POD*/) const {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ //To avoid problem with the string assumptions, never allocate a dynamic buffer smaller or equal
+ //than the static one:
+ if (__new_size < _Base::_DEFAULT_SIZE + 1)
+ return (_Base::_DEFAULT_SIZE + 1) - __new_size;
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ return 0;
+ }
+ size_type _M_get_additional_size(size_type, const __true_type& /*_Char_Is_POD*/) const
+ { return 0; }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Self& _M_append_sum (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s) {
+ size_type __s_size = __s.size();
+ if (__s_size == 0)
+ return *this;
+ const size_type __old_size = this->size();
+ if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size))
+ this->_M_throw_length_error();
+ size_type __offset_size = _M_get_additional_size(__old_size + __s_size, _Char_Is_POD());
+ if (__old_size + __s_size + __offset_size > this->capacity()) {
+ const size_type __len = __old_size + __offset_size + (max)(__old_size, __s_size) + 1;
+ pointer __new_start = this->_M_end_of_storage.allocate(__len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = this->_M_append_fast(__s, __new_finish);
+ this->_M_construct_null(__new_finish);
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ this->_M_destroy_range();
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _M_append_sum_no_overflow(__s, 0, __s_size);
+ }
+ return *this;
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Self& _M_append_sum_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n) {
+ size_type __s_size = (min)(__s.size() - __pos, __n);
+ if (__s_size == 0)
+ return *this;
+ const size_type __old_size = this->size();
+ if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size))
+ this->_M_throw_length_error();
+ size_type __offset_size = _M_get_additional_size(__old_size + __s_size, _Char_Is_POD());
+ if (__old_size + __s_size + __offset_size > this->capacity()) {
+ const size_type __len = __old_size + __offset_size + (max)(__old_size, __s_size) + 1;
+ pointer __new_start = this->_M_end_of_storage.allocate(__len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = _M_append_fast_pos(__s, __new_finish, __pos, __s_size);
+ this->_M_construct_null(__new_finish);
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ this->_M_destroy_range();
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _M_append_sum_no_overflow(__s, __pos, __s_size);
+ }
+ return *this;
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ void _M_append_sum_no_overflow(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n) {
+ pointer __finish = this->_M_Finish();
+ _M_append_fast_pos(__s, __finish + 1, __pos + 1, __n - 1);
+ _STLP_TRY {
+ this->_M_construct_null(__finish + __n);
+ }
+ _STLP_UNWIND(this->_M_destroy_ptr_range(__finish + 1, __finish + __n))
+ /* The call to the traits::assign method is only important for non POD types because the instance
+ * pointed to by _M_finish has been constructed (default constructor) and should not be constructed
+ * (copy constructor) once again. For POD it is irrelevant, uninitialized_copy could be fine,
+ * but we are not going to make two implementations just for that.
+ */
+ _Traits::assign(*this->_M_finish, __s[__pos]);
+ this->_M_finish += __n;
+ }
--- /dev/null
+/*
+ * Copyright (c) 2004
+ * 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.
+ *
+ */
+
+//Included from _string.h, no need for macro guarding.
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG)
+# define basic_string _STLP_NON_DBG_NAME(str)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+#define _STLP_NO_MEM_T_STRING_BASE _STLP_PRIV _STLP_NO_MEM_T_NAME(str)<_CharT, _Traits, _Alloc>
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_string : public _STLP_NO_MEM_T_STRING_BASE
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && \
+ !defined (basic_string)
+ , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
+#endif
+{
+protected: // Protected members inherited from base.
+ typedef basic_string<_CharT, _Traits, _Alloc> _Self;
+ typedef _STLP_NO_MEM_T_STRING_BASE _Base;
+ typedef typename _Base::_Char_Is_POD _Char_Is_POD;
+
+public:
+
+ __IMPORT_WITH_REVERSE_ITERATORS(_Base)
+
+ typedef typename _Base::_Iterator_category _Iterator_category;
+ typedef typename _Base::traits_type traits_type;
+ typedef typename _Base::_Reserve_t _Reserve_t;
+
+public: // Constructor, destructor, assignment.
+ explicit basic_string(const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__a) {}
+
+ basic_string(_Reserve_t __r, size_t __n,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__r, __n, __a) {}
+
+ basic_string(const _Self& __s)
+ : _STLP_NO_MEM_T_STRING_BASE(__s) {}
+
+ basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__s, __pos, __n, __a) {}
+
+ basic_string(const _CharT* __s, size_type __n,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__s, __n, __a) {}
+
+ basic_string(const _CharT* __s,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__s, __a) {}
+
+ basic_string(size_type __n, _CharT __c,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__n, __c, __a) {}
+
+ basic_string(__move_source<_Self> src)
+ : _STLP_NO_MEM_T_STRING_BASE(__move_source<_Base>(src.get())) {}
+
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+#if !(defined(__MRC__) || (defined(__SC__) && !defined(__DMC__))) //*ty 04/30/2001 - mpw compilers choke on this ctor
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l,
+ const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_NO_MEM_T_STRING_BASE(_Base::_CalledFromWorkaround_t(), __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_NO_MEM_T_STRING_BASE(_Base::_CalledFromWorkaround_t(), allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__f, __l, _Integral());
+ }
+# endif
+#endif /* !__MRC__ || (__SC__ && !__DMC__) */
+
+ _Self& operator=(const _Self& __s) {
+ _Base::operator=(__s);
+ return *this;
+ }
+
+ _Self& operator=(const _CharT* __s) {
+ _Base::operator=(__s);
+ return *this;
+ }
+
+ _Self& operator=(_CharT __c) {
+ _Base::operator=(__c);
+ return *this;
+ }
+
+private:
+ template <class _InputIter>
+ void _M_range_initialize(_InputIter __f, _InputIter __l,
+ const input_iterator_tag &__tag) {
+ this->_M_allocate_block();
+ this->_M_construct_null(this->_M_Finish());
+ _STLP_TRY {
+ _M_appendT(__f, __l, __tag);
+ }
+ _STLP_UNWIND(this->_M_destroy_range())
+ }
+
+ template <class _ForwardIter>
+ void _M_range_initialize(_ForwardIter __f, _ForwardIter __l,
+ const forward_iterator_tag &) {
+ difference_type __n = distance(__f, __l);
+ this->_M_allocate_block(__n + 1);
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf()) {
+ _M_copyT(__f, __l, this->_M_Start());
+ this->_M_finish = this->_M_Start() + __n;
+ }
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ 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);
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf()) {
+ _Traits::assign(this->_M_Start(), __n, __x);
+ this->_M_finish = this->_M_Start() + __n;
+ }
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ this->_M_finish = 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: // Append, operator+=, push_back.
+ _Self& operator+=(const _Self& __s) {
+ _Base::operator+=(__s);
+ return *this;
+ }
+ _Self& operator+=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::operator+=(__s);
+ return *this;
+ }
+ _Self& operator+=(_CharT __c) {
+ _Base::operator+=(__c);
+ return *this;
+ }
+
+ _Self& append(const _Self& __s) {
+ _Base::append(__s);
+ return *this;
+ }
+
+ _Self& append(const _Self& __s,
+ size_type __pos, size_type __n) {
+ _Base::append(__s, __pos, __n);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::append(__s, __n);
+ return *this;
+ }
+ _Self& append(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::append(__s);
+ return *this;
+ }
+ _Self& append(size_type __n, _CharT __c) {
+ _Base::append(__n, __c);
+ return *this;
+ }
+
+ // 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());
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ //See equivalent assign method remark.
+ _Self& append(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _Base::append(__f, __l);
+ return *this;
+ }
+#endif
+
+private: // Helper functions for append.
+
+ template <class _InputIter>
+ _Self& _M_appendT(_InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last ; ++__first)
+ _Base::push_back(*__first);
+ return *this;
+ }
+
+ template <class _ForwardIter>
+ _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ const size_type __old_size = this->size();
+ difference_type __n = distance(__first, __last);
+ if (__STATIC_CAST(size_type,__n) > max_size() || __old_size > max_size() - __STATIC_CAST(size_type,__n))
+ this->_M_throw_length_error();
+ if (__old_size + __n > capacity()) {
+ const size_type __len = __old_size +
+ (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
+ pointer __new_start = this->_M_end_of_storage.allocate(__len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __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);
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ this->_M_destroy_range();
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _ForwardIter __f1 = __first;
+ ++__f1;
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copyT(__f1, __last, this->_M_Finish() + 1);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ uninitialized_copy(__f1, __last, this->_M_Finish() + 1);
+ _STLP_TRY {
+ this->_M_construct_null(this->_M_Finish() + __n);
+ }
+ _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_Finish() + 1, this->_M_Finish() + __n))
+ _Traits::assign(*this->_M_finish, *__first);
+ 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: // Assign
+
+ _Self& assign(const _Self& __s) {
+ _Base::assign(__s);
+ return *this;
+ }
+
+ _Self& assign(const _Self& __s,
+ size_type __pos, size_type __n) {
+ _Base::assign(__s, __pos, __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::assign(__s, __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::assign(__s);
+ return *this;
+ }
+
+ _Self& assign(size_type __n, _CharT __c) {
+ _Base::assign(__n, __c);
+ return *this;
+ }
+
+private: // 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)
+ _Base::erase(__cur, this->_M_Finish());
+ 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());
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ /* This method is not part of the standard and is a specialization of the
+ * template method assign. It is only granted for convenience to call assign
+ * with mixed parameters iterator and const_iterator.
+ */
+ _Self& assign(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _Base::assign(__f, __l);
+ return *this;
+ }
+#endif
+
+public: // Insert
+
+ _Self& insert(size_type __pos, const _Self& __s) {
+ _Base::insert(__pos, __s);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _Self& __s,
+ size_type __beg, size_type __n) {
+ _Base::insert(__pos, __s, __beg, __n);
+ return *this;
+ }
+ _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::insert(__pos, __s, __n);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::insert(__pos, __s);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, size_type __n, _CharT __c) {
+ _Base::insert(__pos, __n, __c);
+ return *this;
+ }
+
+ iterator insert(iterator __p, _CharT __c) {
+ return _Base::insert(__p, __c);
+ }
+
+ void insert(iterator __p, size_t __n, _CharT __c) {
+ _Base::insert(__p, __n, __c);
+ }
+
+ // 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());
+ }
+
+private: // Helper functions for insert.
+
+ void _M_insert(iterator __p, const _CharT* __f, const _CharT* __l, bool __self_ref) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _Base::_M_insert(__p, __f, __l, __self_ref);
+ }
+
+ template <class _ForwardIter>
+ void _M_insert_overflow(iterator __position, _ForwardIter __first, _ForwardIter __last,
+ difference_type __n) {
+ const size_type __old_size = this->size();
+ const size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
+ pointer __new_start = this->_M_end_of_storage.allocate(__len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __new_finish = uninitialized_copy(this->_M_Start(), __position, __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ __new_finish = uninitialized_copy(__position, this->_M_Finish(), __new_finish);
+ this->_M_construct_null(__new_finish);
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ this->_M_destroy_range();
+ 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 __position, _ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ difference_type __n = distance(__first, __last);
+ if (this->_M_end_of_storage._M_data - this->_M_finish >= __n + 1) {
+ const difference_type __elems_after = this->_M_finish - __position;
+ if (__elems_after >= __n) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _Base::_M_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
+ this->_M_finish += __n;
+ _Traits::move(__position + __n, __position, (__elems_after - __n) + 1);
+ _M_copyT(__first, __last, __position);
+ }
+ else {
+ pointer __old_finish = this->_M_Finish();
+ _ForwardIter __mid = __first;
+ advance(__mid, __elems_after + 1);
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _M_copyT(__mid, __last, this->_M_Finish() + 1);
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ uninitialized_copy(__mid, __last, this->_M_Finish() + 1);
+ this->_M_finish += __n - __elems_after;
+ _STLP_TRY {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (this->_M_using_static_buf())
+ _Base::_M_copy(__position, __old_finish + 1, this->_M_Finish());
+ else
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ uninitialized_copy(__position, __old_finish + 1, this->_M_Finish());
+ this->_M_finish += __elems_after;
+ }
+ _STLP_UNWIND((this->_M_destroy_ptr_range(__old_finish + 1, this->_M_Finish()),
+ this->_M_finish = __old_finish))
+ _M_copyT(__first, __mid, __position);
+ }
+ }
+ else {
+ _M_insert_overflow(__position, __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)
+ /*
+ * Within the basic_string implementation we are only going to check for
+ * self referencing if iterators are string iterators or _CharT pointers.
+ * A user could encapsulate those iterator within their own iterator interface
+ * and in this case lead to a bad behavior, this is a known limitation.
+ */
+ typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator;
+ typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
+ typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside;
+ _M_insert_aux(__p, __first, __last, _CheckInside());
+ }
+
+ template <class _RandomIter>
+ void _M_insert_aux (iterator __p, _RandomIter __first, _RandomIter __last,
+ const __true_type& /*_CheckInside*/) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ _M_insert(__p, &(*__first), &(*__last), _Base::_M_inside(&(*__first)));
+ }
+
+ template<class _InputIter>
+ void _M_insert_aux (iterator __p, _InputIter __first, _InputIter __last,
+ const __false_type& /*_CheckInside*/) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ _M_insertT(__p, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+ }
+
+ template <class _InputIterator>
+ void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ 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)
+ _Base::_M_copy(__f, __l, __res);
+ }
+#endif
+
+public: // Erase.
+
+ _Self& erase(size_type __pos = 0, size_type __n = npos) {
+ _Base::erase(__pos, __n);
+ return *this;
+ }
+
+ iterator erase(iterator __pos) {
+ _STLP_FIX_LITERAL_BUG(__pos)
+ return _Base::erase(__pos);
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return _Base::erase(__first, __last);
+ }
+
+public: // Replace. (Conceptually equivalent
+ // to erase followed by insert.)
+ _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
+ _Base::replace(__pos, __n, __s);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) {
+ _Base::replace(__pos1, __n1, __s, __pos2, __n2);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ const _CharT* __s, size_type __n2) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::replace(__pos, __n1, __s, __n2);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::replace(__pos, __n1, __s);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ size_type __n2, _CharT __c) {
+ _Base::replace(__pos, __n1, __n2, __c);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last, const _Self& __s) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _Base::replace(__first, __last, __s);
+ return *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)
+ _Base::replace(__first, __last, __s, __n);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::replace(__first, __last, __s);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ size_type __n, _CharT __c) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _Base::replace(__first, __last, __n, __c);
+ return *this;
+ }
+
+ // 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());
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ _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)
+ _Base::replace(__first, __last, __f, __l);
+ return *this;
+ }
+#endif
+
+protected: // Helper functions for replace.
+ _Self& _M_replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l, bool __self_ref) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _Base::_M_replace(__first, __last, __f, __l, __self_ref);
+ return *this;
+ }
+
+ 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)
+ typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator;
+ typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
+ typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside;
+ return _M_replace_aux(__first, __last, __f, __l, _CheckInside());
+ }
+
+ template <class _RandomIter>
+ _Self& _M_replace_aux(iterator __first, iterator __last,
+ _RandomIter __f, _RandomIter __l, __true_type const& /*_CheckInside*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return _M_replace(__first, __last, &(*__f), &(*__l), _Base::_M_inside(&(*__f)));
+ }
+
+ template <class _InputIter>
+ _Self& _M_replace_aux(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l, __false_type const& /*_CheckInside*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return _M_replaceT(__first, __last, __f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ }
+
+ template <class _InputIter>
+ _Self& _M_replaceT(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l, const input_iterator_tag&__ite_tag) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ for ( ; __first != __last && __f != __l; ++__first, ++__f)
+ _Traits::assign(*__first, *__f);
+ if (__f == __l)
+ _Base::erase(__first, __last);
+ else
+ _M_insertT(__last, __f, __l, __ite_tag);
+ return *this;
+ }
+
+ template <class _ForwardIter>
+ _Self& _M_replaceT(iterator __first, iterator __last,
+ _ForwardIter __f, _ForwardIter __l, const forward_iterator_tag &__ite_tag) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ difference_type __n = distance(__f, __l);
+ const difference_type __len = __last - __first;
+ if (__len >= __n) {
+ _M_copyT(__f, __l, __first);
+ _Base::erase(__first + __n, __last);
+ }
+ else {
+ _ForwardIter __m = __f;
+ advance(__m, __len);
+ _M_copyT(__f, __m, __first);
+ _M_insertT(__last, __m, __l, __ite_tag);
+ }
+ return *this;
+ }
+
+public: // Other modifier member functions.
+
+ void swap(_Self& __s)
+ { _Base::swap(__s); }
+
+public: // Substring.
+
+ _Self substr(size_type __pos = 0, size_type __n = npos) const
+ { return _Self(*this, __pos, __n, get_allocator()); }
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG)
+# define _STLP_STRING_SUM_BASE _STLP_NO_MEM_T_STRING_BASE
+# include <stl/_string_sum_methods.h>
+# undef _STLP_STRING_SUM_BASE
+#endif
+};
+
+#undef _STLP_NO_MEM_T_STRING_BASE
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+#endif
+
+_STLP_END_NAMESPACE
--- /dev/null
+/*
+ * Copyright (c) 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_STRSTREAM
+#define _STLP_INTERNAL_STRSTREAM
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h> // Includes <ostream>, <ios>, <iosfwd>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#ifndef _STLP_USE_NAMESPACES
+# define strstream _STLP_strstream
+# define ostrstream _STLP_ostrstream
+# define istrstream _STLP_istrstream
+# define strstreambuf _STLP_strstreambuf
+#endif
+
+//----------------------------------------------------------------------
+// Class strstreambuf, a streambuf class that manages an array of char.
+// Note that this class is not a template.
+
+class _STLP_CLASS_DECLSPEC strstreambuf : public basic_streambuf<char, char_traits<char> > {
+public: // Types.
+ typedef char_traits<char> _Traits;
+ typedef basic_streambuf<char, char_traits<char> > _Base;
+ typedef void* (*__alloc_fn)(size_t);
+ typedef void (*__free_fn)(void*);
+public: // Constructor, destructor
+
+ explicit strstreambuf(streamsize _Initial_capacity = 0);
+
+ strstreambuf(__alloc_fn, __free_fn);
+
+ strstreambuf(char* __get, streamsize __n, char* __put = 0);
+ strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0);
+ strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0);
+
+ strstreambuf(const char* __get, streamsize __n);
+ strstreambuf(const signed char* __get, streamsize __n);
+ strstreambuf(const unsigned char* __get, streamsize __n);
+
+ virtual ~strstreambuf();
+
+public: // strstreambuf operations.
+ void freeze(bool = true);
+ char* str();
+ int pcount() const;
+
+protected: // Overridden virtual member functions.
+ virtual int_type overflow(int_type __c = _Traits::eof());
+ virtual int_type pbackfail(int_type __c = _Traits::eof());
+ virtual int_type underflow();
+ virtual _Base* setbuf(char* __buf, streamsize __n);
+ virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
+ ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+
+private: // Helper functions.
+ // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
+ char* _M_alloc(size_t);
+ void _M_free(char*);
+
+ // Helper function used in constructors.
+ void _M_setup(char* __get, char* __put, streamsize __n);
+private: // Data members.
+ __alloc_fn _M_alloc_fun;
+ __free_fn _M_free_fun;
+ bool _M_dynamic : 1;
+ bool _M_frozen : 1;
+ bool _M_constant : 1;
+};
+
+//----------------------------------------------------------------------
+// Class istrstream, an istream that manages a strstreambuf.
+
+class _STLP_CLASS_DECLSPEC istrstream : public basic_istream<char, char_traits<char> > {
+public:
+ explicit istrstream(char*);
+ explicit istrstream(const char*);
+ istrstream(char* , streamsize);
+ istrstream(const char*, streamsize);
+ virtual ~istrstream();
+
+ strstreambuf* rdbuf() const;
+ char* str();
+
+private:
+ strstreambuf _M_buf;
+};
+
+//----------------------------------------------------------------------
+// Class ostrstream
+
+class _STLP_CLASS_DECLSPEC ostrstream : public basic_ostream<char, char_traits<char> >
+{
+public:
+ ostrstream();
+ ostrstream(char*, int, ios_base::openmode = ios_base::out);
+ virtual ~ostrstream();
+
+ strstreambuf* rdbuf() const;
+ void freeze(bool = true);
+ char* str();
+ int pcount() const;
+
+private:
+ strstreambuf _M_buf;
+};
+
+//----------------------------------------------------------------------
+// Class strstream
+
+class _STLP_CLASS_DECLSPEC strstream : public basic_iostream<char, char_traits<char> > {
+public:
+ typedef char char_type;
+ typedef char_traits<char>::int_type int_type;
+ typedef char_traits<char>::pos_type pos_type;
+ typedef char_traits<char>::off_type off_type;
+
+ strstream();
+ strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
+ virtual ~strstream();
+
+ strstreambuf* rdbuf() const;
+ void freeze(bool = true);
+ int pcount() const;
+ char* str();
+
+private:
+ strstreambuf _M_buf;
+
+ //explicitely defined as private to avoid warnings:
+ strstream(strstream const&);
+ strstream& operator = (strstream const&);
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_STRSTREAM */
--- /dev/null
+/*
+ *
+ *
+ * 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:
--- /dev/null
+/*
+ *
+ * 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 = 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:
--- /dev/null
+/*
+ *
+ *
+ * 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_THREADS_C
+#define _STLP_THREADS_C
+
+#ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+#endif
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+#if defined (_STLP_SGI_THREADS)
+# include <time.h>
+#elif defined (_STLP_UNIX)
+# ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h>
+# endif
+# if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_VENDOR_GLOBAL_CSTD)
+using _STLP_VENDOR_CSTD::time_t;
+# endif
+# include <sys/time.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if (_STLP_STATIC_TEMPLATE_DATA > 0)
+
+# if defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+template<int __32bits>
+_STLP_STATIC_MUTEX
+_Atomic_swap_struct<__32bits>::_S_swap_lock _STLP_MUTEX_INITIALIZER;
+# undef _STLP_USE_ATOMIC_SWAP_MUTEX
+# endif
+
+# if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
+template <int __inst>
+unsigned _STLP_mutex_spin<__inst>::__max = _STLP_mutex_spin<__inst>::__low_max;
+
+template <int __inst>
+unsigned _STLP_mutex_spin<__inst>::__last = 0;
+# endif // _STLP_USE_PTHREAD_SPINLOCK
+
+#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
+
+# if defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+__DECLARE_INSTANCE(_STLP_STATIC_MUTEX, _Atomic_swap_struct<sizeof(__stl_atomic_t) == sizeof(void*)>::_S_swap_lock,
+ _STLP_MUTEX_INITIALIZER );
+# undef _STLP_USE_ATOMIC_SWAP_MUTEX
+# endif /* _STLP_PTHREADS */
+
+# if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
+__DECLARE_INSTANCE(unsigned, _STLP_mutex_spin<0>::__max, =30);
+__DECLARE_INSTANCE(unsigned, _STLP_mutex_spin<0>::__last, =0);
+# endif // _STLP_USE_PTHREAD_SPINLOCK
+
+#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
+
+#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
+
+# if defined (_STLP_SPARC_SOLARIS_THREADS)
+// underground function in libc.so; we do not want dependance on librt
+extern "C" int __nanosleep(const struct timespec*, struct timespec*);
+# define _STLP_NANOSLEEP __nanosleep
+# else
+# define _STLP_NANOSLEEP nanosleep
+# endif
+
+template <int __inst>
+void _STLP_CALL
+_STLP_mutex_spin<__inst>::_S_nsec_sleep(int __log_nsec) {
+# if defined (_STLP_WIN32THREADS)
+ if (__log_nsec <= 20) {
+ // Note from boost (www.boost.org):
+ // Changed to Sleep(1) from Sleep(0).
+ // According to MSDN, Sleep(0) will never yield
+ // to a lower-priority thread, whereas Sleep(1)
+ // will. Performance seems not to be affected.
+ Sleep(1);
+ } else {
+ Sleep(1 << (__log_nsec - 20));
+ }
+# elif defined(_STLP_OS2THREADS)
+ if (__log_nsec <= 20) {
+ DosSleep(0);
+ } else {
+ DosSleep(1 << (__log_nsec - 20));
+ }
+# elif defined (_STLP_UNIX)
+ timespec __ts;
+ /* Max sleep is 2**27nsec ~ 60msec */
+ __ts.tv_sec = 0;
+ __ts.tv_nsec = 1 << __log_nsec;
+ _STLP_NANOSLEEP(&__ts, 0);
+# endif
+}
+
+template <int __inst>
+void _STLP_CALL
+_STLP_mutex_spin<__inst>::_M_do_lock(volatile __stl_atomic_t* __lock) {
+# if defined(_STLP_ATOMIC_EXCHANGE)
+ if (_Atomic_swap(__lock, 1)) {
+ unsigned __my_spin_max = _STLP_mutex_spin<0>::__max;
+ unsigned __my_last_spins = _STLP_mutex_spin<0>::__last;
+ volatile unsigned __junk = 17; // Value doesn't matter.
+ unsigned __i;
+
+ for (__i = 0; __i < __my_spin_max; ++__i) {
+ if (__i < __my_last_spins/2 || *__lock) {
+ __junk *= __junk; __junk *= __junk;
+ __junk *= __junk; __junk *= __junk;
+ } else {
+ if (!_Atomic_swap(__lock, 1)) {
+ // got it!
+ // Spinning worked. Thus we're probably not being scheduled
+ // against the other process with which we were contending.
+ // Thus it makes sense to spin longer the next time.
+ _STLP_mutex_spin<0>::__last = __i;
+ _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__high_max;
+ return;
+ }
+ }
+ }
+
+ // We are probably being scheduled against the other process. Sleep.
+ _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__low_max;
+
+ for (__i = 0 ;; ++__i) {
+ int __log_nsec = __i + 6;
+
+ if (__log_nsec > 27) __log_nsec = 27;
+ if (!_Atomic_swap(__lock, 1)) {
+ break;
+ }
+ _S_nsec_sleep(__log_nsec);
+ }
+ } /* first _Atomic_swap */
+# endif
+}
+#endif // _STLP_USE_PTHREAD_SPINLOCK
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+#endif /* _STLP_THREADS_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+// 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_THREADS_H
+#define _STLP_INTERNAL_THREADS_H
+
+// Supported threading models are native SGI, pthreads, uithreads
+// (similar to pthreads, but based on an earlier draft of the Posix
+// threads standard), and Win32 threads. Uithread support by Jochen
+// Schlick, 1999, and Solaris threads generalized to them.
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+// On SUN and Mac OS X gcc, zero-initialization works just fine...
+#if defined (__sun) || (defined (__GNUC__) && defined(__APPLE__))
+# define _STLP_MUTEX_INITIALIZER
+#endif
+
+/* This header defines the following atomic operation that platform should
+ * try to support as much as possible. Atomic operation are exposed as macro
+ * in order to easily test for their existance. They are:
+ * __stl_atomic_t _STLP_ATOMIC_INCREMENT(volatile __stl_atomic_t* __ptr) :
+ * increment *__ptr by 1 and returns the new value
+ * __stl_atomic_t _STLP_ATOMIC_DECREMENT(volatile __stl_atomic_t* __ptr) :
+ * decrement *__ptr by 1 and returns the new value
+ * __stl_atomic_t _STLP_ATOMIC_EXCHANGE(volatile __stl_atomic_t* __target, __stl_atomic_t __val) :
+ * assign __val to *__target and returns former *__target value
+ * void* _STLP_ATOMIC_EXCHANGE_PTR(void* volatile* __target, void* __ptr) :
+ * assign __ptr to *__target and returns former *__target value
+ * __stl_atomic_t _STLP_ATOMIC_ADD(volatile __stl_atomic_t* __target, __stl_atomic_t __val) :
+ * does *__target = *__target + __val and returns the old *__target value
+ */
+
+#if defined (_STLP_WIN32) || defined (__sgi) || defined (_STLP_SPARC_SOLARIS_THREADS)
+typedef long __stl_atomic_t;
+#else
+/* Don't import whole namespace!!!! - ptr */
+// # if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
+// // using _STLP_VENDOR_CSTD::size_t;
+// using namespace _STLP_VENDOR_CSTD;
+// # endif
+typedef size_t __stl_atomic_t;
+#endif
+
+#if defined (_STLP_THREADS)
+
+# if defined (_STLP_SGI_THREADS)
+
+# include <mutex.h>
+// Hack for SGI o32 compilers.
+# if !defined(__add_and_fetch) && \
+ (__mips < 3 || !(defined (_ABIN32) || defined(_ABI64)))
+# define __add_and_fetch(__l,__v) add_then_test((unsigned long*)__l,__v)
+# define __test_and_set(__l,__v) test_and_set(__l,__v)
+# endif /* o32 */
+
+# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64))
+# define _STLP_ATOMIC_EXCHANGE(__p, __q) test_and_set(__p, __q)
+# else
+# define _STLP_ATOMIC_EXCHANGE(__p, __q) __test_and_set((unsigned long*)__p, (unsigned long)__q)
+# endif
+
+# define _STLP_ATOMIC_INCREMENT(__x) __add_and_fetch(__x, 1)
+# define _STLP_ATOMIC_DECREMENT(__x) __add_and_fetch(__x, (size_t) -1)
+
+# elif defined (_STLP_PTHREADS)
+
+# include <pthread.h>
+# if !defined (_STLP_USE_PTHREAD_SPINLOCK)
+# if defined (PTHREAD_MUTEX_INITIALIZER) && !defined (_STLP_MUTEX_INITIALIZER) && defined (_REENTRANT)
+# define _STLP_MUTEX_INITIALIZER = { PTHREAD_MUTEX_INITIALIZER }
+# endif
+//HPUX variants have (on some platforms optional) non-standard "DCE" pthreads impl
+# if defined (_DECTHREADS_) && (defined (_PTHREAD_USE_D4) || defined (__hpux)) && !defined (_CMA_SUPPRESS_EXTERNALS_)
+# define _STLP_PTHREAD_ATTR_DEFAULT pthread_mutexattr_default
+# else
+# define _STLP_PTHREAD_ATTR_DEFAULT 0
+# endif
+# else // _STLP_USE_PTHREAD_SPINLOCK
+# if defined (__OpenBSD__)
+# include <spinlock.h>
+# endif
+# endif // _STLP_USE_PTHREAD_SPINLOCK
+
+# if defined (__GNUC__) && defined (__i386__)
+
+# if !defined (_STLP_ATOMIC_INCREMENT)
+inline long _STLP_atomic_increment_gcc_x86(long volatile* p) {
+ long result;
+ __asm__ __volatile__
+ ("lock; xaddl %1, %0;"
+ :"=m" (*p), "=r" (result)
+ :"m" (*p), "1" (1)
+ :"cc");
+ return result + 1;
+}
+# define _STLP_ATOMIC_INCREMENT(__x) (_STLP_atomic_increment_gcc_x86((long volatile*)__x))
+# endif
+
+# if !defined (_STLP_ATOMIC_DECREMENT)
+inline long _STLP_atomic_decrement_gcc_x86(long volatile* p) {
+ long result;
+ __asm__ __volatile__
+ ("lock; xaddl %1, %0;"
+ :"=m" (*p), "=r" (result)
+ :"m" (*p), "1" (-1)
+ :"cc");
+ return result - 1;
+}
+# define _STLP_ATOMIC_DECREMENT(__x) (_STLP_atomic_decrement_gcc_x86((long volatile*)__x))
+# endif
+
+# if !defined (_STLP_ATOMIC_ADD)
+inline long _STLP_atomic_add_gcc_x86(long volatile* p, long addend) {
+ long result;
+ __asm__ __volatile__
+ ("lock; xaddl %1, %0;"
+ :"=m" (*p), "=r" (result)
+ :"m" (*p), "1" (addend)
+ :"cc");
+ return result + addend;
+}
+# define _STLP_ATOMIC_ADD(__dst, __val) (_STLP_atomic_add_gcc_x86((long volatile*)__dst, (long)__val))
+# endif
+
+# endif /* if defined(__GNUC__) && defined(__i386__) */
+
+# elif defined (_STLP_WIN32THREADS)
+
+# if !defined (_STLP_ATOMIC_INCREMENT)
+# if !defined (_STLP_NEW_PLATFORM_SDK)
+# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__CONST_CAST(long*, __x))
+# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__CONST_CAST(long*, __x))
+# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__CONST_CAST(long*, __x), __y)
+# else
+# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__x)
+# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__x)
+# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__x, __y)
+# endif
+# define _STLP_ATOMIC_EXCHANGE_PTR(__x, __y) STLPInterlockedExchangePointer(__x, __y)
+/*
+ * The following functionnality is only available since Windows 98, those that are targeting previous OSes
+ * should define _WIN32_WINDOWS to a value lower that the one of Win 98, see Platform SDK documentation for
+ * more informations:
+ */
+# if defined (_STLP_NEW_PLATFORM_SDK) && (!defined (_STLP_WIN32_VERSION) || (_STLP_WIN32_VERSION >= 0x0410))
+# define _STLP_ATOMIC_ADD(__dst, __val) InterlockedExchangeAdd(__dst, __val)
+# endif
+# endif
+
+# elif defined (__DECC) || defined (__DECCXX)
+
+# include <machine/builtins.h>
+# define _STLP_ATOMIC_EXCHANGE __ATOMIC_EXCH_LONG
+# define _STLP_ATOMIC_INCREMENT(__x) __ATOMIC_ADD_LONG(__x, 1)
+# define _STLP_ATOMIC_DECREMENT(__x) __ATOMIC_ADD_LONG(__x, -1)
+
+# elif defined(_STLP_SPARC_SOLARIS_THREADS)
+
+# include <stl/_sparc_atomic.h>
+
+# elif defined (_STLP_UITHREADS)
+
+// this inclusion is potential hazard to bring up all sorts
+// of old-style headers. Let's assume vendor already know how
+// to deal with that.
+# ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h>
+# endif
+# if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
+using _STLP_VENDOR_CSTD::time_t;
+# endif
+# include <synch.h>
+# include <cstdio>
+# include <cwchar>
+
+# elif defined (_STLP_BETHREADS)
+
+# include <OS.h>
+# include <cassert>
+# include <stdio.h>
+# define _STLP_MUTEX_INITIALIZER = { 0 }
+
+# elif defined (_STLP_NWTHREADS)
+
+# include <nwthread.h>
+# include <nwsemaph.h>
+
+# elif defined(_STLP_OS2THREADS)
+
+# if defined (__GNUC__)
+# define INCL_DOSSEMAPHORES
+# include <os2.h>
+# else
+// This section serves to replace os2.h for VisualAge C++
+ typedef unsigned long ULONG;
+# if !defined (__HEV__) /* INCL_SEMAPHORE may also define HEV */
+# define __HEV__
+ typedef ULONG HEV;
+ typedef HEV* PHEV;
+# endif
+ typedef ULONG APIRET;
+ typedef ULONG HMTX;
+ typedef HMTX* PHMTX;
+ typedef const char* PCSZ;
+ typedef ULONG BOOL32;
+ APIRET _System DosCreateMutexSem(PCSZ pszName, PHEV phev, ULONG flAttr, BOOL32 fState);
+ APIRET _System DosRequestMutexSem(HMTX hmtx, ULONG ulTimeout);
+ APIRET _System DosReleaseMutexSem(HMTX hmtx);
+ APIRET _System DosCloseMutexSem(HMTX hmtx);
+# define _STLP_MUTEX_INITIALIZER = { 0 }
+# endif /* GNUC */
+
+# endif
+
+#else
+/* no threads */
+# define _STLP_ATOMIC_INCREMENT(__x) ++(*__x)
+# define _STLP_ATOMIC_DECREMENT(__x) --(*__x)
+/* We do not grant other atomic operations as they are useless if STLport do not have
+ * to be thread safe
+ */
+#endif
+
+#if !defined (_STLP_MUTEX_INITIALIZER)
+# if defined(_STLP_ATOMIC_EXCHANGE)
+# define _STLP_MUTEX_INITIALIZER = { 0 }
+# elif defined(_STLP_UITHREADS)
+# define _STLP_MUTEX_INITIALIZER = { DEFAULTMUTEX }
+# else
+# define _STLP_MUTEX_INITIALIZER
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
+// Helper struct. This is a workaround for various compilers that don't
+// handle static variables in inline functions properly.
+template <int __inst>
+struct _STLP_mutex_spin {
+ enum { __low_max = 30, __high_max = 1000 };
+ // Low if we suspect uniprocessor, high for multiprocessor.
+ static unsigned __max;
+ static unsigned __last;
+ static void _STLP_CALL _M_do_lock(volatile __stl_atomic_t* __lock);
+ static void _STLP_CALL _S_nsec_sleep(int __log_nsec);
+};
+#endif // !_STLP_USE_PTHREAD_SPINLOCK
+
+// Locking class. Note that this class *does not have a constructor*.
+// It must be initialized either statically, with _STLP_MUTEX_INITIALIZER,
+// or dynamically, by explicitly calling the _M_initialize member function.
+// (This is similar to the ways that a pthreads mutex can be initialized.)
+// There are explicit member functions for acquiring and releasing the lock.
+
+// There is no constructor because static initialization is essential for
+// some uses, and only a class aggregate (see section 8.5.1 of the C++
+// standard) can be initialized that way. That means we must have no
+// constructors, no base classes, no virtual functions, and no private or
+// protected members.
+
+// For non-static cases, clients should use _STLP_mutex.
+
+struct _STLP_CLASS_DECLSPEC _STLP_mutex_base {
+#if defined (_STLP_ATOMIC_EXCHANGE) || defined (_STLP_SGI_THREADS)
+ // It should be relatively easy to get this to work on any modern Unix.
+ volatile __stl_atomic_t _M_lock;
+#endif
+
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE)
+ inline void _M_initialize() { _M_lock = 0; }
+ inline void _M_destroy() {}
+
+ void _M_acquire_lock() {
+ _STLP_mutex_spin<0>::_M_do_lock(&_M_lock);
+ }
+
+ inline void _M_release_lock() {
+ volatile __stl_atomic_t* __lock = &_M_lock;
+# if defined(_STLP_SGI_THREADS) && defined(__GNUC__) && __mips >= 3
+ asm("sync");
+ *__lock = 0;
+# elif defined(_STLP_SGI_THREADS) && __mips >= 3 && \
+ (defined (_ABIN32) || defined(_ABI64))
+ __lock_release(__lock);
+# elif defined (_STLP_SPARC_SOLARIS_THREADS)
+# if defined (__WORD64) || defined (__arch64__) || defined (__sparcv9) || defined (__sparcv8plus)
+ asm("membar #StoreStore ; membar #LoadStore");
+# else
+ asm(" stbar ");
+# endif
+ *__lock = 0;
+# else
+ *__lock = 0;
+ // This is not sufficient on many multiprocessors, since
+ // writes to protected variables and the lock may be reordered.
+# endif
+ }
+# elif defined (_STLP_PTHREADS)
+# if defined (_STLP_USE_PTHREAD_SPINLOCK)
+# if !defined (__OpenBSD__)
+ pthread_spinlock_t _M_lock;
+ inline void _M_initialize() { pthread_spin_init( &_M_lock, 0 ); }
+ inline void _M_destroy() { pthread_spin_destroy( &_M_lock ); }
+
+ // sorry, but no static initializer for pthread_spinlock_t;
+ // this will not work for compilers that has problems with call
+ // constructor of static object...
+
+ // _STLP_mutex_base()
+ // { pthread_spin_init( &_M_lock, 0 ); }
+
+ // ~_STLP_mutex_base()
+ // { pthread_spin_destroy( &_M_lock ); }
+
+ inline void _M_acquire_lock() { pthread_spin_lock( &_M_lock ); }
+ inline void _M_release_lock() { pthread_spin_unlock( &_M_lock ); }
+# else // __OpenBSD__
+ spinlock_t _M_lock;
+ inline void _M_initialize() { _SPINLOCK_INIT( &_M_lock ); }
+ inline void _M_destroy() { }
+ inline void _M_acquire_lock() { _SPINLOCK( &_M_lock ); }
+ inline void _M_release_lock() { _SPINUNLOCK( &_M_lock ); }
+# endif // __OpenBSD__
+# else // !_STLP_USE_PTHREAD_SPINLOCK
+ pthread_mutex_t _M_lock;
+ inline void _M_initialize()
+ { pthread_mutex_init(&_M_lock,_STLP_PTHREAD_ATTR_DEFAULT); }
+ inline void _M_destroy()
+ { pthread_mutex_destroy(&_M_lock); }
+ inline void _M_acquire_lock() {
+# if defined ( __hpux ) && ! defined (PTHREAD_MUTEX_INITIALIZER)
+ if (!_M_lock.field1) _M_initialize();
+# endif
+ pthread_mutex_lock(&_M_lock);
+ }
+ inline void _M_release_lock() { pthread_mutex_unlock(&_M_lock); }
+# endif // !_STLP_USE_PTHREAD_SPINLOCK
+
+# elif defined (_STLP_UITHREADS)
+ mutex_t _M_lock;
+ inline void _M_initialize()
+ { mutex_init(&_M_lock, 0, NULL); }
+ inline void _M_destroy()
+ { mutex_destroy(&_M_lock); }
+ inline void _M_acquire_lock() { mutex_lock(&_M_lock); }
+ inline void _M_release_lock() { mutex_unlock(&_M_lock); }
+
+# elif defined (_STLP_OS2THREADS)
+ HMTX _M_lock;
+ inline void _M_initialize() { DosCreateMutexSem(NULL, &_M_lock, 0, false); }
+ inline void _M_destroy() { DosCloseMutexSem(_M_lock); }
+ inline void _M_acquire_lock() {
+ if (!_M_lock) _M_initialize();
+ DosRequestMutexSem(_M_lock, SEM_INDEFINITE_WAIT);
+ }
+ inline void _M_release_lock() { DosReleaseMutexSem(_M_lock); }
+# elif defined (_STLP_BETHREADS)
+ sem_id sem;
+ inline void _M_initialize() {
+ sem = create_sem(1, "STLPort");
+ assert(sem > 0);
+ }
+ inline void _M_destroy() {
+ int t = delete_sem(sem);
+ assert(t == B_NO_ERROR);
+ }
+ inline void _M_acquire_lock();
+ inline void _M_release_lock() {
+ status_t t = release_sem(sem);
+ assert(t == B_NO_ERROR);
+ }
+# elif defined (_STLP_NWTHREADS)
+ LONG _M_lock;
+ inline void _M_initialize()
+ { _M_lock = OpenLocalSemaphore(1); }
+ inline void _M_destroy()
+ { CloseLocalSemaphore(_M_lock); }
+ inline void _M_acquire_lock()
+ { WaitOnLocalSemaphore(_M_lock); }
+ inline void _M_release_lock() { SignalLocalSemaphore(_M_lock); }
+# else //*ty 11/24/2001 - added configuration check
+# error "Unknown thread facility configuration"
+# endif
+#else /* No threads */
+ inline void _M_initialize() {}
+ inline void _M_destroy() {}
+ inline void _M_acquire_lock() {}
+ inline void _M_release_lock() {}
+#endif // _STLP_PTHREADS
+};
+
+// Locking class. The constructor initializes the lock, the destructor destroys it.
+// Well - behaving class, does not need static initializer
+
+class _STLP_CLASS_DECLSPEC _STLP_mutex : public _STLP_mutex_base {
+ public:
+ inline _STLP_mutex () { _M_initialize(); }
+ inline ~_STLP_mutex () { _M_destroy(); }
+ private:
+ _STLP_mutex(const _STLP_mutex&);
+ void operator=(const _STLP_mutex&);
+};
+
+// A locking class that uses _STLP_STATIC_MUTEX. The constructor takes
+// a reference to an _STLP_STATIC_MUTEX, and acquires a lock. The destructor
+// releases the lock.
+// It's not clear that this is exactly the right functionality.
+// It will probably change in the future.
+
+struct _STLP_CLASS_DECLSPEC _STLP_auto_lock {
+ _STLP_auto_lock(_STLP_STATIC_MUTEX& __lock) : _M_lock(__lock)
+ { _M_lock._M_acquire_lock(); }
+ ~_STLP_auto_lock()
+ { _M_lock._M_release_lock(); }
+
+private:
+ _STLP_STATIC_MUTEX& _M_lock;
+ void operator=(const _STLP_auto_lock&);
+ _STLP_auto_lock(const _STLP_auto_lock&);
+};
+
+/*
+ * Class _Refcount_Base provides a type, __stl_atomic_t, a data member,
+ * _M_ref_count, and member functions _M_incr and _M_decr, which perform
+ * atomic preincrement/predecrement. The constructor initializes
+ * _M_ref_count.
+ */
+class _STLP_CLASS_DECLSPEC _Refcount_Base {
+ // The data member _M_ref_count
+#if defined (__DMC__)
+public:
+#endif
+ _STLP_VOLATILE __stl_atomic_t _M_ref_count;
+
+#if defined (_STLP_THREADS) && \
+ (!defined (_STLP_ATOMIC_INCREMENT) || !defined (_STLP_ATOMIC_DECREMENT) || \
+ (defined (_STLP_WIN32_VERSION) && (_STLP_WIN32_VERSION <= 0x0400)))
+# define _STLP_USE_MUTEX
+ _STLP_mutex _M_mutex;
+#endif
+
+ public:
+ // Constructor
+ _Refcount_Base(__stl_atomic_t __n) : _M_ref_count(__n) {}
+
+ // _M_incr and _M_decr
+#if defined (_STLP_THREADS)
+# if !defined (_STLP_USE_MUTEX)
+ __stl_atomic_t _M_incr() { return _STLP_ATOMIC_INCREMENT(&_M_ref_count); }
+ __stl_atomic_t _M_decr() { return _STLP_ATOMIC_DECREMENT(&_M_ref_count); }
+# else
+# undef _STLP_USE_MUTEX
+ __stl_atomic_t _M_incr() {
+ _STLP_auto_lock l(_M_mutex);
+ return ++_M_ref_count;
+ }
+ __stl_atomic_t _M_decr() {
+ _STLP_auto_lock l(_M_mutex);
+ return --_M_ref_count;
+ }
+# endif
+#else /* No threads */
+ __stl_atomic_t _M_incr() { return ++_M_ref_count; }
+ __stl_atomic_t _M_decr() { return --_M_ref_count; }
+#endif
+};
+
+/* Atomic swap on __stl_atomic_t
+ * This is guaranteed to behave as though it were atomic only if all
+ * possibly concurrent updates use _Atomic_swap.
+ * In some cases the operation is emulated with a lock.
+ * Idem for _Atomic_swap_ptr
+ */
+/* Helper struct to handle following cases:
+ * - on platforms where sizeof(__stl_atomic_t) == sizeof(void*) atomic
+ * exchange can be done on pointers
+ * - on platform without atomic operation swap is done in a critical section,
+ * portable but inefficient.
+ */
+template <int __use_ptr_atomic_swap>
+class _Atomic_swap_struct {
+public:
+#if defined (_STLP_THREADS) && \
+ !defined (_STLP_ATOMIC_EXCHANGE) && \
+ (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \
+ defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS))
+# define _STLP_USE_ATOMIC_SWAP_MUTEX
+ static _STLP_STATIC_MUTEX _S_swap_lock;
+#endif
+
+ static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE)
+ return _STLP_ATOMIC_EXCHANGE(__p, __q);
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ _S_swap_lock._M_acquire_lock();
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing atomic swap implementation
+# endif
+#else
+ /* no threads */
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ return __result;
+#endif // _STLP_THREADS
+ }
+
+ static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE_PTR)
+ return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q);
+# elif defined (_STLP_ATOMIC_EXCHANGE)
+ _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*))
+ return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p),
+ __REINTERPRET_CAST(__stl_atomic_t, __q))
+ );
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ _S_swap_lock._M_acquire_lock();
+ void *__result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing pointer atomic swap implementation
+# endif
+#else
+ /* no thread */
+ void *__result = *__p;
+ *__p = __q;
+ return __result;
+#endif
+ }
+};
+
+_STLP_TEMPLATE_NULL
+class _Atomic_swap_struct<0> {
+public:
+#if defined (_STLP_THREADS) && \
+ (!defined (_STLP_ATOMIC_EXCHANGE) || !defined (_STLP_ATOMIC_EXCHANGE_PTR)) && \
+ (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \
+ defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS))
+# define _STLP_USE_ATOMIC_SWAP_MUTEX
+ static _STLP_STATIC_MUTEX _S_swap_lock;
+#endif
+
+ static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE)
+ return _STLP_ATOMIC_EXCHANGE(__p, __q);
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ /* This should be portable, but performance is expected
+ * to be quite awful. This really needs platform specific
+ * code.
+ */
+ _S_swap_lock._M_acquire_lock();
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing atomic swap implementation
+# endif
+#else
+ /* no threads */
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ return __result;
+#endif // _STLP_THREADS
+ }
+
+ static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE_PTR)
+ return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q);
+# elif defined (_STLP_ATOMIC_EXCHANGE)
+ _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*))
+ return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p),
+ __REINTERPRET_CAST(__stl_atomic_t, __q))
+ );
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ _S_swap_lock._M_acquire_lock();
+ void *__result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing pointer atomic swap implementation
+# endif
+#else
+ /* no thread */
+ void *__result = *__p;
+ *__p = __q;
+ return __result;
+#endif
+ }
+};
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300)
+# pragma warning (push)
+# pragma warning (disable : 4189) //__use_ptr_atomic_swap initialized but not used
+#endif
+
+inline __stl_atomic_t _STLP_CALL _Atomic_swap(_STLP_VOLATILE __stl_atomic_t * __p, __stl_atomic_t __q) {
+ const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*);
+ return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap(__p, __q);
+}
+
+inline void* _STLP_CALL _Atomic_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
+ const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*);
+ return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap_ptr(__p, __q);
+}
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300)
+# pragma warning (pop)
+#endif
+
+#if defined (_STLP_BETHREADS)
+template <int __inst>
+struct _STLP_beos_static_lock_data {
+ static bool is_init;
+ struct mutex_t : public _STLP_mutex {
+ mutex_t()
+ { _STLP_beos_static_lock_data<0>::is_init = true; }
+ ~mutex_t()
+ { _STLP_beos_static_lock_data<0>::is_init = false; }
+ };
+ static mutex_t mut;
+};
+
+template <int __inst>
+bool _STLP_beos_static_lock_data<__inst>::is_init = false;
+template <int __inst>
+typename _STLP_beos_static_lock_data<__inst>::mutex_t _STLP_beos_static_lock_data<__inst>::mut;
+
+inline void _STLP_mutex_base::_M_acquire_lock() {
+ if (sem == 0) {
+ // we need to initialise on demand here
+ // to prevent race conditions use our global
+ // mutex if it's available:
+ if (_STLP_beos_static_lock_data<0>::is_init) {
+ _STLP_auto_lock al(_STLP_beos_static_lock_data<0>::mut);
+ if (sem == 0) _M_initialize();
+ }
+ else {
+ // no lock available, we must still be
+ // in startup code, THERE MUST BE ONE THREAD
+ // ONLY active at this point.
+ _M_initialize();
+ }
+ }
+ status_t t;
+ t = acquire_sem(sem);
+ assert(t == B_NO_ERROR);
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_threads.c>
+#endif
+
+#endif /* _STLP_INTERNAL_THREADS_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_TIME_FACETS_C
+#define _STLP_TIME_FACETS_C
+
+#ifndef _STLP_INTERNAL_TIME_FACETS_H
+# include <stl/_time_facets.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Declarations of static template members.
+#if (_STLP_STATIC_TEMPLATE_DATA > 0)
+
+# if !defined (__BORLANDC__)
+template <class _CharT, class _InputIterator>
+locale::id time_get<_CharT, _InputIterator>::id;
+
+template <class _CharT, class _OutputIterator>
+locale::id time_put<_CharT, _OutputIterator>::id;
+# endif
+
+# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \
+ defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)
+/*
+ * Under cygwin, when STLport is used as a shared library, the id needs
+ * to be specified as imported otherwise they will be duplicated in the
+ * calling executable.
+ */
+template <>
+_STLP_DECLSPEC locale::id time_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
+/*
+template <>
+_STLP_DECLSPEC locale::id time_get<char, const char*>::id;
+*/
+
+template <>
+_STLP_DECLSPEC locale::id time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
+/*
+template <>
+_STLP_DECLSPEC locale::id time_put<char, char*>::id;
+*/
+
+# ifndef _STLP_NO_WCHAR_T
+template <>
+_STLP_DECLSPEC locale::id time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
+/*
+template <>
+_STLP_DECLSPEC locale::id time_get<wchar_t, const wchar_t*>::id;
+*/
+
+template <>
+_STLP_DECLSPEC locale::id time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
+/*
+template <>
+_STLP_DECLSPEC locale::id time_put<wchar_t, wchar_t*>::id;
+*/
+# endif /* _STLP_NO_WCHAR_T */
+# endif /* __CUGWIN__ && _STLP_USE_DYNAMIC_LIB */
+
+#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
+
+//typedef time_get<char, const char*> time_get_char;
+typedef time_get<char, istreambuf_iterator<char, char_traits<char> > > time_get_char_2;
+//typedef time_put<char, char*> time_put_char;
+typedef time_put<char, ostreambuf_iterator<char, char_traits<char> > > time_put_char_2;
+
+//__DECLARE_INSTANCE(locale::id, time_get_char::id, );
+__DECLARE_INSTANCE(locale::id, time_get_char_2::id, );
+//__DECLARE_INSTANCE(locale::id, time_put_char::id, );
+__DECLARE_INSTANCE(locale::id, time_put_char_2::id, );
+
+# if !defined (_STLP_NO_WCHAR_T)
+
+//typedef time_get<wchar_t, const wchar_t*> time_get_wchar_t;
+typedef time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > time_get_wchar_t_2;
+//typedef time_put<wchar_t, wchar_t*> time_put_wchar_t;
+typedef time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > time_put_wchar_t_2;
+
+//__DECLARE_INSTANCE(locale::id, time_get_wchar_t::id, );
+__DECLARE_INSTANCE(locale::id, time_get_wchar_t_2::id, );
+//__DECLARE_INSTANCE(locale::id, time_put_wchar_t::id, );
+__DECLARE_INSTANCE(locale::id, time_put_wchar_t_2::id, );
+
+# endif
+
+#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InIt, class _CharT>
+const string* _STLP_CALL
+__match(_InIt& __first, _InIt& __last, const string *__name, const string *__name_end,
+ const ctype<_CharT>& __ct) {
+ typedef ptrdiff_t difference_type;
+ difference_type __n = __name_end - __name;
+ difference_type __i;
+ size_t __pos = 0;
+ difference_type __check_count = __n;
+ bool __do_check[_MAXNAMES];
+ const string* __matching_name[_MAX_NAME_LENGTH];
+
+ for (__i = 0; __i < _MAXNAMES; ++__i)
+ __do_check[__i] = true;
+
+ for (__i = 0; __i < _MAX_NAME_LENGTH; ++__i)
+ __matching_name[__i] = __name_end;
+
+ while (__first != __last) {
+ for (__i = 0; __i < __n; ++__i) {
+ if (__do_check[__i]) {
+ if (*__first == __ct.widen(__name[__i][__pos])) {
+ if (__pos == (__name[__i].size() - 1)) {
+ __do_check[__i] = 0;
+ __matching_name[__pos + 1] = __name + __i;
+ --__check_count;
+ if (__check_count == 0) {
+ ++__first;
+ return __name + __i;
+ }
+ }
+ }
+ else {
+ __do_check[__i] = 0;
+ --__check_count;
+ if (__check_count == 0)
+ return __matching_name[__pos];
+ }
+ }
+ }
+
+ ++__first; ++__pos;
+ }
+
+ return __matching_name[__pos];
+}
+
+// __get_formatted_time reads input that is assumed to be formatted
+// according to the rules for the C strftime function (C standard,
+// 7.12.3.5). This function is used to implement the do_get_time
+// and do_get_date virtual functions, which depend on the locale
+// specifications for the time and day formats respectively.
+// Note the catchall default case, intended mainly for the '%Z'
+// format designator, which does not make sense here since the
+// representation of timezones is not part of the locale.
+//
+// The case branches are implemented either by doing a match using
+// the appopriate name table or by doing a __get_integer_nogroup.
+//
+// 'y' format is assumed to mean that the input represents years
+// since 1900. That is, 2002 should be represented as 102. There
+// is no century-guessing.
+//
+// The match is successful if and only if the second component of the
+// return value is format_end.
+
+// Note that the antepenultimate parameter is being used only to determine
+// the correct overloading for the calls to __get_integer_nogroup.
+template <class _InIt1, class _Ch>
+string::const_iterator _STLP_CALL
+__get_formatted_time _STLP_WEAK (_InIt1 __first, _InIt1 __last,
+ string::const_iterator __format, string::const_iterator __format_end,
+ _Ch*, const _Time_Info& __table,
+ const ios_base& __s, ios_base::iostate& __err, tm* __t) {
+ const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __s._M_ctype_facet());
+ while (__first != __last && __format != __format_end) {
+ if (*__format == '%') {
+ ++__format;
+ char __c = *__format;
+ if (__c == '#') { //MS extension
+ ++__format;
+ __c = *__format;
+ }
+
+ switch (__c) {
+ case 'a': {
+ const string* __pr = __match(__first, __last,
+ __table._M_dayname + 0, __table._M_dayname + 7,
+ __ct);
+ if (__pr == __table._M_dayname + 7)
+ return __format;
+ __t->tm_wday = __STATIC_CAST(int, __pr - __table._M_dayname);
+ break;
+ }
+
+ case 'A': {
+ const string* __pr = __match(__first, __last,
+ __table._M_dayname + 7, __table._M_dayname + 14,
+ __ct);
+ if (__pr == __table._M_dayname + 14)
+ return __format;
+ __t->tm_wday = __STATIC_CAST(int, __pr - __table._M_dayname - 7);
+ break;
+ }
+
+ case 'b': {
+ const string* __pr = __match(__first, __last,
+ __table._M_monthname + 0, __table._M_monthname + 12,
+ __ct);
+ if (__pr == __table._M_monthname + 12)
+ return __format;
+ __t->tm_mon = __STATIC_CAST(int, __pr - __table._M_monthname);
+ break;
+ }
+
+ case 'B': {
+ const string* __pr = __match(__first, __last,
+ __table._M_monthname + 12, __table._M_monthname + 24,
+ __ct);
+ if (__pr == __table._M_monthname + 24)
+ return __format;
+ __t->tm_mon = __STATIC_CAST(int, __pr - __table._M_monthname - 12);
+ break;
+ }
+
+ case 'd': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_mday, __STATIC_CAST(_Ch*, 0));
+ if (!__pr || __t->tm_mday < 1 || __t->tm_mday > 31) {
+ __err |= ios_base::failbit;
+ return __format;
+ }
+ break;
+ }
+
+ case 'H': case 'I': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_hour, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'j': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_yday, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'm': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_mon, __STATIC_CAST(_Ch*, 0));
+ --__t->tm_mon;
+ if (!__pr || __t->tm_mon < 0 || __t->tm_mon > 11) {
+ __err |= ios_base::failbit;
+ return __format;
+ }
+ break;
+ }
+
+ case 'M': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_min, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'p': {
+ const string* __pr = __match(__first, __last,
+ __table._M_am_pm + 0, __table._M_am_pm + 2, __ct);
+ if (__pr == __table._M_am_pm + 2)
+ return __format;
+ // 12:00 PM <=> 12:00, 12:00 AM <=> 00:00
+ if (__pr == __table._M_am_pm + 1 && __t->tm_hour != 12 )
+ __t->tm_hour += 12;
+ if (__pr == __table._M_am_pm && __t->tm_hour == 12 )
+ __t->tm_hour = 0;
+ break;
+ }
+
+ case 'S': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_sec, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'y': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'Y': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0));
+ __t->tm_year -= 1900;
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+ else {
+ if (*__first++ != __ct.widen(*__format)) break;
+ }
+
+ ++__format;
+ }
+
+ return __format;
+}
+
+template <class _InIt, class _CharT>
+bool _STLP_CALL
+__get_short_or_long_dayname(_InIt& __first, _InIt& __last, const ctype<_CharT>& __ct,
+ const _Time_Info& __table, tm* __t) {
+ const string* __pr =
+ __match(__first, __last, __table._M_dayname + 0, __table._M_dayname + 14, __ct);
+ __t->tm_wday = __STATIC_CAST(int, (__pr - __table._M_dayname) % 7);
+ return __pr != __table._M_dayname + 14;
+}
+
+template <class _InIt, class _CharT>
+bool _STLP_CALL
+__get_short_or_long_monthname(_InIt& __first, _InIt& __last, const ctype<_CharT>& __ct,
+ const _Time_Info& __table, tm* __t) {
+ const string* __pr =
+ __match(__first, __last, __table._M_monthname + 0, __table._M_monthname + 24, __ct);
+ __t->tm_mon = __STATIC_CAST(int, (__pr - __table._M_monthname) % 12);
+ return __pr != __table._M_monthname + 24;
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+template <class _OuIt>
+_OuIt _STLP_CALL
+__put_time(char * __first, char * __last, _OuIt __out_ite,
+ const ios_base& __s, wchar_t) {
+ const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __s._M_ctype_facet());
+ wchar_t __wbuf[64];
+ __ct.widen(__first, __last, __wbuf);
+ ptrdiff_t __len = __last - __first;
+ wchar_t * __eend = __wbuf + __len;
+ return copy((wchar_t*)__wbuf, __eend, __out_ite);
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_date(_InIt __s, _InIt __end,
+ ios_base& __str, ios_base::iostate& __err,
+ tm* __t) const {
+ typedef string::const_iterator string_iterator;
+
+ string_iterator __format = _M_timeinfo._M_date_format.begin();
+ string_iterator __format_end = _M_timeinfo._M_date_format.end();
+
+ string_iterator __result
+ = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
+ __STATIC_CAST(_Ch*, 0), _M_timeinfo,
+ __str, __err, __t);
+ if (__result == __format_end)
+ __err = ios_base::goodbit;
+ else {
+ __err = ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ }
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_time(_InIt __s, _InIt __end,
+ ios_base& __str, ios_base::iostate& __err,
+ tm* __t) const {
+ typedef string::const_iterator string_iterator;
+ string_iterator __format = _M_timeinfo._M_time_format.begin();
+ string_iterator __format_end = _M_timeinfo._M_time_format.end();
+
+ string_iterator __result
+ = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
+ __STATIC_CAST(_Ch*, 0), _M_timeinfo,
+ __str, __err, __t);
+ __err = __result == __format_end ? ios_base::goodbit
+ : ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_year(_InIt __s, _InIt __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const {
+ if (__s == __end) {
+ __err = ios_base::failbit | ios_base::eofbit;
+ return __s;
+ }
+
+ bool __pr = _STLP_PRIV __get_decimal_integer(__s, __end, __t->tm_year, __STATIC_CAST(_Ch*, 0));
+ __t->tm_year -= 1900;
+ __err = __pr ? ios_base::goodbit : ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_weekday(_InIt __s, _InIt __end,
+ ios_base &__str, ios_base::iostate &__err,
+ tm *__t) const {
+ const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __str._M_ctype_facet());
+ bool __result =
+ _STLP_PRIV __get_short_or_long_dayname(__s, __end, __ct, _M_timeinfo, __t);
+ if (__result)
+ __err = ios_base::goodbit;
+ else {
+ __err = ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ }
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_monthname(_InIt __s, _InIt __end,
+ ios_base &__str, ios_base::iostate &__err,
+ tm *__t) const {
+ const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __str._M_ctype_facet());
+ bool __result =
+ _STLP_PRIV __get_short_or_long_monthname(__s, __end, __ct, _M_timeinfo, __t);
+ if (__result)
+ __err = ios_base::goodbit;
+ else {
+ __err = ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ }
+ return __s;
+}
+
+template<class _Ch, class _OutputIter>
+_OutputIter
+time_put<_Ch,_OutputIter>::put(_OutputIter __s, ios_base& __f, _Ch __fill,
+ const tm* __tmb, const _Ch* __pat,
+ const _Ch* __pat_end) const {
+ // locale __loc = __f.getloc();
+ // const ctype<_Ch>& _Ct = use_facet<ctype<_Ch> >(__loc);
+ const ctype<_Ch>& _Ct = *__STATIC_CAST(const ctype<_Ch>*, __f._M_ctype_facet());
+ while (__pat != __pat_end) {
+ char __c = _Ct.narrow(*__pat, 0);
+ if (__c == '%') {
+ char __mod = 0;
+ ++__pat;
+ __c = _Ct.narrow(*__pat++, 0);
+ if (__c == '#') { // MS extension
+ __mod = __c;
+ __c = _Ct.narrow(*__pat++, 0);
+ }
+ __s = do_put(__s, __f, __fill, __tmb, __c, __mod);
+ }
+ else
+ *__s++ = *__pat++;
+ }
+ return __s;
+}
+
+template<class _Ch, class _OutputIter>
+_OutputIter
+time_put<_Ch,_OutputIter>::do_put(_OutputIter __s, ios_base& __f, _Ch /* __fill */,
+ const tm* __tmb, char __format,
+ char __modifier ) const {
+ char __buf[64];
+ char * __iend = _STLP_PRIV __write_formatted_time(_STLP_ARRAY_AND_SIZE(__buf),
+ __format, __modifier, _M_timeinfo, __tmb);
+ // locale __loc = __f.getloc();
+ return _STLP_PRIV __put_time(__buf, __iend, __s, __f, _Ch());
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_TIME_FACETS_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// 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_TIME_FACETS_H
+#define _STLP_INTERNAL_TIME_FACETS_H
+
+#ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h> // Needed (for struct tm) by time facets
+#endif
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Template functions used by time_get
+
+// Matching input against a list of names
+
+// Alphabetic input of the names of months and the names
+// of weekdays requires matching input against a list of names.
+// We use a simple generic algorithm to accomplish this. This
+// algorithm is not very efficient, especially for longer lists
+// of names, but it probably does not matter for the initial
+// implementation and it may never matter, since we do not expect
+// this kind of input to be used very often. The algorithm
+// could be improved fairly simply by creating a new list of
+// names still in the running at each iteration. A more sophisticated
+// approach would be to build a trie to do the matching.
+//
+// We compare each character of the input to the corresponding
+// character of each name on the list that has not been eliminated,
+// either because every character in the name has already been
+// matched, or because some character has not been matched. We
+// continue only as long as there are some names that have not been
+// eliminated.
+
+// We do not really need a random access iterator (a forward iterator
+// would do), but the extra generality makes the notation clumsier,
+// and we don't really need it.
+
+// We can recognize a failed match by the fact that the second
+// component of the return value will be __name_end.
+
+#define _MAXNAMES 64
+#define _MAX_NAME_LENGTH 64
+
+// Both time_get and time_put need a structure of type _Time_Info
+// to provide names and abbreviated names for months and days,
+// as well as the am/pm designator. The month and weekday tables
+// have the all the abbreviated names before all the full names.
+// The _Time_Info tables are initialized using the non-template
+// function _Init_timeinfo, which has two overloadings: one
+// with a single reference parameter for the table to be initialized,
+// and one with a second _Locale_time * parameter. The first form
+// is called by the default constructor and the second by a special
+// constructor invoked from the _byname subclass constructor to
+// construct the base class.
+
+class _STLP_CLASS_DECLSPEC _Time_Info {
+public:
+ string _M_dayname[14];
+ string _M_monthname[24];
+ string _M_am_pm[2];
+ string _M_time_format;
+ string _M_date_format;
+ string _M_date_time_format;
+ string _M_long_date_format;
+ string _M_long_date_time_format;
+};
+
+void _STLP_CALL _Init_timeinfo(_Time_Info&);
+void _STLP_CALL _Init_timeinfo(_Time_Info&, _Locale_time*);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+class _STLP_CLASS_DECLSPEC time_base {
+public:
+ enum dateorder {no_order, dmy, mdy, ymd, ydm};
+};
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _InIt>
+#else
+template <class _Ch, class _InIt = istreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_get : public locale::facet, public time_base {
+ friend class _Locale_impl;
+
+public:
+ typedef _Ch char_type;
+ typedef _InIt iter_type;
+
+ explicit time_get(size_t __refs = 0) : locale::facet(__refs)
+ { _STLP_PRIV _Init_timeinfo(_M_timeinfo); }
+ dateorder date_order() const { return do_date_order(); }
+ iter_type get_time(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_time(__s, __end, __str, __err, __t); }
+ iter_type get_date(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_date(__s, __end, __str, __err, __t); }
+ iter_type get_weekday(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_weekday(__s, __end, __str, __err, __t); }
+ iter_type get_monthname(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_monthname(__s, __end, __str, __err, __t); }
+ iter_type get_year(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_year(__s, __end, __str, __err, __t); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ time_get(_Locale_time *, size_t __refs) : locale::facet(__refs) {}
+
+ ~time_get() {}
+
+ virtual dateorder do_date_order() const {return no_order;}
+
+ virtual iter_type do_get_time(iter_type __s, iter_type __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const;
+
+ virtual iter_type do_get_date(iter_type __s, iter_type __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const;
+
+ virtual iter_type do_get_weekday(iter_type __s, iter_type __end,
+ ios_base&,
+ ios_base::iostate& __err,
+ tm* __t) const;
+ virtual iter_type do_get_monthname(iter_type __s, iter_type __end,
+ ios_base&,
+ ios_base::iostate& __err,
+ tm* __t) const;
+
+ virtual iter_type do_get_year(iter_type __s, iter_type __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const;
+
+ _STLP_PRIV _Time_Info _M_timeinfo;
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+time_base::dateorder _STLP_CALL __get_date_order(_Locale_time*);
+_Locale_time* _STLP_CALL __acquire_time(const char* __name, _Locale_name_hint*);
+void _STLP_CALL __release_time(_Locale_time* __time);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Ch, class _InIt>
+class time_get_byname;
+
+#if defined (__GNUC__) && (__GNUC__ < 3)
+template <class _Ch, class _InIt>
+_Locale_name_hint* _Locale_time_extract_hint(time_get_byname<_Ch, _InIt>*);
+#else
+_Locale_name_hint* _Locale_time_extract_hint(time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >*);
+#endif
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _InIt>
+#else
+template <class _Ch, class _InIt = istreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_get_byname : public time_get<_Ch, _InIt> {
+public:
+ typedef time_base::dateorder dateorder;
+ typedef _InIt iter_type;
+
+ explicit time_get_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0)
+ : time_get<_Ch, _InIt>((_Locale_time*) 0, __refs),
+ _M_time(_STLP_PRIV __acquire_time(__name, __hint))
+ { _STLP_PRIV _Init_timeinfo(this->_M_timeinfo, this->_M_time); }
+
+protected:
+ ~time_get_byname() { _STLP_PRIV __release_time(_M_time); }
+ dateorder do_date_order() const { return _STLP_PRIV __get_date_order(_M_time); }
+
+private:
+ _Locale_time* _M_time;
+
+ typedef time_get_byname<_Ch, _InIt> _Self;
+ //explicitely defined as private to avoid warnings:
+ time_get_byname(_Self const&);
+ _Self& operator = (_Self const&);
+#if defined (__GNUC__) && (__GNUC__ < 3)
+ friend _Locale_name_hint* _Locale_time_extract_hint<>(_Self*);
+#else
+ friend _Locale_name_hint* _Locale_time_extract_hint(time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >*);
+#endif
+};
+
+// time_put facet
+
+// For the formats 'x, 'X', and 'c', do_put calls the first form of
+// put with the pattern obtained from _M_timeinfo._M_date_format or
+// _M_timeinfo._M_time_format.
+
+// Helper function: __ takes a single-character
+// format. As indicated by the foregoing remark, this will never be
+// 'x', 'X', or 'c'.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+char * _STLP_CALL
+__write_formatted_time(char *__buf, size_t __buf_size, char __format, char __modifier,
+ const _Time_Info& __table, const tm* __t);
+
+template <class _OuIt>
+inline _OuIt _STLP_CALL __put_time(char * __first, char * __last, _OuIt __out_ite,
+ const ios_base& /* __loc */, char)
+{ return copy(__first, __last, __out_ite); }
+
+#if !defined (_STLP_NO_WCHAR_T)
+template <class _OuIt>
+_OuIt _STLP_CALL __put_time(char * __first, char * __last, _OuIt __out_ite,
+ const ios_base& __s, wchar_t);
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _OutIt>
+#else
+template <class _Ch, class _OutIt = ostreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_put : public locale::facet, public time_base {
+ friend class _Locale_impl;
+public:
+ typedef _Ch char_type;
+ typedef _OutIt iter_type;
+
+ explicit time_put(size_t __refs = 0) : locale::facet(__refs)
+ { _STLP_PRIV _Init_timeinfo(_M_timeinfo); }
+
+ _OutIt put(iter_type __s, ios_base& __f, _Ch __fill,
+ const tm* __tmb,
+ const _Ch* __pat, const _Ch* __pat_end) const;
+
+ _OutIt put(iter_type __s, ios_base& __f, _Ch __fill,
+ const tm* __tmb, char __format, char __modifier = 0) const
+ { return do_put(__s, __f, __fill, __tmb, __format, __modifier); }
+
+ static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
+
+protected:
+ time_put(_Locale_time* /*__time*/, size_t __refs) : locale::facet(__refs)
+ {} //_STLP_PRIV _Init_timeinfo(_M_timeinfo, __time); }
+
+ ~time_put() {}
+ virtual iter_type do_put(iter_type __s, ios_base& __f,
+ char_type /* __fill */, const tm* __tmb,
+ char __format, char /* __modifier */) const;
+
+ _STLP_PRIV _Time_Info _M_timeinfo;
+};
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _OutIt>
+#else
+template <class _Ch, class _OutIt = ostreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_put_byname : public time_put<_Ch, _OutIt> {
+ friend class _Locale_impl;
+public:
+ typedef time_base::dateorder dateorder;
+ typedef _OutIt iter_type;
+ typedef _Ch char_type;
+
+ explicit time_put_byname(const char * __name, size_t __refs = 0, _Locale_name_hint* __hint = 0)
+ : time_put<_Ch, _OutIt>((_Locale_time*) 0, __refs),
+ _M_time(_STLP_PRIV __acquire_time(__name, __hint))
+ { _STLP_PRIV _Init_timeinfo(this->_M_timeinfo, this->_M_time); }
+
+protected:
+ ~time_put_byname() { _STLP_PRIV __release_time(_M_time); }
+
+private:
+ _Locale_time* _M_time;
+
+ typedef time_put_byname<_Ch, _OutIt> _Self;
+ //explicitely defined as private to avoid warnings:
+ time_put_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS time_get<char, istreambuf_iterator<char, char_traits<char> > >;
+_STLP_EXPORT_TEMPLATE_CLASS time_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+// _STLP_EXPORT_TEMPLATE_CLASS time_get<char, const char*>;
+// _STLP_EXPORT_TEMPLATE_CLASS time_put<char, char*>;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+_STLP_EXPORT_TEMPLATE_CLASS time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// _STLP_EXPORT_TEMPLATE_CLASS time_get<wchar_t, const wchar_t*>;
+// _STLP_EXPORT_TEMPLATE_CLASS time_put<wchar_t, wchar_t*>;
+# endif
+
+#endif
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_time_facets.c>
+#endif
+
+#endif /* _STLP_INTERNAL_TIME_FACETS_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ *
+ * 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.
+ *
+ * Modified CRP 7/10/00 for improved conformance / efficiency on insert_unique /
+ * insert_equal with valid hint -- efficiency is improved all around, and it is
+ * should now be standard conforming for complexity on insert point immediately
+ * after hint (amortized constant time).
+ *
+ */
+#ifndef _STLP_TREE_C
+#define _STLP_TREE_C
+
+#ifndef _STLP_INTERNAL_TREE_H
+# include <stl/_tree.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree)
+#endif
+
+// fbp: these defines are for outline methods definitions.
+// needed for definitions to be portable. Should not be used in method bodies.
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define __iterator__ _Rb_tree_iterator<_Value, _STLP_HEADER_TYPENAME _Traits::_NonConstTraits>
+# define __size_type__ size_t
+# define iterator __iterator__
+#else
+# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc>::iterator
+# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc>::size_type
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+template <class _Dummy> void _STLP_CALL
+_Rb_global<_Dummy>::_Rotate_left(_Rb_tree_node_base* __x,
+ _Rb_tree_node_base*& __root) {
+ _Rb_tree_node_base* __y = __x->_M_right;
+ __x->_M_right = __y->_M_left;
+ if (__y->_M_left != 0)
+ __y->_M_left->_M_parent = __x;
+ __y->_M_parent = __x->_M_parent;
+
+ if (__x == __root)
+ __root = __y;
+ else if (__x == __x->_M_parent->_M_left)
+ __x->_M_parent->_M_left = __y;
+ else
+ __x->_M_parent->_M_right = __y;
+ __y->_M_left = __x;
+ __x->_M_parent = __y;
+}
+
+template <class _Dummy> void _STLP_CALL
+_Rb_global<_Dummy>::_Rotate_right(_Rb_tree_node_base* __x,
+ _Rb_tree_node_base*& __root) {
+ _Rb_tree_node_base* __y = __x->_M_left;
+ __x->_M_left = __y->_M_right;
+ if (__y->_M_right != 0)
+ __y->_M_right->_M_parent = __x;
+ __y->_M_parent = __x->_M_parent;
+
+ if (__x == __root)
+ __root = __y;
+ else if (__x == __x->_M_parent->_M_right)
+ __x->_M_parent->_M_right = __y;
+ else
+ __x->_M_parent->_M_left = __y;
+ __y->_M_right = __x;
+ __x->_M_parent = __y;
+}
+
+template <class _Dummy> void _STLP_CALL
+_Rb_global<_Dummy>::_Rebalance(_Rb_tree_node_base* __x,
+ _Rb_tree_node_base*& __root) {
+ __x->_M_color = _S_rb_tree_red;
+ while (__x != __root && __x->_M_parent->_M_color == _S_rb_tree_red) {
+ if (__x->_M_parent == __x->_M_parent->_M_parent->_M_left) {
+ _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_right;
+ if (__y && __y->_M_color == _S_rb_tree_red) {
+ __x->_M_parent->_M_color = _S_rb_tree_black;
+ __y->_M_color = _S_rb_tree_black;
+ __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
+ __x = __x->_M_parent->_M_parent;
+ }
+ else {
+ if (__x == __x->_M_parent->_M_right) {
+ __x = __x->_M_parent;
+ _Rotate_left(__x, __root);
+ }
+ __x->_M_parent->_M_color = _S_rb_tree_black;
+ __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
+ _Rotate_right(__x->_M_parent->_M_parent, __root);
+ }
+ }
+ else {
+ _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_left;
+ if (__y && __y->_M_color == _S_rb_tree_red) {
+ __x->_M_parent->_M_color = _S_rb_tree_black;
+ __y->_M_color = _S_rb_tree_black;
+ __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
+ __x = __x->_M_parent->_M_parent;
+ }
+ else {
+ if (__x == __x->_M_parent->_M_left) {
+ __x = __x->_M_parent;
+ _Rotate_right(__x, __root);
+ }
+ __x->_M_parent->_M_color = _S_rb_tree_black;
+ __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
+ _Rotate_left(__x->_M_parent->_M_parent, __root);
+ }
+ }
+ }
+ __root->_M_color = _S_rb_tree_black;
+}
+
+template <class _Dummy> _Rb_tree_node_base* _STLP_CALL
+_Rb_global<_Dummy>::_Rebalance_for_erase(_Rb_tree_node_base* __z,
+ _Rb_tree_node_base*& __root,
+ _Rb_tree_node_base*& __leftmost,
+ _Rb_tree_node_base*& __rightmost) {
+ _Rb_tree_node_base* __y = __z;
+ _Rb_tree_node_base* __x;
+ _Rb_tree_node_base* __x_parent;
+
+ if (__y->_M_left == 0) // __z has at most one non-null child. y == z.
+ __x = __y->_M_right; // __x might be null.
+ else {
+ if (__y->_M_right == 0) // __z has exactly one non-null child. y == z.
+ __x = __y->_M_left; // __x is not null.
+ else { // __z has two non-null children. Set __y to
+ __y = _Rb_tree_node_base::_S_minimum(__y->_M_right); // __z's successor. __x might be null.
+ __x = __y->_M_right;
+ }
+ }
+
+ if (__y != __z) { // relink y in place of z. y is z's successor
+ __z->_M_left->_M_parent = __y;
+ __y->_M_left = __z->_M_left;
+ if (__y != __z->_M_right) {
+ __x_parent = __y->_M_parent;
+ if (__x) __x->_M_parent = __y->_M_parent;
+ __y->_M_parent->_M_left = __x; // __y must be a child of _M_left
+ __y->_M_right = __z->_M_right;
+ __z->_M_right->_M_parent = __y;
+ }
+ else
+ __x_parent = __y;
+ if (__root == __z)
+ __root = __y;
+ else if (__z->_M_parent->_M_left == __z)
+ __z->_M_parent->_M_left = __y;
+ else
+ __z->_M_parent->_M_right = __y;
+ __y->_M_parent = __z->_M_parent;
+ _STLP_STD::swap(__y->_M_color, __z->_M_color);
+ __y = __z;
+ // __y now points to node to be actually deleted
+ }
+ else { // __y == __z
+ __x_parent = __y->_M_parent;
+ if (__x) __x->_M_parent = __y->_M_parent;
+ if (__root == __z)
+ __root = __x;
+ else {
+ if (__z->_M_parent->_M_left == __z)
+ __z->_M_parent->_M_left = __x;
+ else
+ __z->_M_parent->_M_right = __x;
+ }
+
+ if (__leftmost == __z) {
+ if (__z->_M_right == 0) // __z->_M_left must be null also
+ __leftmost = __z->_M_parent;
+ // makes __leftmost == _M_header if __z == __root
+ else
+ __leftmost = _Rb_tree_node_base::_S_minimum(__x);
+ }
+ if (__rightmost == __z) {
+ if (__z->_M_left == 0) // __z->_M_right must be null also
+ __rightmost = __z->_M_parent;
+ // makes __rightmost == _M_header if __z == __root
+ else // __x == __z->_M_left
+ __rightmost = _Rb_tree_node_base::_S_maximum(__x);
+ }
+ }
+
+ if (__y->_M_color != _S_rb_tree_red) {
+ while (__x != __root && (__x == 0 || __x->_M_color == _S_rb_tree_black))
+ if (__x == __x_parent->_M_left) {
+ _Rb_tree_node_base* __w = __x_parent->_M_right;
+ if (__w->_M_color == _S_rb_tree_red) {
+ __w->_M_color = _S_rb_tree_black;
+ __x_parent->_M_color = _S_rb_tree_red;
+ _Rotate_left(__x_parent, __root);
+ __w = __x_parent->_M_right;
+ }
+ if ((__w->_M_left == 0 ||
+ __w->_M_left->_M_color == _S_rb_tree_black) && (__w->_M_right == 0 ||
+ __w->_M_right->_M_color == _S_rb_tree_black)) {
+ __w->_M_color = _S_rb_tree_red;
+ __x = __x_parent;
+ __x_parent = __x_parent->_M_parent;
+ } else {
+ if (__w->_M_right == 0 ||
+ __w->_M_right->_M_color == _S_rb_tree_black) {
+ if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black;
+ __w->_M_color = _S_rb_tree_red;
+ _Rotate_right(__w, __root);
+ __w = __x_parent->_M_right;
+ }
+ __w->_M_color = __x_parent->_M_color;
+ __x_parent->_M_color = _S_rb_tree_black;
+ if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black;
+ _Rotate_left(__x_parent, __root);
+ break;
+ }
+ } else { // same as above, with _M_right <-> _M_left.
+ _Rb_tree_node_base* __w = __x_parent->_M_left;
+ if (__w->_M_color == _S_rb_tree_red) {
+ __w->_M_color = _S_rb_tree_black;
+ __x_parent->_M_color = _S_rb_tree_red;
+ _Rotate_right(__x_parent, __root);
+ __w = __x_parent->_M_left;
+ }
+ if ((__w->_M_right == 0 ||
+ __w->_M_right->_M_color == _S_rb_tree_black) && (__w->_M_left == 0 ||
+ __w->_M_left->_M_color == _S_rb_tree_black)) {
+ __w->_M_color = _S_rb_tree_red;
+ __x = __x_parent;
+ __x_parent = __x_parent->_M_parent;
+ } else {
+ if (__w->_M_left == 0 ||
+ __w->_M_left->_M_color == _S_rb_tree_black) {
+ if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black;
+ __w->_M_color = _S_rb_tree_red;
+ _Rotate_left(__w, __root);
+ __w = __x_parent->_M_left;
+ }
+ __w->_M_color = __x_parent->_M_color;
+ __x_parent->_M_color = _S_rb_tree_black;
+ if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black;
+ _Rotate_right(__x_parent, __root);
+ break;
+ }
+ }
+ if (__x) __x->_M_color = _S_rb_tree_black;
+ }
+ return __y;
+}
+
+template <class _Dummy> _Rb_tree_node_base* _STLP_CALL
+_Rb_global<_Dummy>::_M_decrement(_Rb_tree_node_base* _M_node) {
+ if (_M_node->_M_color == _S_rb_tree_red && _M_node->_M_parent->_M_parent == _M_node)
+ _M_node = _M_node->_M_right;
+ else if (_M_node->_M_left != 0) {
+ _M_node = _Rb_tree_node_base::_S_maximum(_M_node->_M_left);
+ }
+ else {
+ _Base_ptr __y = _M_node->_M_parent;
+ while (_M_node == __y->_M_left) {
+ _M_node = __y;
+ __y = __y->_M_parent;
+ }
+ _M_node = __y;
+ }
+ return _M_node;
+}
+
+template <class _Dummy> _Rb_tree_node_base* _STLP_CALL
+_Rb_global<_Dummy>::_M_increment(_Rb_tree_node_base* _M_node) {
+ if (_M_node->_M_right != 0) {
+ _M_node = _Rb_tree_node_base::_S_minimum(_M_node->_M_right);
+ }
+ else {
+ _Base_ptr __y = _M_node->_M_parent;
+ while (_M_node == __y->_M_right) {
+ _M_node = __y;
+ __y = __y->_M_parent;
+ }
+ // check special case: This is necessary if _M_node is the
+ // _M_head and the tree contains only a single node __y. In
+ // that case parent, left and right all point to __y!
+ if (_M_node->_M_right != __y)
+ _M_node = __y;
+ }
+ return _M_node;
+}
+
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>&
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::operator=(
+ const _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>& __x) {
+ if (this != &__x) {
+ // Note that _Key may be a constant type.
+ clear();
+ _M_node_count = 0;
+ _M_key_compare = __x._M_key_compare;
+ if (__x._M_root() == 0) {
+ _M_root() = 0;
+ _M_leftmost() = &this->_M_header._M_data;
+ _M_rightmost() = &this->_M_header._M_data;
+ }
+ else {
+ _M_root() = _M_copy(__x._M_root(), &this->_M_header._M_data);
+ _M_leftmost() = _S_minimum(_M_root());
+ _M_rightmost() = _S_maximum(_M_root());
+ _M_node_count = __x._M_node_count;
+ }
+ }
+ return *this;
+}
+
+// CRP 7/10/00 inserted argument __on_right, which is another hint (meant to
+// act like __on_left and ignore a portion of the if conditions -- specify
+// __on_right != 0 to bypass comparison as false or __on_left != 0 to bypass
+// comparison as true)
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+__iterator__
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::_M_insert(_Rb_tree_node_base * __parent,
+ const _Value& __val,
+ _Rb_tree_node_base * __on_left,
+ _Rb_tree_node_base * __on_right) {
+ // We do not create the node here as, depending on tests, we might call
+ // _M_key_compare that can throw an exception.
+ _Base_ptr __new_node;
+
+ if ( __parent == &this->_M_header._M_data ) {
+ __new_node = _M_create_node(__val);
+ _S_left(__parent) = __new_node; // also makes _M_leftmost() = __new_node
+ _M_root() = __new_node;
+ _M_rightmost() = __new_node;
+ }
+ else if ( __on_right == 0 && // If __on_right != 0, the remainder fails to false
+ ( __on_left != 0 || // If __on_left != 0, the remainder succeeds to true
+ _M_key_compare( _KeyOfValue()(__val), _S_key(__parent) ) ) ) {
+ __new_node = _M_create_node(__val);
+ _S_left(__parent) = __new_node;
+ if (__parent == _M_leftmost())
+ _M_leftmost() = __new_node; // maintain _M_leftmost() pointing to min node
+ }
+ else {
+ __new_node = _M_create_node(__val);
+ _S_right(__parent) = __new_node;
+ if (__parent == _M_rightmost())
+ _M_rightmost() = __new_node; // maintain _M_rightmost() pointing to max node
+ }
+ _S_parent(__new_node) = __parent;
+ _Rb_global_inst::_Rebalance(__new_node, this->_M_header._M_data._M_parent);
+ ++_M_node_count;
+ return iterator(__new_node);
+}
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+__iterator__
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_equal(const _Value& __val) {
+ _Base_ptr __y = &this->_M_header._M_data;
+ _Base_ptr __x = _M_root();
+ while (__x != 0) {
+ __y = __x;
+ if (_M_key_compare(_KeyOfValue()(__val), _S_key(__x))) {
+ __x = _S_left(__x);
+ }
+ else
+ __x = _S_right(__x);
+ }
+ return _M_insert(__y, __val, __x);
+}
+
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+pair<__iterator__, bool>
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_unique(const _Value& __val) {
+ _Base_ptr __y = &this->_M_header._M_data;
+ _Base_ptr __x = _M_root();
+ bool __comp = true;
+ while (__x != 0) {
+ __y = __x;
+ __comp = _M_key_compare(_KeyOfValue()(__val), _S_key(__x));
+ __x = __comp ? _S_left(__x) : _S_right(__x);
+ }
+ iterator __j = iterator(__y);
+ if (__comp) {
+ if (__j == begin())
+ return pair<iterator,bool>(_M_insert(__y, __val, /* __x*/ __y), true);
+ else
+ --__j;
+ }
+ if (_M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__val))) {
+ return pair<iterator,bool>(_M_insert(__y, __val, __x), true);
+ }
+ return pair<iterator,bool>(__j, false);
+}
+
+// Modifications CRP 7/10/00 as noted to improve conformance and
+// efficiency.
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+__iterator__
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_unique(iterator __position,
+ const _Value& __val) {
+ if (__position._M_node == this->_M_header._M_data._M_left) { // begin()
+
+ // if the container is empty, fall back on insert_unique.
+ if (empty())
+ return insert_unique(__val).first;
+
+ if (_M_key_compare(_KeyOfValue()(__val), _S_key(__position._M_node))) {
+ return _M_insert(__position._M_node, __val, __position._M_node);
+ }
+ // first argument just needs to be non-null
+ else {
+ bool __comp_pos_v = _M_key_compare( _S_key(__position._M_node), _KeyOfValue()(__val) );
+
+ if (__comp_pos_v == false) // compare > and compare < both false so compare equal
+ return __position;
+ //Below __comp_pos_v == true
+
+ // Standard-conformance - does the insertion point fall immediately AFTER
+ // the hint?
+ iterator __after = __position;
+ ++__after;
+
+ // Check for only one member -- in that case, __position points to itself,
+ // and attempting to increment will cause an infinite loop.
+ if (__after._M_node == &this->_M_header._M_data)
+ // Check guarantees exactly one member, so comparison was already
+ // performed and we know the result; skip repeating it in _M_insert
+ // by specifying a non-zero fourth argument.
+ return _M_insert(__position._M_node, __val, 0, __position._M_node);
+
+ // All other cases:
+
+ // Optimization to catch insert-equivalent -- save comparison results,
+ // and we get this for free.
+ if (_M_key_compare( _KeyOfValue()(__val), _S_key(__after._M_node) )) {
+ if (_S_right(__position._M_node) == 0)
+ return _M_insert(__position._M_node, __val, 0, __position._M_node);
+ else
+ return _M_insert(__after._M_node, __val, __after._M_node);
+ }
+ else {
+ return insert_unique(__val).first;
+ }
+ }
+ }
+ else if (__position._M_node == &this->_M_header._M_data) { // end()
+ if (_M_key_compare(_S_key(_M_rightmost()), _KeyOfValue()(__val))) {
+ // pass along to _M_insert that it can skip comparing
+ // v, Key ; since compare Key, v was true, compare v, Key must be false.
+ return _M_insert(_M_rightmost(), __val, 0, __position._M_node); // Last argument only needs to be non-null
+ }
+ else
+ return insert_unique(__val).first;
+ }
+ else {
+ iterator __before = __position;
+ --__before;
+
+ bool __comp_v_pos = _M_key_compare(_KeyOfValue()(__val), _S_key(__position._M_node));
+
+ if (__comp_v_pos
+ && _M_key_compare( _S_key(__before._M_node), _KeyOfValue()(__val) )) {
+
+ if (_S_right(__before._M_node) == 0)
+ return _M_insert(__before._M_node, __val, 0, __before._M_node); // Last argument only needs to be non-null
+ else
+ return _M_insert(__position._M_node, __val, __position._M_node);
+ // first argument just needs to be non-null
+ }
+ else {
+ // Does the insertion point fall immediately AFTER the hint?
+ iterator __after = __position;
+ ++__after;
+ // Optimization to catch equivalent cases and avoid unnecessary comparisons
+ bool __comp_pos_v = !__comp_v_pos; // Stored this result earlier
+ // If the earlier comparison was true, this comparison doesn't need to be
+ // performed because it must be false. However, if the earlier comparison
+ // was false, we need to perform this one because in the equal case, both will
+ // be false.
+ if (!__comp_v_pos) {
+ __comp_pos_v = _M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val));
+ }
+
+ if ( (!__comp_v_pos) // comp_v_pos true implies comp_v_pos false
+ && __comp_pos_v
+ && (__after._M_node == &this->_M_header._M_data ||
+ _M_key_compare( _KeyOfValue()(__val), _S_key(__after._M_node) ))) {
+ if (_S_right(__position._M_node) == 0)
+ return _M_insert(__position._M_node, __val, 0, __position._M_node);
+ else
+ return _M_insert(__after._M_node, __val, __after._M_node);
+ } else {
+ // Test for equivalent case
+ if (__comp_v_pos == __comp_pos_v)
+ return __position;
+ else
+ return insert_unique(__val).first;
+ }
+ }
+ }
+}
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+__iterator__
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_equal(iterator __position,
+ const _Value& __val) {
+ if (__position._M_node == this->_M_header._M_data._M_left) { // begin()
+
+ // Check for zero members
+ if (size() <= 0)
+ return insert_equal(__val);
+
+ if (!_M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val)))
+ return _M_insert(__position._M_node, __val, __position._M_node);
+ else {
+ // Check for only one member
+ if (__position._M_node->_M_left == __position._M_node)
+ // Unlike insert_unique, can't avoid doing a comparison here.
+ return _M_insert(__position._M_node, __val);
+
+ // All other cases:
+ // Standard-conformance - does the insertion point fall immediately AFTER
+ // the hint?
+ iterator __after = __position;
+ ++__after;
+
+ // Already know that compare(pos, v) must be true!
+ // Therefore, we want to know if compare(after, v) is false.
+ // (i.e., we now pos < v, now we want to know if v <= after)
+ // If not, invalid hint.
+ if ( __after._M_node == &this->_M_header._M_data ||
+ !_M_key_compare( _S_key(__after._M_node), _KeyOfValue()(__val) ) ) {
+ if (_S_right(__position._M_node) == 0)
+ return _M_insert(__position._M_node, __val, 0, __position._M_node);
+ else
+ return _M_insert(__after._M_node, __val, __after._M_node);
+ }
+ else { // Invalid hint
+ return insert_equal(__val);
+ }
+ }
+ }
+ else if (__position._M_node == &this->_M_header._M_data) { // end()
+ if (!_M_key_compare(_KeyOfValue()(__val), _S_key(_M_rightmost())))
+ return _M_insert(_M_rightmost(), __val, 0, __position._M_node); // Last argument only needs to be non-null
+ else {
+ return insert_equal(__val);
+ }
+ }
+ else {
+ iterator __before = __position;
+ --__before;
+ // store the result of the comparison between pos and v so
+ // that we don't have to do it again later. Note that this reverses the shortcut
+ // on the if, possibly harming efficiency in comparisons; I think the harm will
+ // be negligible, and to do what I want to do (save the result of a comparison so
+ // that it can be re-used) there is no alternative. Test here is for before <= v <= pos.
+ bool __comp_pos_v = _M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val));
+ if (!__comp_pos_v &&
+ !_M_key_compare(_KeyOfValue()(__val), _S_key(__before._M_node))) {
+ if (_S_right(__before._M_node) == 0)
+ return _M_insert(__before._M_node, __val, 0, __before._M_node); // Last argument only needs to be non-null
+ else
+ return _M_insert(__position._M_node, __val, __position._M_node);
+ }
+ else {
+ // Does the insertion point fall immediately AFTER the hint?
+ // Test for pos < v <= after
+ iterator __after = __position;
+ ++__after;
+
+ if (__comp_pos_v &&
+ ( __after._M_node == &this->_M_header._M_data ||
+ !_M_key_compare( _S_key(__after._M_node), _KeyOfValue()(__val) ) ) ) {
+ if (_S_right(__position._M_node) == 0)
+ return _M_insert(__position._M_node, __val, 0, __position._M_node);
+ else
+ return _M_insert(__after._M_node, __val, __after._M_node);
+ }
+ else { // Invalid hint
+ return insert_equal(__val);
+ }
+ }
+ }
+}
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+_Rb_tree_node_base*
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::_M_copy(_Rb_tree_node_base* __x,
+ _Rb_tree_node_base* __p) {
+ // structural copy. __x and __p must be non-null.
+ _Base_ptr __top = _M_clone_node(__x);
+ _S_parent(__top) = __p;
+
+ _STLP_TRY {
+ if (_S_right(__x))
+ _S_right(__top) = _M_copy(_S_right(__x), __top);
+ __p = __top;
+ __x = _S_left(__x);
+
+ while (__x != 0) {
+ _Base_ptr __y = _M_clone_node(__x);
+ _S_left(__p) = __y;
+ _S_parent(__y) = __p;
+ if (_S_right(__x))
+ _S_right(__y) = _M_copy(_S_right(__x), __y);
+ __p = __y;
+ __x = _S_left(__x);
+ }
+ }
+ _STLP_UNWIND(_M_erase(__top))
+
+ return __top;
+}
+
+// this has to stay out-of-line : it's recursive
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+void
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>::_M_erase(_Rb_tree_node_base *__x) {
+ // erase without rebalancing
+ while (__x != 0) {
+ _M_erase(_S_right(__x));
+ _Base_ptr __y = _S_left(__x);
+ _STLP_STD::_Destroy(&_S_value(__x));
+ this->_M_header.deallocate(__STATIC_CAST(_Link_type, __x),1);
+ __x = __y;
+ }
+}
+
+#if defined (_STLP_DEBUG)
+inline int
+__black_count(_Rb_tree_node_base* __node, _Rb_tree_node_base* __root) {
+ if (__node == 0)
+ return 0;
+ else {
+ int __bc = __node->_M_color == _S_rb_tree_black ? 1 : 0;
+ if (__node == __root)
+ return __bc;
+ else
+ return __bc + __black_count(__node->_M_parent, __root);
+ }
+}
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+bool _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>::__rb_verify() const {
+ if (_M_node_count == 0 || begin() == end())
+ return ((_M_node_count == 0) &&
+ (begin() == end()) &&
+ (this->_M_header._M_data._M_left == &this->_M_header._M_data) &&
+ (this->_M_header._M_data._M_right == &this->_M_header._M_data));
+
+ int __len = __black_count(_M_leftmost(), _M_root());
+ for (const_iterator __it = begin(); __it != end(); ++__it) {
+ _Base_ptr __x = __it._M_node;
+ _Base_ptr __L = _S_left(__x);
+ _Base_ptr __R = _S_right(__x);
+
+ if (__x->_M_color == _S_rb_tree_red)
+ if ((__L && __L->_M_color == _S_rb_tree_red) ||
+ (__R && __R->_M_color == _S_rb_tree_red))
+ return false;
+
+ if (__L && _M_key_compare(_S_key(__x), _S_key(__L)))
+ return false;
+ if (__R && _M_key_compare(_S_key(__R), _S_key(__x)))
+ return false;
+
+ if (!__L && !__R && __black_count(__x, _M_root()) != __len)
+ return false;
+ }
+
+ if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root()))
+ return false;
+ if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root()))
+ return false;
+
+ return true;
+}
+#endif /* _STLP_DEBUG */
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#undef _Rb_tree
+#undef __iterator__
+#undef iterator
+#undef __size_type__
+
+#endif /* _STLP_TREE_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_TREE_H
+#define _STLP_INTERNAL_TREE_H
+
+/*
+
+Red-black tree class, designed for use in implementing STL
+associative containers (set, multiset, map, and multimap). The
+insertion and deletion algorithms are based on those in Cormen,
+Leiserson, and Rivest, Introduction to Algorithms (MIT Press, 1990),
+except that
+
+(1) the header cell is maintained with links not only to the root
+but also to the leftmost node of the tree, to enable constant time
+begin(), and to the rightmost node of the tree, to enable linear time
+performance when used with the generic set algorithms (set_union,
+etc.);
+
+(2) when a node being deleted has two children its successor node is
+relinked into its place, rather than copied, so that the only
+iterators invalidated are those referring to the deleted node.
+
+*/
+
+#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
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+typedef bool _Rb_tree_Color_type;
+//const _Rb_tree_Color_type _S_rb_tree_red = false;
+//const _Rb_tree_Color_type _S_rb_tree_black = true;
+
+#define _S_rb_tree_red false
+#define _S_rb_tree_black true
+
+struct _Rb_tree_node_base {
+ typedef _Rb_tree_Color_type _Color_type;
+ typedef _Rb_tree_node_base* _Base_ptr;
+
+ _Color_type _M_color;
+ _Base_ptr _M_parent;
+ _Base_ptr _M_left;
+ _Base_ptr _M_right;
+
+ static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x) {
+ while (__x->_M_left != 0) __x = __x->_M_left;
+ return __x;
+ }
+
+ static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x) {
+ while (__x->_M_right != 0) __x = __x->_M_right;
+ return __x;
+ }
+};
+
+template <class _Value>
+struct _Rb_tree_node : public _Rb_tree_node_base {
+ _Value _M_value_field;
+ __TRIVIAL_STUFF(_Rb_tree_node)
+};
+
+struct _Rb_tree_base_iterator;
+
+template <class _Dummy>
+class _Rb_global {
+public:
+ typedef _Rb_tree_node_base* _Base_ptr;
+ // those used to be global functions
+ static void _STLP_CALL _Rebalance(_Base_ptr __x, _Base_ptr& __root);
+ static _Base_ptr _STLP_CALL _Rebalance_for_erase(_Base_ptr __z,
+ _Base_ptr& __root,
+ _Base_ptr& __leftmost,
+ _Base_ptr& __rightmost);
+ // those are from _Rb_tree_base_iterator - moved here to reduce code bloat
+ // moved here to reduce code bloat without templatizing _Rb_tree_base_iterator
+ static _Base_ptr _STLP_CALL _M_increment (_Base_ptr);
+ static _Base_ptr _STLP_CALL _M_decrement (_Base_ptr);
+ static void _STLP_CALL _Rotate_left (_Base_ptr __x, _Base_ptr& __root);
+ static void _STLP_CALL _Rotate_right(_Base_ptr __x, _Base_ptr& __root);
+};
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_global<bool>;
+# endif
+
+typedef _Rb_global<bool> _Rb_global_inst;
+
+struct _Rb_tree_base_iterator {
+ typedef _Rb_tree_node_base* _Base_ptr;
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+ _Base_ptr _M_node;
+ _Rb_tree_base_iterator() : _M_node(0) {}
+ _Rb_tree_base_iterator(_Base_ptr __x) : _M_node(__x) {}
+};
+
+template <class _Value, class _Traits>
+struct _Rb_tree_iterator : public _Rb_tree_base_iterator {
+ typedef _Value value_type;
+ typedef typename _Traits::reference reference;
+ typedef typename _Traits::pointer pointer;
+ typedef _Rb_tree_iterator<_Value, _Traits> _Self;
+ typedef _Rb_tree_node_base* _Base_ptr;
+ typedef _Rb_tree_node<_Value>* _Link_type;
+
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _Rb_tree_iterator<_Value, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Rb_tree_iterator<_Value, _ConstTraits> const_iterator;
+
+ _Rb_tree_iterator() {}
+#if !defined (_STLP_DEBUG)
+ /* In STL debug mode we need this constructor implicit for the pointer
+ * specialization implementation.
+ */
+ explicit
+#endif
+ _Rb_tree_iterator(_Base_ptr __x) : _Rb_tree_base_iterator(__x) {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Rb_tree_iterator(const iterator& __it) : _Rb_tree_base_iterator(__it._M_node) {}
+
+ reference operator*() const {
+ return __STATIC_CAST(_Link_type, _M_node)->_M_value_field;
+ }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ _M_node = _Rb_global_inst::_M_increment(_M_node);
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+
+ _Self& operator--() {
+ _M_node = _Rb_global_inst::_M_decrement(_M_node);
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+
+ bool operator == (const_iterator __rhs) const {
+ return _M_node == __rhs._M_node;
+ }
+ bool operator != (const_iterator __rhs) const {
+ return _M_node != __rhs._M_node;
+ }
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Value, class _Traits>
+struct __type_traits<_STLP_PRIV _Rb_tree_iterator<_Value, _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 _Value, class _Traits>
+inline _Value* value_type(const _STLP_PRIV _Rb_tree_iterator<_Value, _Traits>&)
+{ return (_Value*)0; }
+inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _Rb_tree_base_iterator&)
+{ return bidirectional_iterator_tag(); }
+inline ptrdiff_t* distance_type(const _STLP_PRIV _Rb_tree_base_iterator&)
+{ return (ptrdiff_t*) 0; }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+// Base class to help EH
+
+template <class _Tp, class _Alloc>
+class _Rb_tree_base {
+public:
+ typedef _Rb_tree_node_base _Node_base;
+ typedef _Rb_tree_node<_Tp> _Node;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type;
+private:
+ typedef _Rb_tree_base<_Tp, _Alloc> _Self;
+ typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator_type;
+ typedef _STLP_alloc_proxy<_Node_base, _Node, _M_node_allocator_type> _AllocProxy;
+
+public:
+ allocator_type get_allocator() const {
+ return _STLP_CONVERT_ALLOCATOR(_M_header, _Tp);
+ }
+
+protected:
+ _Rb_tree_base(const allocator_type& __a) :
+ _M_header(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base() ) {
+ _M_empty_initialize();
+ }
+ _Rb_tree_base(__move_source<_Self> src) :
+ _M_header(__move_source<_AllocProxy>(src.get()._M_header)) {
+ _M_rebind(&src.get()._M_header._M_data);
+ src.get()._M_empty_initialize();
+ }
+ void _M_empty_initialize() {
+ _M_header._M_data._M_color = _S_rb_tree_red; // used to distinguish header from
+ // __root, in iterator.operator++
+ _M_header._M_data._M_parent = 0;
+ _M_header._M_data._M_left = &_M_header._M_data;
+ _M_header._M_data._M_right = &_M_header._M_data;
+ }
+
+ void _M_rebind(_Node_base *__static_node) {
+ if (_M_header._M_data._M_parent != 0) {
+ _M_header._M_data._M_parent->_M_parent = &_M_header._M_data;
+ }
+ if (_M_header._M_data._M_right == __static_node) {
+ _M_header._M_data._M_right = &_M_header._M_data;
+ }
+ if (_M_header._M_data._M_left == __static_node) {
+ _M_header._M_data._M_left = &_M_header._M_data;
+ }
+ }
+
+ _AllocProxy _M_header;
+};
+
+#if defined (_STLP_DEBUG)
+# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree)
+#endif
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits,
+ _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
+class _Rb_tree : public _Rb_tree_base<_Value, _Alloc> {
+ typedef _Rb_tree_base<_Value, _Alloc> _Base;
+ typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self;
+protected:
+ typedef _Rb_tree_node_base * _Base_ptr;
+ typedef _Rb_tree_node<_Value> _Node;
+ typedef _Node* _Link_type;
+ typedef _Rb_tree_Color_type _Color_type;
+public:
+ typedef _Key key_type;
+ typedef _Value value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef const value_type* const_pointer;
+ typedef typename _Traits::reference reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef bidirectional_iterator_tag _Iterator_category;
+ typedef typename _Base::allocator_type allocator_type;
+
+protected:
+
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+ _Base_ptr _M_create_node(const value_type& __x) {
+ _Link_type __tmp = this->_M_header.allocate(1);
+ _STLP_TRY {
+ _Copy_Construct(&__tmp->_M_value_field, __x);
+ }
+ _STLP_UNWIND(this->_M_header.deallocate(__tmp,1))
+ _S_left(__tmp) = 0;
+ _S_right(__tmp) = 0;
+ return __tmp;
+ }
+
+ _Base_ptr _M_clone_node(_Base_ptr __x) {
+ _Base_ptr __tmp = _M_create_node(_S_value(__x));
+ _S_color(__tmp) = _S_color(__x);
+ return __tmp;
+ }
+
+ size_type _M_node_count; // keeps track of size of tree
+ _Compare _M_key_compare;
+
+ _Base_ptr _M_root() const
+ { return this->_M_header._M_data._M_parent; }
+ _Base_ptr _M_leftmost() const
+ { return this->_M_header._M_data._M_left; }
+ _Base_ptr _M_rightmost() const
+ { return this->_M_header._M_data._M_right; }
+
+ _Base_ptr& _M_root()
+ { return this->_M_header._M_data._M_parent; }
+ _Base_ptr& _M_leftmost()
+ { return this->_M_header._M_data._M_left; }
+ _Base_ptr& _M_rightmost()
+ { return this->_M_header._M_data._M_right; }
+
+ static _Base_ptr& _STLP_CALL _S_left(_Base_ptr __x)
+ { return __x->_M_left; }
+ static _Base_ptr& _STLP_CALL _S_right(_Base_ptr __x)
+ { return __x->_M_right; }
+ static _Base_ptr& _STLP_CALL _S_parent(_Base_ptr __x)
+ { return __x->_M_parent; }
+ static value_type& _STLP_CALL _S_value(_Base_ptr __x)
+ { return __STATIC_CAST(_Link_type, __x)->_M_value_field; }
+ static const _Key& _STLP_CALL _S_key(_Base_ptr __x)
+ { return _KeyOfValue()(_S_value(__x));}
+ static _Color_type& _STLP_CALL _S_color(_Base_ptr __x)
+ { return (_Color_type&)(__x->_M_color); }
+
+ static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x)
+ { return _Rb_tree_node_base::_S_minimum(__x); }
+
+ static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x)
+ { return _Rb_tree_node_base::_S_maximum(__x); }
+
+public:
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Rb_tree_iterator<value_type, _NonConstTraits> iterator;
+ typedef _Rb_tree_iterator<value_type, _ConstTraits> const_iterator;
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+private:
+ iterator _M_insert(_Base_ptr __parent, const value_type& __val, _Base_ptr __on_left = 0, _Base_ptr __on_right = 0);
+ _Base_ptr _M_copy(_Base_ptr __x, _Base_ptr __p);
+ void _M_erase(_Base_ptr __x);
+
+public:
+ // allocation/deallocation
+ _Rb_tree()
+ : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(_Compare())
+ {}
+
+ _Rb_tree(const _Compare& __comp)
+ : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(__comp)
+ {}
+
+ _Rb_tree(const _Compare& __comp, const allocator_type& __a)
+ : _Rb_tree_base<_Value, _Alloc>(__a), _M_node_count(0), _M_key_compare(__comp)
+ {}
+
+ _Rb_tree(const _Self& __x)
+ : _Rb_tree_base<_Value, _Alloc>(__x.get_allocator()),
+ _M_node_count(0), _M_key_compare(__x._M_key_compare) {
+ if (__x._M_root() != 0) {
+ _S_color(&this->_M_header._M_data) = _S_rb_tree_red;
+ _M_root() = _M_copy(__x._M_root(), &this->_M_header._M_data);
+ _M_leftmost() = _S_minimum(_M_root());
+ _M_rightmost() = _S_maximum(_M_root());
+ }
+ _M_node_count = __x._M_node_count;
+ }
+
+ _Rb_tree(__move_source<_Self> src)
+ : _Rb_tree_base<_Value, _Alloc>(__move_source<_Base>(src.get())),
+ _M_node_count(src.get()._M_node_count),
+ _M_key_compare(_AsMoveSource(src.get()._M_key_compare)) {
+ src.get()._M_node_count = 0;
+ }
+
+ ~_Rb_tree() { clear(); }
+ _Self& operator=(const _Self& __x);
+
+public:
+ // accessors:
+ _Compare key_comp() const { return _M_key_compare; }
+
+ iterator begin() { return iterator(_M_leftmost()); }
+ const_iterator begin() const { return const_iterator(_M_leftmost()); }
+ iterator end() { return iterator(&this->_M_header._M_data); }
+ const_iterator end() const { return const_iterator(__CONST_CAST(_Base_ptr, &this->_M_header._M_data)); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(begin()); }
+ bool empty() const { return _M_node_count == 0; }
+ size_type size() const { return _M_node_count; }
+ size_type max_size() const { return size_type(-1); }
+
+ void swap(_Self& __t) {
+ if (__t.empty()) {
+ if (this->empty()) return;
+ __t._M_header.swap(this->_M_header);
+ __t._M_rebind(&this->_M_header._M_data);
+ this->_M_empty_initialize();
+ }
+ else if (this->empty()) {
+ __t.swap(*this);
+ return;
+ }
+ else {
+ this->_M_header.swap(__t._M_header);
+ this->_M_rebind(&__t._M_header._M_data);
+ __t._M_rebind(&this->_M_header._M_data);
+ }
+ _STLP_STD::swap(_M_node_count, __t._M_node_count);
+ _STLP_STD::swap(_M_key_compare, __t._M_key_compare);
+ }
+
+public:
+ // insert/erase
+ pair<iterator,bool> insert_unique(const value_type& __x);
+ iterator insert_equal(const value_type& __x);
+
+ iterator insert_unique(iterator __pos, const value_type& __x);
+ iterator insert_equal(iterator __pos, const value_type& __x);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template<class _II> void insert_equal(_II __first, _II __last) {
+ for ( ; __first != __last; ++__first)
+ insert_equal(*__first);
+ }
+ template<class _II> void insert_unique(_II __first, _II __last) {
+ for ( ; __first != __last; ++__first)
+ insert_unique(*__first);
+ }
+#else
+ void insert_unique(const_iterator __first, const_iterator __last) {
+ for ( ; __first != __last; ++__first)
+ insert_unique(*__first);
+ }
+ void insert_unique(const value_type* __first, const value_type* __last) {
+ for ( ; __first != __last; ++__first)
+ insert_unique(*__first);
+ }
+ void insert_equal(const_iterator __first, const_iterator __last) {
+ for ( ; __first != __last; ++__first)
+ insert_equal(*__first);
+ }
+ void insert_equal(const value_type* __first, const value_type* __last) {
+ for ( ; __first != __last; ++__first)
+ insert_equal(*__first);
+ }
+#endif
+
+ void erase(iterator __pos) {
+ _Base_ptr __x = _Rb_global_inst::_Rebalance_for_erase(__pos._M_node,
+ this->_M_header._M_data._M_parent,
+ this->_M_header._M_data._M_left,
+ this->_M_header._M_data._M_right);
+ _STLP_STD::_Destroy(&_S_value(__x));
+ this->_M_header.deallocate(__STATIC_CAST(_Link_type, __x), 1);
+ --_M_node_count;
+ }
+
+ size_type erase(const key_type& __x) {
+ pair<iterator,iterator> __p = equal_range(__x);
+ size_type __n = distance(__p.first, __p.second);
+ erase(__p.first, __p.second);
+ return __n;
+ }
+
+ size_type erase_unique(const key_type& __x) {
+ iterator __i = find(__x);
+ if (__i._M_node != &this->_M_header._M_data) {
+ erase(__i);
+ return 1;
+ }
+ return 0;
+ }
+
+ void erase(iterator __first, iterator __last) {
+ if (__first._M_node == this->_M_header._M_data._M_left && // begin()
+ __last._M_node == &this->_M_header._M_data) // end()
+ clear();
+ else
+ while (__first != __last) erase(__first++);
+ }
+
+ void erase(const key_type* __first, const key_type* __last) {
+ while (__first != __last) erase(*__first++);
+ }
+
+ void clear() {
+ if (_M_node_count != 0) {
+ _M_erase(_M_root());
+ _M_leftmost() = &this->_M_header._M_data;
+ _M_root() = 0;
+ _M_rightmost() = &this->_M_header._M_data;
+ _M_node_count = 0;
+ }
+ }
+
+public:
+ // set operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __k) { return iterator(_M_find(__k)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __k) const { return const_iterator(_M_find(__k)); }
+private:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Base_ptr _M_find(const _KT& __k) const {
+ _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); // Last node which is not less than __k.
+ _Base_ptr __x = _M_root(); // Current node.
+
+ while (__x != 0)
+ if (!_M_key_compare(_S_key(__x), __k))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+
+ if (__y != &this->_M_header._M_data) {
+ if (_M_key_compare(__k, _S_key(__y))) {
+ __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data);
+ }
+ }
+ return __y;
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Base_ptr _M_lower_bound(const _KT& __k) const {
+ _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is not less than __k. */
+ _Base_ptr __x = _M_root(); /* Current node. */
+
+ while (__x != 0)
+ if (!_M_key_compare(_S_key(__x), __k))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+
+ return __y;
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Base_ptr _M_upper_bound(const _KT& __k) const {
+ _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is greater than __k. */
+ _Base_ptr __x = _M_root(); /* Current node. */
+
+ while (__x != 0)
+ if (_M_key_compare(__k, _S_key(__x)))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+
+ return __y;
+ }
+
+public:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const {
+ pair<const_iterator, const_iterator> __p = equal_range(__x);
+ return distance(__p.first, __p.second);
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return iterator(_M_lower_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return const_iterator(_M_lower_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return iterator(_M_upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return const_iterator(_M_upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x)
+ { return pair<iterator, iterator>(lower_bound(__x), upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const
+ { return pair<const_iterator, const_iterator>(lower_bound(__x), upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range_unique(const _KT& __x) {
+ pair<iterator, iterator> __p;
+ __p.second = lower_bound(__x);
+ if (__p.second._M_node != &this->_M_header._M_data &&
+ !_M_key_compare(__x, _S_key(__p.second._M_node))) {
+ __p.first = __p.second++;
+ }
+ else {
+ __p.first = __p.second;
+ }
+ return __p;
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range_unique(const _KT& __x) const {
+ pair<const_iterator, const_iterator> __p;
+ __p.second = lower_bound(__x);
+ if (__p.second._M_node != &this->_M_header._M_data &&
+ !_M_key_compare(__x, _S_key(__p.second._M_node))) {
+ __p.first = __p.second++;
+ }
+ else {
+ __p.first = __p.second;
+ }
+ return __p;
+ }
+
+#if defined (_STLP_DEBUG)
+public:
+ // Debugging.
+ bool __rb_verify() const;
+#endif //_STLP_DEBUG
+};
+
+#if defined (_STLP_DEBUG)
+# undef _Rb_tree
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_tree.c>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_tree.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Compare, class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER _STLP_PRIV _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Key, class _Compare, class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+struct __move_traits<_STLP_PRIV _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> >
+ : _STLP_PRIV __move_traits_help2<_Compare, _Alloc> {};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_TREE_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_TYPEINFO
+#define _STLP_INTERNAL_TYPEINFO
+
+#if !defined (_STLP_NO_TYPEINFO)
+
+# if defined (_STLP_NO_NEW_NEW_HEADER)
+# include <typeinfo.h>
+# else
+# ifdef _STLP_BROKEN_BAD_CAST_CLASS
+# define bad_cast _STLP_NULLIFIED_BROKEN_BAD_CAST_CLASS
+# endif
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo)
+# ifdef _STLP_BROKEN_BAD_CAST_CLASS
+# undef bad_cast
+# undef _STLP_NULLIFIED_BROKEN_BAD_CAST_CLASS
+# endif
+# endif
+
+# if (defined(_STLP_MSVC) && (_STLP_MSVC >= 1300)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800))
+// In .NET, <typeinfo> actually includes <typeinfo.h>
+# undef _STLP_OLDSTD_typeinfo
+# endif
+
+// if <typeinfo.h> already included, do not import anything
+# if defined(_STLP_USE_NAMESPACES) && !defined(_STLP_OLDSTD_typeinfo) && \
+ (defined(_STLP_VENDOR_GLOBAL_EXCEPT_STD) || \
+ defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_DEBUG))
+# if defined(_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined(_STLP_WCE_NET)
+class bad_cast : public exception {};
+# endif
+
+_STLP_BEGIN_NAMESPACE
+// VC 6 and eVC 4 have type_info in the global namespace
+# if (defined(_STLP_MSVC) && (_STLP_MSVC < 1300)) || defined(_STLP_WCE_NET)
+using ::type_info;
+# else
+using _STLP_VENDOR_EXCEPT_STD::type_info;
+# endif
+
+# if !(defined (__MRC__) || defined (__SC__) || defined (__DMC__))
+using _STLP_VENDOR_EXCEPT_STD::bad_typeid;
+# endif
+
+//#if defined( __xlC__ ) && (__xlC__ < 0x500)
+//# include <exception>
+//struct bad_cast : exception {};
+//#endif
+# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined (_STLP_WCE_NET)
+using ::bad_cast;
+# else
+using _STLP_VENDOR_EXCEPT_STD::bad_cast;
+# endif
+
+_STLP_END_NAMESPACE
+
+# endif
+
+#else
+
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+# if !defined (__DMC__)
+struct bad_cast : exception {};
+# endif
+_STLP_END_NAMESPACE
+#endif
+
+#endif
--- /dev/null
+/*
+ *
+ * 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_UNINITIALIZED_H
+#define _STLP_INTERNAL_UNINITIALIZED_H
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// uninitialized_copy
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, _Distance*) {
+ _OutputIter __cur = __result;
+ _STLP_TRY {
+ for ( ; __first != __last; ++__first, ++__cur)
+ _Param_Construct(&*__cur, *__first);
+ return __cur;
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
+ _STLP_RET_AFTER_THROW(__cur)
+}
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const input_iterator_tag &, _Distance* __d)
+{ return __ucopy(__first, __last, __result, __d); }
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const forward_iterator_tag &, _Distance* __d)
+{ return __ucopy(__first, __last, __result, __d); }
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const bidirectional_iterator_tag &, _Distance* __d)
+{ return __ucopy(__first, __last, __result, __d); }
+#endif
+
+template <class _RandomAccessIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last,
+ _OutputIter __result, const random_access_iterator_tag &, _Distance*) {
+ _OutputIter __cur = __result;
+ _STLP_TRY {
+ for (_Distance __n = __last - __first; __n > 0; --__n) {
+ _Param_Construct(&*__cur, *__first);
+ ++__first;
+ ++__cur;
+ }
+ return __cur;
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
+ _STLP_RET_AFTER_THROW(__cur)
+}
+
+//Used internaly
+template <class _RandomAccessIter, class _OutputIter>
+inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last, _OutputIter __result)
+{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); }
+
+inline void*
+__ucopy_trivial(const void* __first, const void* __last, void* __result) {
+ //dums: this version can use memcpy (__copy_trivial can't)
+ return (__last == __first) ? __result :
+ ((char*)memcpy(__result, __first, ((const char*)__last - (const char*)__first))) +
+ ((const char*)__last - (const char*)__first);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*TrivialUCopy*/)
+{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); }
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*TrivialUCopy*/) {
+ // we know they all pointers, so this cast is OK
+ // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result));
+ return (_OutputIter)__ucopy_trivial(__first, __last, __result);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*BothPtrType*/) {
+ return __ucopy_ptrs(__first, __last, __result,
+ _UseTrivialUCopy(_STLP_VALUE_TYPE(__first, _InputIter),
+ _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*BothPtrType*/) {
+ return __ucopy(__first, __last, __result,
+ _STLP_ITERATOR_CATEGORY(__first, _InputIter),
+ _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _ForwardIter>
+inline _ForwardIter
+uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result)
+{ return _STLP_PRIV __ucopy_aux(__first, __last, __result, _BothPtrType< _InputIter, _ForwardIter>::_Answer()); }
+
+inline char*
+uninitialized_copy(const char* __first, const char* __last, char* __result)
+{ return (char*)_STLP_PRIV __ucopy_trivial(__first, __last, __result); }
+
+# if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97
+inline wchar_t*
+uninitialized_copy(const wchar_t* __first, const wchar_t* __last, wchar_t* __result)
+{ return (wchar_t*)_STLP_PRIV __ucopy_trivial (__first, __last, __result); }
+# endif
+
+// uninitialized_copy_n (not part of the C++ standard)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _Size, class _ForwardIter>
+_STLP_INLINE_LOOP
+pair<_InputIter, _ForwardIter>
+__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result,
+ const input_iterator_tag &) {
+ _ForwardIter __cur = __result;
+ _STLP_TRY {
+ for ( ; __count > 0 ; --__count, ++__first, ++__cur)
+ _Param_Construct(&*__cur, *__first);
+ return pair<_InputIter, _ForwardIter>(__first, __cur);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
+ _STLP_RET_AFTER_THROW((pair<_InputIter, _ForwardIter>(__first, __cur)))
+}
+
+# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIter, class _Size, class _ForwardIterator>
+inline pair<_InputIter, _ForwardIterator>
+__ucopy_n(_InputIter __first, _Size __count,
+ _ForwardIterator __result,
+ const forward_iterator_tag &)
+{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); }
+
+template <class _InputIter, class _Size, class _ForwardIterator>
+inline pair<_InputIter, _ForwardIterator>
+__ucopy_n(_InputIter __first, _Size __count,
+ _ForwardIterator __result,
+ const bidirectional_iterator_tag &)
+{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); }
+# endif
+
+template <class _RandomAccessIter, class _Size, class _ForwardIter>
+inline pair<_RandomAccessIter, _ForwardIter>
+__ucopy_n(_RandomAccessIter __first, _Size __count, _ForwardIter __result,
+ const random_access_iterator_tag &) {
+ _RandomAccessIter __last = __first + __count;
+ return pair<_RandomAccessIter, _ForwardIter>(__last, uninitialized_copy(__first, __last, __result));
+}
+
+// This is used internally in <rope> , which is extension itself.
+template <class _InputIter, class _Size, class _ForwardIter>
+inline pair<_InputIter, _ForwardIter>
+__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result)
+{ return _STLP_PRIV __ucopy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _Size, class _ForwardIter>
+inline pair<_InputIter, _ForwardIter>
+uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result)
+{ return _STLP_PRIV __ucopy_n(__first, __count, __result); }
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#endif
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x, _Distance*) {
+ _ForwardIter __cur = __first;
+ _STLP_TRY {
+ for ( ; __cur != __last; ++__cur)
+ _Param_Construct(&*__cur, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
+}
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const input_iterator_tag &, _Distance* __d)
+{ __ufill(__first, __last, __x, __d); }
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const forward_iterator_tag &, _Distance* __d)
+{ __ufill(__first, __last, __x, __d); }
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const bidirectional_iterator_tag &, _Distance* __d)
+{ __ufill(__first, __last, __x, __d); }
+#endif
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const random_access_iterator_tag &, _Distance*) {
+ _ForwardIter __cur = __first;
+ _STLP_TRY {
+ for (_Distance __n = __last - __first; __n > 0; --__n, ++__cur)
+ _Param_Construct(&*__cur, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+inline void uninitialized_fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x) {
+ _STLP_PRIV __ufill(__first, __last, __x,
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+// Specialization: for one-byte types we can use memset.
+inline void uninitialized_fill(unsigned char* __first, unsigned char* __last,
+ const unsigned char& __val) {
+ unsigned char __tmp = __val;
+ memset(__first, __tmp, __last - __first);
+}
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+inline void uninitialized_fill(signed char* __first, signed char* __last,
+ const signed char& __val) {
+ signed char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+#endif
+inline void uninitialized_fill(char* __first, char* __last, const char& __val) {
+ char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x) {
+ _ForwardIter __cur = __first;
+ _STLP_TRY {
+ for ( ; __n > 0; --__n, ++__cur)
+ _Param_Construct(&*__cur, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
+ return __cur;
+}
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const input_iterator_tag &)
+{ return __ufill_n(__first, __n, __x); }
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const forward_iterator_tag &)
+{ return __ufill_n(__first, __n, __x); }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const bidirectional_iterator_tag &)
+{ return __ufill_n(__first, __n, __x); }
+#endif
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) {
+ _ForwardIter __last = __first + __n;
+ __ufill(__first, __last, __x, random_access_iterator_tag(), (ptrdiff_t*)0);
+ return __last;
+}
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const random_access_iterator_tag &)
+{ return __uninitialized_fill_n(__first, __n, __x); }
+
+/* __uninitialized_init is an internal algo to init a range with a value
+ * built using default constructor. It is only called with pointer as
+ * iterator.
+ */
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& __val,
+ const __false_type& /*_HasDefaultZero*/)
+{ return __uninitialized_fill_n(__first, __n, __val); }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& __val,
+ const __true_type& /*_HasDefaultZero*/) {
+ memset((unsigned char*)__first, 0, __n * sizeof(_Tp));
+ return __first + __n;
+}
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp&,
+ const __true_type& /*_TrivialInit*/)
+{ return __first + __n; }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp& __val,
+ const __false_type& /*_TrivialInit*/)
+{ return __uinit_aux_aux(__first, __n, __val, _HasDefaultZeroValue(__first)._Answer()); }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uninitialized_init(_ForwardIter __first, _Size __n, const _Tp& __val)
+{ return __uinit_aux(__first, __n, __val, _UseTrivialInit(__first)._Answer()); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline void
+uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x)
+{ _STLP_PRIV __ufill_n(__first, __n, __x, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); }
+
+// Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill,
+// __uninitialized_fill_copy.
+
+// __uninitialized_copy_copy
+// Copies [first1, last1) into [result, result + (last1 - first1)), and
+// copies [first2, last2) into
+// [result + (last1 - first1), result + (last1 - first1) + (last2 - first2)).
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _ForwardIter>
+inline _ForwardIter
+__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _ForwardIter __result)
+{ return uninitialized_copy(__first2, __last2, uninitialized_copy(__first1, __last1, __result)); }
+
+// __uninitialized_fill_copy
+// Fills [result, mid) with x, and copies [first, last) into
+// [mid, mid + (last - first)).
+template <class _ForwardIter, class _Tp, class _InputIter>
+inline _ForwardIter
+__uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid, const _Tp& __x,
+ _InputIter __first, _InputIter __last) {
+ uninitialized_fill(__result, __mid, __x);
+ _STLP_TRY {
+ return uninitialized_copy(__first, __last, __mid);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __mid))
+ _STLP_RET_AFTER_THROW(__result)
+}
+
+// __uninitialized_copy_fill
+// Copies [first1, last1) into [first2, first2 + (last1 - first1)), and
+// fills [first2 + (last1 - first1), last2) with x.
+template <class _Iter, class _Tp>
+inline void
+__uninitialized_copy_fill(_Iter __first1, _Iter __last1, _Iter __first2, _Iter __last2,
+ const _Tp& __x) {
+ _Iter __mid2 = uninitialized_copy(__first1, __last1, __first2);
+ _STLP_TRY {
+ uninitialized_fill(__mid2, __last2, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first2, __mid2))
+}
+
+/* __uninitialized_move:
+ * This function is used internaly and only with pointers as iterators.
+ */
+template <class _InputIter, class _ForwardIter, class _TrivialUCpy>
+inline _ForwardIter
+__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result,
+ _TrivialUCpy __trivial_ucpy, const __false_type& /*_Movable*/)
+{ return __ucopy_ptrs(__first, __last, __result, __trivial_ucpy); }
+
+template <class _InputIter, class _ForwardIter, class _TrivialUCpy>
+_STLP_INLINE_LOOP
+_ForwardIter
+__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result,
+ _TrivialUCpy , const __true_type& /*_Movable*/) {
+ //Move constructor should not throw so we do not need to take care of exceptions here.
+ for (ptrdiff_t __n = __last - __first ; __n > 0; --__n) {
+ _Move_Construct(&*__result, *__first);
+ ++__first; ++__result;
+ }
+ return __result;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_UNINITIALIZED_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 2004
+ * 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.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_UNORDERED_MAP_H
+#define _STLP_INTERNAL_UNORDERED_MAP_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMapTraitsT, 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(const _Key, _Tp) >
+class unordered_map
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+#if !defined (__DMC__)
+ typedef pair<const key_type, data_type> value_type;
+#else
+ typedef pair<key_type, data_type> value_type;
+#endif
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedMapTraitsT<value_type> _UnorderedMapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _UnorderedMapTraits,
+ _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::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() 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:
+ explicit unordered_map(size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+ unordered_map(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_map(_InputIterator __f, _InputIterator __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#else
+ unordered_map(const value_type* __f, const value_type* __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ unordered_map(const_iterator __f, const_iterator __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ 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); }
+
+ 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(); }
+
+ pair<iterator,bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+ iterator insert(const_iterator /*__hint*/, 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 value_type* __f, const value_type* __l)
+ { _M_ht.insert_unique(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+#endif /*_STLP_MEMBER_TEMPLATES */
+ { _M_ht.insert_unique(__f, __l); }
+
+ _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); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultimapTraitsT, 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(const _Key, _Tp) >
+class unordered_multimap
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+#if !defined (__DMC__)
+ typedef pair<const key_type, data_type> value_type;
+#else
+ typedef pair<key_type, data_type> value_type;
+#endif
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedMultimapTraitsT<value_type> _UnorderedMultimapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _UnorderedMultimapTraits,
+ _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::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() 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:
+ explicit unordered_multimap(size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+ unordered_multimap(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_multimap(_InputIterator __f, _InputIterator __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#else
+ unordered_multimap(const value_type* __f, const value_type* __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ unordered_multimap(const_iterator __f, const_iterator __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ 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); }
+
+ 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(); }
+
+ iterator insert(const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+ iterator insert(const_iterator /*__hint*/, const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __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)
+#endif /*_STLP_MEMBER_TEMPLATES */
+ { _M_ht.insert_equal(__f, __l); }
+
+ _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); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER unordered_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
+
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER unordered_multimap<_Key,_Tp,_HashFcn,_EqlKey,_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 unordered_map
+// and unordered_multimap.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef unordered_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<unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef unordered_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_UNORDERED_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 2004
+ * 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.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_UNORDERED_SET_H
+#define _STLP_INTERNAL_UNORDERED_SET_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedSetTraitsT, Const_traits)
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>),
+ _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
+class unordered_set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedSetTraitsT<_Value> _UnorderedSetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _UnorderedSetTraits, _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::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() 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:
+ explicit unordered_set(size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+ unordered_set(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_set(_InputIterator __f, _InputIterator __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#else
+ unordered_set(const value_type* __f, const value_type* __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ unordered_set(const_iterator __f, const_iterator __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ 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); }
+
+ 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(); }
+
+ pair<iterator, bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+ iterator insert(const_iterator /*__hint*/, 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); }
+
+ _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); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultisetTraitsT, Const_traits)
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>),
+ _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
+class unordered_multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedMultisetTraitsT<_Value> _UnorderedMultisetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _UnorderedMultisetTraits, _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::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() 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:
+ explicit unordered_multiset(size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+ unordered_multiset(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_multiset(_InputIterator __f, _InputIterator __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#else
+ unordered_multiset(const value_type* __f, const value_type* __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ unordered_multiset(const_iterator __f, const_iterator __l,
+ size_type __n = 100, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ 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); }
+
+ 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(); }
+
+ iterator insert(const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+ iterator insert(const_iterator /*__hint*/, const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __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)
+#endif /*_STLP_MEMBER_TEMPLATES */
+ { _M_ht.insert_equal(__f, __l); }
+
+ _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); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER unordered_set<_Value,_HashFcn,_EqualKey,_Alloc>
+
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER unordered_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 unordered_set
+// and unordered_multiset.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename unordered_set<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef unordered_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<unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef unordered_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_UNORDERED_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ *
+ *
+ * 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_VALARRAY_C
+#define _STLP_VALARRAY_C
+
+#ifndef _STLP_VALARRAY_H
+# include <stl/_valarray.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+_Valarray_bool valarray<_Tp>:: operator!() const {
+ _Valarray_bool __tmp(this->size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ __tmp[__i] = !(*this)[__i];
+ return __tmp;
+}
+
+// Behavior is undefined if __x and *this have different sizes
+template <class _Tp>
+valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __x)
+{
+ size_t __index = __x._M_slice.start();
+ for (size_t __i = 0;
+ __i < __x._M_slice.size();
+ ++__i, __index += __x._M_slice.stride())
+ (*this)[__i] = __x._M_array[__index];
+ return *this;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::operator[](slice __slice) const {
+ valarray<_Tp> __tmp(__slice.size(), _NoInit());
+ size_t __index = __slice.start();
+ for (size_t __i = 0;
+ __i < __slice.size();
+ ++__i, __index += __slice.stride())
+ __tmp[__i] = (*this)[__index];
+ return __tmp;
+}
+
+template <class _Size>
+bool _Gslice_Iter_tmpl<_Size>::_M_incr() {
+ size_t __dim = _M_indices.size() - 1;
+ ++_M_step;
+ for (;;) {
+ _M_1d_idx += _M_gslice._M_strides[__dim];
+ if (++_M_indices[__dim] != _M_gslice._M_lengths[__dim])
+ return true;
+ else if (__dim != 0) {
+ _M_1d_idx -= _M_gslice._M_strides[__dim] * _M_gslice._M_lengths[__dim];
+ _M_indices[__dim] = 0;
+ --__dim;
+ }
+ else
+ return false;
+ }
+}
+
+// Behavior is undefined if __x and *this have different sizes, or if
+// __x was constructed from a degenerate gslice.
+template <class _Tp>
+valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __x)
+{
+ if (this->size() != 0) {
+ _Gslice_Iter __i(__x._M_gslice);
+ do
+ (*this)[__i._M_step] = __x._M_array[__i._M_1d_idx];
+ while(__i._M_incr());
+ }
+ return *this;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::operator[](const gslice& __slice) const
+{
+ valarray<_Tp> __tmp(__slice._M_size(), _NoInit());
+ if (__tmp.size() != 0) {
+ _Gslice_Iter __i(__slice);
+ do __tmp[__i._M_step] = (*this)[__i._M_1d_idx]; while(__i._M_incr());
+ }
+ return __tmp;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) const
+{
+ size_t _p_size = 0;
+ {
+ for (size_t __i = 0; __i < __mask.size(); ++__i)
+ if (__mask[__i]) ++_p_size;
+ }
+
+ valarray<_Tp> __tmp(_p_size, _NoInit());
+ size_t __idx = 0;
+ {
+ for (size_t __i = 0; __i < __mask.size(); ++__i)
+ if (__mask[__i]) __tmp[__idx++] = (*this)[__i];
+ }
+
+ return __tmp;
+}
+
+template <class _Tp>
+valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __x) {
+ for (size_t __i = 0; __i < __x._M_addr.size(); ++__i)
+ (*this)[__i] = __x._M_array[__x._M_addr[__i]];
+ return *this;
+}
+
+template <class _Tp>
+valarray<_Tp>
+valarray<_Tp>::operator[](const _Valarray_size_t& __addr) const
+{
+ valarray<_Tp> __tmp(__addr.size(), _NoInit());
+ for (size_t __i = 0; __i < __addr.size(); ++__i)
+ __tmp[__i] = (*this)[__addr[__i]];
+ return __tmp;
+}
+
+//----------------------------------------------------------------------
+// Other valarray noninline member functions
+
+// Shift and cshift
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::shift(int __n) const
+{
+ valarray<_Tp> __tmp(this->size());
+
+ if (__n >= 0) {
+ if (__n < this->size())
+ copy(this->_M_first + __n, this->_M_first + this->size(),
+ __tmp._M_first);
+ }
+ else {
+ if (-__n < this->size())
+ copy(this->_M_first, this->_M_first + this->size() + __n,
+ __tmp._M_first - __n);
+ }
+ return __tmp;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::cshift(int __m) const
+{
+ valarray<_Tp> __tmp(this->size());
+
+ // Reduce __m to an equivalent number in the range [0, size()). We
+ // have to be careful with negative numbers, since the sign of a % b
+ // is unspecified when a < 0.
+ long __n = __m;
+ if (this->size() < (numeric_limits<long>::max)())
+ __n %= long(this->size());
+ if (__n < 0)
+ __n += this->size();
+
+ copy(this->_M_first, this->_M_first + __n,
+ __tmp._M_first + (this->size() - __n));
+ copy(this->_M_first + __n, this->_M_first + this->size(),
+ __tmp._M_first);
+
+ return __tmp;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_VALARRAY_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_VALARRAY_H
+#define _STLP_VALARRAY_H
+
+#ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NEW
+# include <stl/_new.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMERIC_H
+# include <stl/_numeric.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+/* As we only need the _STLP_ASSERT macro from _debug.h we test it to include _debug.h */
+#ifndef _STLP_ASSERT
+# include <stl/debug/_debug.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class slice;
+class gslice;
+
+template <class _Tp> class valarray;
+typedef valarray<bool> _Valarray_bool;
+typedef valarray<size_t> _Valarray_size_t;
+
+template <class _Tp> class slice_array;
+template <class _Tp> class gslice_array;
+template <class _Tp> class mask_array;
+template <class _Tp> class indirect_array;
+
+//----------------------------------------------------------------------
+// class valarray
+
+// Base class to handle memory allocation and deallocation. We can't just
+// use vector<>, because vector<bool> would be unsuitable as an internal
+// representation for valarray<bool>.
+
+template <class _Tp>
+struct _Valarray_base
+{
+ _Tp* _M_first;
+ size_t _M_size;
+
+ _Valarray_base() : _M_first(0), _M_size(0) {}
+ _Valarray_base(size_t __n) : _M_first(0), _M_size(0) { _M_allocate(__n); }
+ ~_Valarray_base() { _M_deallocate(); }
+
+ void _M_allocate(size_t __n) {
+ if (__n != 0) {
+ _M_first = __STATIC_CAST(_Tp*, (malloc(__n * sizeof(_Tp))));
+ _M_size = __n;
+#if !defined(_STLP_NO_BAD_ALLOC) && defined(_STLP_USE_EXCEPTIONS)
+ if (_M_first == 0) {
+ _M_size = 0;
+ throw _STLP_STD::bad_alloc();
+ }
+#endif
+ }
+ else {
+ _M_first = 0;
+ _M_size = 0;
+ }
+ }
+
+ void _M_deallocate() {
+ free(_M_first);
+ _M_first = 0;
+ _M_size = 0;
+ }
+};
+
+template <class _Tp>
+class valarray : private _Valarray_base<_Tp>
+{
+ friend class gslice;
+
+public:
+ typedef _Tp value_type;
+
+ // Basic constructors
+ valarray() : _Valarray_base<_Tp>() {}
+ explicit valarray(size_t __n) : _Valarray_base<_Tp>(__n)
+ { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+ valarray(const value_type& __x, size_t __n) : _Valarray_base<_Tp>(__n)
+ { uninitialized_fill_n(this->_M_first, this->_M_size, __x); }
+ valarray(const value_type* __p, size_t __n) : _Valarray_base<_Tp>(__n)
+ { uninitialized_copy(__p, __p + __n, this->_M_first); }
+ valarray(const valarray<_Tp>& __x) : _Valarray_base<_Tp>(__x._M_size) {
+ uninitialized_copy(__x._M_first, __x._M_first + __x._M_size,
+ this->_M_first);
+ }
+
+ // Constructors from auxiliary array types
+ valarray(const slice_array<_Tp>&);
+ valarray(const gslice_array<_Tp>&);
+ valarray(const mask_array<_Tp>&);
+ valarray(const indirect_array<_Tp>&);
+
+ // Destructor
+ ~valarray() { _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size); }
+
+ // Extension: constructor that doesn't initialize valarray elements to a
+ // specific value. This is faster for types such as int and double.
+private:
+ void _M_initialize(const __true_type&) {}
+ void _M_initialize(const __false_type&)
+ { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+
+public:
+ struct _NoInit {};
+ valarray(size_t __n, _NoInit) : _Valarray_base<_Tp>(__n) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ }
+
+public: // Assignment
+ // Basic assignment. Note that 'x = y' is undefined if x.size() != y.size()
+ valarray<_Tp>& operator=(const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ if (this != &__x)
+ copy(__x._M_first, __x._M_first + __x._M_size, this->_M_first);
+ return *this;
+ }
+
+ // Scalar assignment
+ valarray<_Tp>& operator=(const value_type& __x) {
+ fill_n(this->_M_first, this->_M_size, __x);
+ return *this;
+ }
+
+ // Assignment of auxiliary array types
+ valarray<_Tp>& operator=(const slice_array<_Tp>&);
+ valarray<_Tp>& operator=(const gslice_array<_Tp>&);
+ valarray<_Tp>& operator=(const mask_array<_Tp>&);
+ valarray<_Tp>& operator=(const indirect_array<_Tp>&);
+
+public: // Element access
+ value_type operator[](size_t __n) const { return this->_M_first[__n]; }
+ value_type& operator[](size_t __n) { return this->_M_first[__n]; }
+ size_t size() const { return this->_M_size; }
+
+public: // Subsetting operations with auxiliary type
+ valarray<_Tp> operator[](slice) const;
+ slice_array<_Tp> operator[](slice);
+ valarray<_Tp> operator[](const gslice&) const;
+ gslice_array<_Tp> operator[](const gslice&);
+ valarray<_Tp> operator[](const _Valarray_bool&) const;
+ mask_array<_Tp> operator[](const _Valarray_bool&);
+ valarray<_Tp> operator[](const _Valarray_size_t&) const;
+ indirect_array<_Tp> operator[](const _Valarray_size_t&);
+
+public: // Unary operators.
+ valarray<_Tp> operator+() const { return *this; }
+
+ valarray<_Tp> operator-() const {
+ valarray<_Tp> __tmp(this->size(), _NoInit());
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ __tmp[__i] = -(*this)[__i];
+ return __tmp;
+ }
+
+ valarray<_Tp> operator~() const {
+ valarray<_Tp> __tmp(this->size(), _NoInit());
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ __tmp[__i] = ~(*this)[__i];
+ return __tmp;
+ }
+
+ _Valarray_bool operator!() const;
+
+public: // Scalar computed assignment.
+ valarray<_Tp>& operator*= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] *= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator/= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] /= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator%= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] %= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator+= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] += __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator-= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] -= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator^= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] ^= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator&= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] &= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator|= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] |= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator<<= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] <<= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator>>= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] >>= __x;
+ return *this;
+ }
+
+public: // Array computed assignment.
+ valarray<_Tp>& operator*= (const valarray<_Tp>& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] *= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator/= (const valarray<_Tp>& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] /= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator%= (const valarray<_Tp>& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] %= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator+= (const valarray<_Tp>& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] += __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator-= (const valarray<_Tp>& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] -= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator^= (const valarray<_Tp>& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] ^= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator&= (const valarray<_Tp>& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] &= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator|= (const valarray<_Tp>& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] |= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator<<= (const valarray<_Tp>& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] <<= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator>>= (const valarray<_Tp>& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] >>= __x[__i];
+ return *this;
+ }
+
+public: // Other member functions.
+
+ // The result is undefined for zero-length arrays
+ value_type sum() const {
+ return accumulate(this->_M_first + 1, this->_M_first + this->_M_size,
+ (*this)[0]);
+ }
+
+ // The result is undefined for zero-length arrays
+ value_type (min) () const {
+ return *min_element(this->_M_first + 0, this->_M_first + this->_M_size);
+ }
+
+ value_type (max) () const {
+ return *max_element(this->_M_first + 0, this->_M_first + this->_M_size);
+ }
+
+ valarray<_Tp> shift(int __n) const;
+ valarray<_Tp> cshift(int __n) const;
+
+ valarray<_Tp> apply(value_type __f(value_type)) const {
+ valarray<_Tp> __tmp(this->size());
+ transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first,
+ __f);
+ return __tmp;
+ }
+ valarray<_Tp> apply(value_type __f(const value_type&)) const {
+ valarray<_Tp> __tmp(this->size());
+ transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first,
+ __f);
+ return __tmp;
+ }
+
+ void resize(size_t __n, value_type __x = value_type()) {
+ _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size);
+ _Valarray_base<_Tp>::_M_deallocate();
+ _Valarray_base<_Tp>::_M_allocate(__n);
+ uninitialized_fill_n(this->_M_first, this->_M_size, __x);
+ }
+};
+
+//----------------------------------------------------------------------
+// valarray non-member functions.
+
+// Binary arithmetic operations between two arrays. Behavior is
+// undefined if the two arrays do not have the same length.
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] * __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] / __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] % __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] + __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] - __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] ^ __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] & __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] | __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] << __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >> __y[__i];
+ return __tmp;
+}
+
+// Binary arithmetic operations between an array and a scalar.
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] * __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator*(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c * __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] / __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator/(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c / __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] % __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator%(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c % __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] + __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator+(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c + __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] - __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator-(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c - __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] ^ __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator^(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c ^ __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] & __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator&(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c & __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] | __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator|(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c | __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] << __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator<<(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c << __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >> __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator>>(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c >> __x[__i];
+ return __tmp;
+}
+
+// Binary logical operations between two arrays. Behavior is undefined
+// if the two arrays have different lengths. Note that operator== does
+// not do what you might at first expect.
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] == __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] < __y[__i];
+ return __tmp;
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] != __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] > __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] <= __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >= __y[__i];
+ return __tmp;
+}
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+// fbp : swap ?
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] && __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] || __y[__i];
+ return __tmp;
+}
+
+// Logical operations between an array and a scalar.
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x, const _Tp& __c)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] == __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator==(const _Tp& __c, const valarray<_Tp>& __x)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c == __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x, const _Tp& __c)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] != __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator!=(const _Tp& __c, const valarray<_Tp>& __x)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c != __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x, const _Tp& __c)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] < __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<(const _Tp& __c, const valarray<_Tp>& __x)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c < __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x, const _Tp& __c)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] > __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>(const _Tp& __c, const valarray<_Tp>& __x)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c > __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x, const _Tp& __c)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] <= __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<=(const _Tp& __c, const valarray<_Tp>& __x)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c <= __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x, const _Tp& __c)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >= __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>=(const _Tp& __c, const valarray<_Tp>& __x)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c >= __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x, const _Tp& __c)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] && __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator&&(const _Tp& __c, const valarray<_Tp>& __x)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c && __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x, const _Tp& __c)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] || __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator||(const _Tp& __c, const valarray<_Tp>& __x)
+{
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c || __x[__i];
+ return __tmp;
+}
+
+// valarray "transcendentals" (the list includes abs and sqrt, which,
+// of course, are not transcendental).
+
+template <class _Tp>
+inline valarray<_Tp> abs(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::abs(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> acos(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::acos(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> asin(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::asin(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan2(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan2(__x[__i], __y[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan2(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan2(__x[__i], __c);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan2(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan2(__c, __x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> cos(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::cos(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> cosh(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::cosh(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> exp(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::exp(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> log(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::log(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> log10(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::log10(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> pow(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::pow(__x[__i], __y[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> pow(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::pow(__x[__i], __c);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> pow(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::pow(__c, __x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> sin(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::sin(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> sinh(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::sinh(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> sqrt(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::sqrt(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> tan(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::tan(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> tanh(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::tanh(__x[__i]);
+ return __tmp;
+}
+
+//----------------------------------------------------------------------
+// slice and slice_array
+
+class slice {
+public:
+ slice() : _M_start(0), _M_length(0), _M_stride(0) {}
+ slice(size_t __start, size_t __length, size_t __stride)
+ : _M_start(__start), _M_length(__length), _M_stride(__stride)
+ {}
+ __TRIVIAL_DESTRUCTOR(slice)
+
+ size_t start() const { return _M_start; }
+ size_t size() const { return _M_length; }
+ size_t stride() const { return _M_stride; }
+
+private:
+ size_t _M_start;
+ size_t _M_length;
+ size_t _M_stride;
+};
+
+template <class _Tp>
+class slice_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] = __x[__i];
+ }
+
+ void operator*=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] *= __x[__i];
+ }
+
+ void operator/=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] /= __x[__i];
+ }
+
+ void operator%=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] %= __x[__i];
+ }
+
+ void operator+=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] += __x[__i];
+ }
+
+ void operator-=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] -= __x[__i];
+ }
+
+ void operator^=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] ^= __x[__i];
+ }
+
+ void operator&=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] &= __x[__i];
+ }
+
+ void operator|=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] |= __x[__i];
+ }
+
+ void operator<<=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] <<= __x[__i];
+ }
+
+ void operator>>=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] >>= __x[__i];
+ }
+
+ void operator=(const value_type& __c) /*const could be const but standard says NO (26.3.5.4-1)*/ {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] = __c;
+ }
+
+ ~slice_array() {}
+
+private:
+ slice_array(const slice& __slice, valarray<_Tp>& __array)
+ : _M_slice(__slice), _M_array(__array)
+ {}
+
+ slice _M_slice;
+ valarray<_Tp>& _M_array;
+
+private: // Disable assignment and default constructor
+ slice_array();
+ slice_array(const slice_array&);
+ slice_array& operator=(const slice_array&);
+};
+
+// valarray member functions dealing with slice and slice_array
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const slice_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_slice.size()) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+
+template <class _Tp>
+inline slice_array<_Tp> valarray<_Tp>::operator[](slice __slice) {
+ return slice_array<_Tp>(__slice, *this);
+}
+
+//----------------------------------------------------------------------
+// gslice and gslice_array
+
+template <class _Size>
+struct _Gslice_Iter_tmpl;
+
+class gslice {
+ friend struct _Gslice_Iter_tmpl<size_t>;
+public:
+ gslice() : _M_start(0), _M_lengths(0), _M_strides(0) {}
+ gslice(size_t __start,
+ const _Valarray_size_t& __lengths, const _Valarray_size_t& __strides)
+ : _M_start(__start), _M_lengths(__lengths), _M_strides(__strides)
+ {}
+ __TRIVIAL_DESTRUCTOR(gslice)
+
+ size_t start() const { return _M_start; }
+ _Valarray_size_t size() const { return _M_lengths; }
+ _Valarray_size_t stride() const { return _M_strides; }
+
+ // Extension: check for an empty gslice.
+ bool _M_empty() const { return _M_lengths.size() == 0; }
+
+ // Extension: number of indices this gslice represents. (For a degenerate
+ // gslice, they're not necessarily all distinct.)
+ size_t _M_size() const {
+ return !this->_M_empty()
+ ? accumulate(_M_lengths._M_first + 1,
+ _M_lengths._M_first + _M_lengths._M_size,
+ _M_lengths[0],
+ multiplies<size_t>())
+ : 0;
+ }
+
+# ifndef __HP_aCC
+private:
+# endif
+
+ size_t _M_start;
+ _Valarray_size_t _M_lengths;
+ _Valarray_size_t _M_strides;
+};
+
+// This is not an STL iterator. It is constructed from a gslice, and it
+// steps through the gslice indices in sequence. See 23.3.6 of the C++
+// standard, paragraphs 2-3, for an explanation of the sequence. At
+// each step we get two things: the ordinal (i.e. number of steps taken),
+// and the one-dimensional index.
+
+template <class _Size>
+struct _Gslice_Iter_tmpl {
+ _Gslice_Iter_tmpl(const gslice& __gslice)
+ : _M_step(0), _M_1d_idx(__gslice.start()),
+ _M_indices(size_t(0), __gslice._M_lengths.size()),
+ _M_gslice(__gslice)
+ {}
+
+ bool _M_done() const { return _M_indices[0] == _M_gslice._M_lengths[0]; }
+
+ bool _M_incr();
+
+ _Size _M_step;
+ _Size _M_1d_idx;
+
+ valarray<_Size> _M_indices;
+ const gslice& _M_gslice;
+};
+
+typedef _Gslice_Iter_tmpl<size_t> _Gslice_Iter;
+
+template <class _Tp>
+class gslice_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] = __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator*= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] *= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator/= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] /= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator%= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] %= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator+= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] += __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator-= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] -= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator^= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] ^= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator&= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] &= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator|= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] |= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator<<= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] <<= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator>>= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] >>= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator= (const value_type& __c) /*const could be const but standard says NO (26.3.7.4-1)*/ {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] = __c; while(__i._M_incr());
+ }
+ }
+
+ ~gslice_array() {}
+
+private:
+ gslice_array(const gslice& __gslice, valarray<_Tp>& __array)
+ : _M_gslice(__gslice), _M_array(__array)
+ {}
+
+ gslice _M_gslice;
+ valarray<value_type>& _M_array;
+
+private: // Disable assignment
+ void operator=(const gslice_array<_Tp>&);
+};
+
+// valarray member functions dealing with gslice and gslice_array. Note
+// that it is illegal (behavior is undefined) to construct a gslice_array
+// from a degenerate gslice.
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const gslice_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_gslice._M_size()) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+template <class _Tp>
+inline gslice_array<_Tp> valarray<_Tp>::operator[](const gslice& __slice) {
+ return gslice_array<_Tp>(__slice, *this);
+}
+
+
+//----------------------------------------------------------------------
+// mask_array
+
+template <class _Tp>
+class mask_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] = __x[__idx++];
+ }
+
+ void operator*=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] *= __x[__idx++];
+ }
+
+ void operator/=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] /= __x[__idx++];
+ }
+
+ void operator%=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] %= __x[__idx++];
+ }
+
+ void operator+=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] += __x[__idx++];
+ }
+
+ void operator-=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] -= __x[__idx++];
+ }
+
+ void operator^=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] ^= __x[__idx++];
+ }
+
+ void operator&=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] &= __x[__idx++];
+ }
+
+ void operator|=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] |= __x[__idx++];
+ }
+
+ void operator<<=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] <<= __x[__idx++];
+ }
+
+ void operator>>=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] >>= __x[__idx++];
+ }
+
+ void operator=(const value_type& __c) const {
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] = __c;
+ }
+
+ ~mask_array() {}
+
+ // Extension: number of true values in the mask
+ size_t _M_num_true() const {
+ size_t __result = 0;
+ for (size_t __i = 0; __i < _M_mask.size(); ++__i)
+ if (_M_mask[__i]) ++__result;
+ return __result;
+ }
+
+private:
+ mask_array(const _Valarray_bool& __mask, valarray<_Tp>& __array)
+ : _M_mask(__mask), _M_array(__array)
+ {}
+
+ _Valarray_bool _M_mask;
+ valarray<_Tp>& _M_array;
+
+private: // Disable assignment
+ void operator=(const mask_array<_Tp>&);
+};
+
+// valarray member functions dealing with mask_array
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const mask_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_num_true())
+{
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+// Behavior is undefined if __x._M_num_true() != this->size()
+template <class _Tp>
+inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<_Tp>& __x) {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < __x._M_array.size(); ++__i)
+ if (__x._M_mask[__i]) (*this)[__idx++] = __x._M_array[__i];
+ return *this;
+}
+
+template <class _Tp>
+inline mask_array<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask)
+{
+ return mask_array<_Tp>(__mask, *this);
+}
+
+
+//----------------------------------------------------------------------
+// indirect_array
+
+template <class _Tp>
+class indirect_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] = __x[__i];
+ }
+
+ void operator*=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] *= __x[__i];
+ }
+
+ void operator/=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] /= __x[__i];
+ }
+
+ void operator%=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] %= __x[__i];
+ }
+
+ void operator+=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] += __x[__i];
+ }
+
+ void operator-=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] -= __x[__i];
+ }
+
+ void operator^=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] ^= __x[__i];
+ }
+
+ void operator&=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] &= __x[__i];
+ }
+
+ void operator|=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] |= __x[__i];
+ }
+
+ void operator<<=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] <<= __x[__i];
+ }
+
+ void operator>>=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] >>= __x[__i];
+ }
+
+ void operator=(const value_type& __c) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] = __c;
+ }
+
+ ~indirect_array() {}
+
+private:
+ indirect_array(const _Valarray_size_t& __addr, valarray<_Tp>& __array)
+ : _M_addr(__addr), _M_array(__array)
+ {}
+
+ _Valarray_size_t _M_addr;
+ valarray<_Tp>& _M_array;
+
+private: // Disable assignment
+ void operator=(const indirect_array<_Tp>&);
+};
+
+// valarray member functions dealing with indirect_array
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const indirect_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_addr.size())
+{
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+
+template <class _Tp>
+inline indirect_array<_Tp>
+valarray<_Tp>::operator[](const _Valarray_size_t& __addr)
+{
+ return indirect_array<_Tp>(__addr, *this);
+}
+
+_STLP_END_NAMESPACE
+
+# if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_valarray.c>
+# endif
+
+#endif /* _STLP_VALARRAY */
+
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ *
+ * 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_VECTOR_C
+#define _STLP_VECTOR_C
+
+#if !defined (_STLP_INTERNAL_VECTOR_H)
+# include <stl/_vector.h>
+#endif
+
+#include <stl/_range_errors.h>
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Alloc>
+void _Vector_base<_Tp,_Alloc>::_M_throw_length_error() const {
+ __stl_throw_length_error("vector");
+}
+
+template <class _Tp, class _Alloc>
+void _Vector_base<_Tp, _Alloc>::_M_throw_out_of_range() const {
+ __stl_throw_out_of_range("vector");
+}
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define vector _STLP_PTR_IMPL_NAME(vector)
+#elif defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define __iterator__ _Tp*
+#else
+# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE vector<_Tp, _Alloc>::iterator
+#endif
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::reserve(size_type __n) {
+ if (capacity() < __n) {
+ if (max_size() < __n) {
+ this->_M_throw_length_error();
+ }
+
+ const size_type __old_size = size();
+ pointer __tmp;
+ if (this->_M_start) {
+ __tmp = _M_allocate_and_copy(__n, this->_M_start, this->_M_finish);
+ _M_clear();
+ } else {
+ __tmp = this->_M_end_of_storage.allocate(__n, __n);
+ }
+ _M_set(__tmp, __tmp + __old_size, __tmp + __n);
+ }
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*DO NOT USE!!*/,
+ size_type __fill_len, bool __atend ) {
+ const size_type __old_size = size();
+ size_type __len = __old_size + (max)(__old_size, __fill_len);
+
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable());
+ // handle insertion
+ if (__fill_len == 1) {
+ _Copy_Construct(__new_finish, __x);
+ ++__new_finish;
+ } else
+ __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __fill_len, __x);
+ if (!__atend)
+ __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable()); // copy remainder
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ _M_clear_after_move();
+ _M_set(__new_start, __new_finish, __new_start + __len);
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/,
+ size_type __fill_len, bool __atend ) {
+ const size_type __old_size = size();
+ size_type __len = __old_size + (max)(__old_size, __fill_len);
+
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(this->_M_start, __pos, __new_start));
+ // handle insertion
+ __new_finish = _STLP_PRIV __fill_n(__new_finish, __fill_len, __x);
+ if (!__atend)
+ __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(__pos, this->_M_finish, __new_finish)); // copy remainder
+ _M_clear();
+ _M_set(__new_start, __new_finish, __new_start + __len);
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
+ const _Tp& __x, const __true_type& /*_Movable*/) {
+ if (_M_is_inside(__x)) {
+ _Tp __x_copy = __x;
+ _M_fill_insert_aux(__pos, __n, __x_copy, __true_type());
+ return;
+ }
+ iterator __src = this->_M_finish - 1;
+ iterator __dst = __src + __n;
+ for (; __src >= __pos; --__dst, --__src) {
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ _STLP_STD::_Destroy_Moved(__src);
+ }
+ _STLP_PRIV __uninitialized_fill_n(__pos, __n, __x);
+ this->_M_finish += __n;
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_insert_aux (iterator __pos, size_type __n,
+ const _Tp& __x, const __false_type& /*_Movable*/) {
+ //Here self referencing needs to be checked even for non movable types.
+ if (_M_is_inside(__x)) {
+ _Tp __x_copy = __x;
+ _M_fill_insert_aux(__pos, __n, __x_copy, __false_type());
+ return;
+ }
+ const size_type __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after > __n) {
+ _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __n;
+ _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy());
+ _STLP_STD::fill(__pos, __pos + __n, __x);
+ } else {
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - __elems_after, __x);
+ _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __elems_after;
+ _STLP_STD::fill(__pos, __old_finish, __x);
+ }
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_insert(iterator __pos,
+ size_type __n, const _Tp& __x) {
+ if (__n != 0) {
+ if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) {
+ _M_fill_insert_aux(__pos, __n, __x, _Movable());
+ } else
+ _M_insert_overflow(__pos, __x, _TrivialCopy(), __n);
+ }
+}
+
+template <class _Tp, class _Alloc>
+vector<_Tp, _Alloc>& vector<_Tp, _Alloc>::operator = (const vector<_Tp, _Alloc>& __x) {
+ if (&__x != this) {
+ const size_type __xlen = __x.size();
+ if (__xlen > capacity()) {
+ size_type __len = __xlen;
+ pointer __tmp = _M_allocate_and_copy(__len, __CONST_CAST(const_pointer, __x._M_start) + 0,
+ __CONST_CAST(const_pointer, __x._M_finish) + 0);
+ _M_clear();
+ this->_M_start = __tmp;
+ this->_M_end_of_storage._M_data = this->_M_start + __len;
+ } else if (size() >= __xlen) {
+ pointer __i = _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + 0,
+ __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_start, _TrivialCopy());
+ _STLP_STD::_Destroy_Range(__i, this->_M_finish);
+ } else {
+ _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start),
+ __CONST_CAST(const_pointer, __x._M_start) + size(), this->_M_start, _TrivialCopy());
+ _STLP_PRIV __ucopy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + size(),
+ __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_finish, _TrivialUCopy());
+ }
+ this->_M_finish = this->_M_start + __xlen;
+ }
+ return *this;
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_assign(size_t __n, const _Tp& __val) {
+ if (__n > capacity()) {
+ vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator());
+ __tmp.swap(*this);
+ } else if (__n > size()) {
+ fill(begin(), end(), __val);
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - size(), __val);
+ } else
+ erase(_STLP_PRIV __fill_n(begin(), __n, __val), end());
+}
+
+template <class _Tp, class _Alloc>
+__iterator__
+vector<_Tp, _Alloc>::insert(iterator __pos, const _Tp& __x) {
+ size_type __n = __pos - begin();
+ _M_fill_insert(__pos, 1, __x);
+ return begin() + __n;
+}
+
+#undef __iterator__
+
+#if defined (vector)
+# undef vector
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_VECTOR_C */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_VECTOR_H
+#define _STLP_INTERNAL_VECTOR_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
+
+_STLP_BEGIN_NAMESPACE
+
+// The vector base class serves one purpose, its constructor and
+// destructor allocate (but don't initialize) storage. This makes
+// exception safety easier.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Alloc>
+class _Vector_base {
+public:
+ typedef _Vector_base<_Tp, _Alloc> _Self;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type;
+ typedef _Tp* pointer;
+ typedef _STLP_alloc_proxy<pointer, _Tp, allocator_type> _AllocProxy;
+
+ _Vector_base(const _Alloc& __a)
+ : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) {}
+
+ _Vector_base(size_t __n, const _Alloc& __a)
+ : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) {
+ _M_start = _M_end_of_storage.allocate(__n, __n);
+ _M_finish = _M_start;
+ _M_end_of_storage._M_data = _M_start + __n;
+ _STLP_MPWFIX_TRY _STLP_MPWFIX_CATCH
+ }
+
+ _Vector_base(__move_source<_Self> src)
+ : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
+ _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) {
+ //Set the source as empty:
+ src.get()._M_finish = src.get()._M_end_of_storage._M_data = src.get()._M_start = 0;
+ }
+
+ ~_Vector_base() {
+ if (_M_start != _STLP_DEFAULT_CONSTRUCTED(pointer))
+ _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start);
+ }
+
+protected:
+ void _STLP_FUNCTION_THROWS _M_throw_length_error() const;
+ void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
+
+ pointer _M_start;
+ pointer _M_finish;
+ _AllocProxy _M_end_of_storage;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define vector _STLP_PTR_IMPL_NAME(vector)
+#elif defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
+class vector : protected _STLP_PRIV _Vector_base<_Tp, _Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector)
+ , public __stlport_class<vector<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_PRIV _Vector_base<_Tp, _Alloc> _Base;
+ typedef vector<_Tp, _Alloc> _Self;
+public:
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+
+ 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_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_end_of_storage, _Tp); }
+
+private:
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#else
+ typedef __false_type _Movable;
+#endif
+
+ // handles insertions on overflow
+ void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*_Movable*/,
+ size_type __fill_len, bool __atend);
+ void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __true_type& /*_Movable*/,
+ size_type __fill_len, bool __atend) {
+ //We need to take care of self referencing here:
+ if (_M_is_inside(__x)) {
+ value_type __x_copy = __x;
+ _M_insert_overflow_aux(__pos, __x_copy, __false_type(), __fill_len, __atend);
+ return;
+ }
+ _M_insert_overflow_aux(__pos, __x, __false_type(), __fill_len, __atend);
+ }
+
+ void _M_insert_overflow(pointer __pos, const _Tp& __x, const __false_type& /*_TrivialCopy*/,
+ size_type __fill_len, bool __atend = false)
+ { _M_insert_overflow_aux(__pos, __x, _Movable(), __fill_len, __atend); }
+ void _M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/,
+ size_type __fill_len, bool __atend = false);
+ void _M_range_check(size_type __n) const {
+ if (__n >= size_type(this->_M_finish - this->_M_start))
+ this->_M_throw_out_of_range();
+ }
+
+public:
+ iterator begin() { return this->_M_start; }
+ const_iterator begin() const { return this->_M_start; }
+ iterator end() { return this->_M_finish; }
+ const_iterator end() const { return this->_M_finish; }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return size_type(this->_M_finish - this->_M_start); }
+ size_type max_size() const {
+ size_type __vector_max_size = size_type(-1) / sizeof(_Tp);
+ typename allocator_type::size_type __alloc_max_size = this->_M_end_of_storage.max_size();
+ return (__alloc_max_size < __vector_max_size)?__alloc_max_size:__vector_max_size;
+ }
+
+ size_type capacity() const { return size_type(this->_M_end_of_storage._M_data - this->_M_start); }
+ bool empty() const { return this->_M_start == this->_M_finish; }
+
+ reference operator[](size_type __n) { return *(begin() + __n); }
+ const_reference operator[](size_type __n) const { return *(begin() + __n); }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(end() - 1); }
+ const_reference back() const { return *(end() - 1); }
+
+ 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]; }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(const allocator_type& __a = allocator_type())
+#else
+ vector()
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) {}
+ vector(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) {}
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+private:
+ //We always call _M_initialize with only 1 parameter. Default parameter
+ //is used to allow explicit instanciation of vector with types with no
+ //default constructor.
+ void _M_initialize(size_type __n, const _Tp& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp))
+ { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, __val); }
+public:
+ explicit vector(size_type __n)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
+ { _M_initialize(__n); }
+ vector(size_type __n, const _Tp& __val, const allocator_type& __a = allocator_type())
+#else
+ explicit vector(size_type __n)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
+ { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+ vector(size_type __n, const _Tp& __val)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
+ { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); }
+ vector(size_type __n, const _Tp& __val, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, __a)
+ { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); }
+
+ vector(const _Self& __x)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__x.size(), __x.get_allocator())
+ { this->_M_finish = _STLP_PRIV __ucopy_ptrs(__x.begin(), __x.end(), this->_M_start, _TrivialUCopy()); }
+
+ vector(__move_source<_Self> src)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__move_source<_Base>(src.get()))
+ {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+private:
+ template <class _Integer>
+ void _M_initialize_aux(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/) {
+ size_type __real_n;
+ this->_M_start = this->_M_end_of_storage.allocate(__n, __real_n);
+ this->_M_end_of_storage._M_data = this->_M_start + __real_n;
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_initialize_aux(_InputIterator __first, _InputIterator __last,
+ const __false_type& /*_IsIntegral*/)
+ { _M_range_initialize(__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>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL )
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_aux(__first, __last, _Integral());
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_aux(__first, __last, _Integral());
+ }
+# endif /* _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS */
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ vector(const _Tp* __first, const _Tp* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__last - __first, __a)
+ { this->_M_finish = _STLP_PRIV __ucopy_ptrs(__first, __last, this->_M_start, _TrivialUCopy()); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ //As the vector container is a back insert oriented container it
+ //seems rather logical to destroy elements in reverse order.
+ ~vector() { _STLP_STD::_Destroy_Range(rbegin(), rend()); }
+
+ _Self& operator=(const _Self& __x);
+
+ void reserve(size_type __n);
+
+ // 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); }
+ void _M_fill_assign(size_type __n, const _Tp& __val);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIter>
+ void _M_assign_aux(_ForwardIter __first, _ForwardIter __last, const forward_iterator_tag &) {
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ typedef const_iterator _ForwardIter;
+#endif
+ const size_type __len = distance(__first, __last);
+ if (__len > capacity()) {
+ size_type __n = __len;
+ iterator __tmp = _M_allocate_and_copy(__n, __first, __last);
+ _M_clear();
+ _M_set(__tmp, __tmp + __len, __tmp + __n);
+ }
+ else if (size() >= __len) {
+ iterator __new_finish = copy(__first, __last, this->_M_start);
+ _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ }
+ else {
+ _ForwardIter __mid = __first;
+ advance(__mid, size());
+ copy(__first, __mid, this->_M_start);
+ this->_M_finish = uninitialized_copy(__mid, __last, this->_M_finish);
+ }
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ 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 _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/)
+ { _M_fill_assign(__n, __val); }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/)
+ { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
+
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void push_back(const _Tp& __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ if (this->_M_finish != this->_M_end_of_storage._M_data) {
+ _Copy_Construct(this->_M_finish, __x);
+ ++this->_M_finish;
+ }
+ else
+ _M_insert_overflow(this->_M_finish, __x, _TrivialCopy(), 1UL, true);
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp));
+#else
+ iterator insert(iterator __pos, const _Tp& __x);
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_back() { push_back(_STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+ iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void swap(_Self& __x) {
+ _STLP_STD::swap(this->_M_start, __x._M_start);
+ _STLP_STD::swap(this->_M_finish, __x._M_finish);
+ this->_M_end_of_storage.swap(__x._M_end_of_storage);
+ }
+
+private:
+ void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __true_type& /*_Movable*/);
+ void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __false_type& /*_Movable*/);
+ void _M_fill_insert (iterator __pos, size_type __n, const _Tp& __x);
+
+ bool _M_is_inside(const value_type& __x) const {
+ return (&__x >= this->_M_start && &__x < this->_M_finish);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ void _M_range_insert_realloc(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+#else
+ void _M_range_insert_realloc(iterator __pos,
+ const_iterator __first, const_iterator __last,
+#endif /* _STLP_MEMBER_TEMPLATES */
+ size_type __n) {
+ const size_type __old_size = size();
+ size_type __len = __old_size + (max)(__old_size, __n);
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable());
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable());
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ _M_clear_after_move();
+ _M_set(__new_start, __new_finish, __new_start + __len);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ void _M_range_insert_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+#else
+ void _M_range_insert_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+#endif /* _STLP_MEMBER_TEMPLATES */
+ size_type __n, const __true_type& /*_Movable*/) {
+ iterator __src = this->_M_finish - 1;
+ iterator __dst = __src + __n;
+ for (; __src >= __pos; --__dst, --__src) {
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ _STLP_STD::_Destroy_Moved(__src);
+ }
+ uninitialized_copy(__first, __last, __pos);
+ this->_M_finish += __n;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ void _M_range_insert_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+#else
+ void _M_range_insert_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+#endif /* _STLP_MEMBER_TEMPLATES */
+ size_type __n, const __false_type& /*_Movable*/) {
+ const size_type __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after > __n) {
+ _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __n;
+ _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy());
+ copy(__first, __last, __pos);
+ }
+ else {
+#if defined ( _STLP_MEMBER_TEMPLATES )
+ _ForwardIterator __mid = __first;
+ advance(__mid, __elems_after);
+#else
+ const_pointer __mid = __first + __elems_after;
+#endif
+ uninitialized_copy(__mid, __last, this->_M_finish);
+ this->_M_finish += __n - __elems_after;
+ _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __elems_after;
+ copy(__first, __mid, __pos);
+ } /* elems_after */
+ }
+
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_fill_insert(__pos, (size_type) __n, (_Tp) __val); }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&)
+ { _M_range_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());
+ }
+
+private:
+ template <class _InputIterator>
+ void _M_range_insert(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first) {
+ __pos = insert(__pos, *__first);
+ ++__pos;
+ }
+ }
+
+ template <class _ForwardIterator>
+ void _M_range_insert(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+#else /* _STLP_MEMBER_TEMPLATES */
+public:
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ /* This method do not check self referencing.
+ * Standard forbids it, checked by the debug mode.
+ */
+ if (__first != __last) {
+ size_type __n = distance(__first, __last);
+
+ if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) {
+ _M_range_insert_aux(__pos, __first, __last, __n, _Movable());
+ }
+ else {
+ _M_range_insert_realloc(__pos, __first, __last, __n);
+ }
+ }
+ }
+
+public:
+ void insert (iterator __pos, size_type __n, const _Tp& __x)
+ { _M_fill_insert(__pos, __n, __x); }
+
+ void pop_back() {
+ --this->_M_finish;
+ _STLP_STD::_Destroy(this->_M_finish);
+ }
+
+private:
+ iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/) {
+ _STLP_STD::_Destroy(__pos);
+ iterator __dst = __pos, __src = __dst + 1;
+ iterator __end = end();
+ for (; __src != __end; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ _STLP_STD::_Destroy_Moved(__src);
+ }
+ this->_M_finish = __dst;
+ return __pos;
+ }
+ iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/) {
+ if (__pos + 1 != end())
+ _STLP_PRIV __copy_ptrs(__pos + 1, this->_M_finish, __pos, _TrivialCopy());
+ --this->_M_finish;
+ _STLP_STD::_Destroy(this->_M_finish);
+ return __pos;
+ }
+ iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/) {
+ iterator __dst = __first, __src = __last;
+ iterator __end = end();
+ for (; __dst != __last && __src != __end; ++__dst, ++__src) {
+ _STLP_STD::_Destroy(__dst);
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ }
+ if (__dst != __last) {
+ //There is more elements to erase than element to move:
+ _STLP_STD::_Destroy_Range(__dst, __last);
+ _STLP_STD::_Destroy_Moved_Range(__last, __end);
+ }
+ else {
+ //There is more element to move than element to erase:
+ for (; __src != __end; ++__dst, ++__src) {
+ _STLP_STD::_Destroy_Moved(__dst);
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ }
+ _STLP_STD::_Destroy_Moved_Range(__dst, __end);
+ }
+ this->_M_finish = __dst;
+ return __first;
+ }
+ iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/) {
+ pointer __i = _STLP_PRIV __copy_ptrs(__last, this->_M_finish, __first, _TrivialCopy());
+ _STLP_STD::_Destroy_Range(__i, this->_M_finish);
+ this->_M_finish = __i;
+ return __first;
+ }
+
+public:
+ iterator erase(iterator __pos) {
+ return _M_erase(__pos, _Movable());
+ }
+ iterator erase(iterator __first, iterator __last) {
+ if (__first == __last)
+ return __first;
+ return _M_erase(__first, __last, _Movable());
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void resize(size_type __new_size, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ if (__new_size < size())
+ erase(begin() + __new_size, end());
+ else
+ insert(end(), __new_size - size(), __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*/
+
+ void clear() {
+ erase(begin(), end());
+ }
+
+private:
+ void _M_clear() {
+ _STLP_STD::_Destroy_Range(rbegin(), rend());
+ this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start);
+ }
+
+ void _M_clear_after_move() {
+ _STLP_STD::_Destroy_Moved_Range(rbegin(), rend());
+ this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start);
+ }
+
+ void _M_set(pointer __s, pointer __f, pointer __e) {
+ this->_M_start = __s;
+ this->_M_finish = __f;
+ this->_M_end_of_storage._M_data = __e;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ pointer _M_allocate_and_copy(size_type& __n,
+ _ForwardIterator __first, _ForwardIterator __last)
+#else /* _STLP_MEMBER_TEMPLATES */
+ pointer _M_allocate_and_copy(size_type& __n,
+ const_pointer __first, const_pointer __last)
+#endif /* _STLP_MEMBER_TEMPLATES */
+ {
+ pointer __result = this->_M_end_of_storage.allocate(__n, __n);
+ _STLP_TRY {
+ uninitialized_copy(__first, __last, __result);
+ return __result;
+ }
+ _STLP_UNWIND(this->_M_end_of_storage.deallocate(__result, __n))
+ _STLP_RET_AFTER_THROW(__result)
+ }
+
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_range_initialize(_InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first)
+ push_back(*__first);
+ }
+ // This function is only called by the constructor.
+ template <class _ForwardIterator>
+ void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __n = distance(__first, __last);
+ this->_M_start = this->_M_end_of_storage.allocate(__n, __n);
+ this->_M_end_of_storage._M_data = this->_M_start + __n;
+ this->_M_finish = uninitialized_copy(__first, __last, this->_M_start);
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+};
+
+#if defined (vector)
+# undef vector
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_vector.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_vector.h>
+#endif
+
+//We define the bool specialization before the debug interfave
+//to benefit of the debug version of vector even for the bool
+//specialization.
+#if !defined (_STLP_NO_BOOL) || !defined (_STLP_NO_EXTENSIONS)
+# if !defined (_STLP_INTERNAL_BVECTOR_H)
+# include <stl/_bvector.h>
+# endif
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_vector.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_NO_BOOL) && !defined (_STLP_NO_EXTENSIONS)
+// This typedef is non-standard. It is provided for backward compatibility.
+typedef vector<bool, allocator<bool> > bit_vector;
+#endif
+
+#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER vector<_Tp, _Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp, class _Alloc>
+struct __move_traits<vector<_Tp, _Alloc> > {
+ typedef __stlp_movable implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
+ // disable incorrect "dependent type qualifier" error
+ typedef __false_type _Ret;
+#endif
+};
+
+# if !defined (_STLP_DEBUG)
+template <class _Tp, class _Alloc>
+struct _DefaultZeroValue<vector<_Tp, _Alloc> >
+{ typedef typename __type_traits<_Alloc>::has_trivial_default_constructor _Ret; };
+# endif
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_VECTOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * Copyright (c) 2004
+ * 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_BOOST_TYPE_TRAITS_H
+#define _STLP_BOOST_TYPE_TRAITS_H
+
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/is_float.hpp>
+#include <boost/type_traits/has_trivial_constructor.hpp>
+#include <boost/type_traits/has_trivial_copy.hpp>
+#include <boost/type_traits/has_trivial_assign.hpp>
+#include <boost/type_traits/has_trivial_destructor.hpp>
+#include <boost/type_traits/is_pod.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/is_reference.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+/*
+ * This file mostly wraps boost type_traits in the STLport type_traits.
+ * When checking a type traits like trivial assign operator for instance
+ * both the boost value and STLport values has to be taken into account
+ * as we don't know what the user might have prefer, specializing the boost
+ * type traits or the STLport one.
+ */
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp> struct _IsRef {
+ enum { _Is = ::boost::is_reference<_Tp>::value };
+ typedef typename __bool2type<_Is>::_Ret _Ret;
+};
+
+template <class _Tp> struct _IsPtr {
+ enum { is_pointer = ::boost::is_pointer<_Tp>::value };
+ typedef typename __bool2type<is_pointer>::_Ret _Ret;
+};
+
+template <class _Tp> struct _IsIntegral {
+ enum { is_integral = ::boost::is_integral<_Tp>::value };
+ typedef typename __bool2type<is_integral>::_Ret _Ret;
+};
+
+template <class _Tp> struct _IsRational {
+ enum { is_float = ::boost::is_float<_Tp>::value };
+ typedef typename __bool2type<is_float>::_Ret _Ret;
+};
+
+template <class _Tp>
+struct __type_traits {
+ enum { trivial_constructor = ::boost::has_trivial_constructor<_Tp>::value };
+ typedef typename __bool2type<trivial_constructor>::_Ret has_trivial_default_constructor;
+
+ enum { trivial_copy = ::boost::has_trivial_copy<_Tp>::value };
+ typedef typename __bool2type<trivial_copy>::_Ret has_trivial_copy_constructor;
+
+ enum { trivial_assign = ::boost::has_trivial_assign<_Tp>::value };
+ typedef typename __bool2type<trivial_assign>::_Ret has_trivial_assignment_operator;
+
+ enum { trivial_destructor = ::boost::has_trivial_destructor<_Tp>::value };
+ typedef typename __bool2type<trivial_destructor>::_Ret has_trivial_destructor;
+
+ enum { pod = ::boost::is_pod<_Tp>::value };
+ typedef typename __bool2type<pod>::_Ret is_POD_type;
+};
+
+template <class _Tp1, class _Tp2>
+struct _TrivialCopy {
+ typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
+ typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
+
+ enum { same = ::boost::is_same<uncv1, uncv2>::value };
+ typedef typename __bool2type<same>::_Ret _Same;
+
+ enum { boost_trivial_assign = ::boost::has_trivial_assign<uncv1>::value };
+ typedef typename __bool2type<boost_trivial_assign>::_Ret _BoostTrivialAssign;
+ typedef typename __type_traits<uncv1>::has_trivial_assignment_operator _STLPTrivialAssign;
+ typedef typename _Lor2<_BoostTrivialAssign, _STLPTrivialAssign>::_Ret _TrivialAssign;
+
+ typedef typename _Land2<_Same, _TrivialAssign>::_Ret _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp1, class _Tp2>
+struct _TrivialUCopy {
+ typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
+ typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
+
+ enum { same = ::boost::is_same<uncv1, uncv2>::value };
+ typedef typename __bool2type<same>::_Ret _Same;
+
+ enum { boost_trivial_copy = ::boost::has_trivial_copy<uncv1>::value };
+ typedef typename __bool2type<boost_trivial_copy>::_Ret _BoostTrivialCopy;
+ typedef typename __type_traits<uncv1>::has_trivial_copy_constructor _STLPTrivialCopy;
+ typedef typename _Lor2<_BoostTrivialCopy, _STLPTrivialCopy>::_Ret _TrivialCopy;
+
+ typedef typename _Land2<_Same, _TrivialCopy>::_Ret _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp>
+struct _DefaultZeroValue {
+ enum { is_integral = ::boost::is_integral<_Tp>::value };
+ typedef typename __bool2type<is_integral>::_Ret _IsIntegral;
+ enum { is_float = ::boost::is_float<_Tp>::value };
+ typedef typename __bool2type<is_float>::_Ret _IsFloat;
+ enum { is_pointer = ::boost::is_pointer<_Tp>::value };
+ typedef typename __bool2type<is_pointer>::_Ret _IsPointer;
+
+ typedef typename _Lor3<_IsIntegral, _IsFloat, _IsPointer>::_Ret _Ret;
+};
+
+template <class _Tp>
+struct _TrivialInit {
+ typedef typename ::boost::remove_cv<_Tp>::type uncv;
+
+ enum { boost_trivial_constructor = ::boost::has_trivial_constructor<uncv>::value };
+ typedef typename __bool2type<boost_trivial_constructor>::_Ret _BoostTrivialInit;
+ typedef typename __type_traits<uncv>::has_trivial_default_constructor _STLPTrivialInit;
+ typedef typename _Lor2<_BoostTrivialInit, _STLPTrivialInit>::_Ret _Tr1;
+
+ typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2;
+ typedef typename _Not<_Tr2>::_Ret _Tr3;
+
+ typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_BOOST_TYPE_TRAITS_H */
--- /dev/null
+/*
+ * Copyright (c) 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_C_LOCALE_H
+#define _STLP_C_LOCALE_H
+
+/*
+ * Implementation dependent definitions.
+ * Beware: This header is not a purely internal header, it is also included
+ * from the outside world when building the STLport library. So this header
+ * should not reference internal headers (stlport/stl/_*.h) directly.
+ */
+#if defined (__sgi)
+# if defined (ROOT_65) /* IRIX 6.5.x */
+# include <sgidefs.h>
+# include <standards.h>
+# include <wchar.h>
+# include <ctype.h>
+# else /* IRIX pre-6.5 */
+# include <sgidefs.h>
+# include <standards.h>
+# if !defined(_SIZE_T) && !defined(_SIZE_T_)
+# define _SIZE_T
+# if (_MIPS_SZLONG == 32)
+typedef unsigned int size_t;
+# endif
+# if (_MIPS_SZLONG == 64)
+typedef unsigned long size_t;
+# endif
+# endif
+# if !defined (_WCHAR_T)
+# define _WCHAR_T
+# if (_MIPS_SZLONG == 32)
+typedef long wchar_t;
+# endif
+# if (_MIPS_SZLONG == 64)
+typedef __int32_t wchar_t;
+# endif
+# endif /* _WCHAR_T */
+# if !defined (_WINT_T)
+# define _WINT_T
+# if (_MIPS_SZLONG == 32)
+typedef long wint_t;
+# endif
+# if (_MIPS_SZLONG == 64)
+typedef __int32_t wint_t;
+# endif
+# endif /* _WINT_T */
+# if !defined (_MBSTATE_T)
+# define _MBSTATE_T
+/* _MSC_VER check is here for historical reason and seems wrong as it is the macro defined
+ * by Microsoft compilers to give their version and we are currently in a SGI platform scope.
+ * However _MSC_VER might also be a SGI compiler macro so we keep it this way.*/
+# if defined (_MSC_VER)
+typedef int mbstate_t;
+# else
+typedef char mbstate_t;
+# endif
+# endif /* _MBSTATE_T */
+# endif /* ROOT65 */
+#else /* __sgi */
+# include <stddef.h>
+# if !defined (ANDROID)
+/* The Android wchar.h header is broken, and tries to redefine wchar_t. */
+# include <wchar.h>
+# endif
+# include <ctype.h>
+#endif /* __sgi */
+
+/*
+ * GENERAL FRAMEWORK
+ */
+
+/*
+ * Opaque types, implementation (if there is one) depends
+ * on platform locale API.
+ */
+struct _Locale_ctype;
+struct _Locale_numeric;
+struct _Locale_time;
+struct _Locale_collate;
+struct _Locale_monetary;
+struct _Locale_messages;
+struct _Locale_name_hint;
+
+/*
+ Bitmask macros.
+*/
+
+/*
+ * For narrow characters, we expose the lookup table interface.
+ */
+
+/* Internal bitmask macros, os-specific. */
+
+#if defined (__sgi) /* IRIX */
+
+# define _Locale_S 0x00000008 /* Spacing character */
+# define _Locale_A 0x00004000 /* Alphabetical characters only */
+# define _Locale_B 0x00000040 /* Obsolete: was space char only */
+# define _Locale_PR 0x00008000 /* Printable characters only */
+# define _Locale_G 0x40000000 /* Graphic characters only */
+# define _Locale_BL 0x80000000 /* The blank character class */
+
+/* Public bitmask macros, must be defined for every OS. These values, of
+ * course, are specific to IRIX. */
+
+# define _Locale_CNTRL 0x00000020 /* Control character */
+# define _Locale_UPPER 0x00000001 /* Upper case */
+# define _Locale_LOWER 0x00000002 /* Lower case */
+# define _Locale_DIGIT 0x00000004 /* Numeral (digit) */
+# define _Locale_XDIGIT 0x00000080 /* heXadecimal digit */
+# define _Locale_PUNCT 0x00000010 /* Punctuation */
+# define _Locale_SPACE (_Locale_S | _Locale_BL)
+# define _Locale_PRINT (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \
+ _Locale_DIGIT | _Locale_A | _Locale_XDIGIT | \
+ _Locale_PR)
+# define _Locale_ALPHA _Locale_A
+
+/*
+* All of these except for graph and blank are from the C standard;
+* graph and blank are XPG4. (graph in XPG4 doesn't mean quite the
+* same thing as graph in the C++ library)
+*/
+
+#endif /* IRIX */
+
+
+#if defined (__Lynx__)
+ /* azov: On Lynx isalpha defined as (_U | _L), which gives us a mask
+ * unusable in ctype_table. So we have to redefine it and use hard-coded
+ * numbers (to avoid potential clashes if system headers change).
+ *
+ * P.S. Actually, I see no reason in using platform-specific masks -
+ * having just one set of masks for all platforms should work just as
+ * well - we only use them internally and they don't have to be equal
+ * to whatever defined in local ctype.h
+ *
+ */
+# define _Locale_CNTRL 040 /* _C, Control character */
+# define _Locale_UPPER 01 /* _U, Upper case */
+# define _Locale_LOWER 02 /* _L, Lower case */
+# define _Locale_DIGIT 04 /* _N, Numeral (digit) */
+# define _Locale_XDIGIT 0200 /* _X, heXadecimal digit */
+# define _Locale_PUNCT 020 /* _P, Punctuation */
+# define _Locale_SPACE 010 /* _S, Spacing */
+# define _Locale_ALPHA 040000 /* none, Alphanumerical */
+# define _Locale_PRINT (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \
+ _Locale_DIGIT | _Locale_ALPHA | _Locale_XDIGIT |\
+ _Locale_SPACE ) /* Printable */
+#endif /* __Lynx__ */
+
+#if defined (__GNUC__) || defined (__BORLANDC__) || defined (__COMO__)
+
+# if defined (__CYGWIN__)
+
+# define _Locale_CNTRL 040
+# define _Locale_UPPER 02
+# define _Locale_LOWER 01
+# define _Locale_DIGIT 04
+# define _Locale_XDIGIT ( 0100 | _Locale_DIGIT )
+# define _Locale_PUNCT 020
+# define _Locale_SPACE 010
+# define _Locale_ALPHA 0200
+# define _Locale_PRINT (_Locale_ALPHA | _Locale_DIGIT | _Locale_PUNCT | 0400 )
+
+# elif defined (__FreeBSD__) || ( defined (__APPLE__) && defined (__GNUC__) && (__GNUC__ > 3) )
+
+# define _Locale_CNTRL _CTYPE_C
+# define _Locale_UPPER _CTYPE_U
+# define _Locale_LOWER _CTYPE_L
+# define _Locale_DIGIT _CTYPE_D
+# define _Locale_XDIGIT _CTYPE_X
+# define _Locale_PUNCT _CTYPE_P
+# define _Locale_SPACE _CTYPE_S
+# define _Locale_PRINT _CTYPE_R
+# define _Locale_ALPHA _CTYPE_A
+
+# elif defined (__NetBSD__) || defined (__OpenBSD__) || defined (__amigaos__) || defined(ANDROID)
+
+# define _Locale_CNTRL _C
+# define _Locale_UPPER _U
+# define _Locale_LOWER _L
+# define _Locale_DIGIT _N
+# define _Locale_XDIGIT (_N|_X)
+# define _Locale_PUNCT _P
+# define _Locale_SPACE _S
+# define _Locale_PRINT (_P|_U|_L|_N|_B)
+# define _Locale_ALPHA (_U|_L)
+# elif defined (__EMX__) /* OS/2 with emx runtime */
+# define _Locale_CNTRL _CNTRL
+# define _Locale_UPPER _UPPER
+# define _Locale_LOWER _LOWER
+# define _Locale_DIGIT _DIGIT
+# define _Locale_XDIGIT _XDIGIT
+# define _Locale_PUNCT _PUNCT
+# define _Locale_SPACE _SPACE
+# define _Locale_PRINT _PRINT
+# define _Locale_ALPHA (_UPPER|_LOWER)
+
+# elif defined (_STLP_USE_GLIBC) /* linux, using the gnu compiler */
+
+/* This section uses macros defined in the gnu libc ctype.h header */
+
+# define _Locale_CNTRL _IScntrl
+# define _Locale_UPPER _ISupper
+# define _Locale_LOWER _ISlower
+# define _Locale_DIGIT _ISdigit
+# define _Locale_XDIGIT _ISxdigit
+# define _Locale_PUNCT _ISpunct
+# define _Locale_SPACE _ISspace
+# define _Locale_PRINT _ISprint
+# define _Locale_ALPHA _ISalpha
+
+# endif /* GLIBC */
+
+#endif /* gnu */
+
+#if (defined (__sun) && defined (__SVR4)) || \
+ (defined (__digital__) && defined (__unix__)) || \
+ defined (_AIX)
+/* fbp : condition from AT&T code*/
+# if !(defined (__XPG4_CHAR_CLASS__) || defined (_XPG4_2) || \
+ (defined (_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4))) && ! defined (_ISCNTRL)
+ /* fbp : on 2.5.1, the defines are different ;( */
+ /* # if ( defined (__sun) && defined (__SVR4) && ! defined (_ISCNTRL) ) */
+# define _ISCNTRL _C
+# define _ISUPPER _U
+# define _ISLOWER _L
+# define _ISDIGIT _N
+# define _ISXDIGIT _X
+# define _ISPUNCT _P
+# define _ISSPACE _S
+# define _ISPRINT (_P | _U | _L | _N | _B)
+# define _ISALPHA (_U | _L)
+# endif
+
+# define _Locale_CNTRL _ISCNTRL
+# define _Locale_UPPER _ISUPPER
+# define _Locale_LOWER _ISLOWER
+# define _Locale_DIGIT _ISDIGIT
+# define _Locale_XDIGIT _ISXDIGIT
+# define _Locale_PUNCT _ISPUNCT
+# define _Locale_SPACE _ISSPACE
+# define _Locale_PRINT _ISPRINT
+# define _Locale_ALPHA _ISALPHA
+#elif defined (__MWERKS__) && defined (N_PLAT_NLM)
+# define _Locale_CNTRL _CNTRL_
+# define _Locale_UPPER _UPPER_
+# define _Locale_LOWER _LOWER_
+# define _Locale_DIGIT _DIGIT_
+# define _Locale_XDIGIT _XDIGIT_
+# define _Locale_PUNCT _PUNCT_
+# define _Locale_SPACE _SPACE_
+# define _Locale_PRINT (_PUNCT_|_UPPER_|_LOWER_|_DIGIT_|_BLANK_)
+# define _Locale_ALPHA (_UPPER_|_LOWER_)
+#elif defined (__MWERKS__)
+# define _Locale_CNTRL __control_char
+# define _Locale_UPPER __upper_case
+# define _Locale_LOWER __lower_case
+# define _Locale_DIGIT __digit
+# define _Locale_XDIGIT __hex_digit
+# define _Locale_PUNCT __punctuation
+# define _Locale_SPACE __space_char
+# define _Locale_PRINT __printable
+# define _Locale_ALPHA __alphanumeric
+#elif defined (__BORLANDC__)
+# define _Locale_CNTRL _IS_CTL
+# define _Locale_UPPER _IS_UPP
+# define _Locale_LOWER _IS_LOW
+# define _Locale_DIGIT _IS_DIG
+# define _Locale_XDIGIT _IS_HEX
+# define _Locale_PUNCT _IS_PUN
+# define _Locale_SPACE _IS_SP
+# define _Locale_PRINT (_IS_SP|_IS_PUN|_IS_UPP|_IS_LOW|_IS_DIG)
+# define _Locale_ALPHA _IS_ALPHA
+#elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__)
+# define _Locale_CNTRL _CONTROL
+# define _Locale_UPPER _UPPER
+# define _Locale_LOWER _LOWER
+# define _Locale_DIGIT _DIGIT
+# define _Locale_XDIGIT _HEX
+# define _Locale_PUNCT _PUNCT
+# define _Locale_SPACE _SPACE
+# define _Locale_PRINT (_ALPHA | _DIGIT | _BLANK | _PUNCT)
+# define _Locale_ALPHA ( _ALPHA & ~ (_UPPER | _LOWER ))
+#elif defined (__DMC__)
+# define _Locale_CNTRL _CONTROL
+# define _Locale_UPPER _UPPER
+# define _Locale_LOWER _LOWER
+# define _Locale_DIGIT _DIGIT
+# define _Locale_XDIGIT _HEX
+# define _Locale_PUNCT _PUNCT
+# define _Locale_SPACE _SPACE
+# define _Locale_PRINT (_UPPER | _LOWER | _DIGIT | _PUNCT | _SPACE)
+# define _Locale_ALPHA _ALPHA & ~(_UPPER | _LOWER)
+#elif defined (__MRC__) || defined (__SC__) /* *TY 02/24/2000 - added support for MPW */
+# define _Locale_CNTRL _CTL
+# define _Locale_UPPER _UPP
+# define _Locale_LOWER _LOW
+# define _Locale_DIGIT _DIG
+# define _Locale_XDIGIT _HEX
+# define _Locale_PUNCT _PUN
+# define _Locale_SPACE _BLA
+# define _Locale_PRINT (_UPP | _LOW | _DIG | _PUN | _BLA)
+# define _Locale_ALPHA (_UPP | _LOW)
+#elif defined (__MLCCPP__)
+# define _Locale_CNTRL 1
+# define _Locale_UPPER 2
+# define _Locale_LOWER 4
+# define _Locale_DIGIT 8
+# define _Locale_XDIGIT 16
+# define _Locale_PUNCT 32
+# define _Locale_SPACE 64
+# define _Locale_PRINT 128
+# define _Locale_ALPHA 256
+#elif defined (__GNUC__) && (__GNUC__ == 3) && defined (__APPLE__)
+# define _Locale_CNTRL _C
+# define _Locale_UPPER _U
+# define _Locale_LOWER _L
+# define _Locale_DIGIT _D
+# define _Locale_XDIGIT _X
+# define _Locale_PUNCT _P
+# define _Locale_SPACE _S
+# define _Locale_PRINT _R
+# define _Locale_ALPHA _A
+#elif defined (__hpux) || defined (__osf__)
+# if defined (__HP_aCC) && !defined (_INCLUDE_HPUX_SOURCE)
+# define _ISALPHA 0x001
+# define _ISALNUM 0x002
+# define _ISBLANK 0x004
+# define _ISCNTRL 0x008
+# define _ISDIGIT 0x010
+# define _ISGRAPH 0x020
+# define _ISLOWER 0x040
+# define _ISPRINT 0x080
+# define _ISPUNCT 0x100
+# define _ISSPACE 0x200
+# define _ISUPPER 0x400
+# define _ISXDIGIT 0x800
+# endif
+# define _Locale_CNTRL _ISCNTRL
+# define _Locale_UPPER _ISUPPER
+# define _Locale_LOWER _ISLOWER
+# define _Locale_DIGIT _ISDIGIT
+# define _Locale_XDIGIT _ISXDIGIT
+# define _Locale_PUNCT _ISPUNCT
+# define _Locale_SPACE _ISSPACE
+# define _Locale_PRINT _ISPRINT
+# define _Locale_ALPHA _ISALPHA
+#elif defined (__MVS__) || defined (__OS400__)
+# define _Locale_CNTRL __ISCNTRL
+# define _Locale_UPPER __ISUPPER
+# define _Locale_LOWER __ISLOWER
+# define _Locale_DIGIT __ISDIGIT
+# define _Locale_XDIGIT __ISXDIGIT
+# define _Locale_PUNCT __ISPUNCT
+# define _Locale_SPACE __ISSPACE
+# define _Locale_PRINT __ISPRINT
+# define _Locale_ALPHA __ISALPHA
+#elif defined (__QNXNTO__) || defined (__WATCOMC__)
+# define _Locale_CNTRL _CNTRL
+# define _Locale_UPPER _UPPER
+# define _Locale_LOWER _LOWER
+# define _Locale_DIGIT _DIGIT
+# define _Locale_XDIGIT _XDIGT
+# define _Locale_PUNCT _PUNCT
+# define _Locale_SPACE _SPACE
+# define _Locale_PRINT _PRINT
+# define _Locale_ALPHA (_UPPER | _LOWER)
+#elif defined (__DJGPP)
+# define _Locale_CNTRL __dj_ISCNTRL
+# define _Locale_UPPER __dj_ISUPPER
+# define _Locale_LOWER __dj_ISLOWER
+# define _Locale_DIGIT __dj_ISDIGIT
+# define _Locale_XDIGIT __dj_ISXDIGIT
+# define _Locale_PUNCT __dj_ISPUNCT
+# define _Locale_SPACE __dj_ISSPACE
+# define _Locale_PRINT __dj_ISPRINT
+# define _Locale_ALPHA __dj_ISALPHA
+#elif defined (_STLP_SCO_OPENSERVER)
+# define _Locale_CNTRL _C
+# define _Locale_UPPER _U
+# define _Locale_LOWER _L
+# define _Locale_DIGIT _N
+# define _Locale_XDIGIT _X
+# define _Locale_PUNCT _P
+# define _Locale_SPACE _S
+# define _Locale_PRINT _R
+# define _Locale_ALPHA _A
+#elif defined (__NCR_SVR)
+# define _Locale_CNTRL _C
+# define _Locale_UPPER _U
+# define _Locale_LOWER _L
+# define _Locale_DIGIT _N
+# define _Locale_XDIGIT _X
+# define _Locale_PUNCT _P
+# define _Locale_SPACE _S
+# define _Locale_PRINT (_P | _U | _L | _N | _B)
+# define _Locale_ALPHA (_U | _L)
+#elif defined (_CRAY)
+# define _Locale_CNTRL _CNTRL
+# define _Locale_UPPER _UPPER
+# define _Locale_LOWER _LOWER
+# define _Locale_DIGIT _DIGIT
+# define _Locale_XDIGIT _XDIGIT
+# define _Locale_PUNCT _PUNCT
+# define _Locale_SPACE _SPACE
+# define _Locale_PRINT _PRINT
+# define _Locale_ALPHA _ALPHA
+#endif
+
+/* We arbitrarily consider _Locale_CNTRL macro to check locale facet numeric
+ * identifier has been defined for the platform/compiler:
+ */
+#if !defined (_Locale_CNTRL)
+# error Unable to find your platform locale facets definitions, please grant them.
+#endif
+
+#endif /* _STLP_C_LOCALE_H */
--- /dev/null
+/*
+ * 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) || defined (N_PLAT_NLM)
+# include <sys/types.h> // For off_t
+#endif /* __unix */
+
+#ifdef __BORLANDC__
+# include _STLP_NATIVE_C_HEADER(mem.h)
+# include _STLP_NATIVE_C_HEADER(string.h)
+# include _STLP_NATIVE_C_HEADER(_stddef.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 (__sgi) && defined (_STLP_HAS_NO_NEW_C_HEADERS) /* IRIX */
+typedef off64_t streamoff;
+#elif 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;
+# elif defined(ANDROID)
+typedef long 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;
+};
+
+#if !defined (_STLP_NO_MBSTATE_T)
+typedef fpos<mbstate_t> streampos;
+typedef fpos<mbstate_t> wstreampos;
+#endif
+
+// 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;
+#if defined (_STLP_NO_MBSTATE_T)
+ typedef char state_type;
+#else
+ typedef mbstate_t state_type;
+#endif
+
+ 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:
+ typedef char char_type;
+ typedef int int_type;
+ typedef streamoff off_type;
+#if !defined (_STLP_NO_MBSTATE_T)
+ typedef streampos pos_type;
+ typedef mbstate_t state_type;
+#endif
+
+ 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 (N_PLAT_NLM)
+# 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); }
+# endif
+
+ 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:
/*
- * Copyright 2009, The Android Open Source Project
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
*/
-#ifndef __STL_USE_CONCEPT_CHECKS
+#ifndef _STLP_USE_CONCEPT_CHECKS
// Some compilers lack the features that are necessary for concept checks.
// On those compilers we define the concept check macros to do nothing.
-#define __STL_REQUIRES(__type_var, __concept) do {} while(0)
-#define __STL_CLASS_REQUIRES(__type_var, __concept) \
+#define _STLP_REQUIRES(__type_var, __concept) do {} while(0)
+#define _STLP_CLASS_REQUIRES(__type_var, __concept) \
static int __##__type_var##_##__concept
-#define __STL_CONVERTIBLE(__type_x, __type_y) do {} while(0)
-#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0)
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
+#define _STLP_CONVERTIBLE(__type_x, __type_y) do {} while(0)
+#define _STLP_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0)
+#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
static int __##__type_x##__type_y##_require_same_type
-#define __STL_GENERATOR_CHECK(__func, __ret) do {} while(0)
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \
+#define _STLP_GENERATOR_CHECK(__func, __ret) do {} while(0)
+#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) \
static int __##__func##__ret##_generator_check
-#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0)
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
+#define _STLP_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0)
+#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
static int __##__func##__ret##__arg##_unary_function_check
-#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
+#define _STLP_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
do {} while(0)
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
+#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
static int __##__func##__ret##__first##__second##_binary_function_check
-#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
+#define _STLP_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
do {} while(0)
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
+#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
static int __##__opname##__ret##__first##__second##_require_binary_op
-#else /* __STL_USE_CONCEPT_CHECKS */
+#else /* _STLP_USE_CONCEPT_CHECKS */
// This macro tests whether the template argument "__type_var"
// satisfies the requirements of "__concept". Here is a list of concepts
// _Mutable_BidirectionalIterator
// _Mutable_RandomAccessIterator
-#define __STL_REQUIRES(__type_var, __concept) \
+#define _STLP_REQUIRES(__type_var, __concept) \
do { \
void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\
- ::__concept##_requirement_violation; __x = __x; } while (0)
+ ::##__concept##_requirement_violation; __x = __x; } while (0)
// Use this to check whether type X is convertible to type Y
-#define __STL_CONVERTIBLE(__type_x, __type_y) \
+#define _STLP_CONVERTIBLE(__type_x, __type_y) \
do { \
void (*__x)( __type_x , __type_y ) = _STL_CONVERT_ERROR< __type_x , \
__type_y >::__type_X_is_not_convertible_to_type_Y; \
__x = __x; } while (0)
// Use this to test whether two template arguments are the same type
-#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) \
+#define _STLP_REQUIRES_SAME_TYPE(__type_x, __type_y) \
do { \
void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \
__type_y >::__type_X_not_same_as_type_Y; \
// function object checks
-#define __STL_GENERATOR_CHECK(__func, __ret) \
+#define _STLP_GENERATOR_CHECK(__func, __ret) \
do { \
__ret (*__x)( __func&) = \
_STL_GENERATOR_ERROR< \
__x = __x; } while (0)
-#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
+#define _STLP_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
do { \
__ret (*__x)( __func&, const __arg& ) = \
_STL_UNARY_FUNCTION_ERROR< \
__x = __x; } while (0)
-#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
+#define _STLP_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
do { \
__ret (*__x)( __func&, const __first&, const __second& ) = \
_STL_BINARY_FUNCTION_ERROR< \
__x = __x; } while (0)
-#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
+#define _STLP_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
do { \
__ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \
__ret, __first, __second>::__binary_operator_requirement_violation; \
__y = __y; __x = __x; } while (0)
-#ifdef __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
+#ifdef _STLP_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
-#define __STL_CLASS_REQUIRES(__type_var, __concept)
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y)
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret)
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg)
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second)
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second)
+#define _STLP_CLASS_REQUIRES(__type_var, __concept)
+#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y)
+#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret)
+#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg)
+#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second)
+#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second)
#else
// Warning: do not pass pointers and such (e.g. T*) in as the __type_var,
// since the type_var is used to construct identifiers. Instead typedef
// the pointer type, then use the typedef name for the __type_var.
-#define __STL_CLASS_REQUIRES(__type_var, __concept) \
+#define _STLP_CLASS_REQUIRES(__type_var, __concept) \
typedef void (* __func##__type_var##__concept)( __type_var ); \
template <__func##__type_var##__concept _Tp1> \
struct __dummy_struct_##__type_var##__concept { }; \
__dummy_ptr_##__type_var##__concept
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
+#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
typedef void (* __func_##__type_x##__type_y##same_type)( __type_x, \
__type_y ); \
template < __func_##__type_x##__type_y##same_type _Tp1> \
__dummy_ptr_##__type_x##__type_y##_same_type
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \
+#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) \
typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \
template <__f_##__func##__ret##_generator _Tp1> \
struct __dummy_struct_##__func##__ret##_generator { }; \
__dummy_ptr_##__func##__ret##_generator
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
+#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
typedef __ret (* __f_##__func##__ret##__arg##_unary_check)( __func&, \
const __arg& ); \
template <__f_##__func##__ret##__arg##_unary_check _Tp1> \
__dummy_ptr_##__func##__ret##__arg##_unary_check
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
+#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
typedef __ret (* __f_##__func##__ret##__first##__second##_binary_check)( __func&, const __first&,\
const __second& ); \
template <__f_##__func##__ret##__first##__second##_binary_check _Tp1> \
__dummy_ptr_##__func##__ret##__first##__second##_binary_check
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
+#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
typedef __ret (* __f_##__func##__ret##__first##__second##_binary_op)(const __first&, \
const __second& ); \
template <__f_##__func##__ret##__first##__second##_binary_op _Tp1> \
template <class _TypeX, class _TypeY>
struct _STL_SAME_TYPE_ERROR {
static void
- __type_X_not_same_as_type_Y(_TypeX , _TypeY ) {
+ __type_X_not_same_as_type_Y(_TypeX , _TypeY ) {
__check_equal<_TypeX> t1 = __check_equal<_TypeY>();
}
};
struct _STL_BINARY_FUNCTION_ERROR {
static _Ret
__binary_function_requirement_violation(_Func& __f,
- const _First& __first,
+ const _First& __first,
const _Second& __second) {
return __f(__first, __second);
}
struct _STL_BINARY_FUNCTION_ERROR<_Func, void, _First, _Second> {
static void
__binary_function_requirement_violation(_Func& __f,
- const _First& __first,
+ const _First& __first,
const _Second& __second) {
__f(__first, __second);
}
};
-#define __STL_DEFINE_BINARY_OP_CHECK(_OP, _NAME) \
+#define _STLP_DEFINE_BINARY_OP_CHECK(_OP, _NAME) \
template <class _Ret, class _First, class _Second> \
struct _STL_BINARY##_NAME##_ERROR { \
static _Ret \
} \
}
-__STL_DEFINE_BINARY_OP_CHECK(==, _OP_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(!=, _OP_NOT_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(<, _OP_LESS_THAN);
-__STL_DEFINE_BINARY_OP_CHECK(<=, _OP_LESS_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(>, _OP_GREATER_THAN);
-__STL_DEFINE_BINARY_OP_CHECK(>=, _OP_GREATER_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(+, _OP_PLUS);
-__STL_DEFINE_BINARY_OP_CHECK(*, _OP_TIMES);
-__STL_DEFINE_BINARY_OP_CHECK(/, _OP_DIVIDE);
-__STL_DEFINE_BINARY_OP_CHECK(-, _OP_SUBTRACT);
-__STL_DEFINE_BINARY_OP_CHECK(%, _OP_MOD);
+_STLP_DEFINE_BINARY_OP_CHECK(==, _OP_EQUAL);
+_STLP_DEFINE_BINARY_OP_CHECK(!=, _OP_NOT_EQUAL);
+_STLP_DEFINE_BINARY_OP_CHECK(<, _OP_LESS_THAN);
+_STLP_DEFINE_BINARY_OP_CHECK(<=, _OP_LESS_EQUAL);
+_STLP_DEFINE_BINARY_OP_CHECK(>, _OP_GREATER_THAN);
+_STLP_DEFINE_BINARY_OP_CHECK(>=, _OP_GREATER_EQUAL);
+_STLP_DEFINE_BINARY_OP_CHECK(+, _OP_PLUS);
+_STLP_DEFINE_BINARY_OP_CHECK(*, _OP_TIMES);
+_STLP_DEFINE_BINARY_OP_CHECK(/, _OP_DIVIDE);
+_STLP_DEFINE_BINARY_OP_CHECK(-, _OP_SUBTRACT);
+_STLP_DEFINE_BINARY_OP_CHECK(%, _OP_MOD);
// ...
// TODO, add unary operators (prefix and postfix)
}
template <class _Type>
static _Type
- __const_parameter_required_for_copy_constructor(_Type /* __a */,
+ __const_parameter_required_for_copy_constructor(_Type /* __a */,
const _Type& __b) {
_Type __c(__b);
return __c;
}
template <class _Type>
static _Type
- __const_parameter_required_for_assignment_operator(_Type __a,
+ __const_parameter_required_for_assignment_operator(_Type __a,
const _Type& __b) {
__a = __b;
return __a;
}
template <class _Iterator, class _Distance>
static _Iterator
- __iterator_addition_assignment_requirement_violation(_Iterator __i,
+ __iterator_addition_assignment_requirement_violation(_Iterator __i,
_Distance __n) {
__i += __n;
return __i;
/* Associated Type Requirements */
-__STL_BEGIN_NAMESPACE
+_STLP_BEGIN_NAMESPACE
template <class _Iterator> struct iterator_traits;
-__STL_END_NAMESPACE
+_STLP_END_NAMESPACE
-template <class _Iter>
+template <class _Iter>
struct __value_type_type_definition_requirement_violation {
typedef typename __STD::iterator_traits<_Iter>::value_type value_type;
};
-template <class _Iter>
+template <class _Iter>
struct __difference_type_type_definition_requirement_violation {
typedef typename __STD::iterator_traits<_Iter>::difference_type
difference_type;
};
-template <class _Iter>
+template <class _Iter>
struct __reference_type_definition_requirement_violation {
typedef typename __STD::iterator_traits<_Iter>::reference reference;
};
-template <class _Iter>
+template <class _Iter>
struct __pointer_type_definition_requirement_violation {
typedef typename __STD::iterator_traits<_Iter>::pointer pointer;
};
-template <class _Iter>
+template <class _Iter>
struct __iterator_category_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::iterator_category
+ typedef typename __STD::iterator_traits<_Iter>::iterator_category
iterator_category;
};
// Refinement of LessThanComparable
_LessThanComparable_concept_specification<_RandAccIter>::
_LessThanComparable_requirement_violation(__i);
- typedef typename
+ typedef typename
__value_type_type_definition_requirement_violation<_RandAccIter>
::value_type
value_type;
typedef typename
__difference_type_type_definition_requirement_violation<_RandAccIter>
- ::difference_type
+ ::difference_type
_Dist;
typedef typename _Mutable_trait<_Dist>::_Type _MutDist;
}
};
-#define __STL_TYPEDEF_REQUIREMENT(__REQUIREMENT) \
+#define _STLP_TYPEDEF_REQUIREMENT(__REQUIREMENT) \
template <class Type> \
struct __##__REQUIREMENT##__typedef_requirement_violation { \
typedef typename Type::__REQUIREMENT __REQUIREMENT; \
-}
+};
-__STL_TYPEDEF_REQUIREMENT(value_type);
-__STL_TYPEDEF_REQUIREMENT(difference_type);
-__STL_TYPEDEF_REQUIREMENT(size_type);
-__STL_TYPEDEF_REQUIREMENT(reference);
-__STL_TYPEDEF_REQUIREMENT(const_reference);
-__STL_TYPEDEF_REQUIREMENT(pointer);
-__STL_TYPEDEF_REQUIREMENT(const_pointer);
+_STLP_TYPEDEF_REQUIREMENT(value_type);
+_STLP_TYPEDEF_REQUIREMENT(difference_type);
+_STLP_TYPEDEF_REQUIREMENT(size_type);
+_STLP_TYPEDEF_REQUIREMENT(reference);
+_STLP_TYPEDEF_REQUIREMENT(const_reference);
+_STLP_TYPEDEF_REQUIREMENT(pointer);
+_STLP_TYPEDEF_REQUIREMENT(const_pointer);
template <class _Alloc>
__const_reference__typedef_requirement_violation<_Alloc>();
__pointer__typedef_requirement_violation<_Alloc>();
__const_pointer__typedef_requirement_violation<_Alloc>();
- typedef typename _Alloc::value_type _Tp;
- //__STL_REQUIRES_SAME_TYPE(typename _Alloc::__STL_TEMPLATE rebind<_Tp>::other,
- // _Alloc);
+ typedef typename _Alloc::value_type _Type;
+ _STLP_REQUIRES_SAME_TYPE(typename _Alloc::rebind<_Type>::other, _Alloc);
}
};
-#endif /* __STL_USE_CONCEPT_CHECKS */
+#endif /* _STLP_USE_CONCEPT_CHECKS */
#endif /* __CONCEPT_CHECKS_H */
--- /dev/null
+#define _STLP_PLATFORM "AIX"
--- /dev/null
+#ifndef __stl_config__android_h
+#define __stl_config__android_h
+
+#define _STLP_PLATFORM "Android"
+
+// The Android C library is mostly glibc-like
+#define _STLP_USE_GLIBC 1
+
+// ...and Unix-like.
+#define _STLP_UNIX 1
+
+// Have pthreads support.
+#define _PTHREADS
+
+// Don't have native <cplusplus> headers
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+// Don't use wchar.h etc
+#define _STLP_NO_WCHAR_T 1
+
+// Don't have (working) native wide character support.
+#define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+
+// Don't use mbstate_t, define our own.
+#define _STLP_NO_NATIVE_MBSTATE_T 1
+
+// No (proper) wide stream support in Android
+#define _STLP_NO_NATIVE_WIDE_STREAMS 1
+
+// C library is in the global namespace.
+#define _STLP_VENDOR_GLOBAL_CSTD 1
+
+// Don't have underlying local support.
+#undef _STLP_REAL_LOCALE_IMPLEMENTED
+
+// No pthread_spinlock_t in Android
+#define _STLP_DONT_USE_PTHREAD_SPINLOCK 1
+
+// Do not enable thread support
+#define _NOTHREADS 1
+
+// Little endian platform.
+#define _STLP_LITTLE_ENDIAN 1
+
+// No <exception> headers
+#define _STLP_NO_EXCEPTION_HEADER 1
+
+// No throwing exceptions
+#define _STLP_NO_EXCEPTIONS 1
+
+// Disable all iostreams
+#define _STLP_NO_IOSTREAMS 1
+
+// No need to define our own namespace
+#define _STLP_NO_OWN_NAMESPACE 1
+
+// Need this to define STLport's own bad_alloc class (which won't be
+// thrown in any case)
+#define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+
+// Use __new_alloc instead of __node_alloc, so we don't need static functions.
+#define _STLP_USE_SIMPLE_NODE_ALLOC 1
+
+// Don't use extern versions of range errors, so we don't need to
+// compile as a library.
+#define _STLP_USE_NO_EXTERN_RANGE_ERRORS 1
+
+// The system math library doesn't have long double variants, e.g
+// sinl, cosl, etc
+#define _STLP_NO_VENDOR_MATH_L 1
+
+// Define how to include our native headers.
+#define _STLP_NATIVE_HEADER(header) <libstdc++/include/header>
+#define _STLP_NATIVE_C_HEADER(header) <../include/header>
+#define _STLP_NATIVE_CPP_C_HEADER(header) <libstdc++/include/header>
+#define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <libstdc++/include/header>
+#define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <libstdc++/include/header>
+
+#endif /* __stl_config__android_h */
--- /dev/null
+// STLport config file for Apogee 4.x
+
+#define _STLP_COMPILER "Apogee"
+
+#define _STLP_NO_NEW_NEW_HEADER 1
+#define _STLP_HAS_NO_NEW_IOSTREAMS 1
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+// # define _STLP_RAND48 1
+#define _STLP_LONG_LONG long long
+#define _STLP_NO_BAD_ALLOC 1
+#define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+#define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+#define _STLP_NO_EXCEPTION_HEADER 1
+
+#undef _STLP_LINK_TIME_INSTANTIATION
+#define _STLP_LINK_TIME_INSTANTIATION 1
+
+#ifdef __STDLIB
+# undef _STLP_NO_NEW_C_HEADERS
+# undef _STLP_NO_NEW_NEW_HEADER
+# undef _STLP_NO_BAD_ALLOC
+# undef _STLP_LONG_LONG
+#else
+# undef _STLP_NO_EXCEPTION_SPEC
+# define _STLP_NO_EXCEPTION_SPEC 1
+#endif
--- /dev/null
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+/* common configuration settings for Apple MPW MrCpp / SCpp */
+
+#if defined (__MRC__)
+# define _STLP_COMPILER "MPW MrCpp"
+#else
+# define _STLP_COMPILER "MPW SCpp"
+#endif
+
+#if defined(__MRC__) && __MRC__ < 0x500
+# error Apple's MPW MrCpp v.5.0.0 or better compiler required
+#endif
+#if defined(__SC__) && __SC__ < 0x890
+# error Apple's MPW SCpp v.8.9.0 or better compiler required
+#endif
+
+/* TODO: Check that this config is necessary for all compiler versions.
+ * It is here for historical reasons for the moment.
+ */
+#define _STLP_NO_CONTAINERS_EXTENSION
+
+#ifdef qMacApp
+# ifndef __CONDITIONALMACROS__ /* skip including ConditionalMacros_AC.h if ConditionalMacros.h is already included */
+# include <CoreSwitches_AC.h>
+# include <ConditionalMacros_AC.h>
+# include <Types_AC.h>
+# define _STLP_FILE__ _FILE_AC
+# define _STLP_DEBUG_MESSAGE
+# define __stl_debug_message ProgramBreak_AC
+# include <ConditionalMacros.h>
+# endif
+# include <Types.h>
+#else
+# include <ConditionalMacros.h>
+# include <Types.h>
+#endif
+
+#define _STLP_UINT32_T UInt32
+typedef int wint_t;
+
+#ifndef TYPE_BOOL
+# error <ConditionalMacros.h> must be included. (TYPE_BOOL)
+#endif
+#if !TYPE_BOOL
+# define _STLP_NO_BOOL
+# define _STLP_DONT_USE_BOOL_TYPEDEF
+#endif
+
+#ifndef TYPE_LONGLONG
+# error <ConditionalMacros.h> must be included. (TYPE_LONGLONG)
+#endif
+#if TYPE_LONGLONG
+# define _STLP_LONG_LONG long long
+#endif
+
+#if !__option(exceptions)
+# define _STLP_HAS_NO_EXCEPTIONS
+#endif
+
+#define _STLP_DEBUG_MESSAGE_POST DebugStr("\pSTL diagnosis issued. See 'stderr' for detail.");
+#define _STLP_ASSERT_MSG_TRAILER " "
+
+#ifdef _STLP_DEBUG
+# define _STLP_THROW(x) (DebugStr("\pSTL is about to throw exception: "#x),throw x)
+#endif
+
+#if defined(__MRC__)
+# ifndef __spillargs
+# define __spillargs 1 // MrCpp requires this symbol to be defined as 1 to properly handle va_start; ref.[ file stdarg.h; line 26 ]
+# endif
+#endif
+
+#if defined(__SC__)
+#define _STLP_VENDOR_LONG_DOUBLE_MATH //*TY 12/03/2000 - SCpp's native math type is long double
+#endif
+
+#ifndef _STLP_NATIVE_INCLUDE_PATH
+# if __option(unix_includes)
+# define _STLP_NATIVE_INCLUDE_PATH ../CIncludes // expects the alias to {CIncludes} under the same folder as {STL}
+# else
+# define _STLP_NATIVE_INCLUDE_PATH ::CIncludes // expects the alias to {CIncludes} under the same folder as {STL}
+# endif
+#endif
+#if !defined(_STLP_MAKE_HEADER)
+# if !__option(unix_includes)
+# define _STLP_MAKE_HEADER(path, header) <path:header> // Mac uses ":" for directory delimiter
+# endif
+#endif
+
+# define _STLD _DBG // to keep the length of generated symbols within the compiler limitation
+
+#define _STLP_USE_STDIO_IO 1 //*TY 02/24/2000 - see also ; ref.[ file _fstream.h; line 36 ]
+#define _STLP_NO_THREADS //*TY 12/17/2000 - multi-thread capability not explored, yet.
+#undef _REENTRANT //*ty 11/24/2001 - to make sure no thread facility is activated
+#define _NOTHREADS //*ty 12/07/2001 -
+
+// native library limitations
+#define _STLP_VENDOR_GLOBAL_STD // mpw's c++ libs do not utilize namespace std yet
+#define _STLP_NO_BAD_ALLOC // known limitation
+#define _STLP_HAS_NO_NEW_C_HEADERS // known limitation
+#define _STLP_NO_NEW_NEW_HEADER // known limitation
+#define _STLP_NO_NATIVE_MBSTATE_T // known limitation
+#define _STLP_NO_NATIVE_WIDE_FUNCTIONS // known limitation
+#define _STLP_NO_NATIVE_WIDE_STREAMS // known limitation
+#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT // known limitation
+#define _STLP_BROKEN_EXCEPTION_CLASS // known limitation
+
+// compiler limitations
+# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+
+# define _STLP_MPWFIX_TRY try{ //*TY 06/01/2000 - exception handling bug workaround
+# define _STLP_MPWFIX_CATCH }catch(...){throw;} //*TY 06/01/2000 - exception handling bug workaround
+# define _STLP_MPWFIX_CATCH_ACTION(action) }catch(...){action;throw;} //*TY 06/01/2000 - exception handling bug workaround
+# define _STLP_THROW_RETURN_BUG // known limitation
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION // known limitation
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX // known limitation
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER // known limitation
+# define _STLP_NO_RELOPS_NAMESPACE // known limitation
+// end of stl_apple.h
--- /dev/null
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+// AS/400 C++ config
+
+# ifdef _REENTRANT
+# define _PTHREADS
+# endif
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# define _STLP_NO_BOOL
+# define _STLP_LIMITED_DEFAULT_TEMPLATES
+
+# define _STLP_HAS_NO_NAMESPACES
+# define _STLP_NEED_TYPENAME
+# define _STLP_NEED_EXPLICIT
+# define _STLP_HAS_NO_EXCEPTIONS
+# define _STLP_NO_EXCEPTION_SPEC
+# define _STLP_NO_ARROW_OPERATOR
+# define _STLP_NO_NEW_STYLE_CASTS
+
+# define _STLP_NEED_MUTABLE
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
+# define _STLP_NO_BAD_ALLOC
+# define _STLP_NO_MEMBER_TEMPLATES
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+# define _STLP_NO_FRIEND_TEMPLATES
+# define _STLP_NO_QUALIFIED_FRIENDS
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+
+# define _STLP_NO_METHOD_SPECIALIZATION
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+
+// # define _STLP_NO_EXCEPTION_HEADER
+
+# define _STLP_HAS_NO_NEW_C_HEADERS
+
+# define _STLP_STATIC_CONST_INIT_BUG
+# define _STLP_THROW_RETURN_BUG
+# define _STLP_LINK_TIME_INSTANTIATION
+# define _STLP_NO_TEMPLATE_CONVERSIONS
+
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_TRIVIAL_DESTRUCTOR_BUG 1
+
+# if defined(_LONG_LONG)
+# define _STLP_LONG_LONG long long
+# endif
+# if defined(_PTHREADS)
+# define _MULTI_THREADED
+# endif
+// fbp : to fix __partition() problem
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
--- /dev/null
+/* 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
+
+# define _STLP_VERSION_STR _STLP_STRINGIZE(_STLPORT_MAJOR)"."_STLP_STRINGIZE(_STLPORT_MINOR)
+
+# define _STLP_STLPORT_LIB "stlport"_STLP_LIB_OPTIM_MODE""_STLP_LIB_TYPE""_STLP_LIB_MOTIF"."_STLP_VERSION_STR".lib"
+
+# if defined (_STLP_VERBOSE_AUTO_LINK)
+# 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 */
+
--- /dev/null
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+//#define _STLP_VERBOSE
+
+#define _STLP_COMPILER "Borland"
+
+#if (__BORLANDC__ < 0x551)
+# error - Borland compilers below version 5.5.1 not supported.
+#endif
+
+#if (__BORLANDC__ >= 0x580) && (__BORLANDC__ < 0x590)
+# define _STLP_NO_NEW_C_HEADERS
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/dinkumware/##header>
+# define _STLP_NO_FORCE_INSTANTIATE
+#endif
+
+#if (__BORLANDC__ >= 0x560) && (__BORLANDC__ < 0x570)
+# define _USE_OLD_RW_STL
+#endif
+
+#if (__BORLANDC__ >= 0x560)
+# define NOWINBASEINTERLOCK // src/fstream.cpp error in winbase.h
+#endif
+
+#if (__BORLANDC__ < 0x564)
+# define _STLP_QUALIFIED_SPECIALIZATION_BUG
+#endif
+
+#if (__BORLANDC__ < 0x560)
+# define _STLP_NO_CONTAINERS_EXTENSION
+#endif
+
+#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+#define _STLP_DONT_USE_PRIV_NAMESPACE
+#define _STLP_NO_VENDOR_STDLIB_L
+#define _STLP_NO_VENDOR_MATH_F
+#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1
+#define _STLP_NO_NATIVE_MBSTATE_T
+#define _STLP_DLLEXPORT_NEEDS_PREDECLARATION
+#undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+#if (__BORLANDC__ < 0x580) && !defined (_RTLDLL)
+# define _UNCAUGHT_EXCEPTION 1
+#endif
+
+// <limits> problem
+#define _STLP_STATIC_CONST_INIT_BUG
+
+// <bitset> problems
+#define _STLP_MEMBER_SPECIALIZATION_BUG 1
+#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1
+
+#define _STLP_LONG_LONG __int64
+
+// auto enable thread safety and exceptions:
+#ifndef _CPPUNWIND
+# define _STLP_HAS_NO_EXCEPTIONS
+#endif
+
+#if defined (__MT__) && !defined (_NOTHREADS) && !defined (_REENTRANT)
+# if defined (_STLP_VERBOSE)
+# pragma message ("multi threaded")
+# endif
+# define _REENTRANT 1
+#else
+# if defined (_STLP_VERBOSE)
+# pragma message ("single threaded")
+# endif
+#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)
+# define _STLP_DLL
+#endif
+#if defined (_RTLDLL)
+# define _STLP_RUNTIME_DLL
+#endif
+#include <stl/config/_detect_dll_or_lib.h>
+#undef _STLP_RUNTIME_DLL
+#undef _STLP_DLL
+
+#if defined (_STLP_USE_DYNAMIC_LIB)
+# if defined (_STLP_VERBOSE)
+# pragma message ("Using/Building STLport dll")
+# endif
+#elif defined (_STLP_USE_STATIC_LIB)
+# if defined (_STLP_VERBOSE)
+# pragma message ("Using/Building STLport lib")
+# endif
+#else
+# error Unknown STLport usage config (dll/lib?)
+#endif
+
+#if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# if defined (_STLP_VERBOSE)
+# pragma message ("Using cross version of native runtime")
+# endif
+#endif
+
+#if !defined (_STLP_IMPORT_TEMPLATE_KEYWORD)
+//# define _STLP_IMPORT_TEMPLATE_KEYWORD __declspec(dllimport)
+#endif
+//#define _STLP_EXPORT_TEMPLATE_KEYWORD __declspec(dllexport)
+
+#if defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DECLSPEC 1
+# if (__BORLANDC__ < 0x580)
+# if defined (__BUILDING_STLPORT)
+# define _STLP_CALL __cdecl __export
+# else
+# define _STLP_CALL __cdecl __import
+# endif
+#else
+# define _STLP_CALL __cdecl
+#endif
+#else
+# define _STLP_CALL __cdecl
+#endif
+
+#include <stl/config/_auto_link.h>
--- /dev/null
+
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Comeau"
+
+#include <stl/config/_native_headers.h>
+
+#define _STLP_UINT32_T unsigned int
+
+#define _STLP_HAS_NO_NEW_C_HEADERS
+// #define _STLP_VENDOR_GLOBAL_EXCEPT_STD
+#define _STLP_LONG_LONG long long
+
+
+//
+// ADDITIONS FOR COMEAU C++, made by Comeau Computing.
+// We can be reached through comeau@comeaucomputing.com
+// You shouldn't need to change anything below here for Comeau C++.
+// If you do, please tell us at comeau@comeaucomputing.com
+//
+// Changes made here, AND THROUGH ALL FILES, based upon the __COMO__ macro
+// (and SIMILAR NAMES INVOLVING COMO).... no doubt some of this will
+// change as SGI integrates the changes into their code base since
+// some changes are not really Comeau C++ specific, but required to
+// make the SGI code compliant with Standard C++).
+//
+// Testing was done with Comeau C++ 4.2.44 and 4.2.45.2. Changes were made for
+// both Comeau relaxed mode and Comeau strict mode, especially for end user code
+// (that is, some of the .cxx files cannot compile in strict mode, because they
+// contain extensions to Standard C++, however their object code forms can
+// be used once compiled in relaxed mode, even if the end user code uses
+// strict mode).
+//
+// These changes may also work for some earlier versions of Comeau C++,
+// though we have not tested them.
+//
+// Actual mods made under RedHat 6.1 LINUX, should be ok with SuSE too and
+// other LINUX's, and older Caldera LINUX, Solaris/SPARC, SunOS, SCO UNIX,
+// and NetBSD. Other platforms may be added. Comeau will also perform
+// custom ports for you.
+//
+// Check libcomo details at http://www.comeaucomputing.com/libcomo and
+// http://www.comeaucomputing.com
+//
+// History of Comeau changes (this is rough, as work was often going on in parallel):
+// BETA1 July 14, 2000, Initial port for RedHat 6.1 INTEL/ELF
+// BETA2 Aug 4, 2000, Stronger RedHat support
+// Support for Comeau strict mode for end user code
+// BETA3 Aug 22, 2000, Support for other LINUX/INTEL/ELF's, including older ones
+// BETA4 Sept 2, 2000, Initial support for SCO UNIX + other UNIX x86 SVR3's
+// Stronger support for end user Comeau strict mode
+// BETA5 Oct 5, 2000, Initial support for Solaris/SPARC
+// More SCO support (though still incomplete)
+// BETA6 Feb 5, 2001, Minor mods to accomodate Comeau C++ 4.2.45.1
+// BETA7 Mar 13, 2001, Verified with Comeau C++ 4.2.45.2
+// Minor NetBSD support
+// BETA8 Apr 1. 2001, Initial support for SunOS/SPARC
+// BETA9 Apr 7, 2001, Stronger SCO support + other UNIX x86 SVR3's
+// Mods for an fpos_t problem for some LINUXes
+// Mods since Destroy did not work in strict mode
+// BETA10 Apr 12. 2001, Stronger NetBSD support
+//
+// PLANNED:
+// BETAx TBA TBA, 2001, NetBSD, UNIXWARE, and Windows support expected
+//
+
+
+#ifdef __linux__
+
+# define _STLP_NO_NATIVE_MBSTATE_T 1
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+# define _STLP_NO_LONG_DOUBLE 1
+
+// Comeau C++ under LINUX/INTEL/ELF
+// Preprocess away "long long" routines for now, even in relaxed mode
+# define __wcstoull_internal_defined 1
+# define __wcstoll_internal_defined 1
+
+#endif /* __COMO__ under __linux__ */
+
+#ifdef __USING_x86SVR3x_WITH_COMO /* SCO et al */
+/* UNIX 386+ SVR3 mods made with __USING_x86SVR3x_WITH_COMO
+ in other sources, not here */
+# define atan2l atan2
+# define cosl cos
+# define sinl sin
+# define sqrtl sqrt
+# include <math.h>
+ inline long double expl(long double arg) { return exp(arg); }
+ inline long double logl(long double arg) { return log(arg); }
+# define log10l log10
+
+# define sinhl sinh
+# define coshl cosh
+# define fabsl fabs
+namespace std {
+ inline int min(int a, int b) { return a>b ? b : a; }
+}
+#endif
+
+#ifdef sun
+// Comeau C++ under Solaris/SPARC or SunOS
+
+#ifdef solarissparc
+#define __USING_SOLARIS_SPARC_WITH_COMO /* show this in the source when grep'ing for COMO */
+// Note comowchar.h for Solaris/SPARC wchar stuff
+
+#include <math.h>
+# define sinf sin
+# define sinl sin
+# define sinhf sinh
+# define sinhl sinh
+# define cosf cos
+# define cosl cos
+# define coshf cosh
+# define coshl cosh
+# define atan2l atan2
+# define atan2f atan2
+ inline float logf(float arg) { return log(arg); }
+ inline long double logl(long double arg) { return log(arg); }
+# define log10f log10
+# define log10l log10
+# define expf exp
+ inline long double expl(long double arg) { return exp(arg); }
+# define sqrtf sqrt
+# define sqrtl sqrt
+# define fabsf fabs
+# define fabsl fabs
+#else
+#define __USING_SUNOS_WITH_COMO
+
+#define __unix 1
+#define __EXTENSIONS__ /* This might create undue noise somewhere */
+#endif
+#endif /* sun */
+
+#if defined(__NetBSD__)
+// From non-como #ifdef __GNUC__ above
+#undef _STLP_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
+#define __unix 1
+
+#include <sys/cdefs.h>
+// Some joker #define'd __END_DECLS as };
+#undef __END_DECLS
+#define __END_DECLS }
+
+// <sys/stat.h> prob
+#include <sys/cdefs.h>
+#undef __RENAME
+#define __RENAME(x)
+
+#define wchar_t __COMO_WCHAR_T
+#include <stddef.h>
+#undef wchar_t
+
+#include <math.h>
+# ifdef BORIS_DISABLED
+# define atan2l atan2
+# define cosl cos
+# define sinl sin
+# define sqrtl sqrt
+ inline long double expl(long double arg) { return exp(arg); }
+ inline long double logl(long double arg) { return log(arg); }
+# define log10l log10
+# define sinhl sinh
+# define coshl cosh
+# define fabsl fabs
+# endif
+#endif /* __NetBSD__ under __COMO__ */
+
+// Shouldn't need to change anything below here for Comeau C++
+// If so, tell us at comeau@comeaucomputing.com
+
+#define _STLP_NO_DRAND48
+
+#define _STLP_PARTIAL_SPECIALIZATION_SYNTAX
+#define _STLP_NO_USING_CLAUSE_IN_CLASS
+
+#if __COMO_VERSION__ < 4300
+#if __COMO_VERSION__ >= 4245
+#define _STLP_NO_EXCEPTION_HEADER /**/
+ // Is this needed?
+# include <stdexcept.stdh>
+#endif
+#define _STLP_NO_BAD_ALLOC /**/
+#define _STLP_USE_AUTO_PTR_CONVERSIONS /**/
+#endif
+
+// this one is true only with MS
+# if defined (_MSC_VER)
+# define _STLP_WCHAR_T_IS_USHORT 1
+# if _MSC_VER <= 1200
+# define _STLP_VENDOR_GLOBAL_CSTD
+# endif
+# if _MSC_VER < 1100
+# define _STLP_NO_BAD_ALLOC 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_NO_NEW_NEW_HEADER 1
+# define _STLP_USE_NO_IOSTREAMS 1
+# endif
+# endif
+
+// # define __EDG_SWITCHES
+
+
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+#define _STLP_COMPILER "CC"
+
+// Mostly correct guess, change it for Alpha (and other environments
+// that has 64-bit "long")
+# define _STLP_UINT32_T unsigned long
+
+// Uncomment if long long is available
+# define _STLP_LONG_LONG long long
+
+// Uncomment this if your compiler can't inline while(), for()
+# define _STLP_LOOP_INLINE_PROBLEMS 1
+
+// Uncomment this if your compiler does not support exceptions
+// Cray C++ supports exceptions when '-h exceptions' option is user;
+// therefore '-D_STLP_HAS_NO_EXCEPTIONS' must be used when '-h exceptions'
+// is NOT used.
+//# define _STLP_HAS_NO_EXCEPTIONS 1
+
+// Delete?
+// Define this if compiler lacks <exception> header
+//# define _STLP_NO_EXCEPTION_HEADER 1
+
+// Uncomment this if your C library has lrand48() function
+# define _STLP_RAND48 1
+
+// Uncomment if native new-style C library headers lile <cstddef>, etc are not available.
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+// uncomment if new-style headers <new> is available
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+// uncomment this if <iostream> and other STD headers put their stuff in ::namespace,
+// not std::
+# define _STLP_VENDOR_GLOBAL_STD
+
+// uncomment this if <cstdio> and the like put stuff in ::namespace,
+// not std::
+# define _STLP_VENDOR_GLOBAL_CSTD
+
+# define _STLP_NATIVE_C_HEADER(__x) </usr/include/##__x>
+// WARNING: Following is hardcoded to the system default C++ include files
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) </opt/ctl/CC/CC/include/##__x>
+
+
+# define _STLP_NO_NATIVE_MBSTATE_T
+# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS
+//# define _STLP_VENDOR_GLOBAL_EXCEPT_STD
+
+#if !defined (_CRAYIEEE)
+# define _STLP_NO_IEC559_SUPPORT 1
+#endif
--- /dev/null
+#define _STLP_PLATFORM "Cygwin"
+
+/* Glibc is the platform API */
+#if !defined (_STLP_USE_GLIBC)
+# define _STLP_USE_GLIBC
+#endif
--- /dev/null
+#define _STLP_COMPILER "Dec"
+
+# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+
+# define _STLP_NATIVE_HEADER(header) <../cxx/##header>
+# define _STLP_NATIVE_C_HEADER(x) <../include/##x>
+
+#if (__DECCXX_VER < 60300000)
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../cxx/##header>
+#else
+# define _STLP_NATIVE_CPP_C_HEADER(header) </usr/include/cxx_cname/##header>
+#endif
+
+# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../cxx/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../cxx/##header>
+
+// Alpha is little-endian
+# define _STLP_LITTLE_ENDIAN
+
+// collisions
+# define _STLP_DONT_PUT_STLPORT_IN_STD
+
+#if (__DECCXX_VER < 60000000)
+
+// automatic template instantiation does not
+// work with namespaces ;(
+# define _STLP_HAS_NO_NAMESPACES 1
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NEED_EXPLICIT 1
+
+# define _STLP_NO_BOOL 1
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_BAD_ALLOC 1
+
+
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_FRIEND_TEMPLATES 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_BROKEN_USING_DIRECTIVE 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+#endif
+
+
+#ifdef __NO_USE_STD_IOSTREAM
+# define _STLP_HAS_NO_NEW_IOSTREAMS 1
+# else
+// default is to use new iostreams, anyway
+# ifndef __USE_STD_IOSTREAM
+# define __USE_STD_IOSTREAM
+# endif
+#endif
+
+//# ifndef __STD_STRICT_ANSI_ERRORS
+//# endif
+
+#ifndef __EXCEPTIONS
+# define _STLP_HAS_NO_EXCEPTIONS 1
+#endif
+
+# ifdef __IMPLICIT_INCLUDE_ENABLED
+
+// but, works with ours ;).
+# define _STLP_LINK_TIME_INSTANTIATION 1
+# else
+# undef _STLP_LINK_TIME_INSTANTIATION
+# endif
+
+# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM)
+// we should ban that !
+// # error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM"
+# endif
+
+# if (defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS))
+# define _STLP_STRICT_ANSI 1
+# else
+// we want to enforce it
+# define _STLP_LONG_LONG long long
+# endif
+
+// unsigned 32-bit integer type
+# define _STLP_UINT32_T unsigned int
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+// # define _STLP_RAND48 1
+
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+# if (__DECCXX_VER <= 60600000)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# endif
+
--- /dev/null
+// OpenVMS version
+
+#define _STLP_COMPILER "Dec Vms"
+
+# define _STLP_NATIVE_HEADER(header) <sys$library:##header>
+# define _STLP_NATIVE_C_HEADER(x) <sys$library:##x>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <sys$library:##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <sys$library:##header>
+
+#if (__DECCXX_VER < 60000000)
+
+// automatic template instantiation does not
+// work with namespaces ;(
+# define _STLP_HAS_NO_NAMESPACES 1
+
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NEED_EXPLICIT 1
+
+# define _STLP_NO_BOOL 1
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_BAD_ALLOC 1
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_FRIEND_TEMPLATES 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_BROKEN_USING_DIRECTIVE 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+#endif
+
+
+#ifdef __NO_USE_STD_IOSTREAM
+# define _STLP_USE_NO_IOSTREAMS 1
+# else
+// default is to use new iostreams, anyway
+# ifndef __USE_STD_IOSTREAM
+# define __USE_STD_IOSTREAM
+# endif
+#endif
+
+#ifndef __EXCEPTIONS
+# define _STLP_HAS_NO_EXCEPTIONS 1
+#endif
+
+# ifdef __IMPLICIT_INCLUDE_ENABLED
+
+#ifdef _STLP_USE_NO_IOSTREAMS
+// implicit include introduces conflicts
+// between stlport and native lib.
+# undef __IMPLICIT_INCLUDE_ENABLED
+#endif
+
+// but, works with ours ;).
+# define _STLP_LINK_TIME_INSTANTIATION 1
+
+# endif
+
+# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM)
+// we should ban that !
+# error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM"
+# endif
+
+# if !(defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS))
+// we want to enforce it
+# define _STLP_LONG_LONG long long
+# endif
+
+// unsigned 32-bit integer type
+# define _STLP_UINT32_T unsigned int
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+// # define _STLP_RAND48 1
+
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+
--- /dev/null
+/* 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
--- /dev/null
+// STLport configuration file for Digital Mars C++
+
+//#define _STLP_VERBOSE
+
+#define _STLP_COMPILER "DMC"
+
+#if defined (_STLP_VERBOSE)
+# pragma message __DMC_VERSION_STRING__
+#endif
+
+#if (__DMC__ < 0x846)
+# error "Digital Mars C++ versions prior to 8.46 are not supported!"
+#endif
+
+#ifndef _CPPUNWIND
+# define _STLP_NO_EXCEPTIONS
+#endif
+#define _STLP_VENDOR_GLOBAL_CSTD
+
+//DMC prefer enum to real static const variable because it do not consider
+//static const as const enough to be used in switch declaration...
+#define _STLP_STATIC_CONST_INIT_BUG
+
+#if !defined (_WIN32)
+// it's not fully supported on non-Win32 platforms
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS
+#endif
+
+/* _STLP_NO_OWN_NAMESPACE is defined because Digital Mars' linker and libarian
+ appear to have problems with STLport namespaces. Summary of the issues:
+
+ STATIC: Digital Mars' librarian (lib.exe) may fail with "len <= IDMAX" error
+ if _STLP_DEBUG is defined. This is because Digital Mars' librarian uses
+ Microsoft OMF format, which limits identifier length to about 512 bytes.
+ With STLport namespaces, some identifiers such as Category_Map in
+ src/locale_catalog.cpp may exceed the maximum OMF identifier length.
+
+ DYNAMIC: Export issues with cin, cout, cerr, clog in src/iostream.cpp.
+ Exports in Digital Mars 'def' file must match mangled names in iostream.cpp.
+ With STLport namespaces, the mangled names in the intermediate files no
+ longer match these pre-defined exports. To use STLport dynamic libraries
+ and STLport namespaces with Digital Mars, the pre-defined exports in
+ src/iostream.cpp and the related Digital Mars 'def' files would need to be
+ revised. */
+#define _STLP_NO_OWN_NAMESPACE 1
+
+// select threads strategy
+#if defined (_MT) && !defined (_NOTHREADS)
+# define _REENTRANT
+#else
+# define _NOTHREADS
+#endif
+
+#ifndef _BOOL_DEFINED
+# define _STLP_NO_BOOL
+#else
+# define _STLP_DONT_USE_BOOL_TYPEDEF
+#endif
+
+#if _INTEGRAL_MAX_BITS >= 64
+# define _STLP_LONG_LONG long long
+#endif
+
+#define _STLP_DONT_USE_PRIV_NAMESPACE
+#define _STLP_NO_BAD_ALLOC
+#define _STLP_THROW_RETURN_BUG
+
+#if !defined (_DLL)
+# undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+#endif
+
+#define _STLP_USE_ABBREVS
+#define _STLP_NO_CONTAINERS_EXTENSION
+#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+
+#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)
+
+#define _STLP_IMPORT_TEMPLATE_KEYWORD __declspec(dllimport)
+#define _STLP_EXPORT_TEMPLATE_KEYWORD __declspec(dllexport)
+
+#if defined (_WINDLL)
+# define _STLP_DLL
+#endif
+#if defined (_DLL)
+# define _STLP_RUNTIME_DLL
+#endif
+#include <stl/config/_detect_dll_or_lib.h>
+#undef _STLP_RUNTIME_DLL
+#undef _STLP_DLL
+
+#if defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DECLSPEC 1
+# if defined (__BUILDING_STLPORT)
+# define _STLP_CALL __export
+# else
+# define _STLP_CALL
+# endif
+#else
+# define _STLP_CALL
+#endif
+
+#include <stl/config/_auto_link.h>
+
+# undef __SC__
+
--- /dev/null
+#if defined (_STLP_MSVC) || defined (__ICL) || defined (__BORLANDC__)
+
+#if defined (__BORLANDC__)
+# pragma option pop
+# pragma option -w-pow // -w-8062 Previous options and warnings not restored
+#else
+# if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200))
+# pragma warning (pop)
+# endif
+# pragma pack (pop)
+#endif
+
+#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
+
--- /dev/null
+/*
+ * File to have Microsoft eMbedded Visual C++ 3.0 and .NET working with STLport
+ * May 2004
+ * Origin : Zdenek Nemec - zero@mapfactor.com
+ * Michael Fink - vividos@users.sourceforge.net
+ */
+
+#ifndef _STLP_EVC_H
+#define _STLP_EVC_H
+
+#define _STLP_COMPILER "eMbedded Visual C++"
+
+// This flag is being used by STLport to support
+// old-fashioned Windows CE SDK (see stl_wince.h)
+// do not use with eMebedded Visual C++ 3 or 4!
+#ifdef _STLP_WINCE
+# undef _STLP_WINCE
+#endif
+
+/* Compiler dependent define. The following defines may be available:
+ * _STLP_WCE_EVC3 when compiling under eMbedded Visual C++ 3
+ * _STLP_WCE_NET when compiling under eMbedded Visual C++ .NET
+ * _STLP_WCE always defined when compiling with one of the above
+ */
+#undef _STLP_WCE_EVC3
+#undef _STLP_WCE_NET
+
+#if (_WIN32_WCE > 300)
+# define _STLP_WCE_NET UNDER_CE
+#elif (_WIN32_WCE == 300)
+# define _STLP_WCE_EVC3 UNDER_CE
+#else
+# error No support for Windows CE below 3.0!
+#endif
+
+// This is defined for all platforms using Windows CE
+#define _STLP_WCE
+
+/* All Windows CE versions up to at least version 5 are little-endian, even
+ * if the hardware (like e.g. MIPS) can be configured for big-endian, too. */
+#define _STLP_LITTLE_ENDIAN
+
+// Ensure _DEBUG is defined.
+#if defined (DEBUG) && !defined (_DEBUG)
+# define _DEBUG
+#endif
+
+// in evc3/4, on ARM, check that _STLP_DEBUG is not defined
+// the ARM compiler has a bug that prevents that debug mode from working
+#if _WIN32_WCE < 500 && defined(ARM) && defined(_STLP_DEBUG)
+# error _STLP_DEBUG mode is not supported in evc3 and evc4 on the ARM platform!
+#endif
+
+// inherit all msvc6 options
+#include <stl/config/_msvc.h>
+
+// CE up to at least version 5 has no C locale support
+#define _STLP_NO_LOCALE_SUPPORT
+
+#if _WIN32_WCE >= 0x500
+ // SDKs built with PB5 have terminate&co in namespace std...
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_STD
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_STD
+ // ...and new_handler/set_new_handler in the global namespace.
+# define _STLP_GLOBAL_NEW_HANDLER 1
+#endif
+
+// Always threaded in eMbedded Visual C++ 3.0 and .NET
+#ifndef _MT
+# define _MT
+#endif
+
+// we don't have a static native runtime library
+#undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+
+#if _WIN32_WCE < 400
+// no long double under CE3 and older
+# define _STLP_NO_LONG_DOUBLE
+#endif
+
+// no *f and *l math functions available
+#define _STLP_NO_VENDOR_MATH_F
+#define _STLP_NO_VENDOR_MATH_L
+
+/*
+ * Redirect cout, cerr and clog:
+ * If defined redirect cout, cerr and clog to
+ * files stdout.txt, stderr.txt and stdlog.txt
+ */
+//# define _STLP_REDIRECT_STDSTREAMS
+
+/*
+ * Static class members may generate LNK1179:
+ * Wrong COMDAT packing may cause LNK1179 error.
+ * For details see http://groups.google.com/groups?th=8a05c82c4ffee280
+ * example P78. This define is not used/needed at this moment
+ * but may came handy in future...
+ */
+//# define _STLP_STATIC_MEMBERS_BUG
+
+// Use wide-string interface of windows native functions (CreateFile...).
+// Note that this should be defined all the time while under CE.
+#if defined (UNICODE)
+# define _STLP_USE_WIDE_INTERFACE
+#endif
+
+// Force exception std to std instead of __std_alias.
+#if defined (__cplusplus) && !defined (_STLP_HAS_NO_NAMESPACES)
+# ifdef _STLP_VENDOR_EXCEPT_STD
+# undef _STLP_VENDOR_EXCEPT_STD
+# endif
+# define _STLP_VENDOR_EXCEPT_STD std
+#endif
+
+// short string optimization bug under evc3, evc4 using ARM compiler
+#if _MSC_VER<1400 && (defined (ARM) || defined (_ARM_))
+# define _STLP_DONT_USE_SHORT_STRING_OPTIM
+#endif
+
+// when using MFC, disable another placement new declaration, since there is one in wcealt.h
+#if !defined (__BUILDING_STLPORT) && defined (_MFC_VER)
+# define __PLACEMENT_NEW_INLINE
+#endif
+
+// threads
+#undef _REENTRANT
+#define _REENTRANT
+#undef _NOTHREADS
+
+// Use old fashioned headers (ctime vs. time.h).
+#undef _STLP_NO_NEW_C_HEADERS
+#define _STLP_NO_NEW_C_HEADERS
+
+// exception handling support: only on evc4 and user added /GX to project settings
+#if defined (_STLP_WCE_EVC3) || !defined (_CPPUNWIND)
+# define _STLP_NO_EXCEPTION_HEADER
+# define _STLP_NO_EXCEPTIONS
+# undef _STLP_USE_EXCEPTIONS
+# ifndef __THROW_BAD_ALLOC
+# define __THROW_BAD_ALLOC { _STLP_WINCE_TRACE(L"out of memory"); ExitThread(1); }
+# endif
+#endif
+
+#define _STLP_WINCE_TRACE(msg) OutputDebugString(msg)
+
+/*
+ * eMbedded Visual C++ .NET specific settings
+ */
+#if defined (_STLP_WCE_NET)
+
+// evc4 has no locale and time support
+# define _STLP_NO_LOCALE_SUPPORT
+# define _STLP_NO_TIME_SUPPORT
+
+// ptrdiff_t is not defined in evc4 headers
+# ifndef _PTRDIFF_T_DEFINED
+ typedef int ptrdiff_t;
+# define _PTRDIFF_T_DEFINED
+# endif
+
+/*
+ * Helper macros for including the native headers in cases where a file with
+ * the same name also exists in the STLport include folder. The idea behind
+ * this is that we first go up one directory and then down into a dir that
+ * is only present in the native install but not in STLport.
+ *
+ */
+# if !defined (_STLP_NATIVE_INCLUDE_PATH)
+# if defined (_X86_)
+# if defined (_STLP_WCE_TARGET_PROC_SUBTYPE_EMULATOR)
+# define _STLP_NATIVE_INCLUDE_PATH ../Emulator
+# else
+# define _STLP_NATIVE_INCLUDE_PATH ../X86
+# endif
+# elif defined (_ARM_)
+# if _MSC_VER < 1400
+ // eVC3/4
+# if defined (ARMV4)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4
+# elif defined (ARMV4I)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i
+# elif defined (ARMV4T)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4t
+# else
+# error Unknown ARM SDK.
+# endif
+# else
+ // VC8 crosscompiling for CE
+# if defined (ARMV4)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4
+# elif defined(ARMV4I) || defined(ARMV4T)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i
+# else
+# error Unknown ARM SDK.
+# endif
+# endif
+# elif defined (_MIPS_)
+# if defined (MIPS16)
+# define _STLP_NATIVE_INCLUDE_PATH ../mips16
+# elif defined (MIPSII)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsII
+# elif defined (MIPSII_FP)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsII_fp
+# elif defined (MIPSIV)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV
+# elif defined (MIPSIV_FP)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV_fp
+# else
+# error Unknown MIPS SDK.
+# endif
+# elif defined (SHx)
+# if defined (SH3)
+# define _STLP_NATIVE_INCLUDE_PATH ../sh3
+# elif defined (SH4)
+# define _STLP_NATIVE_INCLUDE_PATH ../sh4
+# else
+# error Unknown SHx SDK.
+# endif
+# else
+# error Unknown SDK.
+# endif
+# endif /* !_STLP_NATIVE_INCLUDE_PATH */
+
+/* Workaround when using MFCCE and using <new> together: MFCCE's wcealt.h doesn't
+ * check for __PLACEMENT_NEW_INLINE before defining operator new, so when <new>
+ * defines the operatore before, there will be an error C2084:
+ * "function 'void *__cdecl operator new(unsigned int,void *)' already has a body".
+ */
+# ifdef _STLP_USE_MFC
+# define __PLACEMENT_NEW_INLINE
+# endif
+
+#endif /* _STLP_WCE_NET */
+
+/* Workaround in _windows.h needs native headers access macros
+ * to be defined */
+#include <stl/config/_native_headers.h>
+
+/*
+ * eMbedded Visual C++ 3.0 specific settings
+ */
+#if defined (_STLP_WCE_EVC3)
+
+# define _STLP_NO_NATIVE_MBSTATE_T
+
+// evc3 has no locale and time support
+# define _STLP_NO_LOCALE_SUPPORT
+# define _STLP_NO_TIME_SUPPORT
+
+// evc3 has new, but no explicit header
+# define _STLP_NO_NEW_HEADER
+# define _STLP_NO_NEW_NEW_HEADER
+
+// evc3 has no bad_alloc and no typeinfo
+# undef _STLP_NO_BAD_ALLOC
+# define _STLP_NO_BAD_ALLOC
+
+# undef _STLP_NO_TYPEINFO
+# define _STLP_NO_TYPEINFO
+
+// missing things in eMbedded Visual C++ 3.0 headers
+# ifndef _SIZE_T_DEFINED
+ typedef unsigned int size_t;
+# define _SIZE_T_DEFINED
+# endif
+
+# ifndef _WCHAR_T_DEFINED
+ typedef unsigned short wchar_t;
+# define _WCHAR_T_DEFINED
+# endif
+
+// ptrdiff_t is not defined in evc3 headers
+# ifndef _PTRDIFF_T_DEFINED
+ typedef int ptrdiff_t;
+# define _PTRDIFF_T_DEFINED
+# endif
+
+// clock_t is not defined in evc3 headers
+# ifndef _CLOCK_T_DEFINED
+ typedef long clock_t;
+# define _CLOCK_T_DEFINED
+# endif
+
+// Struct tm is not defined in evc3 headers
+# ifndef _TM_DEFINED
+struct tm {
+ int tm_sec; /* seconds after the minute - [0,59] */
+ int tm_min; /* minutes after the hour - [0,59] */
+ int tm_hour; /* hours since midnight - [0,23] */
+ int tm_mday; /* day of the month - [1,31] */
+ int tm_mon; /* months since January - [0,11] */
+ int tm_year; /* years since 1900 */
+ int tm_wday; /* days since Sunday - [0,6] */
+ int tm_yday; /* days since January 1 - [0,365] */
+ int tm_isdst; /* daylight savings time flag */
+};
+# define _TM_DEFINED
+# endif
+
+// define placement new and delete operator
+// note: when MFCCE headers are included first, don't define the new operator,
+// since it was already defined in wcealt.h
+# ifdef __cplusplus
+# ifndef __PLACEMENT_NEW_INLINE
+# ifndef _MFC_VER
+inline void *__cdecl operator new(size_t, void *_P) { return (_P); }
+# endif /* _MFC_VER */
+inline void __cdecl operator delete(void *, void *) { return; }
+# define __PLACEMENT_NEW_INLINE
+# endif
+# endif /* __cplusplus */
+
+// evc3 doesn't have native wide functions, e.g. fgetwc, wmemmove
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS
+
+// evc3 doesn't have assert.h
+# ifndef _ASSERT_DEFINED
+# define assert(expr) _STLP_ASSERT(expr)
+# define _ASSERT_DEFINED
+# endif
+
+#endif /* _STLP_WCE_EVC3 */
+
+// Minimize windows.h includes
+#if !defined (WIN32_LEAN_AND_MEAN)
+# define WIN32_LEAN_AND_MEAN
+#endif
+#if !defined (VC_EXTRALEAN)
+# define VC_EXTRALEAN
+#endif
+#if !defined (STRICT)
+# define STRICT
+#endif
+
+// Don't let windows.h define its min and max macros.
+#if !defined (NOMINMAX)
+# define NOMINMAX
+#endif
+
+/*
+ * original call: TerminateProcess(GetCurrentProcess(), 0);
+ * we substitute the GetCurrentProcess() with the result of the inline function
+ * defined in kfuncs.h, since we then can avoid including <windows.h> at all.
+ * all needed Win32 API functions are defined in <stl/_windows.h>
+ */
+#ifndef _ABORT_DEFINED
+# define _STLP_ABORT() TerminateProcess(reinterpret_cast<HANDLE>(66), 0)
+# define _ABORT_DEFINED
+#endif
+
+// Notice: windows.h isn't included here anymore; all needed defines are in
+// stl/_windows.h now
+
+#endif /* _STLP_EVC_H */
--- /dev/null
+#define _STLP_PLATFORM "Free BSD"
--- /dev/null
+/* STLport configuration for Fujitsu compiler : looks like a perfect one ! */
+#define _STLP_COMPILER "Fujitsu"
+
+#define _STLP_NATIVE_INCLUDE_PATH ../std
+#define _STLP_UINT32_T unsigned int
+#define _STLP_LONG_LONG long long
+#define _STLP_WCHAR_SUNPRO_EXCLUDE 1
--- /dev/null
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+#define _STLP_COMPILER "gcc"
+
+/* Systems having GLIBC installed have different traits */
+#if defined (__linux__)
+# ifndef _STLP_USE_GLIBC
+# define _STLP_USE_GLIBC 1
+# endif
+# if defined (__UCLIBC__) && !defined (_STLP_USE_UCLIBC)
+# define _STLP_USE_UCLIBC 1
+# endif
+#endif
+
+#if defined (__CYGWIN__) && \
+ (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 3) && !defined (_GLIBCPP_USE_C99)
+# define _STLP_NO_VENDOR_MATH_L
+# define _STLP_NO_VENDOR_STDLIB_L
+#endif
+
+#if (__GNUC__ < 3)
+# define _STLP_NO_VENDOR_STDLIB_L
+#endif
+
+/* We guess if we are using the cygwin distrib that has a special include schema.
+ * There is no way to distinguish a cygwin distrib used in no-cygwin mode from a
+ * mingw install. We are forced to use a configuration option
+ */
+#if !defined (_STLP_NATIVE_INCLUDE_PATH) && \
+ (defined (__CYGWIN__) || defined (__MINGW32__) && defined (_STLP_NO_CYGWIN))
+# if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3))
+# define _STLP_NATIVE_INCLUDE_PATH ../../../__GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__/include/c++
+# elif defined (_STLP_NO_CYGWIN)
+# define _STLP_NATIVE_INCLUDE_PATH ../mingw
+/*# else
+ * Before version gcc 3.4, the cygwin package include path was conform to the
+ * GNU convention which is set later in this file.
+ */
+# endif
+#endif
+
+#if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 4))
+/* define for gcc versions before 3.4.0. */
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+#endif
+
+/* azov: gcc on lynx have a bug that causes internal
+ * compiler errors when compiling STLport with namespaces turned on.
+ * When the compiler gets better - comment out _STLP_HAS_NO_NAMESPACES
+ */
+#if defined (__Lynx__) && (__GNUC__ < 3)
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NO_STATIC_TEMPLATE_DATA 1
+/* turn off useless warning about including system headers */
+# define __NO_INCLUDE_WARN__ 1
+#endif
+
+/* Tru64 Unix, AIX, HP : gcc there by default uses native ld and hence cannot auto-instantiate
+ static template data. If you are using GNU ld, please say so in user_config.h header */
+#if (__GNUC__ < 3) && !defined(_STLP_GCC_USES_GNU_LD) && \
+ ((defined (__osf__) && defined (__alpha__)) || defined (_AIX) || defined (__hpux) || defined(__amigaos__) )
+# define _STLP_NO_STATIC_TEMPLATE_DATA
+#endif
+
+#if !defined (_REENTRANT) && (defined (_THREAD_SAFE) || \
+ (defined (__OpenBSD__) && defined (_POSIX_THREADS)) || \
+ (defined (__MINGW32__) && defined (_MT)))
+# define _REENTRANT
+#endif
+
+#if defined (__DJGPP)
+# define _STLP_RAND48 1
+# define _NOTHREADS 1
+# undef _PTHREADS
+# define _STLP_LITTLE_ENDIAN
+#endif
+
+#if defined (__MINGW32__)
+/* Mingw32, egcs compiler using the Microsoft C runtime */
+# define _STLP_VENDOR_GLOBAL_CSTD
+# undef _STLP_NO_DRAND48
+# define _STLP_NO_DRAND48
+# define _STLP_CALL
+
+# if defined (_STLP_NEW_PLATFORM_SDK)
+/* For the moment the Windows SDK coming with Mingw still mimik the old platform SDK. */
+# undef _STLP_NEW_PLATFORM_SDK
+# endif
+#endif /* __MINGW32__ */
+
+#if defined (__CYGWIN__) || defined (__MINGW32__)
+# if !defined (_STLP_USE_STATIC_LIB)
+# define _STLP_USE_DECLSPEC 1
+# if !defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DYNAMIC_LIB
+# endif
+# define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
+# define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
+# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+# endif
+/* The following is defined independently of _STLP_USE_STATIC_LIB because it is also
+ * used to import symbols from PSDK under MinGW
+ */
+# define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+#endif
+
+#if defined (__CYGWIN__) || defined (__MINGW32__) || !(defined (_STLP_USE_GLIBC) || defined (__sun) || defined(__APPLE__))
+# if !defined (__MINGW32__) && !defined (__CYGWIN__)
+# define _STLP_NO_NATIVE_MBSTATE_T 1
+# endif
+# if !defined (__MINGW32__) || (__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 4)
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+# endif
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+#endif
+
+#define _STLP_NORETURN_FUNCTION __attribute__((noreturn))
+
+/* Mac OS X is a little different with namespaces and cannot instantiate
+ * static data members in template classes */
+#if defined (__APPLE__)
+# if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)))
+/* Mac OS X is missing a required typedef and standard macro */
+typedef unsigned int wint_t;
+# endif
+
+# define __unix
+
+# if (__GNUC__ < 3)
+
+ /* Mac OS X needs one and only one source file to initialize all static data
+ * members in template classes. Only one source file in an executable or
+ * library can declare instances for such data members, otherwise duplicate
+ * symbols will be generated. */
+
+# define _STLP_NO_STATIC_TEMPLATE_DATA
+# define _STLP_STATIC_CONST_INIT_BUG 1
+# define _STLP_STATIC_TEMPLATE_DATA 0
+# define _STLP_WEAK_ATTRIBUTE 1
+ /* Workaround for the broken Mac OS X C++ preprocessor which cannot handle
+ * parameterized macros in #include statements */
+# define _STLP_NATIVE_HEADER(header) <../g++/##header##>
+# define _STLP_NATIVE_C_HEADER(header) <../include/##header##>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../g++/##header##>
+# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../g++/##header##>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../g++/##header##>
+# endif /* __GNUC__ < 3 */
+
+# define _STLP_NO_LONG_DOUBLE
+
+/* Mac OS X needs all "::" scope references to be "std::" */
+# define _STLP_USE_NEW_C_HEADERS
+
+# define _STLP_NO_VENDOR_STDLIB_L
+
+#endif /* __APPLE__ */
+
+
+#if defined(__BEOS__) && defined(__INTEL__)
+# define _STLP_NATIVE_HEADER(header) <../stlport/beos/##header##>
+# define _STLP_NATIVE_C_HEADER(header) <../stlport/beos/##header##>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../stlport/beos/##header##>
+# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../stlport/beos/##header##>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../stlport/beos/##header##>
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+/*
+# define _NOTHREADS 1
+*/
+# ifdef _PTHREADS
+# undef _PTHREADS
+# endif
+# ifdef _STLP_PTHREADS
+# undef _STLP_PTHREADS
+# endif
+# define _STLP_USE_STDIO_IO 1
+# define _STLP_USE_GLIBC 1
+#endif
+
+/* g++ 2.7.x and above */
+#define _STLP_LONG_LONG long long
+
+#ifdef _STLP_USE_UCLIBC
+/*
+# ifndef __DO_C99_MATH__
+*/
+ /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */
+# define _STLP_NO_VENDOR_MATH_F
+ /* No *l math fuctions variants (i.e. sqrtl, fabsl, etc.) */
+# define _STLP_NO_VENDOR_MATH_L
+# define _STLP_NO_LONG_DOUBLE
+/*
+# endif
+*/
+#endif
+
+#if defined (__OpenBSD__) || defined (__FreeBSD__)
+# define _STLP_NO_VENDOR_MATH_L
+# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */
+# ifndef __unix
+# define __unix
+# endif
+#endif
+
+#if defined (__alpha__)
+# define _STLP_NO_VENDOR_MATH_L
+# define _STLP_NO_IEC559_SUPPORT
+#endif
+
+#if defined (__hpux)
+# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */
+ /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */
+# define _STLP_NO_VENDOR_MATH_F
+#endif
+
+#if (__GNUC__ >= 3)
+# ifndef _STLP_HAS_NO_NEW_C_HEADERS
+/*
+# ifndef _STLP_USE_UCLIBC
+*/
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+/*
+# endif
+*/
+# else
+# ifdef _STLP_USE_GLIBC
+# define _STLP_VENDOR_LONG_DOUBLE_MATH 1
+# endif
+# endif
+#endif
+
+#if (__GNUC__ < 3)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_USE_PTHREAD_SPINLOCK 1
+# ifndef __HONOR_STD
+# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1
+# endif
+/* egcs fails to initialize builtin types in expr. like this : new(p) char(); */
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+#endif
+
+/*
+#define _STLP_VENDOR_GLOBAL_CSTD 1
+*/
+
+#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
+# define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+# define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+#elif !defined (ANDROID)
+// Don't drag in these externals on Android.
+# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+# undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+#endif
+
+#if (__GNUC_MINOR__ < 9) && (__GNUC__ < 3) /* gcc 2.8 */
+# define _STLP_NO_TEMPLATE_CONVERSIONS
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_NO_FRIEND_TEMPLATES 1
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+/* DJGPP doesn't seem to implement it in 2.8.x */
+# ifdef DJGPP
+# define _STLP_NO_STATIC_TEMPLATE_DATA 1
+# endif
+#endif
+
+#if __GNUC__ <= 2 && __GNUC_MINOR__ <= 7 && !defined (__CYGWIN32__)
+/* Will it work with 2.6 ? I doubt it. */
+# if ( __GNUC_MINOR__ < 6 )
+__GIVE_UP_WITH_STL(GCC_272);
+# endif
+
+# define _STLP_NO_RELOPS_NAMESPACE
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+# define _STLP_DEFAULT_TYPE_PARAM 1
+# define _STLP_NO_BAD_ALLOC
+# define _STLP_NO_ARROW_OPERATOR 1
+# ifndef _STLP_NO_STATIC_TEMPLATE_DATA
+# define _STLP_NO_STATIC_TEMPLATE_DATA
+# endif
+# define _STLP_STATIC_CONST_INIT_BUG 1
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+
+# if !defined (__CYGWIN32__)
+# define _STLP_NESTED_TYPE_PARAM_BUG 1
+# define _STLP_BASE_MATCH_BUG 1
+/* unused operators are required (forward) */
+# define _STLP_CONST_CONSTRUCTOR_BUG
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM
+# endif
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+#else /* ! <= 2.7.* */
+#endif /* ! <= 2.7.* */
+
+/* static template data members workaround strategy for gcc tries
+ * to use weak symbols.
+ * if you don't want to use that, #define _STLP_WEAK_ATTRIBUTE=0 ( you'll
+ * have to put "#define __PUT_STATIC_DATA_MEMBERS_HERE" line in one of your
+ * compilation unit ( or CFLAGS for it ) _before_ including any STL header ).
+ */
+#if defined (_STLP_NO_STATIC_TEMPLATE_DATA) && ! defined (_STLP_WEAK_ATTRIBUTE )
+/* systems using GNU ld or format that supports weak symbols
+ may use "weak" attribute
+ Linux & Solaris ( x86 & SPARC ) are being auto-recognized here */
+# if defined(_STLP_GNU_LD) || defined(__ELF__) || defined (__CYGWIN__) || \
+ (( defined (__SVR4) || defined ( __svr4__ )) && \
+ ( defined (sun) || defined ( __sun__ )))
+# define _STLP_WEAK_ATTRIBUTE 1
+# endif
+#endif /* _STLP_WEAK_ATTRIBUTE */
+
+
+/* strict ANSI prohibits "long long" ( gcc) */
+#if defined ( __STRICT_ANSI__ )
+# undef _STLP_LONG_LONG
+/*
+# define _STLP_STRICT_ANSI 1
+*/
+#endif
+
+/*
+#if !defined (__STRICT_ANSI__) || defined (__BUILDING_STLPORT)
+# define _STLP_USE_TEMPLATE_EXPORT
+# define _STLP_EXPORT_TEMPLATE_KEYWORD extern
+# define _STLP_IMPORT_TEMPLATE_KEYWORD extern
+#endif
+*/
+
+#ifndef __EXCEPTIONS
+# undef _STLP_DONT_USE_EXCEPTIONS
+# define _STLP_DONT_USE_EXCEPTIONS 1
+#endif
+
+#if (__GNUC__ >= 3)
+
+# if !defined (_STLP_NATIVE_INCLUDE_PATH)
+# if ( (__GNUC__ == 3 ) && ((__GNUC_MINOR__ == 0) || ((__GNUC_MINOR__ < 3) && defined(__APPLE_CC__))))
+# define _STLP_NATIVE_INCLUDE_PATH ../g++-v3
+# else
+# if ( ((__GNUC__ == 4 ) || (__GNUC_MINOR__ >= 3)) && defined(__APPLE_CC__))
+# define _STLP_NATIVE_INCLUDE_PATH ../c++
+/*
+* Before version 3.4.0 the 0 patch level was not part of the include path:
+*/
+# elif defined (__GNUC_PATCHLEVEL__) && ((__GNUC_PATCHLEVEL__ > 0) || \
+ (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ > 3))
+# define _STLP_NATIVE_INCLUDE_PATH ../__GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__
+# else
+# define _STLP_NATIVE_INCLUDE_PATH ../__GNUC__.__GNUC_MINOR__
+# endif
+# endif
+# endif
+
+/* Instantiation scheme that used (default) in gcc 3 made void of sense explicit
+ instantiation within library: nothing except increased library size. - ptr
+ */
+# define _STLP_NO_FORCE_INSTANTIATE
+
+#elif (__GNUC_MINOR__ < 8)
+
+# if !defined (_STLP_NATIVE_INCLUDE_PATH)
+# define _STLP_NATIVE_INCLUDE_PATH ../g++-include
+# endif
+
+/* tuning of static template data members workaround */
+# if ( _STLP_STATIC_TEMPLATE_DATA < 1 )
+# if ( _STLP_WEAK_ATTRIBUTE > 0 )
+# define _STLP_WEAK __attribute__ (( weak ))
+# else
+# define _STLP_WEAK
+# endif /* _STLP_WEAK_ATTRIBUTE */
+
+# ifdef __PUT_STATIC_DATA_MEMBERS_HERE
+# define __DECLARE_INSTANCE(type,item,init) type item _STLP_WEAK init
+# else
+# define __DECLARE_INSTANCE(type,item,init)
+# endif /* __PUT_STATIC_DATA_MEMBERS_HERE */
+# endif /* _STLP_STATIC_TEMPLATE_DATA */
+
+#else
+
+/* gcc-2.95.0 used to use "g++-3" directory which has been changed to "g++" in
+ * system-dependent "include" for 2.95.2 except for Cygwin and Mingw packages.
+ * I expect "g++-3" not being used in later releases.
+ * If your installation use "g++-3" include directory for any reason (pre-2.95.2 or Win binary kit),
+ * please change the macro below to point to your directory.
+ */
+
+# if !defined (_STLP_NATIVE_INCLUDE_PATH)
+# if defined(__DJGPP)
+# define _STLP_NATIVE_INCLUDE_PATH ../lang/cxx
+# elif (__GNUC__ >= 3) || (__GNUC_MINOR__ >= 97)
+# define _STLP_NATIVE_INCLUDE_PATH ../include/g++-v3
+# elif ((__GNUC_MINOR__ >= 95 && __GNUC_MINOR__ < 97) && \
+ !( defined (__FreeBSD__) || defined (__NetBSD__) || defined(__sgi) || defined (__OS2__) ) )
+# define _STLP_NATIVE_INCLUDE_PATH ../g++-3
+# elif (__GNUC_MINOR__ > 8) && (__GNUC_MINOR__ < 95) && (__GNUC__ < 3) && !defined( __Lynx__ )
+/* this really sucks, as GNUpro does not really identifies itself, so we have to guess
+ * depending on a platform
+ */
+# ifdef __hpux
+# define _STLP_NATIVE_INCLUDE_PATH ../g++-3
+# else
+# define _STLP_NATIVE_INCLUDE_PATH ../g++-2
+# endif
+# else
+# define _STLP_NATIVE_INCLUDE_PATH g++
+# endif
+# endif
+
+/* <exception> et al */
+# ifdef __FreeBSD__
+# if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../include
+# endif
+# else
+/* azov */
+# ifndef __Lynx__
+# if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)
+/*
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../g++-v3
+*/
+# else
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../include
+# endif
+# endif
+# endif
+
+#endif /* GNUC_MINOR < 8 */
+
+#if !defined (_STLP_NATIVE_C_INCLUDE_PATH)
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+#endif
+
+/* Tune settings for the case where static template data members are not
+ * instaniated by default
+ */
+#if defined ( _STLP_NO_STATIC_TEMPLATE_DATA )
+# define _STLP_STATIC_TEMPLATE_DATA 0
+# if !defined ( _STLP_WEAK_ATTRIBUTE )
+# define _STLP_WEAK_ATTRIBUTE 0
+# endif
+# ifdef __PUT_STATIC_DATA_MEMBERS_HERE
+# define __DECLARE_INSTANCE(type,item,init) type item init
+# else
+# define __DECLARE_INSTANCE(type,item,init)
+# endif
+#else
+# define _STLP_STATIC_TEMPLATE_DATA 1
+#endif
--- /dev/null
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Acc"
+
+// system C-library dependent
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+// # define _STLP_RAND48 1
+#define _STLP_NO_NATIVE_MBSTATE_T 1
+#define _STLP_HPACC_BROKEN_BUFEND 1
+#define _STLP_WCHAR_HPACC_EXCLUDE 1
+
+// this was reported to help, just as with SUN CC 4.2
+#define _STLP_INLINE_STRING_LITERAL_BUG
+
+// specific prolog is needed to select correct threads impl
+#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+
+// HP aCC with +noeh
+#ifdef __HPACC_NOEH
+# define _STLP_HAS_NO_EXCEPTIONS 1
+#endif
+
+// HP compilers
+// At that point, we only know we are on HP (and _not_ using gcc,
+// according to "stlcomp.h"
+
+// __HP_aCC indicate HP ANSI C++, but not always (03.xx does not
+// define it before 3.13, for example).
+//
+#if defined (__HP_aCC)
+
+# define _STLP_NO_FORCE_INSTANTIATE
+# define _STLP_LONG_LONG long long
+# define _STLP_NO_VENDOR_STDLIB_L
+
+# if (__HP_aCC <= 30000 && __HP_aCC >= 12100)
+
+//Special kludge to workaround bug in aCC A.01.23, CR JAGac40634
+# ifdef _STLP_DEBUG
+static void _STLP_dummy_literal() { const char *p = "x";}
+static void _STLP_dummy_literal_2() { const char *p = "123456789"; }
+static void _STLP_dummy_literal_3() { const char *p = "123456700000000000000089";}
+# endif
+
+# define _STLP_HP_ACC 0123
+# define _STLP_NATIVE_INCLUDE_PATH ../include
+# define _STLP_VENDOR_GLOBAL_STD 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_THROW_RANGE_ERRORS 1
+# define _STLP_STATIC_CONST_INIT_BUG 1
+# if (__HP_aCC < 12700)
+//new flag: on most HP compilers cwchar is missing
+# define _STLP_NO_CWCHAR
+# endif
+
+# define _STLP_FORCE_ALLOCATORS(t,a) \
+ typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
+ typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
+
+# endif /* 123 */
+
+// latest version and up
+# if (__HP_aCC >= 32500 )
+# define _STLP_HP_ACC 0325
+
+# define _STLP_USE_NEW_C_HEADERS
+
+# define _STLP_FORCE_ALLOCATORS(t,a) \
+ typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
+ typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
+
+# if !defined ( _INCLUDE__STDC_A1_SOURCE ) // HP-UX 11i only
+# define _STLP_HAS_NO_UNIX98_WCHAR_EXTENSIONS
+# endif
+
+# if defined (_HP_NAMESPACE_STD) // option -AA
+// from now, we have a full standard lib in namespace std
+//
+// -AA indicates that we are compiling against Rogue Wave 2.2.1
+// STL shipped with the HP aCC compiler. -AA tells the compiler
+// to use the STL defined in the include_std directory.
+//
+# define _STLP_NATIVE_INCLUDE_PATH ../include_std
+
+// # define _STLP_HPACC_ONLY_NATIVE_STRING 1 // STLPort _string.c includes <locale>
+# define _STLP_HP_ACC_COMPAT -1
+# else // option -Aa
+# define _STLP_NATIVE_INCLUDE_PATH ../include
+# define _STLP_VENDOR_GLOBAL_STD 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_THROW_RANGE_ERRORS 1
+# endif /* _NAMESPACE_STD */
+# endif
+
+# if (__HP_aCC >= 31400 && __HP_aCC < 32500)
+# define _STLP_HP_ACC 0314
+
+# define _STLP_FORCE_ALLOCATORS(t,a) \
+typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
+typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
+# define _STLP_NO_CWCHAR
+# if defined (_NAMESPACE_STD) // option -AA
+// from now, we have a full standard lib in namespace std
+# define _STLP_NATIVE_INCLUDE_PATH ../include_std
+//# define _STLP_HPACC_ONLY_NATIVE_STRING 1 // STLPort _string.c includes <locale>
+# define _STLP_HP_ACC_COMPAT -1
+# else // kind of compatibility mode
+# define _STLP_NATIVE_INCLUDE_PATH ../include
+# define _STLP_VENDOR_GLOBAL_STD 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_THROW_RANGE_ERRORS 1
+# define _STLP_NO_ROPE 1
+# endif /* _NAMESPACE_STD */
+# endif /* 314 */
+
+# if ((__HP_aCC >= 30000 && __HP_aCC < 31400) || (__HP_aCC == 1)) // A.03.13: __HP_aCC == 1
+
+# if (__HP_aCC != 1)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# endif
+
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+// aCC bug ? need explicit args on constructors of partial specialized
+// classes
+# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS 1
+// ?? fbp : maybe present in some versions ?
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+// <exception> and stuff is in global namespace
+# define _STLP_VENDOR_GLOBAL_EXCEPT_STD
+// fbp : moved here
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+// # define _INCLUDE_HPUX_SOURCE
+# define _XPG4
+# define _INCLUDE_XOPEN_SOURCE
+# define _INCLUDE_AES_SOURCE
+# endif /* < 314 */
+# if __HP_aCC == 1
+# define _STLP_BROKEN_USING_IN_CLASS
+# define _STLP_USING_BASE_MEMBER
+# define _STLP_NO_CWCHAR
+// # define _STLP_NO_WCHAR_T 1
+# endif
+#endif /* HP_ACC */
+
+//
+#ifndef __HP_aCC
+# define _STLP_NATIVE_INCLUDE_PATH ../CC
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+// it is HP's old cfront-based compiler.
+# define _STLP_NO_BOOL 1
+// # define _STLP_DONT_USE_BOOL_TYPEDEF 1
+# define _STLP_NO_NEW_NEW_HEADER 1
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+# define _STLP_NO_SIGNED_BUILTINS
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NEED_EXPLICIT 1
+# define _STLP_NO_EXCEPTION_SPEC 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+# define _STLP_NO_ARROW_OPERATOR 1
+# define _STLP_BASE_MATCH_BUG
+# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+// # define _STLP_NO_WCHAR_T 1
+// # define _STLP_LONG_LONG long long
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+# define _STLP_NO_BAD_ALLOC 1
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_FRIEND_TEMPLATES 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_MEMBER_POINTER_PARAM_BUG 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+// # define _STLP_NO_METHOD_SPECIALIZATION 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+// # define _STLP_STATIC_CONST_INIT_BUG 1
+// # define _STLP_THROW_RETURN_BUG 1
+// # define _STLP_LINK_TIME_INSTANTIATION 1
+// # define _STLP_NO_TEMPLATE_CONVERSIONS 1
+# define _STLP_NO_TYPEINFO 1
+# define _STLP_WCHAR_T_IS_USHORT 1
+
+#endif /* cfront */
--- /dev/null
+#ifndef __stl_config__hpux_h
+#define __stl_config__hpux_h
+
+#define _STLP_PLATFORM "HP Unix"
+
+#ifdef __GNUC__
+# define _STLP_NO_WCHAR_T
+# define _STLP_NO_LONG_DOUBLE
+#endif
+
+#endif /* __stl_config__hpux_h */
--- /dev/null
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+#if defined (__IBMCPP__) || defined (__IBMC__)
+# define _STLP_COMPILER "Visual Age C++"
+#elif defined (__xlC__)
+# define _STLP_COMPILER "xlc"
+#else
+# error "Unknown compiler"
+#endif
+
+#if !defined(__IBMCPP__) || (__IBMCPP__ < 500)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+#endif
+
+/* string literal problem, same as with SUN and aCC */
+# define _STLP_INLINE_STRING_LITERAL_BUG 1
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+
+# ifdef __IBMCPP__
+# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+# endif
+
+/* # if ( defined (__MULTI__) && defined (__WINDOWS__))
+ * # define _STLP_WIN32THREADS 1 Only Visual Age 3.5 for Windows
+ * # endif
+ */
+
+# if ( defined (__MULTI__) && defined (__OS2__))
+# define _STLP_OS2THREADS 1
+# endif
+
+/* __TEMPINC__ is set when /Ft+ option is used */
+# ifdef __TEMPINC__
+# define _STLP_LINK_TIME_INSTANTIATION 1
+# endif
+
+# if defined (__MVS__)
+/* long long support is buggy - reported by Tinny Ng
+ * # if __EXTENDED__ && __COMPILER_VER__ >= 0x22060000
+ * # define _STLP_LONG_LONG long long
+ * # endif
+ */
+/* boris : hstash reported it can be treated like UNIX */
+# define _STLP_UNIX 1
+# define _STLP_NO_TYPEINFO 1
+# undef _STLP_NATIVE_INCLUDE_PATH
+# define _STLP_NATIVE_INCLUDE_PATH /usr/lpp/ioclib/include
+/* same for C headers like <string.h> */
+# undef _STLP_NATIVE_C_INCLUDE_PATH
+# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH /usr/include
+
+# elif (defined (__WINDOWS__) || defined (_AIX) || defined (__OS2__) ) && (__IBMCPP__ >= 350)
+
+# define _STLP_LONG_LONG long long
+
+#endif
+
+#if !( defined( __xlC__ ) && __xlC__ >= 0x500 )
+
+/* AIX xlC 3.1 , 3.0.1 ==0x301
+ * Visual Age C++ 3.x
+ * OS-390 C++
+ * fbp : should be more version-specific!
+ */
+
+# define _STLP_NO_BOOL 1
+# define _STLP_DONT_USE_BOOL_TYPEDEF 1
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NEED_EXPLICIT 1
+# define _STLP_NO_ARROW_OPERATOR 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+# define _STLP_NO_BAD_ALLOC 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_FRIEND_TEMPLATES 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# if defined (__OS2__) && (__IBMCPP__ <= 350)
+# define _STLP_NO_TYPEINFO 1
+# endif
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# define _STLP_STATIC_CONST_INIT_BUG 1
+/* # define _STLP_THROW_RETURN_BUG 1 */
+
+
+# define _STLP_NO_TEMPLATE_CONVERSIONS 1
+# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+
+/* AIX xlC, Visual Age 3.0 for OS/2 and MS */
+# define _STLP_TRIVIAL_DESTRUCTOR_BUG
+
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+
+#if __IBMCPP__ <= 350
+# define _STLP_NEED_UNREACHABLE_RETURN 1
+#endif
+
+#if __IBMCPP__ < 350
+# define _STLP_NO_LONG_DOUBLE 1
+#endif
+
+#if __IBMCPP__ >= 365
+/* does not have new C headers, but has div() */
+# define _STLP_LDIV
+#endif
+
+#endif /* xlC 5 */
+
+/* detect xlC5 by: */
+#if defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 700)
+# define _STLP_USE_EXCEPTIONS 1
+# define _STLP_STATIC_CONST_INIT_BUG 1
+/* #pragma report(disable,CPPC1500029)
+ * unsigned 32-bit integer type
+ */
+# define _STLP_UINT32_T unsigned int
+# if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+# endif
+/* # define _STLP_RAND48 1 */
+#endif /* __IBMCPP__ == 500 */
--- /dev/null
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+// A list of Intel compiler for Linux portion of STLport settings.
+
+#define _STLP_COMPILER "Intel ICC"
+
+#define _STLP_LONG_LONG long long
+
+// Edit relative path below (or put full path) to get native
+// compiler headers included. Default is "../include".
+// C headers may reside in different directory, so separate macro is provided.
+#if (__INTEL_COMPILER < 800)
+# define _STLP_NATIVE_INCLUDE_PATH ../include
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include
+#endif
+
+#if (__INTEL_COMPILER >= 800)
+# define _STLP_NATIVE_INCLUDE_PATH ../include/c++
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include
+
+#endif /* __INTEL_COMPILER >= 800 */
+
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+#define _STLP_VENDOR_GLOBAL_CSTD 1
+
+/* Systems having GLIBC installed have different traits */
+#if !defined (_STLP_USE_GLIBC) && defined (__linux__)
+# define _STLP_USE_GLIBC
+# define _XOPEN_SOURCE 600
+#endif
+
+#undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+
+
+#ifndef __GNUC__
+# define __GNUC__ 3
+#endif
+
+//#define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+
+#define _STLP_NO_FORCE_INSTANTIATE
+//#define _REENTRANT
--- /dev/null
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Intel ICL"
+
+#define _STLP_IMPORT_TEMPLATE_KEYWORD extern
+
+/* You need to undef following macro if your icl install is binded to MSVC 6
+ * native lib and you are building with /Qvc7 or /Qvc7.1 or /Qvc8 option.
+ */
+/* #define _STLP_MSVC_LIB 1200 */
+/* You need to undef following macro if your icl install is binded to MSVC .Net 2002
+ * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7.1
+ * or /Qvc8 option.
+ */
+/* #define _STLP_MSVC_LIB 1300 */
+/* You need to undef following macro if your icl install is binded to MSVC .Net 2002
+ * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7
+ * or /Qvc8 option.
+ */
+/* #define _STLP_MSVC_LIB 1310 */
+/* You need to undef following macro if your icl install is binded to MSVC .Net 2002
+ * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7
+ * or /Qvc7.1 option.
+ */
+/* #define _STLP_MSVC_LIB 1400 */
+
+#include <stl/config/_msvc.h>
+
+#if defined (_STLP_DONT_RETURN_VOID)
+# undef _STLP_DONT_RETURN_VOID
+#endif
+
+#if (__ICL >= 900)
+/* # undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT */
+# if !defined (_STLP_DONT_USE_EXCEPTIONS)
+# define _STLP_NOTHROW throw()
+# endif
+#endif
+
+#if (__ICL <= 810)
+/* If method specialization is activated, compiler do not export some
+ * symbols anymore.
+ */
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+#endif
+
+#if (__ICL >= 800)
+# define _STLP_STATIC_CONST_INIT_BUG 1
+#endif
+
+#if (__ICL >= 450)
+# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
+#endif
+
+#if (__ICL < 450)
+/* only static STLport lib works for ICL */
+# undef _STLP_USE_STATIC_LIB
+# undef _STLP_USE_DYNAMIC_LIB
+# define _STLP_USE_STATIC_LIB
+/* disable hook which makes template symbols to be searched for in the library */
+# undef _STLP_NO_CUSTOM_IO
+#endif
+
+#undef _STLP_LONG_LONG
+#define _STLP_LONG_LONG long long
+
+#if defined (__cplusplus) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
+namespace std
+{
+ void _STLP_CALL unexpected();
+}
+#endif
--- /dev/null
+// STLport config file for KAI C++ compiler
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+
+# ifndef __KAI_STRICT /* _NO_LONGLONG */
+# define _STLP_LONG_LONG long long
+# endif
+
+# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS)
+# define _STLP_HAS_NO_EXCEPTIONS
+# endif
+
+# ifndef __BUILDING_STLPORT
+# define _STLP_LINK_TIME_INSTANTIATION 1
+# endif
+
+// two levels of macros do not work good with kcc.
+# define _STLP_NATIVE_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header>
+
+# ifdef _WIN32
+# define _STLP_MINIMUM_IMPORT_STD
+# endif
+
+// KAI C++ uses EDG front-end, but apparently different switches
+// # define __EDG_SWITCHES 1
+
+
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_VENDOR_MB_NAMESPACE std
+
+// boris : some of those may also apply to KCC 3.4
+# if __KCC_VERSION < 4000
+# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1
+
+# endif
+
+# if defined (__sgi)
+// this requires some discrimination on whether we are actually on
+// a system officially supported by KAI.
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# include <standards.h>
+# endif
+
--- /dev/null
+#ifndef __stl_config__linux_h
+#define __stl_config__linux_h
+
+#define _STLP_PLATFORM "Linux"
+
+#include <features.h>
+
+/* This is defined wether library in use is glibc or not.
+ This may be treated as presence of GNU libc compatible
+ header files (these define is not really intended to check
+ for the presence of a particular library, but rather is used
+ to define an INTERFACE.) */
+#ifndef _STLP_USE_GLIBC
+# define _STLP_USE_GLIBC 1
+#endif
+
+#define _STLP_UNIX 1
+
+#if defined(_REENTRANT) && !defined(_PTHREADS)
+# define _PTHREADS
+#endif
+
+#ifdef __UCLIBC__ /* uClibc 0.9.27 */
+# define _STLP_USE_UCLIBC 1
+# if !defined(__UCLIBC_HAS_WCHAR__)
+# ifndef _STLP_NO_WCHAR_T
+# define _STLP_NO_WCHAR_T
+# endif
+# ifndef _STLP_NO_MBSTATE_T
+# define _STLP_NO_MBSTATE_T
+# endif
+# ifndef _STLP_NO_NATIVE_WIDE_STREAMS
+# define _STLP_NO_NATIVE_WIDE_STREAMS
+# endif
+# endif /* __UCLIBC_HAS_WCHAR__ */
+ /* Hmm, bogus _GLIBCPP_USE_NAMESPACES seems undefined... */
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# if defined(_STLP_REAL_LOCALE_IMPLEMENTED)
+ /* locale in uClibc is very restricted */
+ /* recheck if __UCLIBC_HAS_LOCALE__ defined...*/
+# undef _STLP_REAL_LOCALE_IMPLEMENTED
+# endif
+#endif
+
+
+#if defined(_PTHREADS)
+# define _STLP_THREADS
+# define _STLP_PTHREADS
+/*
+# ifndef __USE_UNIX98
+# define __USE_UNIX98
+# endif
+*/
+/* This feature exist at least since glibc 2.2.4 */
+/* # define __FIT_XSI_THR */ /* Unix 98 or X/Open System Interfaces Extention */
+# ifdef __USE_XOPEN2K
+/* The IEEE Std. 1003.1j-2000 introduces functions to implement spinlocks. */
+# ifndef __UCLIBC__ /* There are no spinlocks in uClibc 0.9.27 */
+# define _STLP_USE_PTHREAD_SPINLOCK
+# else
+# ifndef _STLP_DONT_USE_PTHREAD_SPINLOCK
+ /* in uClibc (0.9.26) pthread_spinlock* declared in headers
+ * but absent in library */
+# define _STLP_DONT_USE_PTHREAD_SPINLOCK
+# endif
+# endif
+/* # define __FIT_PSHARED_MUTEX */
+# endif
+#endif
+
+/* Endiannes */
+#include <endian.h>
+#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN) || !defined(__BIG_ENDIAN)
+# error "One of __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN undefined; Fix me!"
+#endif
+
+#if ( __BYTE_ORDER == __LITTLE_ENDIAN )
+# define _STLP_LITTLE_ENDIAN 1
+#elif ( __BYTE_ORDER == __BIG_ENDIAN )
+# define _STLP_BIG_ENDIAN 1
+#else
+# error "__BYTE_ORDER neither __BIG_ENDIAN nor __LITTLE_ENDIAN; Fix me!"
+#endif
+
+#if defined(__GNUC__) && (__GNUC__ < 3)
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+/*
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+*/
+#endif
+
+
+#endif /* __stl_config__linux_h */
--- /dev/null
+#define _STLP_PLATFORM "Mac"
--- /dev/null
+#define _STLP_PLATFORM "Mac OS X"
+
+#if defined (__BIG_ENDIAN__)
+# define _STLP_BIG_ENDIAN 1
+#elif defined (__LITTLE_ENDIAN__)
+# define _STLP_LITTLE_ENDIAN 1
+#endif
--- /dev/null
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_NO_MEMBER_TEMPLATES // Compiler does not support member templates
+#define _STLP_NO_MEMBER_TEMPLATE_CLASSES // Compiler does not support member template classes
+
+#define _STLP_HAS_NEW_NEW_HEADER
--- /dev/null
+/* 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) && !defined (_REENTRANT)
+# define _REENTRANT 1
+#endif
+
+#if !defined (_NATIVE_WCHAR_T_DEFINED)
+# define _STLP_WCHAR_T_IS_USHORT 1
+#endif
+
+#define _STLP_MINIMUM_IMPORT_STD
+#define _STLP_NO_VENDOR_STDLIB_L 1
+
+#if defined (_STLP_MSVC)
+
+#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
+
+/* # ifndef __BUILDING_STLPORT
+ * # define _STLP_USE_TEMPLATE_EXPORT 1
+ * # endif
+ */
+# if (_STLP_MSVC <= 1401)
+# define _STLP_STATIC_CONST_INIT_BUG 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. */
+# 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
+# if !defined (_STLP_DONT_USE_EXCEPTIONS)
+# define _STLP_NOTHROW throw()
+# endif
+# endif
+# endif
+
+# if (_STLP_MSVC <= 1300)
+# 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
+# define _STLP_NO_FRIEND_TEMPLATES
+/* Fails to properly resolve call to sin() from within sin() */
+# endif
+
+# if (_STLP_MSVC < 1300)
+# define _STLP_NO_IEC559_SUPPORT 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
+
+# if (_STLP_MSVC >= 1200)
+# define _STLP_HAS_NATIVE_FLOAT_ABS 1
+# endif
+
+// 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
+
+/*
+ * MSVC6 is known to have many trouble with namespace management but
+ * MSVC .Net 2003 and 2005 also have a bug difficult to reproduce without
+ * STLport:
+ * namespace stlp_std {
+ * typedef int foo_int;
+ * }
+ * #include <map>
+ * const foo_int bar = 0;
+ *
+ * As you can see foo is available without namespace specification as if
+ * a using namespace stlp_std has been performed. Defining _STLP_USING_NAMESPACE_BUG
+ * restore the expected compilation error.
+ */
+# define _STLP_USING_NAMESPACE_BUG 1
+
+# 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
+
+// TODO: what is the earliest version for this? If it is 1200, use _STLP_MSVC>=1200.
+# if (_STLP_MSVC > 1100) && (_STLP_MSVC < 1300)
+typedef char __stl_char;
+# define _STLP_DEFAULTCHAR __stl_char
+# endif
+
+# if (_STLP_MSVC < 1200) /* before VC++ 6.0 */
+/* # define _STLP_NO_MEMBER_TEMPLATES 1 */
+# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS 1
+# define _STLP_DONT_USE_PARTIAL_SPEC_WRKD 1
+# define _STLP_QUALIFIED_SPECIALIZATION_BUG 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_THROW_RETURN_BUG 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+# endif
+
+# if (_STLP_MSVC < 1100 )
+# ifndef _STLP_USE_NO_IOSTREAMS
+# define _STLP_USE_NO_IOSTREAMS
+# endif
+/* # define _STLP_NESTED_TYPE_PARAM_BUG 1 */
+/* Debug mode does not work for 4.2 */
+# if defined (_STLP_DEBUG)
+# pragma message ("STLport debug mode does not work for VC++ 4.2, turning _STLP_DEBUG off ...")
+# undef _STLP_DEBUG
+# endif
+# define _STLP_NO_BOOL 1
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NEED_EXPLICIT 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+# define _STLP_BROKEN_USING_DIRECTIVE 1
+# define _STLP_NO_ARROW_OPERATOR 1
+# define _STLP_NO_SIGNED_BUILTINS 1
+# define _STLP_NO_EXCEPTION_SPEC 1
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NO_AT_MEMBER_FUNCTION 1
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# endif /* 1100 */
+
+#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. */
+#if (_STLP_MSVC_LIB >= 1400) && !defined (_STLP_USING_PLATFORM_SDK_COMPILER) && !defined(UNDER_CE)
+# 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
+
+#if (_STLP_MSVC_LIB < 1100)
+/* up to 4.2, library is in global namespace */
+# define _STLP_VENDOR_GLOBAL_STD
+#endif
+
+#if (_STLP_MSVC_LIB <= 1010)
+/* "bool" is reserved in MSVC 4.1 while <yvals.h> absent, so : */
+# define _STLP_NO_BAD_ALLOC
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# define _STLP_NO_NEW_NEW_HEADER 1
+#elif (_STLP_MSVC_LIB < 1100)
+/* VC++ 4.2 and higher */
+# define _STLP_YVALS_H 1
+# define _STLP_USE_NO_IOSTREAMS 1
+#endif
+
+#define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+
+#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1100)
+# define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
+# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+#endif
+
+#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 (_STLP_MSVC >= 1200) && (_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
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC < 1200)
+/* only static STLport lib now works for VC 5.0 */
+# undef _STLP_USE_STATIC_LIB
+# undef _STLP_USE_DYNAMIC_LIB
+# define _STLP_USE_STATIC_LIB
+/* disable hook which makes template symbols to be searched for in the library */
+# undef _STLP_NO_CUSTOM_IO
+#endif
+
+#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_AUTO_LINK)
+# pragma message ("STLport: Auto linking to bufferoverflowU.lib")
+# endif
+# endif
+#endif
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */
--- /dev/null
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Metrowerks CodeWarrior"
+
+// Bring in definition of __MSL__ and related items
+#include <mslGlobals.h>
+#include <ansi_parms.h>
+
+// *** CodeWarrior Compiler Common Features ***
+#if __option(longlong)
+# define _STLP_LONG_LONG long long
+#endif
+
+#define _STLP_USE_UNIX_EMULATION_IO 1
+
+#define _STLP_USE_AUTO_PTR_CONVERSIONS 1
+
+#ifdef __INTEL__
+# define _STLP_LITTLE_ENDIAN
+#else
+# define _STLP_BIG_ENDIAN
+#endif
+
+#if defined(_MSL_NO_LOCALE)
+# define _STLP_NO_IMPORT_LOCALE
+#endif
+
+#if !__option( wchar_type )
+# define _STLP_WCHAR_T_IS_USHORT
+#endif
+
+#if __MWERKS__ < 0x3000
+// *** CodeWarrior Compiler Common Bugs ***
+# define __MSL_FIX_ITERATORS__(myType) // Some MSL headers rely on this
+# define _STLP_NO_FRIEND_TEMPLATES 1 // Bug mysteriously reintroduced in this version.
+# define _STLP_THROW_RETURN_BUG 1
+#endif
+
+#if __MWERKS__ >= 0x2405
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+#endif
+
+#if __MWERKS__ < 0x2405
+# define _STLP_STATIC_CONST_INIT_BUG
+#endif
+
+#if __MWERKS__ <= 0x2303
+# define _STLP_NO_TEMPLATE_CONVERSIONS 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+#endif
+
+#if __MWERKS__ < 0x2301
+# define _STLP_MEMBER_SPECIALIZATION_BUG 1
+#endif
+
+#if __MWERKS__ < 0x2300 // CW Pro5 features
+# define _STLP_INLINE_MEMBER_TEMPLATES 1
+# define _STLP_RELOPS_IN_STD_BUG 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+# define _STLP_NO_TYPENAME_ON_RETURN_TYPE
+#endif
+
+// fixes to native inclusion wrappers.
+#if __MWERKS__ >= 0x2300 // CWPro5 changes paths - dwa 2/28/99
+# define _STLP_NATIVE_INCLUDE_PATH ../nwsdk/include/nlm
+# define _STLP_NATIVE_C_INCLUDE_PATH ../nwsdk/include/nlm
+# define _STLP_NATIVE_HEADER(header) <../nwsdk/include/nlm/##header>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../Libraries/MSL C++/Include/##header>
+# define _STLP_NATIVE_C_HEADER(header) <../nwsdk/include/nlm/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../Libraries/MSL C++/Include/##header>
+
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_NO_VENDOR_STDLIB_L 1
+# define _STLP_NO_VENDOR_MATH_F 1
+# define _STLP_NO_VENDOR_MATH_L 1
+ //# define _MSL_NO_THROW_SPECS
+ //# define _STD
+ //# define _CSTD
+#endif
+
+// fbp
+#if !defined( __MSL_CPP__ ) || __MSL_CPP__ <= 0x4105
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+# endif
+
+#define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
--- /dev/null
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Metrowerk Codewarrior"
+
+// Bring in definition of __MSL__ and related items
+#include <mslGlobals.h>
+#include <ansi_parms.h>
+
+//
+// Compiler features
+//
+
+
+// *** CodeWarrior Compiler Common Features ***
+# if __option(longlong)
+# define _STLP_LONG_LONG long long
+# endif
+
+# define _STLP_USE_UNIX_EMULATION_IO 1
+
+# define _STLP_USE_AUTO_PTR_CONVERSIONS 1
+
+# ifdef __INTEL__
+# define _STLP_LITTLE_ENDIAN
+# else
+# define _STLP_BIG_ENDIAN
+# endif
+
+#if defined(_MSL_NO_LOCALE)
+#define _STLP_NO_IMPORT_LOCALE
+#endif
+#if !__option( wchar_type )
+# define _STLP_WCHAR_T_IS_USHORT
+#endif
+
+# if __MWERKS__ < 0x3000
+// *** CodeWarrior Compiler Common Bugs ***
+# define __MSL_FIX_ITERATORS__(myType) // Some MSL headers rely on this
+# define _STLP_NO_FRIEND_TEMPLATES 1 // Bug mysteriously reintroduced in this version.
+# define _STLP_THROW_RETURN_BUG 1
+# endif
+
+// *** Version-specific settings ***
+
+# if __MWERKS__ >= 0x2405
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+# endif
+
+# if __MWERKS__ < 0x2405
+# define _STLP_STATIC_CONST_INIT_BUG
+# endif
+
+# if __MWERKS__ <= 0x2303
+# define _STLP_NO_TEMPLATE_CONVERSIONS 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# endif
+
+# if __MWERKS__ < 0x2301
+# define _STLP_MEMBER_SPECIALIZATION_BUG 1
+# endif
+
+# if __MWERKS__ < 0x2300 // CW Pro5 features
+# define _STLP_INLINE_MEMBER_TEMPLATES 1
+# define _STLP_RELOPS_IN_STD_BUG 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+# define _STLP_NO_TYPENAME_ON_RETURN_TYPE
+# endif
+
+# if __MWERKS__ < 0x2200 // CW Pro4 features
+# define _STLP_BROKEN_USING_DIRECTIVE 1
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_FRIEND_TEMPLATES 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# endif
+
+# if __MWERKS__ < 0x2100 // CW Pro3 features
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NO_ARROW_OPERATOR 1
+# define _STLP_TEMPLATE_PARAM_SUBTYPE_BUG 1
+# define _STLP_FORCED_INLINE_INSTANTIATION_BUG 1
+# define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG 1
+# define _STLP_INLINE_NAME_RESOLUTION_BUG 1
+// *** Metrowerks Standard Library Bug ***
+# define _STLP_MSVC50_COMPATIBILITY 1
+# endif
+
+# if __MWERKS__ < 0x2000 // v. 2.0 features
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 // dwa 8/21/97 - this bug fixed for CWPro2
+# endif
+
+# if __MWERKS__ < 0x1900 // dwa 8/19/97 - 1.9 Compiler feature defines
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+# define _STLP_BASE_TYPEDEF_BUG 1
+# define _STLP_BASE_MATCH_BUG 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+# define _STLP_DEFAULT_TYPE_PARAM 1 // More limited template parameters
+
+# if __MWERKS__ < 0x1800
+ __GIVE_UP_WITH_STL(CW_18)
+# endif
+
+# endif
+
+
+// fixes to native inclusion wrappers.
+# if __MWERKS__ >= 0x2300 // CWPro5 changes paths - dwa 2/28/99
+# define _STLP_NATIVE_INCLUDE_PATH ../include
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+# define _STLP_NATIVE_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header>
+# else
+
+# define _STLP_NATIVE_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include
+# define _STLP_NATIVE_C_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes
+# define _STLP_NATIVE_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include:##header>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include:##header>
+# define _STLP_NATIVE_C_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes:##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes:##header>
+
+# endif
+
+//Following block come from boost intrinsics.hpp file:
+#if defined (__MSL_CPP__) && (__MSL_CPP__ >= 0x8000)
+ // Metrowerks compiler is acquiring intrinsic type traits support
+ // post version 8. We hook into the published interface to pick up
+ // user defined specializations as well as compiler intrinsics as
+ // and when they become available:
+# include <msl_utility>
+# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) Metrowerks::has_trivial_default_ctor<T>::value
+# define _STLP_HAS_TRIVIAL_COPY(T) Metrowerks::has_trivial_copy_ctor<T>::value
+# define _STLP_HAS_TRIVIAL_ASSIGN(T) Metrowerks::has_trivial_assignment<T>::value
+# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) Metrowerks::has_trivial_dtor<T>::value
+# define _STLP_IS_POD(T) Metrowerks::is_POD<T>::value
+# define _STLP_HAS_TYPE_TRAITS_INTRINSICS
+#endif
+
+// fbp
+# if !defined( __MSL_CPP__ ) || __MSL_CPP__ <= 0x4105
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+# endif
+
+# if defined(__MACH__)
+# define _STLP_MAC
+# define O_BINARY 0
+# elif defined(macintosh)
+# define _NOTHREADS
+# endif
+# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
--- /dev/null
+ /*
+ *
+ * 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
--- /dev/null
+#define _STLP_PLATFORM "Novell Netware"
--- /dev/null
+#define _STLP_PLATFORM "Open BSD"
--- /dev/null
+
+#if defined (_STLP_MSVC) || defined (__ICL)
+
+# if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1200)
+# pragma warning(push)
+# endif
+# 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 (__HP_aCC)
+/* _REENTRANT selects Posix 1c threads unless draft4 selected.
+ * * This usage is obsolescent, "-D_POSIX_C_SOURCE=199506" is preferred */
+# if 0 /* defined (_REENTRANT) && ! defined (_POSIX_C_SOURCE) */
+# define _POSIX_C_SOURCE 199506
+# endif
+#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
--- /dev/null
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "CC"
+
+#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+
+// define native include path before trying to include anything
+
+#define _STLP_NATIVE_HEADER(__x) </usr/include/CC/##__x>
+#define _STLP_NATIVE_C_HEADER(__x) </usr/include/##__x>
+#define _STLP_NATIVE_OLD_STREAMS_HEADER(__x) </usr/include/CC/##__x>
+#define _STLP_NATIVE_CPP_C_HEADER(__x) </usr/include/CC/##__x>
+#define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) </usr/include/CC/##__x>
+
+#define _STLP_NO_NATIVE_MBSTATE_T
+
+#define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS
+#define _STLP_NO_NATIVE_WIDE_FUNCTIONS
+#define _STLP_NO_MEMBER_TEMPLATE_CLASSES
+
+// #define _STLP_NO_BAD_ALLOC
+
+#define _STL_HAS_NAMESPACES
+
+#if ! defined (__EXCEPTIONS) && ! defined (_STLP_NO_EXCEPTIONS)
+# define _STLP_NO_EXCEPTIONS
+#endif
+
+// #define _STLP_NOTHROW throw()
+
+#define __EDG_SWITCHES
+
+#define _STLP_USE_SGI_STRING 1
+
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+// # define _STLP_VENDOR_GLOBAL_EXCEPT_STD
+
+#define _STLP_NO_POST_COMPATIBLE_SECTION
+
+#include <standards.h>
+
+#if !(_COMPILER_VERSION >= 730)
+# define _STLP_NO_NEW_NEW_HEADER 1
+#endif
+
+#if (_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_EXTERN_RANGE_ERRORS
+#endif
+
+#if !defined(_BOOL)
+# define _STLP_NO_BOOL
+#endif
+#if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32
+# define _STLP_STATIC_CONST_INIT_BUG
+#endif
+
+#if (_COMPILER_VERSION < 720) || (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32)
+# define _STLP_DEF_CONST_PLCT_NEW_BUG
+# define _STLP_DEF_CONST_DEF_PARAM_BUG
+#endif
+#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32)
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+#endif
+#if !defined(_STANDARD_C_PLUS_PLUS)
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+#endif
+#if !((_COMPILER_VERSION >= 721) && defined(_NAMESPACES))
+# define _STLP_HAS_NO_NAMESPACES
+#endif
+#if (_COMPILER_VERSION < 721) || !defined(_STL_HAS_NAMESPACES) || defined(_STLP_NO_NAMESPACES)
+# define _STLP_NO_EXCEPTION_HEADER
+#endif
+#if _COMPILER_VERSION < 730 || !defined(_STANDARD_C_PLUS_PLUS) || !defined(_NAMESPACES)
+# define _STLP_NO_BAD_ALLOC
+#endif
+#if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI
+# define _STLP_LONG_LONG long long
+#endif
+#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_USE_NO_IOSTREAMS
+#endif
+#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_NO_AT_MEMBER_FUNCTION
+#endif
+// # if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+#if !(_COMPILER_VERSION >= 721 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_NO_TEMPLATE_CONVERSIONS
+#endif
+#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32)
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+#endif
--- /dev/null
+#ifndef __stl_config__solaris_h
+#define __stl_config__solaris_h
+
+#define _STLP_PLATFORM "Sun Solaris"
+
+/* include system features file */
+#include <sys/feature_tests.h>
+
+/* system-dependent defines */
+
+/*
+ * Should be fixed:
+ * 1. __SunOS_5_x not defined, and no way to derive this from headers only;
+ * define it with -D on compiler command line is a bad idea too.
+ *
+ * 2. Solaris may has, but may hasn't MATH_F and MATH_L functions (even with two
+ * underscores)---this depends upon system update level and seems legally present
+ * only in Solaris 10 (i.e. I saw Solaris 9 with and without __acosf in libm.so.1)
+ *
+ * - ptr
+ */
+
+#if defined (__SunOS_5_8) && ! defined (_STLP_HAS_NO_NEW_C_HEADERS) && ( __cplusplus >= 199711L)
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+#endif
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+
+#if (defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)) || defined (__SunOS_5_6)
+# define _STLP_WCHAR_SUNPRO_EXCLUDE 1
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+#endif
+
+/* boris : this should always be defined for Solaris 5 & 6. Any ideas how to do it? */
+#if !(defined ( __KCC ) && __KCC_VERSION > 3400 ) && \
+ ((defined(__SunOS_5_5_1) || defined(__SunOS_5_6) ))
+# ifndef _STLP_NO_NATIVE_MBSTATE_T
+# define _STLP_NO_NATIVE_MBSTATE_T 1
+# endif
+#endif /* KCC */
+
+/* For SPARC we use lightweight synchronization */
+#if defined (__sparc) /* && (defined (_REENTRANT) || defined (_PTHREADS)) */
+# if ( (defined (__GNUC__) && defined (__sparc_v9__)) || \
+ defined (__sparcv9) ) \
+ && !defined(_NOTHREADS) && !defined (_STLP_NO_SPARC_SOLARIS_THREADS)
+# define _STLP_SPARC_SOLARIS_THREADS
+# define _STLP_THREADS_DEFINED
+# endif
+#endif
+
+/* gcc does not support ELF64 yet ; however; it supports ultrasparc + v8plus.
+ * limits.h contains invalid values for this combination
+ */
+#ifdef __GNUC__
+# if (defined (__sparc_v9__) || defined (__sparcv9)) && !defined ( __WORD64 ) && !defined(__arch64__)
+# define __LONG_MAX__ 2147483647L
+# endif
+#endif
+
+/*
+ * Hmm, I don't found in Solaris 9 system headers definition like __SunOS_5_9
+ * (defined in SunPro?); I also can't find functions like fmodf (again,
+ * I found modff in libc, but no acosf etc.). Strange, I saw __cosf functions
+ * (built-in?) at least with gcc some time ago, but don't see ones with
+ * gcc 3.3.2 on SunOS sparc-solaris1 5.9 Generic_112233-03 sun4u sparc SUNW,Ultra-60
+ * from Sorceforge's CF.
+ * 2005-12-15, - ptr
+ *
+ * P.S. That's why I add two defines:
+ */
+
+/* #ifdef __GNUC__ */
+#define _STLP_NO_VENDOR_MATH_F
+#define _STLP_NO_VENDOR_MATH_L
+/* #endif */
+
+#ifdef __GNUC__
+# define _STLP_WCHAR_BORLAND_EXCLUDE
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+#endif
+
+#endif /* __stl_config__solaris_h */
--- /dev/null
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Sunpro CC"
+
+#define _STLP_LONG_LONG long long
+
+// GAB: 11/09/05
+// Starting with 5.0 the STLport code expects to be
+// instantiated during compile time. This is due to undefing
+// a number of defines that are also used in the c versions
+// of the file. When they are undefed the c version fails to
+// compile.
+// # define _STLP_LINK_TIME_INSTANTIATION 1
+
+#if ! defined(_BOOL)
+# define _STLP_NO_BOOL 1
+#endif
+
+// compatibility mode stuff
+#if (__SUNPRO_CC >= 0x510) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 ))
+# define _STLP_NATIVE_INCLUDE_PATH ../CC/Cstd
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../CC
+#elif (__SUNPRO_CC >= 0x500) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 ))
+# define _STLP_NATIVE_INCLUDE_PATH ../CC
+#elif (defined (__SUNPRO_CC_COMPAT) && __SUNPRO_CC_COMPAT == 4)
+# define _STLP_NATIVE_INCLUDE_PATH ../CC4
+#else
+# define _STLP_NATIVE_INCLUDE_PATH ../CC
+#endif
+
+#define _STLP_STATIC_CONST_INIT_BUG 1
+
+#if (__SUNPRO_CC < 0x530)
+// those are tested and proved not to work...
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+#endif
+
+#ifdef _STLP_USE_NO_IOSTREAMS
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+#endif
+
+// those do not depend on compatibility
+#if (__SUNPRO_CC < 0x510)
+# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+#endif
+
+#if (__SUNPRO_CC < 0x510) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5))
+
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+
+// no partial , just for explicit one
+# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_FRIEND_TEMPLATES 1
+
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+#endif
+
+// Features that depend on compatibility switch
+#if ( __SUNPRO_CC < 0x500 ) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5))
+
+# ifndef _STLP_USE_NO_IOSTREAMS
+# define _STLP_USE_NO_IOSTREAMS 1
+# endif
+# define _STLP_NO_NEW_NEW_HEADER 1
+// # define _STLP_NO_RELOPS_NAMESPACE
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_BAD_ALLOC 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+#elif (__SUNPRO_CC < 0x510)
+// # define _STLP_NATIVE_C_HEADER(header) <../CC/##header##.SUNWCCh>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../CC/##header##.SUNWCCh>
+# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
+#elif defined( __SunOS_5_5_1 ) || defined( __SunOS_5_6 ) || defined( __SunOS_5_7 )
+# define _STLP_NATIVE_C_INCLUDE_PATH ../CC/std
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std
+#else
+# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std
+#endif
+
+#if ( __SUNPRO_CC < 0x500 )
+
+# undef _STLP_NATIVE_C_HEADER
+# undef _STLP_NATIVE_CPP_C_HEADER
+
+# define wint_t __wint_t
+// famous CC 4.2 bug
+# define _STLP_INLINE_STRING_LITERAL_BUG 1
+// /usr/include
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+
+// 4.2 cannot handle iterator_traits<_Tp>::iterator_category as a return type ;(
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+
+// 4.2 does not like it
+# undef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NEED_EXPLICIT 1
+# define _STLP_NO_BAD_ALLOC 1
+# define _STLP_NO_ARROW_OPERATOR 1
+
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG 1
+# undef _STLP_HAS_NO_NEW_C_HEADERS
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+// # define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+
+# if ( __SUNPRO_CC < 0x420 )
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+# if ( __SUNPRO_CC > 0x401 )
+# if (__SUNPRO_CC==0x410)
+# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+# endif
+# else
+ // SUNPro C++ 4.0.1
+# define _STLP_BASE_MATCH_BUG 1
+# define _STLP_BASE_TYPEDEF_BUG 1
+# if (( __SUNPRO_CC < 0x401 ) && !defined(__SUNPRO_C))
+ __GIVE_UP_WITH_STL(SUNPRO_401)
+# endif
+# endif /* 4.0.1 */
+# endif /* 4.2 */
+#endif /* < 5.0 */
+
+#ifndef _MBSTATET_H
+# define _MBSTATET_H
+# undef _MBSTATE_T
+# define _MBSTATE_T
+typedef struct __mbstate_t {
+# if defined(_LP64)
+ long __filler[4];
+# else
+ int __filler[6];
+# endif
+} __mbstate_t;
+# ifndef _STLP_HAS_NO_NAMESPACES
+namespace std {
+ typedef __mbstate_t mbstate_t;
+}
+using std::mbstate_t;
+# else
+typedef __mbstate_t mbstate_t;
+# endif
+#endif /* __MBSTATET_H */
--- /dev/null
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+#define _STLP_COMPILER "Symantec"
+
+/* if not using maximum ANSI compatibility ( -A -Ab -Aw),
+ * uncomment the following two lines:
+ */
+/*# define _STLP_NO_BOOL 1 */
+/*# define _STLP_NO_WCHAR_T 1 */
+
+/* TODO: Check that this config is necessary for all compiler versions.
+ * It is here for historical reasons for the moment.
+ */
+#define _STLP_NO_CONTAINERS_EXTENSION
+
+# define _STLP_HAS_NO_NAMESPACES 1
+
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NEED_EXPLICIT 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+/* # define _STLP_NO_BAD_ALLOC 1 */
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_FRIEND_TEMPLATES 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+
+/* # define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 */
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+/* # define _STLP_NO_EXCEPTION_HEADER 1 */
+
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+# define _STLP_STATIC_CONST_INIT_BUG 1
+# define _STLP_THROW_RETURN_BUG 1
+/* # define _STLP_LINK_TIME_INSTANTIATION 1 */
+# define _STLP_NO_TEMPLATE_CONVERSIONS 1
+
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/*
+ * Purpose of this file :
+ *
+ * To hold COMPILER-SPECIFIC portion of STLport settings.
+ * In general, user should not edit this file unless
+ * using the compiler not recognized below.
+ *
+ * If your compiler is not being recognized yet,
+ * please look for definitions of macros in stl_mycomp.h,
+ * copy stl_mycomp.h to stl_YOUR_COMPILER_NAME,
+ * adjust flags for your compiler, and add <include config/stl_YOUR_COMPILER_NAME>
+ * to the secton controlled by unique macro defined internaly by your compiler.
+ *
+ * To change user-definable settings, please edit <user_config.h>
+ *
+ */
+
+#ifndef __stl_config__system_h
+#define __stl_config__system_h
+
+#if defined(__SYMBIAN32__)
+# if defined(__GCCE__) || defined(__ARMCC__)
+# include <stl/config/stl_gcce.h>
+# elif defined(__WINSCW__)
+# include <stl/config/stl_winscw.h>
+# endif
+# include <stl/config/stl_symbian.h>
+#elif defined (__sun)
+# include <stl/config/_solaris.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# elif defined (__SUNPRO_CC)
+# include <stl/config/_sunprocc.h>
+/*
+# ifdef __KCC
+# include <stl/config/_kai.h>
+# endif
+*/
+# elif defined (__APOGEE__) /* Apogee 4.x */
+# include <stl/config/_apcc.h>
+# elif defined (__FCC_VERSION) /* Fujitsu Compiler, v4.0 assumed */
+# include <stl/config/_fujitsu.h>
+# endif
+#elif defined (__hpux)
+# include <stl/config/_hpux.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# elif defined (__HP_aCC)
+# include <stl/config/_hpacc.h>
+# endif
+#elif defined (ANDROID)
+ /* Android mobile phone platform. Somewhat but not entirely GNU/Linux-like */
+# include <stl/config/_android.h>
+# include <stl/config/_gcc.h>
+#elif defined (linux) || defined (__linux__)
+# include <stl/config/_linux.h>
+/* Intel's icc define __GNUC__! */
+# if defined (__INTEL_COMPILER)
+# include <stl/config/_icc.h>
+# elif defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+/*
+# ifdef __KCC
+# include <stl/config/_kai.h>
+# endif
+*/
+#elif defined (__FreeBSD__)
+# include <stl/config/_freebsd.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (__OpenBSD__)
+# include <stl/config/_openbsd.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (N_PLAT_NLM) /* Novell NetWare */
+# include <stl/config/_netware.h>
+# ifdef __MWERKS__ /* Metrowerks CodeWarrior */
+# include <stl/config/_mwccnlm.h>
+# endif
+#elif defined (__sgi) /* IRIX? */
+# define _STLP_PLATFORM "SGI Irix"
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# else
+# include <stl/config/_sgi.h>
+# endif
+#elif defined (__OS400__) /* AS/400 C++ */
+# define _STLP_PLATFORM "OS 400"
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# else
+# include <stl/config/_as400.h>
+# endif
+#elif defined (_AIX)
+# include <stl/config/_aix.h>
+# if defined (__xlC__) || defined (__IBMC__) || defined ( __IBMCPP__ )
+ /* AIX xlC, Visual Age C++ , OS-390 C++ */
+# include <stl/config/_ibm.h>
+# endif
+#elif defined (_CRAY) /* Cray C++ 3.4 or 3.5 */
+# define _STLP_PLATFORM "Cray"
+# include <config/_cray.h>
+#elif defined (__DECCXX) || defined (__DECC)
+# define _STLP_PLATFORM "DECC"
+# ifdef __vms
+# include <stl/config/_dec_vms.h>
+# else
+# include <stl/config/_dec.h>
+# endif
+#elif defined (macintosh) || defined (_MAC)
+# include <stl/config/_mac.h>
+# if defined (__MWERKS__)
+# include <stl/config/_mwerks.h>
+# elif defined (__MRC__) || (defined (__SC__) && (__SC__ >= 0x882))
+ /* Apple MPW SCpp 8.8.2, Apple MPW MrCpp 4.1.0 */
+# include <stl/config/_apple.h>
+# endif
+#elif defined (__APPLE__)
+# include <stl/config/_macosx.h>
+# ifdef __GNUC__
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (__CYGWIN__)
+# include <stl/config/_cygwin.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (__MINGW32__)
+# define _STLP_PLATFORM "MinGW"
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+# include <stl/config/_windows.h>
+#elif defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__) || \
+ defined (__WIN16) || defined (WIN16) || defined (_WIN16)
+# if defined ( __BORLANDC__ ) /* Borland C++ ( 4.x - 5.x ) */
+# include <stl/config/_bc.h>
+# elif defined (__WATCOM_CPLUSPLUS__) || defined (__WATCOMC__) /* Watcom C++ */
+# include <stl/config/_watcom.h>
+# elif defined (__COMO__) || defined (__COMO_VERSION_)
+# include <stl/config/_como.h>
+# elif defined (__DMC__) /* Digital Mars C++ */
+# include <stl/config/_dm.h>
+# elif defined (__SC__) && (__SC__ < 0x800) /* Symantec 7.5 */
+# include <stl/config/_symantec.h>
+# elif defined (__ICL) /* Intel reference compiler for Win */
+# include <stl/config/_intel.h>
+# elif defined (__MWERKS__)
+# include <stl/config/_mwerks.h>
+# elif defined (_MSC_VER) && (_MSC_VER >= 1200) && defined (UNDER_CE)
+ /* Microsoft eMbedded Visual C++ 3.0, 4.0 (.NET) */
+# include <stl/config/_evc.h>
+# elif defined (_MSC_VER)
+ /* Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0 */
+# include <stl/config/_msvc.h>
+# endif
+
+# include <stl/config/_windows.h>
+#else
+# error Unknown platform !!
+#endif
+
+#if !defined (_STLP_COMPILER)
+/* Unable to identify the compiler, issue error diagnostic.
+ * Edit <config/stl_mycomp.h> to set STLport up for your compiler. */
+# include <stl/config/stl_mycomp.h>
+#endif
+
+#endif /* __stl_config__system_h */
--- /dev/null
+/* This header turns off warnings that STLport headers generate for compiled
+ * user code.
+ */
+
+#if defined (_STLP_MSVC)
+# if (_STLP_MSVC > 1000)
+# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+/*
+ * 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 < 1200) // VC5 and earlier
+# pragma warning( disable : 4389 ) // '==' : signed/unsigned mismatch
+// multiple copy constructors/assignment operators specified,
+// with member templates are bogus...
+# pragma warning( disable : 4521 )
+# pragma warning( disable : 4522 )
+# 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
+# endif
+#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
--- /dev/null
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Watcom"
+
+# ifndef _STLP_USE_NO_IOSTREAMS
+# define _STLP_USE_NO_IOSTREAMS
+# endif
+
+# define _STLP_NO_RELOPS_NAMESPACE
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
+
+# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+
+// On QNX, headers are supposed to be found in /usr/include,
+// so default "../include" should work.
+# ifndef __QNX__
+# define _STLP_NATIVE_INCLUDE_PATH ../h
+# endif
+
+// Inline replacements for locking calls under Watcom
+// Define _STLP_NO_WATCOM_INLINE_INTERLOCK to keep using
+// standard WIN32 calls
+// Define _STL_MULTIPROCESSOR to enable lock
+#if !defined(_STLP_NO_WATCOM_INLINE_INTERLOCK)
+
+long __stl_InterlockedIncrement( long *var );
+long __stl_InterlockedDecrement( long *var );
+
+#ifdef _STL_MULTIPROCESSOR
+// Multiple Processors, add lock prefix
+#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 1" \
+ "lock xadd [ecx], eax" \
+ "inc eax" \
+ value [eax];
+
+
+#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 0FFFFFFFFh" \
+ "lock xadd [ecx], eax" \
+ "dec eax" \
+ value [eax];
+#else
+// Single Processor, lock prefix not needed
+#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 1" \
+ "xadd [ecx], eax" \
+ "inc eax" \
+ value [eax];
+
+#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 0FFFFFFFFh" \
+ "xadd [ecx], eax" \
+ "dec eax" \
+ value [eax];
+#endif // _STL_MULTIPROCESSOR
+
+long __stl_InterlockedExchange( long *Destination, long Value );
+
+// xchg has auto-lock
+#pragma aux __stl_InterlockedExchange parm [ecx] [eax] = \
+ ".586" \
+ "xchg eax, [ecx]" \
+ value [eax];
+#else
+
+#define __stl_InterlockedIncrement InterlockedIncrement
+#define __stl_InterlockedDecrement InterlockedDecrement
+#define __stl_InterlockedExchange InterlockedExchange
+#endif /* INLINE INTERLOCK */
+
+#define _STLP_ATOMIC_INCREMENT(__x) __stl_InterlockedIncrement((long*)__x)
+#define _STLP_ATOMIC_DECREMENT(__x) __stl_InterlockedDecrement((long*)__x)
+#define _STLP_ATOMIC_EXCHANGE(__x, __y) __stl_InterlockedExchange((long*)__x, (long)__y)
+
+// boris : is this true or just the header is not in /usr/include ?
+# ifdef __QNX__
+# define _STLP_NO_TYPEINFO 1
+# endif
+
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_FRIEND_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+
+
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NEED_TYPENAME 1
+
+# if __WATCOMC__ < 1100
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+# endif
+
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+# define _STLP_STATIC_CONST_INIT_BUG 1
+// # define _STLP_THROW_RETURN_BUG 1
+# define _STLP_NO_TEMPLATE_CONVERSIONS 1
+
+# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+
+# define _STLP_HAS_NO_NEW_IOSTREAMS 1
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# define _STLP_NO_NEW_NEW_HEADER 1
+# define _STLP_VENDOR_GLOBAL_STD
+
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_NO_BAD_ALLOC 1
+
+# define _STLP_NESTED_TYPE_PARAM_BUG 1
+
+# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
+
+# if (__WATCOM_CPLUSPLUS__ < 1100 )
+# define _STLP_NO_BOOL 1
+# define _STLP_NEED_EXPLICIT 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_ARROW_OPERATOR 1
+# endif
+// This one is present in 11, but apparently has bugs (with auto_ptr).
+# define _STLP_NO_NEW_STYLE_CASTS 1
+
+// Get rid of Watcom's min and max macros
+#undef min
+#undef max
+
+// for switches (-xs, -xss, -xst)
+//
+#if !(defined (__SW_XS) || defined (__SW_XSS) || defined(__SW_XST))
+# define _STLP_HAS_NO_EXCEPTIONS 1
+# endif
+
+# if defined ( _MT ) && !defined (_NOTHREADS) && !defined (_REENTRANT)
+# define _REENTRANT 1
+# endif
+
+
+
+
+
--- /dev/null
+/*
+ * 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
+
+/* _STLP_WIN32_VERSION is used to detect targetted Windows platforms as
+ * old ones are not supporting some Win32 functions that STLport use.
+ * Limited OSs are going up to and including Windows 98 so they can be
+ * detected using WINVER or _WIN32_WINDOWS macros, we do not have to use
+ * _WINNT_WINDOWS macro for the moment.
+ */
+#if !defined (_STLP_WIN32_VERSION)
+# if defined (WINVER)
+# define _STLP_WIN32_VERSION WINVER
+# elif defined (_WIN32_WINDOWS)
+# define _STLP_WIN32_VERSION _WIN32_WINDOWS
+# endif
+#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 ( _STLP_MSVC ) || defined (__BORLANDC__) || defined (__ICL) || defined (__WATCOMC__) || \
+ defined (__MINGW32__) || defined (__DMC__))
+# if defined (_STLP_USE_MFC)
+# include <afx.h>
+# else
+# include <windows.h>
+# endif
+# else
+/* This section serves as a replacement for windows.h header for Visual C++ */
+# 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
+/* Here we use a different macro name than the InterlockedExchangePointer SDK function
+ * to avoid macro definition conflict as the SDK might already define InterlockedExchangePointer
+ * as a macro.
+ */
+# define STLPInterlockedExchangePointer _InterlockedExchangePointer
+# 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 (STLPInterlockedExchangePointer)
+_STLP_IMPORT_DECLSPEC void* _STLP_STDCALL STLPInterlockedExchangePointer(void* volatile *, void*);
+# endif
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchangeAdd(long volatile *, long);
+# elif defined (_STLP_WCE)
+
+/* start of eMbedded Visual C++ specific section */
+# 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 */
+
+# else
+/* 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);
+# endif
+
+# if !defined (STLPInterlockedExchangePointer)
+/* This API function do not exist in the old platform SDK and is equivalent to
+ * InterlockedExchange on 32 bits platform:
+ */
+# if defined (__cplusplus)
+/* We do not define this function if we are not in a C++ translation unit just
+ * because of the inline 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
+# 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)
+# pragma intrinsic(_InterlockedExchangePointer)
+# endif
+# if defined (__cplusplus)
+} /* extern "C" */
+# endif
+
+# endif /* STL_MSVC __BORLANDC__ __ICL __WATCOMC__ __MINGW32__ __DMC__*/
+
+#endif /* _STLP_WINDOWS_H_INCLUDED */
+
+#endif /* _STLP_INTERNAL_WINDOWS_H */
--- /dev/null
+
+/*
+ * Compatibility section
+ * This section sets new-style macros based on old-style ones, for compatibility
+ */
+
+#if defined (__STL_DEBUG) && !defined (_STLP_DEBUG)
+# define _STLP_DEBUG __STL_DEBUG
+#endif
+#if defined (__STL_NO_ANACHRONISMS) && !defined (_STLP_NO_ANACHRONISMS)
+# define _STLP_NO_ANACHRONISMS __STL_NO_ANACHRONISMS
+#endif
+#if defined (__STL_NO_EXTENSIONS) && !defined (_STLP_NO_EXTENSIONS)
+# define _STLP_NO_EXTENSIONS __STL_NO_EXTENSIONS
+#endif
+#if defined (__STL_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS)
+# define _STLP_NO_EXCEPTIONS __STL_NO_EXCEPTIONS
+#endif
+#if defined (__STL_NO_NAMESPACES) && !defined (_STLP_NO_NAMESPACES)
+# define _STLP_NO_NAMESPACES __STL_NO_NAMESPACES
+#endif
+#if defined (__STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
+# define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS __STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS
+#endif
+#if defined (__STL_NO_OWN_NAMESPACE) && !defined (_STLP_NO_OWN_NAMESPACE)
+# define _STLP_NO_OWN_NAMESPACE __STL_NO_OWN_NAMESPACE
+#endif
+
+#if defined (__STL_NO_RELOPS_NAMESPACE) && !defined (_STLP_NO_RELOPS_NAMESPACE)
+# define _STLP_NO_RELOPS_NAMESPACE __STL_NO_RELOPS_NAMESPACE
+#endif
+
+#if defined (__STL_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_UNINITIALIZED)
+# define _STLP_DEBUG_UNINITIALIZED __STL_DEBUG_UNINITIALIZED
+#endif
+#if defined (__STL_SHRED_BYTE) && !defined (_STLP_SHRED_BYTE)
+# define _STLP_SHRED_BYTE __STL_SHRED_BYTE
+#endif
+#if defined (__STL_USE_MFC) && !defined (_STLP_USE_MFC)
+# define _STLP_USE_MFC __STL_USE_MFC
+#endif
+
+#if defined (__STL_USE_NEWALLOC) && !defined (_STLP_USE_NEWALLOC)
+# define _STLP_USE_NEWALLOC __STL_USE_NEWALLOC
+#endif
+#if defined (__STL_USE_MALLOC) && !defined (_STLP_USE_MALLOC)
+# define _STLP_USE_MALLOC __STL_USE_MALLOC
+#endif
+
+#if defined (__STL_DEBUG_ALLOC) && !defined (_STLP_DEBUG_ALLOC)
+# define _STLP_DEBUG_ALLOC __STL_DEBUG_ALLOC
+#endif
+
+#if defined (__STL_DEBUG_MESSAGE) && !defined (_STLP_DEBUG_MESSAGE)
+# define _STLP_DEBUG_MESSAGE __STL_DEBUG_MESSAGE
+#endif
+
+#if defined (__STL_DEBUG_TERMINATE) && !defined (_STLP_DEBUG_TERMINATE)
+# define _STLP_DEBUG_TERMINATE __STL_DEBUG_TERMINATE
+#endif
+
+#if defined (__STL_USE_ABBREVS) && !defined (_STLP_USE_ABBREVS)
+# define _STLP_USE_ABBREVS __STL_USE_ABBREVS
+#endif
+
+#if defined (__STL_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_NO_MSVC50_COMPATIBILITY)
+# define _STLP_NO_MSVC50_COMPATIBILITY __STL_NO_MSVC50_COMPATIBILITY
+#endif
+
+#if defined (__STL_USE_RAW_SGI_ALLOCATORS) && !defined (_STLP_USE_RAW_SGI_ALLOCATORS)
+# define _STLP_USE_RAW_SGI_ALLOCATORS __STL_USE_RAW_SGI_ALLOCATORS
+#endif
+
+/* STLport do not support anymore the iostream wrapper mode so this macro should
+ * always been define for other libraries that was using it:
+ */
+#if !defined (_STLP_OWN_IOSTREAMS)
+# define _STLP_OWN_IOSTREAMS
+#endif
+
+#if defined (_STLP_NO_OWN_IOSTREAMS)
+# error STLport do not support anymore the wrapper mode. If you want to use STLport \
+use its iostreams implementation or no iostreams at all.
+#endif
--- /dev/null
+ /*
+ *
+ * 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_FEATURES_H
+#define _STLP_FEATURES_H
+
+/*
+ * Purpose of this file:
+ *
+ * Defines all STLport settings.
+ * This file is actually a wrapper : it includes compiler-specific
+ * settings from <config/stlcomp.h>
+ * and user-defined settings from <config/user_config.h>.
+ * See <config/stl_mycomp.h> and <config/user_config.h> for the description
+ * of those macros
+ *
+ */
+
+/* Definition of the STLport version informations */
+#include <stl/_stlport_version.h>
+
+/* Other macros defined by this file:
+
+ * bool, true, and false, if _STLP_NO_BOOL is defined.
+ * typename, as a null macro if it's not already a keyword.
+ * explicit, as a null macro if it's not already a keyword.
+ * namespace-related macros (_STLP_STD, _STLP_BEGIN_NAMESPACE, etc.)
+ * exception-related macros (_STLP_TRY, _STLP_UNWIND, etc.)
+ * _STLP_ASSERT, either as a test or as a null macro, depending on
+ whether or not _STLP_ASSERTIONS is defined.
+*/
+
+/* Definition of the 2 STLport debug levels */
+#define _STLP_STLPORT_DBG_LEVEL 1
+#define _STLP_STANDARD_DBG_LEVEL 2
+
+/* Placeholder for user to override settings.
+ * It could be also used to mask settings from
+ * different directories.
+ */
+#include <stl/config/user_config.h>
+
+#if defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_LEVEL)
+# define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL
+#endif
+
+#if defined (__BUILDING_STLPORT)
+/* For the STLport implementation we can use everything:
+ */
+# if defined (_STLP_NO_ANACHRONISMS)
+# undef _STLP_NO_ANACHRONISMS
+# endif
+# if defined (_STLP_NO_EXTENSIONS)
+# undef _STLP_NO_EXTENSIONS
+# endif
+/* Moreover there are things that has no sens:
+ */
+# if defined (_STLP_NO_IOSTREAMS)
+# error If you do not use iostreams you do not need to build the STLport library.
+# endif
+#endif
+
+/* ========================================================= */
+/* This file is used for compatibility; it accepts old-style config
+ switches */
+#include <stl/config/compat.h>
+
+/* Common configuration file for this particular installation. */
+#include <stl/config/host.h>
+
+/* Operational Environment specific */
+#include <stl/config/_system.h>
+
+/* ========================================================= */
+
+/* some fixes to configuration. This also includes modifications
+ * of STLport switches depending on compiler flags,
+ * or settings applicable to a group of compilers, such as
+ * to all who use EDG front-end.
+ */
+#include <stl/config/stl_confix.h>
+
+#ifdef _STLP_USE_BOOST_SUPPORT
+/* We are going to use the boost library support. To limit the problem
+ * of self referencing headers we have to specify clearly to the boost
+ * library that the Standard lib is STLport:
+ */
+# ifndef BOOST_STDLIB_CONFIG
+# define BOOST_STDLIB_CONFIG <boost/config/stdlib/stlport.hpp>
+# endif
+#endif
+
+
+/*
+ * Performs integrity check on user-specified parameters
+ * and site-specific settings.
+ */
+/*
+# include <stl/_check_config.h>
+*/
+
+/* SGI terms */
+
+#if !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_MEMBER_TEMPLATES)
+# define _STLP_MEMBER_TEMPLATES 1
+#endif
+
+#if !defined (_STLP_NO_FRIEND_TEMPLATES) && !defined (_STLP_FRIEND_TEMPLATES)
+# define _STLP_FRIEND_TEMPLATES 1
+#endif
+
+#if !defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+# define _STLP_MEMBER_TEMPLATE_CLASSES 1
+#endif
+
+#if defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
+#endif
+
+#if !defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# define _STLP_CLASS_PARTIAL_SPECIALIZATION 1
+#endif
+
+#if !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER)
+# define _STLP_FUNCTION_TMPL_PARTIAL_ORDER 1
+#endif
+
+#if !defined (_STLP_DONT_USE_SHORT_STRING_OPTIM) && !defined (_STLP_USE_SHORT_STRING_OPTIM)
+# define _STLP_USE_SHORT_STRING_OPTIM 1
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXTENSIONS) && \
+ !defined (_STLP_NO_CONTAINERS_EXTENSION) && !defined (_STLP_USE_CONTAINERS_EXTENSION)
+# define _STLP_USE_CONTAINERS_EXTENSION
+#endif
+
+#if defined (_STLP_USE_CONTAINERS_EXTENSION)
+# define _STLP_TEMPLATE_FOR_CONT_EXT template <class _KT>
+#else
+# define _STLP_TEMPLATE_FOR_CONT_EXT
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS) && \
+ (defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS))
+# error "Sorry but according the STLport settings your compiler can not support the pointer specialization feature."
+#endif
+
+#if defined (_STLP_NO_IOSTREAMS) && \
+ !defined (_STLP_USE_NEWALLOC) && !defined (_STLP_USE_MALLOC)
+# define _STLP_USE_NEWALLOC
+#endif
+
+#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
+# if defined (_MIPSEB) || defined (__sparc) || defined (_AIX) || \
+ defined (__hpux) || defined (macintosh) || defined (_MAC)
+# define _STLP_BIG_ENDIAN 1
+# elif defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
+ defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
+ defined (__alpha__)
+# define _STLP_LITTLE_ENDIAN 1
+# elif 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
+# else
+# error "can't determine endianess"
+# endif
+#endif /* _STLP_BIG_ENDIAN */
+
+/* ==========================================================
+ * final workaround tuning based on given flags
+ * ========================================================== */
+
+#ifndef _STLP_UINT32_T
+# define _STLP_UINT32_T unsigned long
+#endif
+#ifndef _STLP_ABORT
+# define _STLP_ABORT() abort()
+#endif
+
+#if !defined (_STLP_HAS_NO_NAMESPACES)
+# if defined _STLP_NO_NAMESPACES
+# undef _STLP_USE_NAMESPACES
+# else
+/* assume it as the default, turn it off later if NO_NAMESPACES selected */
+# undef _STLP_USE_NAMESPACES
+# define _STLP_USE_NAMESPACES 1
+# endif
+#endif
+
+#if defined (_STLP_NO_IOSTREAMS)
+# define _STLP_USE_NO_IOSTREAMS
+#endif
+
+/* Operating system recognition (basic) */
+#if defined (__unix) || defined (__linux__) || defined (__QNX__) || defined (_AIX) || defined (__NetBSD__) || defined(__OpenBSD__) || defined (__Lynx__)
+# define _STLP_UNIX 1
+#elif defined(macintosh) || defined (_MAC)
+# define _STLP_MAC 1
+#elif defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__)
+# ifndef __SYMBIAN32__
+# define _STLP_WIN32 1
+# endif
+#elif defined (__WIN16) || defined (WIN16) || defined (_WIN16)
+# define _STLP_WIN16
+#endif /* __unix */
+
+#if defined (_STLP_WIN16)
+# define _STLP_LDOUBLE_80
+#elif defined(_STLP_WIN32)
+# if defined (_STLP_MSVC) || defined (__ICL) || defined (__BORLANDC__) || defined (__CYGWIN__)
+# define _STLP_LDOUBLE_64
+# else
+# define _STLP_LDOUBLE_96
+# endif
+#elif defined (_STLP_UNIX)
+# if defined (__CYGWIN__)
+# define _STLP_LDOUBLE_96
+# endif
+#endif
+
+#if !defined (_STLP_LDOUBLE_64) && !defined (_STLP_LDOUBLE_80) && !defined (_STLP_LDOUBLE_96) && !defined (_STLP_LDOUBLE_128)
+# define _STLP_LDOUBLE_128
+#endif
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+# define _STLP_LONGEST_FLOAT_TYPE long double
+#else
+# define _STLP_LONGEST_FLOAT_TYPE double
+#endif
+
+/* Native headers access macros */
+#include <stl/config/_native_headers.h>
+
+/* shared library tune-up */
+
+#if defined (__BUILDING_STLPORT)
+/* if we are rebuilding right now, place everything here */
+# undef _STLP_DESIGNATED_DLL
+# define _STLP_DESIGNATED_DLL 1
+#endif
+
+/* Use own namespace always if possible and not explicitly instructed otherwise */
+#if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_BROKEN_USING_DIRECTIVE) && \
+ !defined (_STLP_NO_OWN_NAMESPACE)
+# undef _STLP_USE_OWN_NAMESPACE
+# define _STLP_USE_OWN_NAMESPACE 1
+#else
+# undef _STLP_WHOLE_NATIVE_STD
+#endif
+
+#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED)
+
+# if defined (_PTHREADS)
+# define _STLP_PTHREADS
+# define _STLP_THREADS
+# endif
+# if defined (_UITHREADS)
+# define _STLP_UITHREADS
+# define _STLP_THREADS
+# endif
+
+# if defined (__sgi) && !defined (__KCC) && !defined (__GNUC__)
+# define _STLP_SGI_THREADS
+# elif defined (__DECC) || defined (__DECCXX)
+# define _STLP_DEC_THREADS
+# elif defined (_STLP_WIN32) && !defined (_STLP_PTHREADS)
+# define _STLP_WIN32THREADS 1
+# elif ((defined (__sun) && !defined (__linux__)) || defined (_UITHREADS) ) && \
+ !defined(_STLP_PTHREADS)
+# define _STLP_UITHREADS
+# elif defined (__OS2__)
+# define _STLP_OS2THREADS
+# elif defined (__BEOS__)
+# define _STLP_BETHREADS
+# elif defined (__MWERKS__) && defined (N_PLAT_NLM) /* (__dest_os == __netware_os) */
+# define _STLP_NWTHREADS
+# else
+# define _STLP_PTHREADS
+# endif /* __sgi */
+# define _STLP_THREADS_DEFINED
+#endif
+
+#if (defined (_REENTRANT) || defined (_THREAD_SAFE) || \
+ (defined (_POSIX_THREADS) && defined (__OpenBSD__))) && \
+ !defined (_STLP_THREADS)
+# define _STLP_THREADS
+#endif /* _REENTRANT */
+
+#if defined (__linux__) && defined (_STLP_PTHREADS)
+/* # include <features.h> */
+
+# if defined (__USE_XOPEN2K) && !defined (_STLP_DONT_USE_PTHREAD_SPINLOCK)
+# define _STLP_USE_PTHREAD_SPINLOCK
+# define _STLP_STATIC_MUTEX _STLP_mutex
+# endif /* __USE_XOPEN2K */
+#endif /* __linux__ && _STLP_PTHREADS */
+
+#if defined (__OpenBSD__) && defined (_POSIX_THREADS) && !defined (_STLP_DONT_USE_PTHREAD_SPINLOCK)
+# define _STLP_USE_PTHREAD_SPINLOCK
+# define _STLP_STATIC_MUTEX _STLP_mutex
+#endif
+
+#ifndef _STLP_STATIC_MUTEX
+# define _STLP_STATIC_MUTEX _STLP_mutex_base
+#endif
+
+#if (defined (_MFC_VER) || defined (_AFXDLL)) && !defined (_STLP_USE_MFC)
+# define _STLP_USE_MFC 1
+#endif
+
+#if defined (_STLP_THREADS)
+# define _STLP_VOLATILE volatile
+/* windows.h _MUST be included before bool definition ;( */
+# if defined (_STLP_WIN32THREADS) && defined (_STLP_NO_BOOL)
+# undef NOMINMAX
+# define NOMINMAX
+# ifdef _STLP_USE_MFC
+# include <afx.h>
+# else
+# include <windows.h>
+# endif
+# define _STLP_WINDOWS_H_INCLUDED
+# endif
+#else
+# define _STLP_VOLATILE
+#endif
+
+#if !defined (_STLP_USE_NEW_C_HEADERS) && !defined (_STLP_HAS_NO_NEW_C_HEADERS)
+# define _STLP_USE_NEW_C_HEADERS
+#endif
+/* disable new-style headers if requested */
+#if defined (_STLP_NO_NEW_C_HEADERS)
+# undef _STLP_USE_NEW_C_HEADERS
+#endif
+
+#if !defined (_STLP_STATIC_TEMPLATE_DATA)
+# define _STLP_STATIC_TEMPLATE_DATA 1
+#endif
+
+#if defined (_STLP_BASE_TYPEDEF_BUG)
+# undef _STLP_BASE_TYPEDEF_OUTSIDE_BUG
+# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG) || (defined (_STLP_MSVC) && (_STLP_MSVC < 1100))
+# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG
+#endif
+
+/* SUNpro 4.2 inline string literal bug */
+#ifdef _STLP_INLINE_STRING_LITERAL_BUG
+# define _STLP_FIX_LITERAL_BUG(__x) __x = __x;
+#else
+# define _STLP_FIX_LITERAL_BUG(__x)
+#endif
+
+#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
+# undef _STLP_NO_DEFAULT_NON_TYPE_PARAM
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+#endif
+
+#define _STLP_NEW new
+#define _STLP_PLACEMENT_NEW new
+
+#ifdef _STLP_DEBUG
+# define _STLP_ASSERTIONS 1
+#endif
+
+#if !defined (_STLP_STATIC_ASSERT)
+/* Some compiler support 0 size array so we use negative size array to generate
+ * a compilation time error.
+ */
+# define _STLP_STATIC_ASSERT(expr) typedef char __static_assert[expr ? 1 : -1];
+#endif
+
+/* apple mpw exception handling bug */
+#ifndef _STLP_MPWFIX_TRY
+# define _STLP_MPWFIX_TRY
+#endif
+#ifndef _STLP_MPWFIX_CATCH
+# define _STLP_MPWFIX_CATCH
+#endif
+#ifndef _STLP_MPWFIX_CATCH_ACTION
+# define _STLP_MPWFIX_CATCH_ACTION(action)
+#endif
+
+/* if _STLP_DEBUG or _STLP_ASSERTIONS are set, stl/debug/_debug.h defines those */
+
+#if !defined (_STLP_ASSERTIONS) && !defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_ALLOC)
+# define _STLP_ASSERT(expr)
+#endif
+
+#if !defined (_STLP_DEBUG)
+# define _STLP_VERBOSE_ASSERT(expr,diagnostic)
+# define _STLP_DEBUG_CHECK(expr)
+# define _STLP_DEBUG_DO(expr)
+#endif
+
+#if !defined (_STLP_WEAK)
+# define _STLP_WEAK
+#endif
+
+/* default parameters as template types derived from arguments ( not always supported ) */
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname
+#else
+# if !defined (_STLP_DEFAULT_TYPE_PARAM)
+# define _STLP_DEFAULT_TYPE_PARAM 1
+# endif
+# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname = defval
+#endif
+
+/* default parameters as complete types */
+#if defined (_STLP_DEFAULT_TYPE_PARAM)
+# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname = defval
+# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name = val
+#else
+# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname
+# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name
+#endif
+
+/* SGI compatibility */
+
+#ifdef _STLP_NO_WCHAR_T
+# ifndef _STLP_NO_NATIVE_WIDE_STREAMS
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+# endif
+#else
+# define _STLP_HAS_WCHAR_T 1
+#endif
+
+#if !defined (_STLP_NO_AT_MEMBER_FUNCTION)
+# define _STLP_CAN_THROW_RANGE_ERRORS 1
+#endif
+
+#if !defined (_STLP_USE_RAW_SGI_ALLOCATORS)
+# define _STLP_DEFAULT_ALLOCATOR(_Tp) allocator< _Tp >
+# define _STLP_DEFAULT_ALLOCATOR_SELECT( _Tp ) _STLP_DFL_TMPL_PARAM(_Alloc, allocator< _Tp >)
+# define _STLP_DEFAULT_PAIR_ALLOCATOR(_Key, _Tp) allocator< pair < _Key, _Tp > >
+# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) class _Alloc
+# define _STLP_USE_WRAPPER_FOR_ALLOC_PARAM 1
+# else
+# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) \
+ class _Alloc = allocator< pair < _Key, _Tp > >
+# endif
+#else
+# define _STLP_DEFAULT_ALLOCATOR( _Tp ) __sgi_alloc
+# define _STLP_DEFAULT_ALLOCATOR_SELECT( _Tp ) _STLP_DFL_TYPE_PARAM(_Alloc,__sgi_alloc)
+# define _STLP_DEFAULT_PAIR_ALLOCATOR( _Key, _Tp ) __sgi_alloc
+# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) _STLP_DFL_TYPE_PARAM(_Alloc,__sgi_alloc)
+# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) && !defined (_STLP_DEFAULT_TYPE_PARAM)
+# define _STLP_USE_WRAPPER_FOR_ALLOC_PARAM 1
+# endif
+#endif
+
+/* debug mode tool */
+#if defined (_STLP_DEBUG)
+# define _STLP_NON_DBG_NAME(X) _NonDbg_##X
+#endif
+
+/* pointer specialization tool */
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define _STLP_PTR_IMPL_NAME(X) _Impl_##X
+#endif
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define _STLP_NO_MEM_T_NAME(X) _NoMemT_##X
+# if defined (_STLP_DEBUG)
+# define _STLP_NON_DBG_NO_MEM_T_NAME(X) _NonDbg_NoMemT_##X
+# endif
+#endif
+
+/* this always mean the C library is in global namespace */
+#if defined (_STLP_HAS_NO_NEW_C_HEADERS) && !defined (_STLP_VENDOR_GLOBAL_CSTD)
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+#endif
+
+/* Depending of whether compiler supports namespaces,
+ * tune the parameters for vendor-supplied libraries.
+ * This section is guarded by _STLP_HAS_NO_NAMESPACES, not by _STLP_USE_NAMESPACES,
+ * since it depends only on the native features, not on user's preference whether
+ * to use namespace for STLport or not.
+ */
+#if !defined (_STLP_HAS_NO_NAMESPACES)
+/* Import some vendor's headers into corresponding STLport ones if they might be needed
+ * (if we wrap native iostreams and use namepace other than std::) */
+# if defined (_STLP_WHOLE_NATIVE_STD)
+# define _STLP_IMPORT_VENDOR_STD 1
+# undef _STLP_MINIMUM_IMPORT_STD
+# endif
+
+/* if using stlport:: namespace or if C library stuff is not in vendor's std::,
+ * try importing 'em.
+ * MSVC has ambiguity problem when we try to import C-style std:: stuff back into global namespace */
+# if defined (_STLP_USE_NAMESPACES) && (defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_VENDOR_GLOBAL_CSTD))
+# define _STLP_IMPORT_VENDOR_CSTD 1
+# endif
+
+# if defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS) && !defined (_STLP_DO_IMPORT_CSTD_FUNCTIONS)
+# define _STLP_NO_CSTD_FUNCTION_IMPORTS
+# endif
+
+# define _STLP_USING_NAMESPACE(x) using namespace x ;
+
+namespace std { }
+namespace __std_alias = std;
+
+/* assume std:: namespace for C++ std library if not being told otherwise */
+# if defined (_STLP_VENDOR_GLOBAL_STD)
+# define _STLP_VENDOR_STD
+# else
+# define _STLP_VENDOR_STD __std_alias
+# endif
+
+/* tune things that come from C library */
+# if defined (_STLP_VENDOR_GLOBAL_CSTD) || !defined(_STLP_USE_NEW_C_HEADERS)
+/* in old-style headers, C functions go to global scope. */
+# define _STLP_VENDOR_CSTD
+# define _STLP_USING_VENDOR_CSTD
+# else
+# define _STLP_VENDOR_CSTD _STLP_VENDOR_STD
+# define _STLP_USING_VENDOR_CSTD _STLP_USING_NAMESPACE(_STLP_VENDOR_CSTD)
+# endif /* _STLP_VENDOR_CSTD */
+/* exception, typeinfo, new - always come from the vendor */
+# if !defined (_STLP_VENDOR_EXCEPT_STD)
+# if defined (_STLP_VENDOR_GLOBAL_EXCEPT_STD)
+# define _STLP_VENDOR_EXCEPT_STD
+# else
+# define _STLP_VENDOR_EXCEPT_STD _STLP_VENDOR_STD
+# endif
+# endif
+# define _STLP_OLD_IO_NAMESPACE
+# if !defined (_STLP_VENDOR_MB_NAMESPACE)
+# define _STLP_VENDOR_MB_NAMESPACE _STLP_VENDOR_CSTD
+# endif
+#else
+/* compiler has no namespace support */
+# define _STLP_VENDOR_STD
+# define _STLP_VENDOR_CSTD
+# define _STLP_USING_NAMESPACE(x)
+# define _STLP_USING_VENDOR_CSTD
+# define _STLP_VENDOR_EXCEPT_STD
+#endif
+
+#if defined (_STLP_USE_NAMESPACES)
+
+# if defined (_STLP_USE_OWN_NAMESPACE)
+# if !defined (_STLP_STD_NAME)
+# if !defined (_STLP_DEBUG)
+# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpmtx_std
+# else
+# define _STLP_STD_NAME stlp_std
+# endif
+# else
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpxmtx_std
+# else
+# define _STLP_STD_NAME stlpx_std
+# endif
+# endif
+# else
+/*
+ * The STLport debug mode is binary incompatible with the other modes,
+ * lets make it clear on the STLport namespace to generate link errors rather
+ * than runtime.
+ */
+# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpdmtx_std
+# else
+# define _STLP_STD_NAME stlpd_std
+# endif
+# else
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpdxmtx_std
+# else
+# define _STLP_STD_NAME stlpdx_std
+# endif
+# endif
+# endif
+# endif
+namespace _STLP_STD_NAME { }
+# else
+# if defined (_STLP_DEBUG)
+namespace stdD = std;
+# endif
+# define _STLP_STD_NAME std
+# endif /* _STLP_USE_OWN_NAMESPACE */
+
+# if !defined (_STLP_USING_NAMESPACE_BUG)
+# define _STLP_PRIV_NAME stlp_priv
+namespace _STLP_PRIV_NAME {
+ using namespace _STLP_STD_NAME;
+}
+# else
+# define _STLP_PRIV_NAME priv
+# endif
+
+# define _STLP_BEGIN_NAMESPACE namespace _STLP_STD_NAME {
+# define _STLP_END_NAMESPACE }
+
+# if !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
+# if !defined (_STLP_USING_NAMESPACE_BUG)
+/* We prefer to make private namespace a totaly seperated namespace...
+ */
+# define _STLP_PRIV ::_STLP_PRIV_NAME::
+# define _STLP_MOVE_TO_PRIV_NAMESPACE } namespace _STLP_PRIV_NAME {
+# define _STLP_MOVE_TO_STD_NAMESPACE } namespace _STLP_STD_NAME {
+# else
+/* but sometimes we can't:
+ */
+# define _STLP_PRIV _STLP_PRIV_NAME::
+# define _STLP_MOVE_TO_PRIV_NAMESPACE namespace _STLP_PRIV_NAME {
+# define _STLP_MOVE_TO_STD_NAMESPACE }
+# endif
+# else
+# define _STLP_PRIV
+# define _STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+/* decide whether or not we use separate namespace for rel ops */
+# if defined (_STLP_NO_RELOPS_NAMESPACE)
+# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops {}
+# define _STLP_END_RELOPS_NAMESPACE }
+# else
+/* Use std::rel_ops namespace */
+# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops {
+# define _STLP_END_RELOPS_NAMESPACE } }
+# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+# endif /* Use std::rel_ops namespace */
+
+# define _STLP_STD ::_STLP_STD_NAME
+
+/* Official STLport namespace when std is not redefined.
+ * Here we don't use a macro as stlport is used as file name by boost
+ * and folder name under beos:
+ */
+namespace stlport = _STLP_STD_NAME;
+
+/* Backward compatibility:
+ */
+namespace _STL = _STLP_STD_NAME;
+#undef __STLPORT_NAMESPACE
+#define __STLPORT_NAMESPACE _STLP_STD_NAME
+
+#else /* _STLP_USE_NAMESPACES */
+/* STLport is being put into global namespace */
+# define _STLP_STD
+# define _STLP_PRIV
+# define _STLP_BEGIN_NAMESPACE
+# define _STLP_END_NAMESPACE
+# define _STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_MOVE_TO_STD_NAMESPACE
+
+/* boris : it was found out that _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+ causes less problems than having relational operator templates in global namespace
+ Please define _STLP_NO_RELOPS_NAMESPACE in config/user_config.h if your code rely on them. */
+# if !defined (_STLP_NO_RELOPS_NAMESPACE)
+# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+# endif
+# define _STLP_BEGIN_RELOPS_NAMESPACE
+# define _STLP_END_RELOPS_NAMESPACE
+# undef _STLP_USE_OWN_NAMESPACE
+#endif /* _STLP_USE_NAMESPACES */
+
+#define STLPORT_CSTD _STLP_VENDOR_CSTD
+#define STLPORT _STLP_STD_NAME
+
+#if defined(_STLP_BOGUS_TEMPLATE_TYPE_MATCHING_BUG)
+# define _STLP_SIMPLE_TYPE(T) _stl_trivial_proxy<T>
+#else
+# define _STLP_SIMPLE_TYPE(T) T
+#endif
+
+#ifndef _STLP_RAND48
+# define _STLP_NO_DRAND48
+#endif
+
+/* advanced keywords usage */
+#define __C_CAST(__x, __y) ((__x)(__y))
+#ifndef _STLP_NO_NEW_STYLE_CASTS
+# define __CONST_CAST(__x,__y) const_cast<__x>(__y)
+# define __STATIC_CAST(__x,__y) static_cast<__x>(__y)
+# define __REINTERPRET_CAST(__x,__y) reinterpret_cast<__x>(__y)
+# define __DYNAMIC_CAST(__x,__y) dynamic_cast<__x>(__y)
+#else
+# define __STATIC_CAST(__x,__y) __C_CAST(__x, __y)
+# define __CONST_CAST(__x,__y) __C_CAST(__x, __y)
+# define __REINTERPRET_CAST(__x,__y) __C_CAST(__x, __y)
+# define __DYNAMIC_CAST(__x,__y) __C_CAST(__x, __y)
+#endif
+
+#if defined (_STLP_NEED_TYPENAME) && ! defined (typename)
+# define typename
+#endif
+
+#if defined (_STLP_NEED_TYPENAME) || defined (_STLP_NO_TYPENAME_ON_RETURN_TYPE )
+# define _STLP_TYPENAME_ON_RETURN_TYPE
+#else
+# define _STLP_TYPENAME_ON_RETURN_TYPE typename
+#endif
+
+#ifdef _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER
+# define _STLP_HEADER_TYPENAME
+#else
+# define _STLP_HEADER_TYPENAME typename
+#endif
+
+#ifndef _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+# define _STLP_TEMPLATE template
+#else
+# define _STLP_TEMPLATE
+#endif
+
+#if defined (_STLP_USE_CONTAINERS_EXTENSION)
+# define _STLP_KEY_TYPE_FOR_CONT_EXT(type)
+# define _STLP_TEMPLATE_FOR_CONT_EXT template <class _KT>
+#else
+# define _STLP_KEY_TYPE_FOR_CONT_EXT(type) typedef type _KT;
+# define _STLP_TEMPLATE_FOR_CONT_EXT
+#endif
+
+#if defined (_STLP_NEED_EXPLICIT) && !defined (explicit)
+# define explicit
+#endif
+
+#if !defined (_STLP_NEED_MUTABLE)
+# define _STLP_ASSIGN_MUTABLE(type,x,y) x = y
+#else
+# define _STLP_ASSIGN_MUTABLE(type,x,y) __CONST_CAST(type,x)=y
+# define mutable
+#endif
+
+#if defined (_STLP_NO_SIGNED_BUILTINS)
+/* old HP-UX doesn't understand "signed" keyword */
+# define signed
+#endif
+
+#if defined (_STLP_LOOP_INLINE_PROBLEMS)
+# define _STLP_INLINE_LOOP
+#else
+# define _STLP_INLINE_LOOP inline
+#endif
+
+#define _STLP_PRIVATE public
+
+#ifndef _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
+# define _STLP_TEMPLATE_NULL template<>
+#else
+# define _STLP_TEMPLATE_NULL
+#endif
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+# define _STLP_OPERATOR_TEMPLATE
+#else
+# define _STLP_OPERATOR_TEMPLATE _STLP_TEMPLATE_NULL
+#endif
+
+#ifndef _STLP_CLASS_PARTIAL_SPECIALIZATION
+/* unless we have other compiler problem, try simulating partial spec here */
+# if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+# define _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+# endif
+/* For your own iterators, please use inheritance from iterator<> instead of these obsolete queries. */
+# if (defined (_STLP_NESTED_TYPE_PARAM_BUG) || !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS))
+# if ! defined ( _STLP_USE_OLD_HP_ITERATOR_QUERIES )
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+# endif
+# elif defined ( _STLP_NO_ANACHRONISMS )
+# undef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+# endif
+#endif
+
+#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+# define _STLP_NULL_TMPL_ARGS <>
+# else
+# define _STLP_NULL_TMPL_ARGS
+#endif
+
+#if !defined (_STLP_ALLOCATOR_TYPE_DFL)
+# if defined (_STLP_DONT_SUP_DFLT_PARAM)
+# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+# endif
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+# define _STLP_ALLOCATOR_TYPE_DFL
+# else
+# define _STLP_ALLOCATOR_TYPE_DFL = allocator_type()
+# endif
+#endif
+
+/* When the compiler do not correctly initialized the basic types value in default parameters we prefer
+ * to avoid them to be able to correct this bug.
+ */
+#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG)
+# define _STLP_DONT_SUP_DFLT_PARAM 1
+#endif
+
+#if defined (__SGI_STL_NO_ARROW_OPERATOR) && ! defined (_STLP_NO_ARROW_OPERATOR)
+# define _STLP_NO_ARROW_OPERATOR
+#endif
+
+#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !(defined (_STLP_NO_ARROW_OPERATOR)) && \
+ !defined (_STLP_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_MSVC50_COMPATIBILITY)
+/* this one is needed for proper reverse_iterator<> operator ->() handling */
+# define _STLP_MSVC50_COMPATIBILITY 1
+# endif
+#endif
+
+#if defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
+# if (defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 600) )
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef typename _STLP_STD :: reverse_iterator<const_iterator> const_reverse_iterator; \
+ typedef typename _STLP_STD :: reverse_iterator<iterator> reverse_iterator
+# elif (defined (__sgi) && ! defined (__GNUC__)) || defined (__SUNPRO_CC) || defined (__xlC__)
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator<const_iterator> const_reverse_iterator; \
+ typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator<iterator> reverse_iterator
+# else
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD::reverse_iterator<const_iterator> const_reverse_iterator; \
+ typedef _STLP_STD::reverse_iterator<iterator> reverse_iterator
+# endif
+#else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD::__reverse_iterator<const_iterator, value_type, const_reference, \
+ const_pointer, difference_type> const_reverse_iterator; \
+ typedef _STLP_STD::__reverse_iterator<iterator, value_type, reference, pointer, difference_type> \
+ reverse_iterator
+# else
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD::__reverse_iterator<const_iterator, value_type, const_reference, \
+ difference_type> const_reverse_iterator; \
+ typedef _STLP_STD::__reverse_iterator<iterator, value_type, \
+ reference, difference_type> \
+ reverse_iterator
+# endif
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#define _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS \
+ _STLP_DECLARE_REVERSE_ITERATORS(reverse_bidirectional_iterator)
+#define _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS \
+ _STLP_DECLARE_REVERSE_ITERATORS(reverse_iterator)
+
+#define __IMPORT_CONTAINER_TYPEDEFS(_Super) \
+ typedef typename _Super::value_type value_type; \
+ typedef typename _Super::size_type size_type; \
+ typedef typename _Super::difference_type difference_type; \
+ typedef typename _Super::reference reference; \
+ typedef typename _Super::const_reference const_reference; \
+ typedef typename _Super::pointer pointer; \
+ typedef typename _Super::const_pointer const_pointer; \
+ typedef typename _Super::allocator_type allocator_type;
+
+
+#define __IMPORT_ITERATORS(_Super) \
+ typedef typename _Super::iterator iterator; \
+ typedef typename _Super::const_iterator const_iterator;
+
+#define __IMPORT_REVERSE_ITERATORS(_Super) \
+ typedef typename _Super::const_reverse_iterator const_reverse_iterator; \
+ typedef typename _Super::reverse_iterator reverse_iterator;
+
+#define __IMPORT_SUPER_COPY_ASSIGNMENT(__derived_name, _Self, _SUPER) \
+ __derived_name(const _Super& __x) : _SUPER(__x) {} \
+ _Self& operator=(const _Super& __x) { \
+ *(_Super*)this = __x; \
+ return *this; \
+ } \
+ __derived_name(const _Self& __x) : _SUPER(__x) {} \
+ _Self& operator=(const _Self& __x) { \
+ *(_Super*)this = __x; \
+ return *this; \
+ }
+
+#define __IMPORT_WITH_ITERATORS(_Super) \
+ __IMPORT_CONTAINER_TYPEDEFS(_Super) __IMPORT_ITERATORS(_Super)
+
+#define __IMPORT_WITH_REVERSE_ITERATORS(_Super) \
+ __IMPORT_WITH_ITERATORS(_Super) __IMPORT_REVERSE_ITERATORS(_Super)
+
+#if defined (_STLP_TRIVIAL_CONSTRUCTOR_BUG)
+# define __TRIVIAL_CONSTRUCTOR(__type) __type() {}
+#else
+# define __TRIVIAL_CONSTRUCTOR(__type)
+#endif
+
+#if defined (_STLP_TRIVIAL_DESTRUCTOR_BUG)
+# define __TRIVIAL_DESTRUCTOR(__type) ~__type() {}
+#else
+# define __TRIVIAL_DESTRUCTOR(__type)
+#endif
+
+#define __TRIVIAL_STUFF(__type) \
+ __TRIVIAL_CONSTRUCTOR(__type) __TRIVIAL_DESTRUCTOR(__type)
+
+#if defined (_STLP_HAS_NO_EXCEPTIONS)
+# define _STLP_NO_EXCEPTIONS
+#endif
+
+#if !defined (_STLP_DONT_USE_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_USE_EXCEPTIONS)
+# define _STLP_USE_EXCEPTIONS
+#endif
+
+#if defined (_STLP_USE_EXCEPTIONS)
+# define _STLP_TRY try
+# define _STLP_CATCH_ALL catch(...)
+# ifndef _STLP_THROW
+# define _STLP_THROW(x) throw x
+# endif
+# define _STLP_RETHROW throw
+
+# define _STLP_UNWIND(action) catch(...) { action; throw; }
+
+# ifdef _STLP_THROW_RETURN_BUG
+# define _STLP_RET_AFTER_THROW(data) return data;
+# else
+# define _STLP_RET_AFTER_THROW(data)
+# endif
+
+/* We do not use exception throw specifications unless we are forced to */
+# if !defined (_STLP_THROWS)
+# define _STLP_THROWS(x)
+# endif
+# if !defined (_STLP_NOTHROW)
+# define _STLP_NOTHROW
+# endif
+#else
+# define _STLP_TRY
+# define _STLP_CATCH_ALL if (false)
+# ifndef _STLP_THROW
+# define _STLP_THROW(x)
+# endif
+# define _STLP_RETHROW {}
+# define _STLP_UNWIND(action)
+# define _STLP_THROWS(x)
+# define _STLP_NOTHROW
+# define _STLP_RET_AFTER_THROW(data)
+#endif
+
+/*
+ * Here we check _STLP_NO_EXCEPTIONS which means that the compiler has no
+ * exception support but not the _STLP_USE_EXCEPTIONS which simply means
+ * that the user do not want to use them.
+ */
+#if !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTION_SPEC)
+# define _STLP_THROWS_INHERENTLY(x) throw x
+# define _STLP_NOTHROW_INHERENTLY throw()
+#else
+# define _STLP_THROWS_INHERENTLY(x)
+# define _STLP_NOTHROW_INHERENTLY
+#endif
+
+/* STLport function not returning are functions that throw so we translate
+ * the noreturn functions in throwing functions taking also into account
+ * exception support activation.
+ */
+#if defined (_STLP_NORETURN_FUNCTION) && !defined (_STLP_NO_EXCEPTIONS) && \
+ !defined (_STLP_FUNCTION_THROWS)
+# define _STLP_FUNCTION_THROWS _STLP_NORETURN_FUNCTION
+#else
+# define _STLP_FUNCTION_THROWS
+#endif
+
+#if defined(_STLP_NO_BOOL)
+# if (defined (__IBMCPP__) && (__IBMCPP__ < 400)) && ! defined (_AIX)
+# include <isynonym.hpp>
+# if defined (__OS400__)
+typedef int bool;
+# elif !( defined (__xlC__) || defined (_AIX))
+typedef Boolean bool;
+# endif
+# else
+# if defined(_STLP_YVALS_H)
+# include <yvals.h>
+# else
+# if defined (_STLP_DONT_USE_BOOL_TYPEDEF)
+# define bool int
+# else
+typedef int bool;
+# endif
+# define true 1
+# define false 0
+# endif
+# endif /* __IBMCPP__ */
+#else
+# define _STLP_BOOL_KEYWORD 1
+#endif /* _STLP_NO_BOOL */
+
+#ifndef _STLP_MPW_EXTRA_CONST
+# define _STLP_MPW_EXTRA_CONST
+#endif
+
+#ifndef _STLP_DEFAULTCHAR
+# define _STLP_DEFAULTCHAR char
+#endif
+
+#if defined (_STLP_DEBUG_ALLOC) && !defined (_STLP_ASSERTIONS)
+# define _STLP_ASSERTIONS 1
+#endif
+
+/* uninitialized value filler */
+#ifndef _STLP_SHRED_BYTE
+/* This value is designed to cause problems if an error occurs */
+# define _STLP_SHRED_BYTE 0xA3
+#endif /* _STLP_SHRED_BYTE */
+
+/* shared library tune-up */
+#ifndef _STLP_IMPORT_DECLSPEC
+# define _STLP_IMPORT_DECLSPEC
+#endif
+
+/* a keyword used to instantiate export template */
+#ifndef _STLP_EXPORT_TEMPLATE_KEYWORD
+# define _STLP_EXPORT_TEMPLATE_KEYWORD
+#endif
+#ifndef _STLP_IMPORT_TEMPLATE_KEYWORD
+# define _STLP_IMPORT_TEMPLATE_KEYWORD
+#endif
+
+#ifdef _STLP_USE_NO_IOSTREAMS
+/*
+ * If we do not use iostreams we do not use the export/import
+ * techniques to avoid build of the STLport library.
+ */
+# undef _STLP_USE_DECLSPEC
+/* We also undef USE_DYNAMIC_LIB macro as this macro add some code
+ * to use the dynamic (shared) STLport library for some platform/compiler
+ * configuration leading to problem when do not link to the STLport lib.
+ */
+# undef _STLP_USE_DYNAMIC_LIB
+#endif
+
+#if defined (_STLP_DLLEXPORT_NEEDS_PREDECLARATION) && defined (_STLP_USE_DECLSPEC)
+# if ! defined (_STLP_USE_TEMPLATE_EXPORT)
+/* this setting turns on "extern template" extension use */
+# define _STLP_USE_TEMPLATE_EXPORT
+# endif
+# if defined (_STLP_DESIGNATED_DLL) && ! defined (_STLP_NO_FORCE_INSTANTIATE)
+# define _STLP_NO_FORCE_INSTANTIATE
+# endif
+#endif
+
+#if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */
+# define _STLP_EXPORT _STLP_EXPORT_TEMPLATE_KEYWORD
+#else
+# define _STLP_EXPORT _STLP_IMPORT_TEMPLATE_KEYWORD
+#endif
+
+#ifndef _STLP_EXPORT_TEMPLATE
+# define _STLP_EXPORT_TEMPLATE _STLP_EXPORT template
+#endif
+
+#if defined (_STLP_USE_DECLSPEC) /* using export/import technique */
+
+# ifndef _STLP_EXPORT_DECLSPEC
+# define _STLP_EXPORT_DECLSPEC
+# endif
+# ifndef _STLP_IMPORT_DECLSPEC
+# define _STLP_IMPORT_DECLSPEC
+# endif
+# ifndef _STLP_CLASS_EXPORT_DECLSPEC
+# define _STLP_CLASS_EXPORT_DECLSPEC
+# endif
+# ifndef _STLP_CLASS_IMPORT_DECLSPEC
+# define _STLP_CLASS_IMPORT_DECLSPEC
+# endif
+# if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */
+# define _STLP_DECLSPEC _STLP_EXPORT_DECLSPEC
+# define _STLP_CLASS_DECLSPEC _STLP_CLASS_EXPORT_DECLSPEC
+# else
+# define _STLP_DECLSPEC _STLP_IMPORT_DECLSPEC /* Other modules, importing STLport exports */
+# define _STLP_CLASS_DECLSPEC _STLP_CLASS_IMPORT_DECLSPEC
+# endif
+
+#else /* Not using DLL export/import specifications */
+
+# define _STLP_DECLSPEC
+# define _STLP_CLASS_DECLSPEC
+
+#endif
+
+#define _STLP_EXPORT_TEMPLATE_CLASS _STLP_EXPORT template class _STLP_CLASS_DECLSPEC
+
+#if defined (_STLP_MSVC) || defined (__ICL)
+# define _STLP_STATIC_MEMBER_DECLSPEC
+#else
+# define _STLP_STATIC_MEMBER_DECLSPEC _STLP_DECLSPEC
+#endif
+
+#if !defined (_STLP_CALL)
+# define _STLP_CALL
+#endif
+
+#ifndef _STLP_USE_NO_IOSTREAMS
+
+# if defined (__DECCXX) && ! defined (__USE_STD_IOSTREAM)
+# define __USE_STD_IOSTREAM
+# endif
+
+/* We only need to expose details of streams implementation
+ if we use non-standard i/o or are building STLport*/
+# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE) || !defined(_STLP_NO_CUSTOM_IO)
+# define _STLP_EXPOSE_STREAM_IMPLEMENTATION 1
+# endif
+
+/* We only need to expose details of global implementation if we are building STLport
+ or have not instantiated everything in the lib */
+# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE)
+# undef _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION 1
+# endif
+
+#else /* _STLP_USE_NO_IOSTREAMS */
+/* when we are not using SGI iostreams, we must expose globals, but not streams implementation */
+# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+#endif /* _STLP_USE_NO_IOSTREAMS */
+
+#ifdef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+# define _STLP_PSPEC2(t1,t2) < t1,t2 >
+# define _STLP_PSPEC3(t1,t2,t3) < t1,t2,t3 >
+#else
+# define _STLP_PSPEC2(t1,t2) /* nothing */
+# define _STLP_PSPEC3(t1,t2,t3) /* nothing */
+#endif
+
+/* Activation of the partial template workaround:
+ */
+#if !defined(_STLP_DONT_USE_PARTIAL_SPEC_WRKD) &&\
+ (!defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || !defined(_STLP_FUNCTION_TMPL_PARTIAL_ORDER))
+# define _STLP_USE_PARTIAL_SPEC_WORKAROUND
+#endif
+
+#ifndef _STLP_USE_NO_IOSTREAMS
+# define _STLP_NEW_IO_NAMESPACE _STLP_STD
+# define _STLP_NO_WIDE_STREAMS _STLP_NO_WCHAR_T
+#endif
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+# define _STLP_RELOPS_OPERATORS(_TMPL, _TP) \
+_TMPL inline bool _STLP_CALL operator!=(const _TP& __x, const _TP& __y) {return !(__x == __y);}\
+_TMPL inline bool _STLP_CALL operator>(const _TP& __x, const _TP& __y) {return __y < __x;}\
+_TMPL inline bool _STLP_CALL operator<=(const _TP& __x, const _TP& __y) { return !(__y < __x);}\
+_TMPL inline bool _STLP_CALL operator>=(const _TP& __x, const _TP& __y) { return !(__x < __y);}
+#else
+# define _STLP_RELOPS_OPERATORS(_TMPL, _TP)
+#endif
+
+#if defined ( _STLP_USE_ABBREVS )
+# include <stl/_abbrevs.h>
+#endif
+
+/* A really useful macro */
+#define _STLP_ARRAY_SIZE(A) sizeof(A) / sizeof(A[0])
+#define _STLP_ARRAY_AND_SIZE(A) A, sizeof(A) / sizeof(A[0])
+
+/* some cleanup */
+#undef _STLP_DONT_USE_BOOL_TYPEDEF
+#undef _STLP_YVALS_H
+#undef _STLP_LOOP_INLINE_PROBLEMS
+#undef _STLP_NEED_EXPLICIT
+#undef _STLP_NEED_TYPENAME
+#undef _STLP_NO_NEW_STYLE_CASTS
+#undef __AUTO_CONFIGURED
+
+#endif /* _STLP_FEATURES_H */
--- /dev/null
+/*
+ * This file defines site configuration.
+ */
+
+/*
+ * _STLP_NO_THREADS: if defined, STLport don't use any
+ * multithreading support. Synonym is _NOTHREADS
+ */
+/*
+#define _NOTHREADS
+#define _STLP_NO_THREADS
+*/
+
+/* _PTHREADS: if defined, use POSIX threads for multithreading support. */
+/*
+#define _PTHREADS
+*/
+
+/* compatibility section
+ */
+
+#if (defined (_STLP_NOTHREADS) || defined (_STLP_NO_THREADS) || defined (NOTHREADS))
+# if !defined (_NOTHREADS)
+# define _NOTHREADS
+# endif
+# if !defined (_STLP_NO_THREADS)
+# define _STLP_NO_THREADS
+# endif
+#endif
+
+#if !defined(_STLP_USE_DYNAMIC_LIB) && !defined(_STLP_USE_STATIC_LIB)
+/*
+ * Turn _STLP_USE_DYNAMIC_LIB to enforce use of .dll version of STLport library.
+ * NOTE: please do that only if you know what you are doing!
+ * Changing default will require you to change makefiles in "build" accordingly
+ * and to rebuild STLPort library!
+ * On UNIX, this has no effect, see build/lib/README for make tags.
+ * See STLport configuration file (build/lib/configure.bat) for help in building
+ * the require library versions.
+ */
+/*
+#define _STLP_USE_DYNAMIC_LIB
+*/
+
+/*
+ * Turn _STLP_USE_STATIC_LIB to enforce use of static version of STLport library.
+ * NOTE: please do that only if you know what you are doing!
+ * Changing default will require you to change makefile in "build" accordingly
+ * and to rebuild STLPort library!
+ * On UNIX, this has no effect, see build/lib/README for make tags.
+ * See STLport configuration file (build/lib/configure.bat) for help in building
+ * the require library versions.
+ */
+/*
+#define _STLP_USE_STATIC_LIB
+*/
+#endif
+
+/*
+ * Signal STLport that we are using the cygwin distrib with the -mno-cygwin option.
+ * This is similar to a mingw environment except that relative path to native headers
+ * is different, this is why we need this macro.
+ */
+/*
+#define _STLP_NO_CYGWIN
+ */
+
+/*
+ * Edit relative path below (or put full path) to get native
+ * compiler vendor's headers included. Default is "../include"
+ * for _STLP_NATIVE_INCLUDE_PATH, default for other macros is
+ * _STLP_NATIVE_INCLUDE_PATH.
+ * Hint: never install STLport in the directory that ends with "include"
+ */
+/*
+#undef _STLP_NATIVE_INCLUDE_PATH
+#define _STLP_NATIVE_INCLUDE_PATH ../include
+*/
+/* same for C library headers like <cstring> */
+/*
+#undef _STLP_NATIVE_CPP_C_INCLUDE_PATH
+#define _STLP_NATIVE_CPP_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+*/
+/* same for C headers like <string.h> */
+/*
+#undef _STLP_NATIVE_C_INCLUDE_PATH
+#define _STLP_NATIVE_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+*/
+/* Some compilers locate basic C++ runtime support headers (<new>, <typeinfo>, <exception>) in separate directory */
+/*
+#undef _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH
+#define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+*/
+
+/*
+ * If namespases available, STLport use own namespace (and masquerade
+ * it as std). Disable own namespace may cause undefined behaviour.
+ */
+/*
+#define _STLP_NO_OWN_NAMESPACE 1
+*/
+
+/*
+ * Uncomment _STLP_LEAKS_PEDANTIC to force deallocation of ALL allocated
+ * memory chunks. Normally not required. But if you worry about quazi-leaks
+ * (may be reported by some leaks detection tools), use
+ * _STLP_LEAKS_PEDANTIC. It should be used with _STLP_USE_NEWALLOC or
+ * _STLP_USE_MALLOC (see below), the default node_alloc allocator also clean
+ * its internal memory pool but only if STLport is used as a dynamic library
+ * under Win32 (using MSVC like compilers).
+ */
+/*
+#define _STLP_LEAKS_PEDANTIC 1
+*/
+
+/*
+ * Uncomment _STLP_USE_NEWALLOC to force allocator<T> to use plain "new"
+ * instead of STLport optimized node allocator engine.
+ */
+/*
+#define _STLP_USE_NEWALLOC 1
+*/
+
+/*
+ * Uncomment _STLP_USE_MALLOC to force allocator<T> to use plain "malloc"
+ * instead of STLport optimized node allocator engine.
+ */
+/*
+#define _STLP_USE_MALLOC 1
+*/
+
+/*
+ * Uncomment _STLP_USE_PERTHREAD_ALLOC to force allocator<T> to use
+ * a specific implementation targetting the massively multi-threaded
+ * environment. The implementation is based on the POSIX pthread
+ * interface.
+ */
+/*
+#define _STLP_USE_PERTHREAD_ALLOC 1
+*/
+
+/*
+ * Set _STLP_DEBUG_ALLOC to use allocators that perform memory debugging,
+ * such as padding/checking for memory consistency
+ */
+/*
+#define _STLP_DEBUG_ALLOC 1
+*/
+
+/*
+ * For compiler not supporting partial template specialization or ordering of
+ * template functions STLport implement a workaround based on inheritance
+ * detection. This inheritance can introduce trouble in client code when
+ * a user class derived a STL container (which is not advised as STL containers
+ * do not have virtual destructors). To disable this workaround turn this macro on:
+ */
+/*
+#define _STLP_DONT_USE_PARTIAL_SPEC_WRKD 1
+*/
+
+/*
+ * Uncomment this to force all debug diagnostic to be directed through a
+ * user-defined global function:
+ * void __stl_debug_message(const char * format_str, ...)
+ * instead of predefined STLport routine.
+ * This allows you to take control of debug message output.
+ * Default routine calls fprintf(stderr,...)
+ * Note : If you set this macro, you must supply __stl_debug_message
+ * function definition somewhere.
+ */
+/*
+#define _STLP_DEBUG_MESSAGE 1
+*/
+
+/*
+ * Uncomment this to force all failed assertions to be executed through
+ * user-defined global function:
+ * void __stl_debug_terminate(void). This allows
+ * you to take control of assertion behaviour for debugging purposes.
+ * Default routine calls _STLP_ABORT().
+ * Note : If you set this macro, you must supply __stl_debug_terminate
+ * function definition somewhere.
+ */
+/*
+#define _STLP_DEBUG_TERMINATE 1
+*/
+
+/*
+ * Uncomment that to disable exception handling code
+ */
+/*
+#define _STLP_DONT_USE_EXCEPTIONS 1
+*/
+
+/*
+ * _STLP_NO_NAMESPACES: if defined, don't put the library in namespace
+ * stlport:: or std::, even if the compiler supports namespaces
+ */
+/*
+#define _STLP_NO_NAMESPACES 1
+*/
+
+/*==========================================================
+ * Compatibility section
+ *==========================================================*/
+
+/*
+ * Use abbreviated class names for linker benefit (don't affect interface).
+ * This option is obsolete, but should work in this release.
+ *
+ */
+/*
+#define _STLP_USE_ABBREVS
+*/
+
+/*
+ * This definition precludes STLport reverse_iterator to be compatible with
+ * other parts of MSVC library. (With partial specialization, it just
+ * has no effect).
+ * Use it _ONLY_ if you use SGI-style reverse_iterator<> template explicitly
+ */
+/*
+#define _STLP_NO_MSVC50_COMPATIBILITY 1
+*/
+
+/*
+ * _STLP_USE_RAW_SGI_ALLOCATORS is a hook so that users can disable use of
+ * allocator<T> as default parameter for containers, and use SGI
+ * raw allocators as default ones, without having to edit library headers.
+ * Use of this macro is strongly discouraged.
+ */
+/*
+#define _STLP_USE_RAW_SGI_ALLOCATORS 1
+*/
+
+/*
+ * Use obsolete overloaded template functions iterator_category(), value_type(), distance_type()
+ * for querying iterator properties. Please note those names are non-standard and are not guaranteed
+ * to be used by every implementation. However, this setting is on by default when partial specialization
+ * is not implemented in the compiler and cannot be simulated (only if _STLP_NO_ANACHRONISMS is not set).
+ * Use of those interfaces for user-defined iterators is strongly discouraged:
+ * please use public inheritance from iterator<> template to achieve desired effect.
+ * Second form is to disable old-style queries in any case.
+ */
+/*
+#define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+#define _STLP_NO_OLD_HP_ITERATOR_QUERIES
+*/
+
+
+/*
+ * On systems with support of large files (_LARGEFILE_SOURCE,
+ * _LARGEFILE64_SOURCE defined) we will use 64-bit file offset, even if
+ * __USE_FILE_OFFSET64 or _FILE_OFFSET_BITS not defined or _FILE_OFFSET_BITS
+ * less than 64. In the last case sizeof(std::streamoff) may not be equal to
+ * sizeof(off_t), if you want to force equal size of off_t and streamoff,
+ * uncomment macro below. But pay attention, this has influence on libstlport
+ * and in future usage it may cause conflict with defined _FILE_OFFSET_BITS macro.
+ */
+
+/*
+#define _STLP_USE_DEFAULT_FILE_OFFSET
+*/
+
+/*==========================================================================*/
+
+/* This section contains swithes which should be off by default,
+ * but so few compilers would have it undefined, so that we set them here,
+ * with the option to be turned off later in compiler-specific file
+ */
+
+#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+#define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+
+/*
+ Local Variables:
+ mode:C++
+ End:
+*/
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/*
+ * STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ * Purpose of this file : to define STLport settings that depend on
+ * compiler flags or can be otherwise missed
+ *
+ */
+
+#ifndef _STLP_CONFIX_H
+# define _STLP_CONFIX_H
+
+/* If, by any chance, C compiler gets there, try to help it to pass smoothly */
+# if ! defined (__cplusplus) && ! defined (_STLP_HAS_NO_NAMESPACES)
+# define _STLP_HAS_NO_NAMESPACES
+# endif
+
+# if defined(__MINGW32__)
+# define _STLP_NO_DRAND48
+# endif
+
+/* Modena C++ library */
+#if defined (__MWERKS__) && __MWERKS__ <= 0x2303 || (defined (__KCC) && __KCC_VERSION < 3400)
+# include <mcompile.h>
+# define _STLP_USE_MSIPL 1
+# if defined (__KCC) || (defined(__MSL_CPP__) && \
+ ( (__MSL_CPP__ >= 0x5000 && defined( _MSL_NO_MESSAGE_FACET )) || \
+ (__MSL_CPP__ < 0x5000 && defined( MSIPL_NL_TYPES ))) \
+ )
+# define _STLP_NO_NATIVE_MESSAGE_FACET 1
+# endif
+#endif
+
+/* common switches for EDG front-end */
+# if defined (__EDG_SWITCHES)
+# if !(defined(_TYPENAME) || defined (_TYPENAME_IS_KEYWORD))
+# undef _STLP_NEED_TYPENAME
+# define _STLP_NEED_TYPENAME 1
+# endif
+# if !defined(_WCHAR_T_IS_KEYWORD)
+# undef _STLP_NO_WCHAR_T
+# define _STLP_NO_WCHAR_T 1
+# endif
+# ifndef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES
+# undef _STLP_NO_CLASS_PARTIAL_SPECIALIZATION
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# endif
+# ifndef _MEMBER_TEMPLATES
+# undef _STLP_NO_MEMBER_TEMPLATES
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# undef _STLP_NO_MEMBER_TEMPLATE_CLASSES
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# endif
+# if !defined(_MEMBER_TEMPLATE_KEYWORD)
+# undef _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# endif
+# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS)
+# undef _STLP_HAS_NO_EXCEPTIONS
+# define _STLP_HAS_NO_EXCEPTIONS
+# endif
+# undef __EDG_SWITCHES
+# endif /* EDG */
+#endif
--- /dev/null
+#ifndef _STLP_WINSCW_H
+#define _STLP_WINSCW_H
+
+#define _STLP_COMPILER "GCCE"
+
+//==========================================================
+
+# define _STLP_LONG_LONG long long
+
+#ifdef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+#endif
+
+#ifdef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+# undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+#endif
+
+//==========================================================
+
+#endif
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/*
+ * Purpose of this file :
+ *
+ * A list of COMPILER-SPECIFIC portion of STLport settings.
+ * This file is provided to help in manual configuration
+ * of STLport. This file is being included by stlcomp.h
+ * when STLport is unable to identify your compiler.
+ * Please remove the error diagnostic below before adjusting
+ * macros.
+ *
+ */
+#ifndef _STLP_MYCOMP_H
+#define _STLP_MYCOMP_H
+
+#error "Your compiler version is not recognized by STLport. Please edit <stlport/stl/config/stl_mycomp.h>"
+
+//==========================================================
+
+// the values choosen here as defaults try to give
+// maximum functionality on the most conservative settings
+
+// Mostly correct guess, change it for Alpha (and other environments
+// that has 64-bit "long")
+// # define _STLP_UINT32_T unsigned long
+
+// Disables wchar_t functionality
+// # define _STLP_NO_WCHAR_T 1
+
+// Define if wchar_t is not a unique type, and is actually a typedef to unsigned short.
+// # define _STLP_WCHAR_T_IS_USHORT 1
+
+// Uncomment if long long is available
+// # define _STLP_LONG_LONG long long
+
+// Uncomment if long double is not available
+// # define _STLP_NO_LONG_DOUBLE 1
+
+// Uncomment this if your compiler does not support "typename" keyword
+// # define _STLP_NEED_TYPENAME 1
+
+// Uncomment this if your compiler does not support "mutable" keyword
+// # define _STLP_NEED_MUTABLE 1
+
+// Uncomment this if your compiler does not support "explicit" keyword
+// # define _STLP_NEED_EXPLICIT 1
+
+// Uncomment if new-style-casts like const_cast<> are not available
+// # define _STLP_NO_NEW_STYLE_CASTS 1
+
+// Uncomment this if your compiler does not have "bool" type
+// # define _STLP_NO_BOOL 1
+
+// Uncomment this if your compiler does not have "bool" type, but has "bool" keyword reserved
+// # define _STLP_DONT_USE_BOOL_TYPEDEF 1
+
+// Uncomment this if your compiler does not have "bool" type, but defines "bool" in <yvals.h>
+// # define _STLP_YVALS_H 1
+
+// Uncomment this if your compiler has limited or no default template arguments for classes
+// # define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+
+// Uncomment this if your compiler support only complete (not dependent on other parameters)
+// types as default parameters for class templates
+// # define _STLP_DEFAULT_TYPE_PARAM 1
+
+// Uncomment this if your compiler do not support default parameters in template class methods
+// # define _STLP_DONT_SUP_DFLT_PARAM 1
+
+// Uncomment this if your compiler has problem with not-type
+// default template parameters
+// # define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+
+// Define if compiler has
+// trouble with functions getting non-type-parameterized classes as parameters
+// # define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+
+// Uncomment this if your compiler lacks static data members.
+// Uncomment next line if your compiler supports __attribute__((weak))
+// # define _STLP_NO_STATIC_TEMPLATE_DATA 1
+// # define _STLP_WEAK_ATTRIBUTE 1
+
+// Uncomment this if your compiler does not support namespaces
+// # define _STLP_HAS_NO_NAMESPACES 1
+
+// Uncomment if "using" keyword does not work with template types
+// # define _STLP_BROKEN_USING_DIRECTIVE 1
+
+// Uncomment this if your compiler does not support exceptions
+// # define _STLP_HAS_NO_EXCEPTIONS 1
+
+// Uncomment this when you are able to detect that the user do not
+// want to use the exceptions feature.
+// # define _STLP_DONT_USE_EXCEPTIONS 1
+
+// Uncomment this if your compiler does not support exception specifications
+// # define _STLP_NO_EXCEPTION_SPEC
+
+// Define this if your compiler requires return statement after throw()
+// # define _STLP_THROW_RETURN_BUG 1
+
+// Define this if your compiler do not support return of void
+// # define _STLP_DONT_RETURN_VOID 1
+
+// Header <new> that comes with the compiler
+// does not define bad_alloc exception
+// # define _STLP_NO_BAD_ALLOC 1
+
+// Define this if your compiler do not throw bad_alloc from the new operator
+// # define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+
+// Uncomment if member template methods are not available
+// # define _STLP_NO_MEMBER_TEMPLATES 1
+
+// Uncomment if member template classes are not available
+// # define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+
+// Uncomment if your compiler do not support the std::allocator rebind technique
+// This is a special case of bad member template classes support, it is automatically
+// defined if _STLP_NO_MEMBER_TEMPLATE_CLASSES is defined.
+// # define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
+
+// Uncomment if no "template" keyword should be used with member template classes
+// # define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+
+// Uncomment if friend member templates are not available
+// # define _STLP_NO_FRIEND_TEMPLATES 1
+
+// Compiler does not accept friend declaration qualified with namespace name.
+// # define _STLP_NO_QUALIFIED_FRIENDS 1
+
+// Uncomment if partial specialization is not available
+// # define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+
+// Define if class being partially specialized require full name (template parameters)
+// of itself for method declarations
+// # define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+
+// Compiler has problem with qualified specializations (cont int, volatile int...)
+// # define _STLP_QUALIFIED_SPECIALIZATION_BUG
+
+// Compiler has problems specializing members of partially
+// specialized class
+// # define _STLP_MEMBER_SPECIALIZATION_BUG
+
+// Uncomment if partial order of template functions is not available
+// # define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+
+// Uncomment if specialization of methods is not allowed
+// # define _STLP_NO_METHOD_SPECIALIZATION 1
+
+// Uncomment if full specialization does not use partial spec. syntax : template <> struct ....
+// # define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+
+// Uncomment if compiler does not support explicit template arguments for functions
+// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+
+// Uncomment this if your compiler can't inline while(), for()
+// # define _STLP_LOOP_INLINE_PROBLEMS 1
+
+// Define if the compiler fails to match a template function argument of base
+// # define _STLP_BASE_MATCH_BUG 1
+
+// Define if the compiler fails to match a template function argument of base
+// (non-template)
+//# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+
+// Define if the compiler rejects outline method definition
+// explicitly taking nested types/typedefs
+// # define _STLP_NESTED_TYPE_PARAM_BUG 1
+
+// Compiler requires typename keyword on outline method definition
+// explicitly taking nested types/typedefs
+// #define _STLP_TYPENAME_ON_RETURN_TYPE
+
+// Define if the baseclass typedefs not visible from outside
+// # define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+
+// if your compiler have serious problems with typedefs, try this one
+// # define _STLP_BASE_TYPEDEF_BUG 1
+
+// Uncomment if getting errors compiling mem_fun* adaptors
+// # define _STLP_MEMBER_POINTER_PARAM_BUG 1
+
+// * _STLP_STATIC_CONST_INIT_BUG: defined if the compiler can't handle a
+// constant-initializer in the declaration of a static const data member
+// of integer type. (See section 9.4.2, paragraph 4, of the C++ standard.)
+// # define _STLP_STATIC_CONST_INIT_BUG
+
+// Define if default constructor for builtin integer type fails to initialize it to 0
+// In expression like new(&char) char():
+//# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+// In default function parameter like _M_method(_Tp __x = _Tp())
+//# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+// Defined if constructor
+// required to explicitly call member's default constructors for const objects
+// # define _STLP_CONST_CONSTRUCTOR_BUG 1
+
+// Defined if the compiler has trouble calling POD-types constructors/destructors
+// # define _STLP_TRIVIAL_CONSTRUCTOR_BUG 1
+// # define _STLP_TRIVIAL_DESTRUCTOR_BUG 1
+
+// Define if having problems specializing maps/sets with
+// key type being const
+// # define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG
+
+// Uncomment this to disable -> operators on all iterators
+// # define _STLP_NO_ARROW_OPERATOR 1
+
+// Uncomment this to disble at() member functions for containers
+// # define _STLP_NO_AT_MEMBER_FUNCTION 1
+
+// Define this if compiler lacks <exception> header
+// # define _STLP_NO_EXCEPTION_HEADER 1
+
+// Uncomment this if your C library has lrand48() function
+// # define _STLP_RAND48 1
+
+// Uncomment if native new-style C library headers lile <cstddef>, etc are not available.
+// # define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+// uncomment if new-style headers <new> is available
+// # define _STLP_HAS_NEW_NEW_HEADER 1
+
+// uncomment this if <iostream> and other STD headers put their stuff in ::namespace,
+// not std::
+// # define _STLP_VENDOR_GLOBAL_STD
+
+// uncomment this if <cstdio> and the like put stuff in ::namespace,
+// not std::
+// # define _STLP_VENDOR_GLOBAL_CSTD
+
+// uncomment this if your compiler consider as ambiguous a function imported within
+// the stlport namespace and called without scope (:: or std::)
+// # define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
+
+// uncomment this if your compiler define all the C math functions C++ additional
+// overloads in ::namespace and not only in std::.
+// # define _STLP_HAS_GLOBAL_C_MATH_FUNCTIONS 1
+
+// uncomment this if your compiler has problem with the import of a namespace in
+// an other one with the using namespace directive
+// # define _STLP_USING_NAMESPACE_BUG 1
+
+// Edit relative path below (or put full path) to get native
+// compiler headers included. Default is "../include".
+// C headers may reside in different directory, so separate macro is provided.
+// Hint : never install STLport in the directory that ends with "include"
+// # define _STLP_NATIVE_INCLUDE_PATH ../include
+// # define _STLP_NATIVE_C_INCLUDE_PATH ../include
+// # define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include
+
+// This macro constructs header path from directory and name.
+// You may change it if your compiler does not understand "/".
+// # define _STLP_MAKE_HEADER(path, header) <path/header>
+
+// This macro constructs native include header path from include path and name.
+// You may have do define it if experimenting problems with preprocessor
+// # define _STLP_NATIVE_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_INCLUDE_PATH,header)
+
+// Same for C headers
+// #define _STLP_NATIVE_C_HEADER(header)
+
+// uncomment this if your compiler/platform do not fully support the IEC 559 floating point
+// numbers specification (also known as IEEE 754 in the US). This specification define the
+// infinity and NaN (Not a Number) representation. Unit tests should tell you if your compiler
+// support it.
+// # define _STLP_NO_IEC559_SUPPORT 1
+
+
+//==========================================================
+#endif
--- /dev/null
+#ifndef __stlp_config_symbian_h
+#define __stlp_config_symbian_h
+
+//==========================================================
+
+#if defined(_WIN32)
+# undef _WIN32
+#endif
+
+//==========================================================
+
+#ifdef __cplusplus
+# include <e32cmn.h>
+#endif
+
+//==========================================================
+
+#if defined(__MARM__)
+# if !defined(_M_ARM)
+# define _M_ARM 1
+# endif
+#else
+# if !defined(_M_IX86)
+# define _M_IX86 1
+# endif
+#endif
+
+//==========================================================
+
+#define __PIPS__
+
+//==========================================================
+
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+#define _STLP_NO_NEW_NEW_HEADER 1
+#define _STLP_NO_NEW_HEADER 1
+#define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+#define _STLP_NO_EXCEPTION_HEADER 1
+#define _STLP_NO_TYPEINFO 1
+#define _STLP_NO_VENDOR_STDLIB_L 1
+#define _STLP_USE_NOT_INIT_SEGMENT 1
+#define _STLP_NO_LONG_DOUBLE 1
+#define _STLP_NO_OWN_NAMESPACE 1
+#define _STLP_USE_MALLOC 1
+#define _STLP_USE_NO_EXTERN_RANGE_ERRORS 1
+#define _STLP_USE_SIMPLE_NODE_ALLOC 1
+#define _STLP_DONT_THROW_RANGE_ERRORS 1
+#define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION 1
+#define _STLP_USE_NEWALLOC 1
+#define _STLP_INLINE_EXCEPTION_CLASS 1
+#define _STLP_USE_PARTIAL_SPEC_WORKAROUND 1
+#define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS 1
+//==========================================================
+
+#ifdef _STLP_REAL_LOCALE_IMPLEMENTED
+# undef _STLP_REAL_LOCALE_IMPLEMENTED
+#endif
+
+//==========================================================
+
+#define _STLP_NATIVE_C_INCLUDE_PATH stdapis
+//==========================================================
+
+#define _Locale_SPACE _CTYPE_S
+#define _Locale_PRINT _CTYPE_R
+#define _Locale_CNTRL _CTYPE_C
+#define _Locale_UPPER _CTYPE_U
+#define _Locale_LOWER _CTYPE_L
+#define _Locale_ALPHA _CTYPE_A
+#define _Locale_DIGIT _CTYPE_D
+#define _Locale_PUNCT _CTYPE_P
+#define _Locale_XDIGIT _CTYPE_X
+
+//==========================================================
+
+#endif
--- /dev/null
+#ifndef _STLP_WINSCW_H
+#define _STLP_WINSCW_H
+
+#define _STLP_COMPILER "WINSCW"
+
+#undef __MWERKS__
+
+//==========================================================
+
+# define _STLP_WCHAR_T_IS_USHORT 1
+# define _STLP_LONG_LONG long long
+
+//==========================================================
+
+#endif
--- /dev/null
+/*
+ * 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.
+ */
+
+/*
+ * Purpose of this file :
+ *
+ * To hold user-definable portion of STLport settings which may be overridden
+ * on per-project basis.
+ * Please note that if you use STLport iostreams (compiled library) then you have
+ * to use consistent settings when you compile STLport library and your project.
+ * Those settings are defined in host.h and have to be the same for a given
+ * STLport installation.
+ */
+
+
+/*==========================================================
+ * User-settable macros that control compilation:
+ * Features selection
+ *==========================================================*/
+
+/*
+ * Use this switch for embedded systems where no iostreams are available
+ * at all. STLport own iostreams will also get disabled automatically then.
+ * You can either use STLport iostreams, or no iostreams.
+ * If you want iostreams, you have to compile library in ../build/lib
+ * and supply resulting library at link time.
+ */
+/*
+#define _STLP_NO_IOSTREAMS 1
+*/
+
+/*
+ * Set _STLP_DEBUG to turn the "Debug Mode" on.
+ * That gets you checked iterators/ranges in the manner
+ * of "Safe STL". Very useful for debugging. Thread-safe.
+ * Please do not forget to link proper STLport library flavor
+ * (e.g libstlportstlg.so or libstlportstlg.a) when you set this flag
+ * in STLport iostreams mode, namespace customization guaranty that you
+ * link to the right library.
+ */
+/*
+#define _STLP_DEBUG 1
+*/
+/*
+ * You can also choose the debug level:
+ * STLport debug level: Default value
+ * Check only what the STLport implementation consider as invalid.
+ * It also change the iterator invalidation schema.
+ * Standard debug level: Check for all operations the standard consider as "undefined behavior"
+ * even if STlport implement it correctly. It also invalidates iterators
+ * more often.
+ */
+/*
+#define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL
+#define _STLP_DEBUG_LEVEL _STLP_STANDARD_DBG_LEVEL
+*/
+/* When an inconsistency is detected by the 'safe STL' the program will abort.
+ * If you prefer an exception define the following macro. The thrown exception
+ * will be the Standard runtime_error exception.
+ */
+/*
+#define _STLP_DEBUG_MODE_THROWS
+ */
+
+/*
+ * _STLP_NO_CUSTOM_IO : define this if you do not instantiate basic_xxx iostream
+ * classes with custom types (which is most likely the case). Custom means types
+ * other than char, wchar_t, char_traits<> and allocator<> like
+ * basic_ostream<my_char_type, my_traits<my_char_type> > or
+ * basic_string<char, char_traits<char>, my_allocator >
+ * When this option is on, most non-inline template functions definitions for iostreams
+ * are not seen by the client which saves a lot of compile time for most compilers,
+ * also object and executable size for some.
+ * Default is off, just not to break compilation for those who do use those types.
+ * That also guarantees that you still use optimized standard i/o when you compile
+ * your program without optimization. Option does not affect STLport library build; you
+ * may use the same binary library with and without this option, on per-project basis.
+ */
+/*
+#define _STLP_NO_CUSTOM_IO
+*/
+
+/*
+ * _STLP_NO_RELOPS_NAMESPACE: if defined, don't put the relational
+ * operator templates (>, <=. >=, !=) in namespace std::rel_ops, even
+ * if the compiler supports namespaces.
+ * Note : if the compiler do not support namespaces, those operators are not be provided by default,
+ * to simulate hiding them into rel_ops. This was proved to resolve many compiler bugs with ambiguity.
+ */
+/*
+#define _STLP_NO_RELOPS_NAMESPACE 1
+*/
+
+/*
+ * If _STLP_USE_OWN_NAMESPACE is in effect, STLport by default will try
+ * to rename std:: for the user to stlport::. If you do not want this feature,
+ * please define the following switch and then use stlport::
+ */
+/*
+#define _STLP_DONT_REDEFINE_STD 1
+*/
+
+/*
+ * _STLP_WHOLE_NATIVE_STD : only meaningful in _STLP_USE_OWN_NAMESPACE mode.
+ * Normally, STLport only imports necessary components from native std:: namespace -
+ * those not yet provided by STLport (<iostream>, <complex>, etc.)
+ * and their dependencies (<string>, <stdexcept>).
+ * You might want everything from std:: being available in std:: namespace when you
+ * include corresponding STLport header (like STLport <map> provides std::map as well, etc.),
+ * if you are going to use both stlport:: and std:: components in your code.
+ * Otherwise this option is not recommended as it increases the size of your object files
+ * and slows down compilation.
+ */
+/*
+#define _STLP_WHOLE_NATIVE_STD
+*/
+
+/*
+ * Use this option to catch uninitialized members in your classes.
+ * When it is set, construct() and destroy() fill the class storage
+ * with _STLP_SHRED_BYTE (see below).
+ * Note : _STLP_DEBUG and _STLP_DEBUG_ALLOC don't set this option automatically.
+ */
+/*
+#define _STLP_DEBUG_UNINITIALIZED 1
+#define _STLP_DEBUG_ALLOC 1
+*/
+
+/*
+ * Uncomment and provide a definition for the byte with which raw memory
+ * will be filled if _STLP_DEBUG_ALLOC or _STLP_DEBUG_UNINITIALIZED is defined.
+ * Choose a value which is likely to cause a noticeable problem if dereferenced
+ * or otherwise abused. A good value may already be defined for your platform.
+ */
+/*
+#define _STLP_SHRED_BYTE 0xA3
+*/
+
+/*
+ * This option is for gcc users only and only affects systems where native linker
+ * does not let gcc to implement automatic instantiation of static template data members/
+ * It is being put in this file as there is no way to check if we are using GNU ld automatically,
+ * so it becomes user's responsibility.
+ */
+/*
+#define _STLP_GCC_USES_GNU_LD
+*/
+
+/*==========================================================
+ * Compatibility section
+ *==========================================================*/
+
+/*
+ * Define this macro to disable anachronistic constructs (like the ones used in HP STL and
+ * not included in final standard, etc.
+ */
+/*
+#define _STLP_NO_ANACHRONISMS 1
+*/
+
+/*
+ * Define this macro to disable STLport extensions (for example, to make sure your code will
+ * compile with some other implementation )
+ */
+/*
+#define _STLP_NO_EXTENSIONS 1
+*/
+
+/*
+ * You should define this macro if compiling with MFC - STLport <stl/config/_windows.h>
+ * then include <afx.h> instead of <windows.h> to get synchronisation primitives
+ */
+/*
+#define _STLP_USE_MFC 1
+*/
+
+/*
+ * boris : this setting is here as we cannot detect precense of new Platform SDK automatically
+ * If you are using new PSDK with VC++ 6.0 or lower,
+ * please define this to get correct prototypes for InterlockedXXX functions
+ */
+/*
+#define _STLP_NEW_PLATFORM_SDK 1
+*/
+
+/*
+ * For the same reason as the one above we are not able to detect easily use
+ * of the compiler coming with the Platform SDK instead of the one coming with
+ * a Microsoft Visual Studio release. This change native C/C++ library location
+ * and implementation, please define this to get correct STLport configuration.
+ */
+/*
+#define _STLP_USING_PLATFORM_SDK_COMPILER 1
+*/
+
+/*
+ * Some compilers support the automatic linking feature.
+ * Uncomment the following if you prefer to specify the STLport library
+ * to link with yourself.
+ * For the moment, this feature is only supported and implemented within STLport
+ * by the Microsoft compilers.
+ */
+/*
+#define _STLP_DONT_USE_AUTO_LINK 1
+*/
+
+/*
+ * If you customize the STLport generated library names don't forget to give
+ * the motif you used during configuration here if you still want the auto link
+ * to work. (Do not remove double quotes in the macro value)
+ */
+/*
+#define _STLP_LIB_NAME_MOTIF "???"
+ */
+
+/*
+ * When using automatic linking (see above), output a message that tells the
+ * user which lib is getting linked via 'pragma message(..)'.
+ * This setting has no effect if automatic linking is not active.
+ */
+/*
+#define _STLP_VERBOSE_AUTO_LINK 1
+*/
+
+/*
+ * Use minimum set of default arguments on template classes that have more
+ * than one - for example map<>, set<>.
+ * This has effect only if _STLP_LIMITED_DEFAULT_TEMPLATES is on.
+ * If _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS is set, you'll be able to compile
+ * set<T> with those compilers, but you'll have to use __set__<T, less<T>>
+ *
+ * Affects : map<>, multimap<>, set<>, multiset<>, hash_*<>,
+ * queue<>, priority_queue<>, stack<>, istream_iterator<>
+ */
+/*
+#define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS 1
+*/
+
+/*
+ * The agregation of strings using the + operator is an expensive operation
+ * as it requires construction of temporary objects that need memory allocation
+ * and deallocation. The problem can be even more important if you are adding
+ * several strings together in a single expression. To avoid this problem STLport
+ * implement expression template. With this technique addition of 2 strings is not
+ * a string anymore but a temporary object having a reference to each of the
+ * original strings involved in the expression. This object carry information
+ * directly to the destination string to set its size correctly and only make
+ * a single call to the allocator. This technique also works for the addition of
+ * N elements where elements are basic_string, C string or a single character.
+ * The drawback can be longer compilation time and bigger executable size.
+ * STLport rebuild: Yes
+ */
+/*
+#define _STLP_USE_TEMPLATE_EXPRESSION 1
+*/
+
+/*
+ * By default the STLport basic_string implementation use a little static buffer
+ * (of 16 chars when writing this doc) to avoid systematically memory allocation
+ * in case of little basic_string. The drawback of such a method is bigger
+ * basic_string size and some performance penalty for method like swap. If you
+ * prefer systematical dynamic allocation turn on this macro.
+ * STLport rebuild: Yes
+ */
+/*
+#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1
+*/
+
+/*
+ * To reduce the famous code bloat trouble due to the use of templates STLport grant
+ * a specialization of some containers for pointer types. So all instanciations
+ * of those containers with a pointer type will use the same implementation based on
+ * a container of void*. This feature has show very good result on object files size
+ * but after link phase and optimization you will only experiment benefit if you use
+ * many container with pointer types.
+ */
+/*
+#define _STLP_USE_PTR_SPECIALIZATIONS 1
+*/
+
+/*
+ * To achieve many different optimizations within the template implementations STLport
+ * uses some type traits technique. With this macro you can ask STLport to use the famous
+ * boost type traits rather than the internal one. The advantages are more compiler
+ * integration and a better support. If you only define this macro once the STLport has been
+ * built you just have to add the boost install path within your include path. If you want
+ * to use this feature at STLport built time you will have to define the
+ * STLP_BUILD_BOOST_PATH enrironment variable with the value of the boost library path.
+ */
+/*
+#define _STLP_USE_BOOST_SUPPORT 1
+*/
+
+/*==========================================================*/
+
+/*
+ Local Variables:
+ mode: C++
+ End:
+*/
--- /dev/null
+/*
+ *
+ * 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_DEBUG_C
+#define _STLP_DEBUG_C
+
+#if defined (_STLP_DEBUG)
+#if defined (_STLP_THREADS)
+# if !defined (_STLP_NEED_MUTABLE)
+# define _STLP_ACQUIRE_LOCK(_Lock) _Lock._M_acquire_lock();
+# define _STLP_RELEASE_LOCK(_Lock) _Lock._M_release_lock();
+# else
+# define _STLP_ACQUIRE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_acquire_lock();
+# define _STLP_RELEASE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_release_lock();
+# endif /* _STLP_NEED_MUTABLE */
+#else
+# define _STLP_ACQUIRE_LOCK(_Lock)
+# define _STLP_RELEASE_LOCK(_Lock)
+#endif /* _STLP_THREADS */
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//==========================================================
+// global non-inline functions
+//==========================================================
+// [ i1, i2)
+#if !defined (__DMC__)
+template <class _Iterator>
+inline bool _STLP_CALL
+__in_range_aux(const _Iterator& __it, const _Iterator& __first,
+ const _Iterator& __last, const random_access_iterator_tag &) {
+ return ( __it >= __first &&
+ __it < __last);
+}
+#endif
+
+template <class _Iterator1, class _Iterator>
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1100)
+inline bool _STLP_CALL __in_range_aux(_Iterator1 __it, const _Iterator& __first,
+#else
+inline bool _STLP_CALL __in_range_aux(const _Iterator1& __it, const _Iterator& __first,
+#endif
+ const _Iterator& __last, const forward_iterator_tag &) {
+ _Iterator1 __i(__first);
+ for (; __i != __last && __i != __it; ++__i);
+ return (__i != __last);
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _Iterator1, class _Iterator>
+inline bool _STLP_CALL
+__in_range_aux(const _Iterator1& __it, const _Iterator& __first,
+ const _Iterator& __last, const bidirectional_iterator_tag &) {
+ _Iterator1 __i(__first);
+ for (; __i != __last && __i != __it; ++__i);
+ return (__i != __last);
+}
+#endif
+
+template <class _Iterator>
+bool _STLP_CALL __check_range_aux(const _Iterator& __first, const _Iterator& __last,
+ const __false_type& /*_IsIntegral*/) {
+ _STLP_VERBOSE_RETURN(__valid_range(__first,__last), _StlMsg_INVALID_RANGE )
+ return true;
+}
+
+template <class _Integral>
+bool _STLP_CALL __check_range_aux(_Integral /*__first*/, _Integral /*__last*/,
+ const __true_type& /*_IsIntegral*/)
+{ return true; }
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last) {
+ typedef typename _IsIntegral<_Iterator>::_Ret _Integral;
+ return __check_range_aux(__first, __last, _Integral());
+}
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator& __it,
+ const _Iterator& __start, const _Iterator& __finish) {
+ _STLP_VERBOSE_RETURN(__in_range(__it, __start, __finish),
+ _StlMsg_NOT_IN_RANGE_1)
+ return true;
+}
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last,
+ const _Iterator& __start, const _Iterator& __finish) {
+ _STLP_VERBOSE_RETURN(__in_range(__first, __last, __start, __finish),
+ _StlMsg_NOT_IN_RANGE_2)
+ return true;
+}
+
+template <class _Tp>
+bool _STLP_CALL __check_ptr_range(const _Tp* __first, const _Tp* __last) {
+ _STLP_VERBOSE_RETURN((__first != 0 || __last == 0), _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_RETURN(__valid_range(__first, __last, random_access_iterator_tag()),
+ _StlMsg_INVALID_RANGE)
+ return true;
+}
+
+//===============================================================
+template <class _Iterator>
+void _STLP_CALL __invalidate_range(const __owned_list* __base,
+ const _Iterator& __first,
+ const _Iterator& __last) {
+ typedef __owned_link _L_type;
+ _STLP_ACQUIRE_LOCK(__base->_M_lock)
+ _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node);
+ _L_type* __pos = __prev->_M_next;
+
+ while (__pos != 0) {
+ if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) &&
+ __in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator,
+ __first._M_iterator, __last._M_iterator,
+ _STLP_ITERATOR_CATEGORY(__first, _Iterator))) {
+ __pos->_M_owner = 0;
+ __prev->_M_next = __pos->_M_next;
+ }
+ else {
+ __prev = __pos;
+ }
+ __pos = __prev->_M_next;
+ }
+ _STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+template <class _Iterator>
+void _STLP_CALL __invalidate_iterator(const __owned_list* __base,
+ const _Iterator& __it) {
+ typedef __owned_link _L_type;
+ _STLP_ACQUIRE_LOCK(__base->_M_lock)
+ _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node);
+ _L_type* __pos = __prev->_M_next;
+ while (__pos != 0) {
+ // this requires safe iterators to be derived from __owned_link
+ if ((__pos != __STATIC_CAST(const _L_type*, &__it)) &&
+ (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) {
+ __pos->_M_owner = 0;
+ __prev->_M_next = __pos->_M_next;
+ }
+ else {
+ __prev = __pos;
+ }
+ __pos = __prev->_M_next;
+ }
+ _STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+template <class _Iterator>
+void _STLP_CALL __change_range_owner(const _Iterator& __first,
+ const _Iterator& __last,
+ const __owned_list* __dst) {
+ if (__first._Owner() == __dst)
+ return;
+
+ typedef __owned_link _L_type;
+ // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
+ //_STLP_ACQUIRE_LOCK(__base->_M_lock)
+ __owned_list *__base = __CONST_CAST(__owned_list*, __first._Owner());
+ _L_type* __src_prev = &__base->_M_node;
+ _L_type* __pos = __src_prev->_M_next;
+ _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node);
+
+ while (__pos != 0) {
+ if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) &&
+ __in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator,
+ __first._M_iterator, __last._M_iterator,
+ _STLP_ITERATOR_CATEGORY(__first, _Iterator))) {
+ __pos->_M_owner = __CONST_CAST(__owned_list*, __dst);
+ //remove __pos from __base:
+ __src_prev->_M_next = __pos->_M_next;
+ //add __pos to __dst:
+ __pos->_M_next = __dst_prev->_M_next;
+ __dst_prev->_M_next = __pos;
+ }
+ else {
+ __src_prev = __pos;
+ }
+ __pos = __src_prev->_M_next;
+ }
+ //_STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+template <class _Iterator>
+void _STLP_CALL __change_ite_owner(const _Iterator& __it,
+ const __owned_list* __dst) {
+ if (__it._Owner() == __dst)
+ return;
+
+ typedef __owned_link _L_type;
+ // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
+ //_STLP_ACQUIRE_LOCK(__base->_M_lock)
+ __owned_list *__base = __CONST_CAST(__owned_list*, __it._Owner());
+ _L_type* __prev = &__base->_M_node;
+ _L_type* __pos = __prev->_M_next;
+ _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node);
+
+ while (__pos != 0) {
+ // this requires safe iterators to be derived from __owned_link
+ if ((__pos != __STATIC_CAST(const _L_type*, &__it)) &&
+ (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) {
+ __pos->_M_owner = __CONST_CAST(__owned_list*, __dst);
+ //remove __pos from __base:
+ __prev->_M_next = __pos->_M_next;
+ //add __pos to __dst:
+ __pos->_M_next = __dst_prev->_M_next;
+ __dst_prev->_M_next = __pos;
+ }
+ else {
+ __prev = __pos;
+ }
+ __pos = __prev->_M_next;
+ }
+ //_STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_DEBUG */
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+# ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+# endif
+
+//==========================================================
+// .c section
+// owned_list non-inline methods and global functions
+//==========================================================
+
+# if defined (_STLP_ASSERTIONS)
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+# if !defined (_STLP_STRING_LITERAL)
+# define _STLP_STRING_LITERAL(__x) __x
+# endif
+
+# if defined (_STLP_USE_WIDE_INTERFACE)
+// note: WinCE needs this to format single-byte strings in __stl_debug_engine::_Message
+# define _STLP_PERCENT_S "%hs"
+# else
+# define _STLP_PERCENT_S "%s"
+# endif /* _STLP_USE_WIDE_INTERFACE */
+
+# define _STLP_MESSAGE_TABLE_BODY = { \
+_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error: " _STLP_PERCENT_S "\n"), \
+_STLP_STRING_LITERAL(_STLP_PERCENT_S "(%d): STL assertion failure : " _STLP_PERCENT_S "\n" _STLP_ASSERT_MSG_TRAILER), \
+_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error : " _STLP_PERCENT_S "\n" _STLP_PERCENT_S "(%d): STL assertion failure: " _STLP_PERCENT_S " \n" _STLP_ASSERT_MSG_TRAILER), \
+_STLP_STRING_LITERAL("Invalid argument to operation (see operation documentation)"), \
+_STLP_STRING_LITERAL("Taking an iterator out of destroyed (or otherwise corrupted) container"), \
+_STLP_STRING_LITERAL("Trying to extract an object out from empty container"),\
+_STLP_STRING_LITERAL("Past-the-end iterator could not be erased"), \
+_STLP_STRING_LITERAL("Index out of bounds"), \
+_STLP_STRING_LITERAL("Container doesn't own the iterator"), \
+_STLP_STRING_LITERAL("Container is owner of the iterator, but should not"), \
+_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) iterator used"), \
+_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) lefthand iterator in expression"), \
+_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) righthand iterator in expression"), \
+_STLP_STRING_LITERAL("Iterators used in expression are from different owners"), \
+_STLP_STRING_LITERAL("Iterator could not be dereferenced (past-the-end ?)"), \
+_STLP_STRING_LITERAL("Range [first,last) is invalid"), \
+_STLP_STRING_LITERAL("Iterator is not in range [first,last)"), \
+_STLP_STRING_LITERAL("Range [first,last) is not in range [start,finish)"), \
+_STLP_STRING_LITERAL("The advance would produce invalid iterator"), \
+_STLP_STRING_LITERAL("Iterator is singular (advanced beyond the bounds ?)"), \
+_STLP_STRING_LITERAL("Invalid strict weak ordering predicate, if pred(a, b) then we should have !pred(b, a)"), \
+_STLP_STRING_LITERAL("Invalid equivalent predicate, if pred(a, b) then we should have pred(b, a)"), \
+_STLP_STRING_LITERAL("Memory block deallocated twice"), \
+_STLP_STRING_LITERAL("Deallocating a block that was never allocated"), \
+_STLP_STRING_LITERAL("Deallocating a memory block allocated for another type"), \
+_STLP_STRING_LITERAL("Size of block passed to deallocate() doesn't match block size"), \
+_STLP_STRING_LITERAL("Pointer underrun - safety margin at front of memory block overwritten"), \
+_STLP_STRING_LITERAL("Pointer overrrun - safety margin at back of memory block overwritten"), \
+_STLP_STRING_LITERAL("Attempt to dereference null pointer returned by auto_ptr::get()"), \
+_STLP_STRING_LITERAL("Memory allocation function returned a wrongly align memory block"), \
+_STLP_STRING_LITERAL("Unknown problem") \
+ }
+
+# if (_STLP_STATIC_TEMPLATE_DATA > 0)
+template <class _Dummy>
+const char* __stl_debug_engine<_Dummy>::_Message_table[_StlMsg_MAX] _STLP_MESSAGE_TABLE_BODY;
+
+# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \
+ defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)
+/*
+ * Under cygwin, when STLport is used as a shared library, the id needs
+ * to be specified as imported otherwise they will be duplicated in the
+ * calling executable.
+ */
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC const char* __stl_debug_engine<bool>::_Message_table[_StlMsg_MAX];
+# endif
+
+# else
+__DECLARE_INSTANCE(const char*, __stl_debug_engine<bool>::_Message_table[_StlMsg_MAX],
+ _STLP_MESSAGE_TABLE_BODY);
+# endif
+
+# undef _STLP_STRING_LITERAL
+# undef _STLP_PERCENT_S
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+// abort()
+# ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+# endif
+
+# if !defined (_STLP_DEBUG_MESSAGE)
+# ifndef _STLP_INTERNAL_CSTDARG
+# include <stl/_cstdarg.h>
+# endif
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+# if defined (_STLP_DEBUG_MODE_THROWS) && !defined (_STLP_RANGE_ERRORS_H)
+# include <stl/_range_errors.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...) {
+ STLPORT_CSTD::va_list __args;
+ va_start( __args, __format_str );
+
+# if !defined (_STLP_DEBUG_MODE_THROWS)
+# if defined (_STLP_USE_WIDE_INTERFACE)
+ TCHAR __buffer[512];
+ int _convert = strlen(__format_str) + 1;
+ LPWSTR _lpw = (LPWSTR)alloca(_convert * sizeof(wchar_t));
+ _lpw[0] = '\0';
+ MultiByteToWideChar(GetACP(), 0, __format_str, -1, _lpw, _convert);
+ wvsprintf(__buffer, _lpw, __args);
+ _STLP_WINCE_TRACE(__buffer);
+# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL))
+ char __buffer [4096];
+
+# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args);
+# else
+ vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args);
+# endif
+
+ OutputDebugStringA(__buffer);
+
+# elif defined (__amigaos__)
+ STLPORT_CSTD::vfprintf(stderr, __format_str, (char *)__args);
+# else
+ STLPORT_CSTD::vfprintf(stderr, __format_str, __args);
+# endif
+# else
+ char __buffer[4096];
+
+# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args);
+# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL))
+ vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args);
+# else
+ vsprintf(__buffer, __format_str, __args);
+# endif
+# endif
+
+# ifdef _STLP_DEBUG_MESSAGE_POST
+ _STLP_DEBUG_MESSAGE_POST
+# endif
+
+ va_end(__args);
+
+# if defined (_STLP_DEBUG_MODE_THROWS)
+ __stl_throw_runtime_error(__buffer);
+# endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+# else
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...)
+{}
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+# endif /* _STLP_DEBUG_MESSAGE */
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_IndexedError(int __error_ind, const char* __f, int __l) {
+ __stl_debug_message(_Message_table[_StlFormat_ERROR_RETURN],
+ __f, __l, _Message_table[__error_ind]);
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l) {
+ __stl_debug_message(_Message_table[_StlFormat_VERBOSE_ASSERTION_FAILURE],
+ __f, __l, _Message_table[__error_ind], __f, __l, __expr);
+ __stl_debug_terminate();
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Assert(const char* __expr, const char* __f, int __l) {
+ __stl_debug_message(_Message_table[_StlFormat_ASSERTION_FAILURE],__f, __l, __expr);
+ __stl_debug_terminate();
+}
+
+// if exceptions are present, sends unique exception
+// if not, calls abort() to terminate
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Terminate()
+{ _STLP_ABORT(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_ASSERTIONS */
+
+# if defined (_STLP_DEBUG)
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//==========================================================
+// owned_list non-inline methods
+//==========================================================
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Invalidate_all(__owned_list* __l) {
+ _STLP_ACQUIRE_LOCK(__l->_M_lock);
+ _Stamp_all(__l, 0);
+ __l->_M_node._M_next =0;
+ _STLP_RELEASE_LOCK(__l->_M_lock);
+}
+
+// boris : this is unasafe routine; should be used from within critical section only !
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Stamp_all(__owned_list* __l, __owned_list* __o) {
+ // crucial
+ if (__l->_M_node._M_owner) {
+ for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next;
+ __pos != 0; __pos = (__owned_link*)__pos->_M_next) {
+ _STLP_ASSERT(__pos->_Owner()== __l)
+ __pos->_M_owner=__o;
+ }
+ }
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Verify(const __owned_list* __l) {
+ _STLP_ACQUIRE_LOCK(__l->_M_lock);
+ if (__l) {
+ _STLP_ASSERT(__l->_M_node._Owner() != 0)
+ for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next;
+ __pos != 0; __pos = (__owned_link*)__pos->_M_next) {
+ _STLP_ASSERT(__pos->_Owner()== __l)
+ }
+ }
+ _STLP_RELEASE_LOCK(__l->_M_lock);
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Swap_owners(__owned_list& __x, __owned_list& __y) {
+ /*
+ * according to the standard : --no swap() function invalidates any references,
+ * pointers, or iterators referring to the elements of the containers being swapped.
+ */
+
+ __owned_link* __tmp;
+
+ /*
+ * boris : there is a deadlock potential situation here if we lock two containers sequentially.
+ * As user is supposed to provide its own synchronization around swap() ( it is unsafe to do any container/iterator access
+ * in parallel with swap()), we just do not use any locking at all -- that behaviour is closer to non-debug version
+ */
+
+ __tmp = __x._M_node._M_next;
+
+ _Stamp_all(&__x, &__y);
+ _Stamp_all(&__y, &__x);
+
+ __x._M_node._M_next = __y._M_node._M_next;
+ __y._M_node._M_next = __tmp;
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Set_owner(__owned_list& __src, __owned_list& __dst) {
+ if (&__src == &__dst)
+ return;
+
+ // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
+ typedef __owned_link _L_type;
+ _L_type* __prev = &__src._M_node;
+ _L_type* __pos = __prev->_M_next;
+
+ while (__pos != 0) {
+ __pos->_M_owner = &__dst;
+ __prev = __pos;
+ __pos = __prev->_M_next;
+ }
+ __prev->_M_next = __dst._M_node._M_next;
+ __dst._M_node._M_next = __src._M_node._M_next;
+ __src._M_node._M_next = 0;
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_M_detach(__owned_list* __l, __owned_link* __c_node) {
+ if (__l != 0) {
+
+ _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER)
+
+ _STLP_ACQUIRE_LOCK(__l->_M_lock)
+ // boris : re-test the condition in case someone else already deleted us
+ if(__c_node->_M_owner != 0) {
+ __owned_link* __prev, *__next;
+
+ for (__prev = &__l->_M_node; (__next = __prev->_M_next) != __c_node;
+ __prev = __next) {
+ _STLP_ASSERT(__next && __next->_Owner() == __l)
+ }
+
+ __prev->_M_next = __c_node->_M_next;
+ __c_node->_M_owner=0;
+ }
+ _STLP_RELEASE_LOCK(__l->_M_lock)
+ }
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_M_attach(__owned_list* __l, __owned_link* __c_node) {
+ if (__l ==0) {
+ (__c_node)->_M_owner = 0;
+ } else {
+ _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER)
+ _STLP_ACQUIRE_LOCK(__l->_M_lock)
+ __c_node->_M_owner = __l;
+ __c_node->_M_next = __l->_M_node._M_next;
+ __l->_M_node._M_next = __c_node;
+ _STLP_RELEASE_LOCK(__l->_M_lock)
+ }
+}
+
+template <class _Dummy>
+void* _STLP_CALL
+__stl_debug_engine<_Dummy>::_Get_container_ptr(const __owned_link* __l) {
+ const __owned_list* __owner = __l->_Owner();
+ _STLP_VERBOSE_RETURN_0(__owner != 0, _StlMsg_INVALID_ITERATOR)
+ void* __ret = __CONST_CAST(void*,__owner->_Owner());
+ _STLP_VERBOSE_RETURN_0(__ret !=0, _StlMsg_INVALID_CONTAINER)
+ return __ret;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_same_owner(const __owned_link& __i1,
+ const __owned_link& __i2) {
+ _STLP_VERBOSE_RETURN(__i1._Valid(), _StlMsg_INVALID_LEFTHAND_ITERATOR)
+ _STLP_VERBOSE_RETURN(__i2._Valid(), _StlMsg_INVALID_RIGHTHAND_ITERATOR)
+ _STLP_VERBOSE_RETURN((__i1._Owner() == __i2._Owner()), _StlMsg_DIFFERENT_OWNERS)
+ return true;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_same_or_null_owner(const __owned_link& __i1,
+ const __owned_link& __i2) {
+ _STLP_VERBOSE_RETURN(__i1._Owner() == __i2._Owner(), _StlMsg_DIFFERENT_OWNERS)
+ return true;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_if_owner( const __owned_list * __l, const __owned_link& __it) {
+ const __owned_list* __owner_ptr = __it._Owner();
+ _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR)
+ _STLP_VERBOSE_RETURN(__l == __owner_ptr, _StlMsg_NOT_OWNER)
+ return true;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_if_not_owner( const __owned_list * __l, const __owned_link& __it) {
+ const __owned_list* __owner_ptr = __it._Owner();
+ _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR)
+ _STLP_VERBOSE_RETURN(__l != __owner_ptr, _StlMsg_SHOULD_NOT_OWNER)
+ return true;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_DEBUG */
+
+#endif /* if defined (EXPOSE_GLOBALS_IMPLEMENTATION) */
+
+#endif /* header guard */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_DEBUG_H
+#define _STLP_DEBUG_H
+
+#if defined (_STLP_ASSERTIONS) || defined (_STLP_DEBUG)
+
+# ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+# endif
+
+# if !defined (_STLP_EXTRA_OPERATORS_FOR_DEBUG) && \
+ (defined (_STLP_BASE_MATCH_BUG) || (defined (_STLP_MSVC) && _STLP_MSVC < 1100))
+# define _STLP_EXTRA_OPERATORS_FOR_DEBUG
+# endif
+
+# if !defined (_STLP_FILE__)
+# define _STLP_FILE__ __FILE__
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+enum {
+ //General errors
+ _StlFormat_ERROR_RETURN,
+ _StlFormat_ASSERTION_FAILURE,
+ _StlFormat_VERBOSE_ASSERTION_FAILURE,
+ _StlMsg_INVALID_ARGUMENT,
+ //Container/Iterator related errors
+ _StlMsg_INVALID_CONTAINER,
+ _StlMsg_EMPTY_CONTAINER,
+ _StlMsg_ERASE_PAST_THE_END,
+ _StlMsg_OUT_OF_BOUNDS,
+ _StlMsg_NOT_OWNER,
+ _StlMsg_SHOULD_NOT_OWNER,
+ _StlMsg_INVALID_ITERATOR,
+ _StlMsg_INVALID_LEFTHAND_ITERATOR,
+ _StlMsg_INVALID_RIGHTHAND_ITERATOR,
+ _StlMsg_DIFFERENT_OWNERS ,
+ _StlMsg_NOT_DEREFERENCEABLE ,
+ _StlMsg_INVALID_RANGE ,
+ _StlMsg_NOT_IN_RANGE_1 ,
+ _StlMsg_NOT_IN_RANGE_2 ,
+ _StlMsg_INVALID_ADVANCE ,
+ _StlMsg_SINGULAR_ITERATOR ,
+ //Bad predicate for sorting
+ _StlMsg_INVALID_STRICT_WEAK_PREDICATE,
+ _StlMsg_INVALID_EQUIVALENT_PREDICATE,
+ // debug alloc messages
+ _StlMsg_DBA_DELETED_TWICE ,
+ _StlMsg_DBA_NEVER_ALLOCATED ,
+ _StlMsg_DBA_TYPE_MISMATCH ,
+ _StlMsg_DBA_SIZE_MISMATCH ,
+ _StlMsg_DBA_UNDERRUN ,
+ _StlMsg_DBA_OVERRUN ,
+ // auto_ptr messages
+ _StlMsg_AUTO_PTR_NULL ,
+ //Memory alignent message
+ _StlMsg_WRONG_MEMORY_ALIGNMENT,
+ _StlMsg_UNKNOWN
+ /* _StlMsg_MAX */
+};
+
+/* have to hardcode that ;() */
+# define _StlMsg_MAX 31
+
+// This class is unique (not inherited from exception),
+// to disallow catch in anything but (...)
+struct __stl_debug_exception {
+ // no members
+};
+
+class _STLP_CLASS_DECLSPEC __owned_link;
+class _STLP_CLASS_DECLSPEC __owned_list;
+
+#if defined (_STLP_DEBUG_MODE_THROWS)
+# define _STLP_MESSAGE_NORETURN _STLP_FUNCTION_THROWS
+#else
+# define _STLP_MESSAGE_NORETURN
+#endif
+
+template <class _Dummy>
+struct __stl_debug_engine {
+
+ // Basic routine to report any debug message
+ // Use _STLP_DEBUG_MESSAGE to override
+ static void _STLP_MESSAGE_NORETURN _STLP_CALL _Message(const char * format_str, ...);
+
+ // Micsellanous function to report indexed error message
+ static void _STLP_CALL _IndexedError(int __ind, const char* __f, int __l);
+
+ // Basic assertion report mechanism.
+ // Reports failed assertion via __stl_debug_message and calls _Terminate
+ // if _STLP_DEBUG_TERMINATE is specified, calls __stl_debug_terminate instead
+ static void _STLP_CALL _Assert(const char* __expr, const char* __f, int __l);
+
+ // The same, with additional diagnostics
+ static void _STLP_CALL _VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l);
+
+ // If exceptions are present, sends unique exception
+ // If not, calls _STLP_ABORT() to terminate
+ // Use _STLP_DEBUG_TERMINATE to override
+ static void _STLP_CALL _Terminate();
+
+# if defined (_STLP_DEBUG)
+ // owned_list/link delegate non-inline functions here
+
+ static bool _STLP_CALL _Check_same_owner( const __owned_link& __i1,
+ const __owned_link& __i2);
+ static bool _STLP_CALL _Check_same_or_null_owner( const __owned_link& __i1,
+ const __owned_link& __i2);
+ static bool _STLP_CALL _Check_if_owner( const __owned_list*, const __owned_link&);
+
+ static bool _STLP_CALL _Check_if_not_owner( const __owned_list*, const __owned_link&);
+
+ static void _STLP_CALL _Verify(const __owned_list*);
+
+ static void _STLP_CALL _Swap_owners(__owned_list&, __owned_list&);
+
+ static void _STLP_CALL _Invalidate_all(__owned_list*);
+
+ static void _STLP_CALL _Set_owner(__owned_list& /*src*/, __owned_list& /*dst*/);
+
+ static void _STLP_CALL _Stamp_all(__owned_list*, __owned_list*);
+
+ static void _STLP_CALL _M_detach(__owned_list*, __owned_link*);
+
+ static void _STLP_CALL _M_attach(__owned_list*, __owned_link*);
+
+ // accessor : check and get pointer to the container
+ static void* _STLP_CALL _Get_container_ptr(const __owned_link*);
+# endif
+
+ // debug messages and formats
+ static _STLP_STATIC_MEMBER_DECLSPEC const char* _Message_table[_StlMsg_MAX];
+};
+
+#undef _STLP_MESSAGE_NORETURN
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE struct _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>;
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+typedef __stl_debug_engine<bool> __stl_debugger;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+# if !defined (_STLP_ASSERT)
+# define _STLP_ASSERT(expr) \
+ if (!(expr)) { _STLP_PRIV __stl_debugger::_Assert( # expr, _STLP_FILE__, __LINE__); }
+# endif
+
+#endif /* _STLP_ASSERTIONS || _STLP_DEBUG */
+
+// this section is for _STLP_DEBUG only
+#if defined (_STLP_DEBUG)
+
+# if !defined (_STLP_VERBOSE_ASSERT)
+// fbp : new form not requiring ";"
+# define _STLP_VERBOSE_ASSERT(expr, __diag_num) \
+ if (!(expr)) { _STLP_PRIV __stl_debugger::_VerboseAssert\
+ ( # expr, _STLP_PRIV __diag_num, _STLP_FILE__, __LINE__ ); \
+ }
+# endif
+
+# define _STLP_DEBUG_CHECK(expr) _STLP_ASSERT(expr)
+# define _STLP_DEBUG_DO(expr) expr;
+
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+# define _STLP_STD_DEBUG_CHECK(expr) _STLP_DEBUG_CHECK(expr)
+# define _STLP_STD_DEBUG_DO(expr) _STLP_DEBUG_DO(expr)
+# else
+# define _STLP_STD_DEBUG_CHECK(expr)
+# define _STLP_STD_DEBUG_DO(expr)
+# endif
+
+# if !defined (_STLP_VERBOSE_RETURN)
+# define _STLP_VERBOSE_RETURN(__expr,__diag_num) if (!(__expr)) { \
+ _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__ , __LINE__); \
+ return false; }
+# endif
+
+# if !defined (_STLP_VERBOSE_RETURN_0)
+# define _STLP_VERBOSE_RETURN_0(__expr,__diag_num) if (!(__expr)) { \
+ _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__, __LINE__); \
+ return 0; }
+# endif
+
+# ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+# endif
+
+# ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * Special debug iterator traits having an additionnal static member
+ * method _Check. It is used by the slit debug implementation to check
+ * the special before_begin iterator.
+ */
+template <class _Traits>
+struct _DbgTraits : _Traits {
+ typedef _DbgTraits<typename _Traits::_ConstTraits> _ConstTraits;
+ typedef _DbgTraits<typename _Traits::_NonConstTraits> _NonConstTraits;
+
+ template <class _Iterator>
+ static bool _Check(const _Iterator&) {return true;}
+};
+
+//=============================================================
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
+ const random_access_iterator_tag&)
+{ return (__i1 < __i2) || (__i1 == __i2); }
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
+ const bidirectional_iterator_tag&) {
+ // check if comparable
+ bool __dummy(__i1==__i2);
+ return (__dummy==__dummy);
+}
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
+ const forward_iterator_tag&) {
+ // check if comparable
+ bool __dummy(__i1==__i2);
+ return (__dummy==__dummy);
+}
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&,
+ const input_iterator_tag&)
+{ return true; }
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&,
+ const output_iterator_tag&)
+{ return true; }
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1, const _Iterator& __i2)
+{ return __valid_range(__i1,__i2,_STLP_ITERATOR_CATEGORY(__i1, _Iterator)); }
+
+// Note : that means in range [i1, i2].
+template <class _Iterator>
+inline bool _STLP_CALL __in_range(const _Iterator& _It,
+ const _Iterator& __i1, const _Iterator& __i2)
+{ return __valid_range(__i1,_It) && __valid_range(_It,__i2); }
+
+template <class _Iterator>
+inline bool _STLP_CALL __in_range(const _Iterator& __first, const _Iterator& __last,
+ const _Iterator& __start, const _Iterator& __finish)
+{ return __valid_range(__first,__last) && __valid_range(__start,__first) && __valid_range(__last,__finish); }
+
+//==========================================================
+class _STLP_CLASS_DECLSPEC __owned_link {
+public:
+ __owned_link() : _M_owner(0) {}
+ __owned_link(const __owned_list* __c) : _M_owner(0), _M_next(0)
+ { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__c), this); }
+ __owned_link(const __owned_link& __rhs): _M_owner(0)
+ { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__rhs._M_owner), this); }
+ __owned_link& operator=(const __owned_link& __rhs) {
+ __owned_list* __new_owner = __CONST_CAST(__owned_list*,__rhs._M_owner);
+ __owned_list* __old_owner = _M_owner;
+ if ( __old_owner != __new_owner ) {
+ __stl_debugger::_M_detach(__old_owner, this);
+ __stl_debugger::_M_attach(__new_owner, this);
+ }
+ return *this;
+ }
+ ~__owned_link() {
+ __stl_debugger::_M_detach(_M_owner, this);
+ _Invalidate();
+ }
+
+ const __owned_list* _Owner() const { return _M_owner; }
+ __owned_list* _Owner() { return _M_owner; }
+ void _Set_owner(const __owned_list* __o) { _M_owner= __CONST_CAST(__owned_list*,__o); }
+ bool _Valid() const { return _M_owner != 0; }
+ void _Invalidate() { _M_owner = 0; _M_next = 0; }
+ void _Link_to_self() { _M_next = 0; }
+
+ __owned_link* _Next() { return _M_next; }
+ const __owned_link* _Next() const { return _M_next; }
+
+public:
+ __owned_list* _M_owner;
+ __owned_link* _M_next;
+};
+
+
+class _STLP_CLASS_DECLSPEC __owned_list {
+public:
+ __owned_list(void* __o) {
+ // fprintf(stderr, "__owned_list(): %p\n",(void*)this);
+ _M_node._M_owner = __REINTERPRET_CAST(__owned_list*,__o);
+ _M_node._M_next = 0;
+ }
+ ~__owned_list() {
+ // fprintf(stderr, "~__owned_list(): %p\n",(void*)this);
+ _Invalidate_all();
+ // that prevents detach
+ _M_node._Invalidate();
+ }
+ const void* _Owner() const { return (const void*)_M_node._M_owner; }
+ void* _Owner() { return (void*)_M_node._M_owner; }
+ bool _Valid() const { return _M_node._M_owner != 0; }
+ void _Invalidate() { _M_node._M_owner = 0; }
+
+ __owned_link* _First() { return _M_node._Next(); }
+ __owned_link* _Last() { return 0 ; }
+
+ const __owned_link* _First() const { return (__owned_link*)_M_node._M_next; }
+ const __owned_link* _Last() const { return 0 ;}
+
+ void _Verify() const { __stl_debugger::_Verify(this); }
+ void _Swap_owners(__owned_list& __y) { __stl_debugger::_Swap_owners(*this, __y); }
+ void _Invalidate_all() { __stl_debugger::_Invalidate_all(this); }
+ void _Set_owner(__owned_list& __y) { __stl_debugger::_Set_owner(*this, __y); }
+
+ mutable __owned_link _M_node;
+ mutable _STLP_mutex _M_lock;
+
+private:
+ // should never be called, should be left not implemented,
+ // but some compilers complain about it ;(
+ __owned_list(const __owned_list&){}
+ __owned_list& operator = (const __owned_list&) { return *this; }
+
+ friend class __owned_link;
+ friend struct __stl_debug_engine<bool>;
+};
+
+
+//==========================================================
+
+// forward declaratioins
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator&, const _Iterator&);
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator&,
+ const _Iterator&, const _Iterator&);
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator&, const _Iterator& ,
+ const _Iterator&, const _Iterator& );
+template <class _Tp>
+bool _STLP_CALL __check_ptr_range(const _Tp*, const _Tp*);
+
+
+template <class _Iterator>
+void _STLP_CALL __invalidate_range(const __owned_list* __base,
+ const _Iterator& __first,
+ const _Iterator& __last);
+
+template <class _Iterator>
+void _STLP_CALL __invalidate_iterator(const __owned_list* __base,
+ const _Iterator& __it);
+
+template <class _Iterator>
+void _STLP_CALL __change_range_owner(const _Iterator& __first,
+ const _Iterator& __last,
+ const __owned_list* __dst);
+
+template <class _Iterator>
+void _STLP_CALL __change_ite_owner(const _Iterator& __it,
+ const __owned_list* __dst);
+
+//============================================================
+inline bool _STLP_CALL
+__check_same_owner(const __owned_link& __i1, const __owned_link& __i2)
+{ return __stl_debugger::_Check_same_owner(__i1,__i2); }
+
+inline bool _STLP_CALL
+__check_same_or_null_owner(const __owned_link& __i1, const __owned_link& __i2)
+{ return __stl_debugger::_Check_same_or_null_owner(__i1,__i2); }
+
+template <class _Iterator>
+inline bool _STLP_CALL __check_if_owner( const __owned_list* __owner,
+ const _Iterator& __it)
+{ return __stl_debugger::_Check_if_owner(__owner, (const __owned_link&)__it); }
+
+template <class _Iterator>
+inline bool _STLP_CALL __check_if_not_owner( const __owned_list* /*__owner*/,
+ const _Iterator& /*__it*/,
+ const __false_type&)
+{ return true; }
+
+template <class _Iterator>
+inline bool _STLP_CALL __check_if_not_owner( const __owned_list* __owner,
+ const _Iterator& __it,
+ const __true_type&)
+{ return __stl_debugger::_Check_if_not_owner(__owner, (const __owned_link&)__it); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_DEBUG */
+
+#if defined (_STLP_ASSERTIONS)
+
+# if !defined (_STLP_ASSERT_MSG_TRAILER)
+# define _STLP_ASSERT_MSG_TRAILER
+# endif
+
+// dwa 12/30/98 - if _STLP_DEBUG_MESSAGE is defined, the user can supply own definition.
+# if !defined (_STLP_DEBUG_MESSAGE)
+# define __stl_debug_message __stl_debugger::_Message
+# else
+extern void __stl_debug_message(const char * format_str, ...);
+# endif
+
+// fbp: if _STLP_DEBUG_TERMINATE is defined, the user can supply own definition.
+# if !defined (_STLP_DEBUG_TERMINATE)
+# define __stl_debug_terminate __stl_debugger::_Terminate
+# else
+extern void __stl_debug_terminate();
+# endif
+
+#endif
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/debug/_debug.c>
+#endif
+
+#endif /* DEBUG_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_DBG_DEQUE_H
+#define _STLP_INTERNAL_DBG_DEQUE_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_DEQUE _STLP_PRIV _STLP_NON_DBG_NAME(deque) <_Tp,_Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp* value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&)
+{ return (_Tp*)0; }
+template <class _Tp, class _Alloc>
+inline random_access_iterator_tag iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&)
+{ return random_access_iterator_tag(); }
+#endif
+
+template <class _Tp, _STLP_DBG_ALLOCATOR_SELECT(_Tp) >
+class deque :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<deque<_Tp, _Alloc> >
+#endif
+{
+ typedef deque<_Tp,_Alloc> _Self;
+ typedef _STLP_NON_DBG_DEQUE _Base;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE > _ConstructCheck;
+
+public:
+ // Basic types
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ // Iterators
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+protected:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_all()
+ { _M_iter_list._Invalidate_all(); }
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+public:
+ // Basic accessors
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ reference operator[](size_type __n) {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+ const_reference operator[](size_type __n) const {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
+ const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
+
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ reference back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+ const_reference back() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+
+ // Constructor, destructor.
+ explicit deque(const allocator_type& __a = allocator_type()) :
+ _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+ deque(const _Self& __x) :
+ _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n, const value_type& __x = _Tp(),
+#else
+ deque(size_type __n, param_type __x,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type()) :
+ _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n) :
+ _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ deque(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+#else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+#endif
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+# endif
+#else
+ deque(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+
+ deque(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+#endif
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ _Invalidate_all();
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+
+public:
+ void assign(size_type __n, const _Tp& __val) {
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
+ }
+ void assign(const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__first, __last);
+ }
+#endif
+
+public: // push_* and pop_*
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __t = _Tp()) {
+#else
+ void push_back(const value_type& __t) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ _Invalidate_all();
+ _M_non_dbg_impl.push_back(__t);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back() {
+ _Invalidate_all();
+ _M_non_dbg_impl.push_back();
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __t = _Tp()) {
+#else
+ void push_front(const value_type& __t) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ _Invalidate_all();
+ _M_non_dbg_impl.push_front(__t);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front() {
+ _Invalidate_all();
+ _M_non_dbg_impl.push_front();
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(end());
+ _M_non_dbg_impl.pop_back();
+ }
+
+ void pop_front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(begin());
+ _M_non_dbg_impl.pop_front();
+ }
+
+public: // Insert
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const value_type& __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_all();
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_all();
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ if (__n != 0) _Invalidate_all();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _AreSameUnCVTypes<_InputIterator, iterator>::_Ret _IsNonConstIterator;
+ typedef typename _AreSameUnCVTypes<_InputIterator, const_iterator>::_Ret _IsConstIterator;
+ typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _DoCheck;
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, _DoCheck()));
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ //dums: because of self insertion iterators must be invalidated after insertion.
+ if (__first != __last) _Invalidate_all();
+ }
+#else
+ void insert(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ //dums: because of self insertion iterators must be invalidated after insertion.
+ if (__first != __last) _Invalidate_all();
+ }
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, __true_type()));
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ //dums: because of self insertion iterators must be invalidated after insertion.
+ if (__first != __last) _Invalidate_all();
+ }
+#endif
+
+#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 (__new_size != size()) {
+ if ((__new_size > size()) || (__new_size < size() - 1))
+ _Invalidate_all();
+ else
+ _Invalidate_iterator(end());
+ }
+ _M_non_dbg_impl.resize(__new_size, __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*/
+
+ // Erase
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ if (__pos._M_iterator == _M_non_dbg_impl.begin())
+ _Invalidate_iterator(__pos);
+ else {
+ typename _Base::iterator __tmp = --(_M_non_dbg_impl.end());
+ if (__pos._M_iterator == __tmp)
+ _Invalidate_iterator(__pos);
+ else
+ _Invalidate_all();
+ }
+ return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ if (!empty()) {
+ if (__first._M_iterator == _M_non_dbg_impl.begin() ||
+ __last._M_iterator == _M_non_dbg_impl.end())
+ _Invalidate_iterators(__first, __last);
+ else
+ _Invalidate_all();
+ }
+ return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+ void clear() {
+ _Invalidate_all();
+ _M_non_dbg_impl.clear();
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_DEQUE
+
+#endif /* _STLP_INTERNAL_DEQUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_DBG_HASHTABLE_H
+#define _STLP_INTERNAL_DBG_HASHTABLE_H
+
+// Hashtable class, used to implement the hashed associative containers
+// hash_set, hash_map, hash_multiset, and hash_multimap,
+// unordered_set, unordered_map, unordered_multiset, unordered_multimap
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Key, class _Equal>
+class _DbgEqual {
+public:
+ _DbgEqual() {}
+ _DbgEqual(const _Equal& __eq) : _M_non_dbg_eq(__eq) {}
+ _DbgEqual(const _DbgEqual& __eq) : _M_non_dbg_eq(__eq._M_non_dbg_eq) {}
+
+#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ bool operator () (const _Key& __lhs, const _Key& __rhs) const
+#else
+ template <class _Kp1, class _Kp2>
+ bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const
+#endif
+ {
+#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ _STLP_VERBOSE_ASSERT(_M_non_dbg_eq(__rhs, __lhs) == _M_non_dbg_eq(__lhs, __rhs), _StlMsg_INVALID_EQUIVALENT_PREDICATE)
+#endif
+ return _M_non_dbg_eq(__lhs, __rhs) ? true : false;
+ }
+
+ _Equal non_dbg_key_eq() const { return _M_non_dbg_eq; }
+private:
+ _Equal _M_non_dbg_eq;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#define _STLP_NON_DBG_HT \
+_STLP_PRIV _STLP_NON_DBG_NAME(hashtable) <_Val, _Key, _HF, _Traits, _ExK, _STLP_PRIV _DbgEqual<_Key, _EqK>, _All>
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Val, class _Key, class _HF,
+ class _ExK, class _EqK, class _All>
+inline _Val*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&)
+{ return (_Val*)0; }
+
+template <class _Val, class _Key, class _HF,
+ class _ExK, class _EqK, class _All>
+inline forward_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&)
+{ return forward_iterator_tag(); }
+#endif
+
+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 _STLP_NON_DBG_HT _Base;
+
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits;
+ typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits;
+
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+public:
+ typedef _Key key_type;
+ typedef _HF hasher;
+ typedef _EqK key_equal;
+
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstTraits> > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstTraits> > const_iterator;
+ //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_NonConstLocalTraits> > local_iterator;
+ typedef iterator local_iterator;
+ //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_ConstLocalTraits> > const_local_iterator;
+ typedef const_iterator const_local_iterator;
+
+ typedef typename _Base::iterator _Base_iterator;
+ typedef typename _Base::const_iterator _Base_const_iterator;
+
+ hasher hash_funct() const { return _M_non_dbg_impl.hash_funct(); }
+ key_equal key_eq() const { return _M_non_dbg_impl.key_eq().non_dbg_key_eq(); }
+
+private:
+ void _Invalidate_iterator(const const_iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const const_iterator& __first, const const_iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const _ExK& __ext,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __hf, __eql, __ext, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __hf, __eql, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ hashtable(const _Self& __ht)
+ : _M_non_dbg_impl(__ht._M_non_dbg_impl),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ hashtable(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+#else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+#endif
+ }
+
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ _Self& operator=(const _Self& __ht) {
+ if (this != &__ht) {
+ //Should not invalidate end iterator
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __ht._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ void swap(_Self& __ht) {
+ _M_iter_list._Swap_owners(__ht._M_iter_list);
+ _M_non_dbg_impl.swap(__ht._M_non_dbg_impl);
+ }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ local_iterator begin(size_type __n) {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n));
+ }
+ local_iterator end(size_type __n) {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n));
+ }
+
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_local_iterator begin(size_type __n) const {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n));
+ }
+ const_local_iterator end(size_type __n) const {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n));
+ }
+
+ pair<iterator, bool> insert_unique(const value_type& __obj) {
+ pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__obj);
+ return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
+ }
+
+ iterator insert_equal(const value_type& __obj)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__obj)); }
+
+ pair<iterator, bool> insert_unique_noresize(const value_type& __obj) {
+ pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique_noresize(__obj);
+ return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
+ }
+
+ iterator insert_equal_noresize(const value_type& __obj)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal_noresize(__obj)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert_unique(_InputIterator __f, _InputIterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
+ }
+
+ template <class _InputIterator>
+ void insert_equal(_InputIterator __f, _InputIterator __l){
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
+ }
+
+#else
+ void insert_unique(const value_type* __f, const value_type* __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ _M_non_dbg_impl.insert_unique(__f, __l);
+ }
+
+ void insert_equal(const value_type* __f, const value_type* __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ _M_non_dbg_impl.insert_equal(__f, __l);
+ }
+
+ void insert_unique(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_unique(__f._M_iterator, __l._M_iterator);
+ }
+
+ void insert_equal(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_equal(__f._M_iterator, __l._M_iterator);
+ }
+#endif
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_non_dbg_impl.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key) {
+ pair<_Base_iterator, _Base_iterator> __res = _M_non_dbg_impl.equal_range(__key);
+ return pair<iterator,iterator> (iterator(&_M_iter_list,__res.first),
+ iterator(&_M_iter_list,__res.second));
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const {
+ pair <_Base_const_iterator, _Base_const_iterator> __res = _M_non_dbg_impl.equal_range(__key);
+ return pair<const_iterator,const_iterator> (const_iterator(&_M_iter_list,__res.first),
+ const_iterator(&_M_iter_list,__res.second));
+ }
+
+ size_type erase(const key_type& __key) {
+ pair<_Base_iterator, _Base_iterator> __p = _M_non_dbg_impl.equal_range(__key);
+ size_type __n = _STLP_STD::distance(__p.first, __p.second);
+ _Invalidate_iterators(const_iterator(&_M_iter_list, __p.first), const_iterator(&_M_iter_list, __p.second));
+ _M_non_dbg_impl.erase(__p.first, __p.second);
+ return __n;
+ }
+
+ void erase(const const_iterator& __it) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__it))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __it))
+ _Invalidate_iterator(__it);
+ _M_non_dbg_impl.erase(__it._M_iterator);
+ }
+ void erase(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last,
+ const_iterator(begin()), const_iterator(end())))
+ _Invalidate_iterators(__first, __last);
+ _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator);
+ }
+
+ void rehash(size_type __num_buckets_hint) { _M_non_dbg_impl.rehash(__num_buckets_hint); }
+ void resize(size_type __num_elements_hint) { _M_non_dbg_impl.resize(__num_elements_hint); }
+
+ void clear() {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+
+ reference _M_insert(const value_type& __obj) { return _M_non_dbg_impl._M_insert(__obj); }
+
+ size_type bucket_count() const { return _M_non_dbg_impl.bucket_count(); }
+ size_type max_bucket_count() const { return _M_non_dbg_impl.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const {
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.elems_in_bucket(__n);
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_non_dbg_impl.bucket(__k); }
+
+ float load_factor() const { return _M_non_dbg_impl.load_factor(); }
+ float max_load_factor() const { return _M_non_dbg_impl.max_load_factor(); }
+ void max_load_factor(float __z) {
+ _STLP_VERBOSE_ASSERT((__z > 0.0f), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.max_load_factor(__z);
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_HT
+
+#endif /* _STLP_INTERNAL_HASHTABLE_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_DBG_ITERATOR_H
+#define _STLP_DBG_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#define _STLP_DBG_ALLOCATOR_SELECT( _Tp ) _STLP_DEFAULT_ALLOCATOR_SELECT( _Tp )
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//============================================================
+
+template <class _Iterator>
+void _Decrement(_Iterator& __it, const bidirectional_iterator_tag &)
+{ --__it; }
+
+template <class _Iterator>
+void _Decrement(_Iterator& __it, const random_access_iterator_tag &)
+{ --__it; }
+
+template <class _Iterator>
+void _Decrement(_Iterator& __it, const forward_iterator_tag &)
+{ _STLP_ASSERT(0) }
+
+template <class _Iterator>
+void _Advance(_Iterator&, ptrdiff_t, const forward_iterator_tag &)
+{ _STLP_ASSERT(0) }
+
+template <class _Iterator>
+void _Advance(_Iterator& __it, ptrdiff_t, const bidirectional_iterator_tag &)
+{ _STLP_ASSERT(0) }
+
+template <class _Iterator>
+void _Advance(_Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &)
+{ __it += __n; }
+
+template <class _Iterator>
+ptrdiff_t _DBG_distance(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &)
+{ return __x - __y; }
+
+template <class _Iterator>
+ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const forward_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return 0;
+}
+
+template <class _Iterator>
+ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return 0;
+}
+
+template <class _Iterator>
+bool _CompareIt(const _Iterator&, const _Iterator&, const forward_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return false;
+}
+
+template <class _Iterator>
+bool _CompareIt(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return false;
+}
+
+template <class _Iterator>
+bool _CompareIt(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &)
+{ return __x < __y; }
+
+template <class _Iterator>
+bool _Dereferenceable(const _Iterator& __it)
+{ return (__it._Get_container_ptr() != 0) && !(__it._M_iterator == (__it._Get_container_ptr())->end()); }
+
+template <class _Iterator>
+bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const forward_iterator_tag &)
+{ return (__n == 1) && _Dereferenceable(__it); }
+
+template <class _Iterator>
+bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const bidirectional_iterator_tag &) {
+ typedef typename _Iterator::_Container_type __container_type;
+ __container_type* __c = __it._Get_container_ptr();
+ return (__c != 0) && ((__n == 1 && __it._M_iterator != __c->end() ) ||
+ (__n == -1 && __it._M_iterator != __c->begin()));
+}
+
+template <class _Iterator>
+bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &) {
+ typedef typename _Iterator::_Container_type __container_type;
+ __container_type* __c = __it._Get_container_ptr();
+ if (__c == 0) return false;
+ ptrdiff_t __new_pos = (__it._M_iterator - __c->begin()) + __n;
+ return (__new_pos >= 0) && (__STATIC_CAST(typename __container_type::size_type, __new_pos) <= __c->size());
+}
+
+
+template <class _Container>
+struct _DBG_iter_base : public __owned_link {
+public:
+ typedef typename _Container::value_type value_type;
+ typedef typename _Container::reference reference;
+ typedef typename _Container::pointer pointer;
+ typedef ptrdiff_t difference_type;
+ //private:
+ typedef typename _Container::iterator _Nonconst_iterator;
+ typedef typename _Container::const_iterator _Const_iterator;
+ typedef _Container _Container_type;
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ typedef typename iterator_traits<_Const_iterator>::iterator_category _Iterator_category;
+#else
+ typedef typename _Container::_Iterator_category _Iterator_category;
+#endif
+ typedef _Iterator_category iterator_category;
+
+ _DBG_iter_base() : __owned_link(0) {}
+ _DBG_iter_base(const __owned_list* __c, const _Const_iterator& __it) :
+#if defined(__HP_aCC) && (__HP_aCC < 60000)
+ __owned_link(__c), _M_iterator(*__REINTERPRET_CAST(const _Nonconst_iterator *, &__it)) {}
+#else
+ __owned_link(__c), _M_iterator(*(const _Nonconst_iterator*)&__it) {}
+#endif
+ _Container* _Get_container_ptr() const {
+ return (_Container*)__stl_debugger::_Get_container_ptr(this);
+ }
+
+ void __increment();
+ void __decrement();
+ void __advance(ptrdiff_t __n);
+
+// protected:
+ _Nonconst_iterator _M_iterator;
+};
+
+template <class _Container>
+inline void _DBG_iter_base<_Container>::__increment() {
+ _STLP_DEBUG_CHECK(_Incrementable(*this, 1, _Iterator_category()))
+ ++_M_iterator;
+}
+
+template <class _Container>
+inline void _DBG_iter_base<_Container>::__decrement() {
+ _STLP_DEBUG_CHECK(_Incrementable(*this, -1, _Iterator_category()))
+ _Decrement(_M_iterator, _Iterator_category());
+}
+
+template <class _Container>
+inline void _DBG_iter_base<_Container>::__advance(ptrdiff_t __n) {
+ _STLP_DEBUG_CHECK(_Incrementable(*this, __n, _Iterator_category()))
+ _Advance(_M_iterator, __n, _Iterator_category());
+}
+
+template <class _Container>
+ptrdiff_t operator-(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y ) {
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Iterator_category;
+ _STLP_DEBUG_CHECK(__check_same_owner(__x, __y))
+ return _DBG_distance(__x._M_iterator,__y._M_iterator, _Iterator_category());
+}
+
+template <class _Container, class _Traits>
+struct _DBG_iter_mid : public _DBG_iter_base<_Container> {
+ typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_self;
+ typedef typename _Container::iterator _Nonconst_iterator;
+ typedef typename _Container::const_iterator _Const_iterator;
+
+ _DBG_iter_mid() {}
+
+ explicit _DBG_iter_mid(const _Nonconst_self& __it) :
+ _DBG_iter_base<_Container>(__it) {}
+
+ _DBG_iter_mid(const __owned_list* __c, const _Const_iterator& __it) :
+ _DBG_iter_base<_Container>(__c, __it) {}
+};
+
+template <class _Container, class _Traits>
+struct _DBG_iter : public _DBG_iter_mid<_Container, _Traits> {
+ typedef _DBG_iter_base<_Container> _Base;
+public:
+ typedef typename _Base::value_type value_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Traits::reference reference;
+ typedef typename _Traits::pointer pointer;
+
+ typedef typename _Base::_Nonconst_iterator _Nonconst_iterator;
+ typedef typename _Base::_Const_iterator _Const_iterator;
+
+private:
+ typedef _DBG_iter<_Container, _Traits> _Self;
+ typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_mid;
+
+public:
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ typedef typename _Base::iterator_category iterator_category;
+#endif
+ typedef typename _Base::_Iterator_category _Iterator_category;
+
+public:
+ _DBG_iter() {}
+ // boris : real type of iter would be nice
+ _DBG_iter(const __owned_list* __c, const _Const_iterator& __it) :
+ _DBG_iter_mid<_Container, _Traits>(__c, __it) {}
+
+ // This allows conversions from iterator to const_iterator without being
+ // redundant with the copy constructor below.
+ _DBG_iter(const _Nonconst_mid& __rhs) :
+ _DBG_iter_mid<_Container, _Traits>(__rhs) {}
+
+ _DBG_iter(const _Self& __rhs) :
+ _DBG_iter_mid<_Container, _Traits>(__rhs) {}
+
+ // This allows conversions from iterator to const_iterator without being
+ // redundant with the copy assignment operator below.
+ _Self& operator=(const _Nonconst_mid& __rhs) {
+ (_Base&)*this = __rhs;
+ return *this;
+ }
+
+ _Self& operator=(const _Self& __rhs) {
+ (_Base&)*this = __rhs;
+ return *this;
+ }
+
+ reference operator*() const;
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ this->__increment();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ this->__increment();
+ return __tmp;
+ }
+ _Self& operator--() {
+ this->__decrement();
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ this->__decrement();
+ return __tmp;
+ }
+
+ _Self& operator+=(difference_type __n) {
+ this->__advance(__n);
+ return *this;
+ }
+
+ _Self& operator-=(difference_type __n) {
+ this->__advance(-__n);
+ return *this;
+ }
+ _Self operator+(difference_type __n) const {
+ _Self __tmp(*this);
+ __tmp.__advance(__n);
+ return __tmp;
+ }
+ _Self operator-(difference_type __n) const {
+ _Self __tmp(*this);
+ __tmp.__advance(-__n);
+ return __tmp;
+ }
+ reference operator[](difference_type __n) const { return *(*this + __n); }
+};
+
+template <class _Container, class _Traits>
+inline
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+_STLP_TYPENAME_ON_RETURN_TYPE _Traits::reference
+#else
+_STLP_TYPENAME_ON_RETURN_TYPE _DBG_iter<_Container, _Traits>::reference
+#endif
+_DBG_iter<_Container, _Traits>::operator*() const {
+ _STLP_DEBUG_CHECK(_Dereferenceable(*this))
+ _STLP_DEBUG_CHECK(_Traits::_Check(*this))
+ return *this->_M_iterator;
+}
+
+template <class _Container>
+inline bool
+operator==(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ return __x._M_iterator == __y._M_iterator;
+}
+
+template <class _Container>
+inline bool
+operator<(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return _CompareIt(__x._M_iterator , __y._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator>(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y) {
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return _CompareIt(__y._M_iterator , __x._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator>=(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return !_CompareIt(__x._M_iterator , __y._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator<=(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y) {
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return !_CompareIt(__y._M_iterator , __x._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator!=(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ return __x._M_iterator != __y._M_iterator;
+}
+
+//------------------------------------------
+
+template <class _Container, class _Traits>
+inline _DBG_iter<_Container, _Traits>
+operator+(ptrdiff_t __n, const _DBG_iter<_Container, _Traits>& __it) {
+ _DBG_iter<_Container, _Traits> __tmp(__it);
+ return __tmp += __n;
+}
+
+
+template <class _Iterator>
+inline _Iterator _Non_Dbg_iter(_Iterator __it)
+{ return __it; }
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _Container, class _Traits>
+inline typename _DBG_iter<_Container, _Traits>::_Nonconst_iterator
+_Non_Dbg_iter(_DBG_iter<_Container, _Traits> __it)
+{ return __it._M_iterator; }
+#endif
+
+/*
+ * Helper classes to check iterator range or pointer validity
+ * at construction time.
+ */
+template <class _Container>
+class __construct_checker {
+ typedef typename _Container::value_type value_type;
+protected:
+ __construct_checker() {}
+
+ __construct_checker(const value_type* __p) {
+ _STLP_VERBOSE_ASSERT((__p != 0), _StlMsg_INVALID_ARGUMENT)
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ __construct_checker(const _InputIter& __f, const _InputIter& __l) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ _M_check_dispatch(__f, __l, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_check_dispatch(_Integer , _Integer, const __true_type& /*IsIntegral*/) {}
+
+ template <class _InputIter>
+ void _M_check_dispatch(const _InputIter& __f, const _InputIter& __l, const __false_type& /*IsIntegral*/) {
+ _STLP_DEBUG_CHECK(__check_range(__f,__l))
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ __construct_checker(const value_type* __f, const value_type* __l) {
+ _STLP_DEBUG_CHECK(__check_ptr_range(__f,__l))
+ }
+
+ typedef _DBG_iter_base<_Container> _IteType;
+ __construct_checker(const _IteType& __f, const _IteType& __l) {
+ _STLP_DEBUG_CHECK(__check_range(__f,__l))
+ }
+#endif
+};
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# if defined (_STLP_NESTED_TYPE_PARAM_BUG) ||\
+ (defined (__SUNPRO_CC) && __SUNPRO_CC < 0x600) ||\
+ (defined (_STLP_MSVC) && (_STLP_MSVC < 1100))
+# define _STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS 1
+# endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Container>
+inline ptrdiff_t*
+distance_type(const _STLP_PRIV _DBG_iter_base<_Container>&) { return (ptrdiff_t*) 0; }
+
+# if !defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Container>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::value_type*
+value_type(const _STLP_PRIV _DBG_iter_base<_Container>&) {
+ typedef typename _STLP_PRIV _DBG_iter_base<_Container>::value_type _Val;
+ return (_Val*)0;
+}
+
+template <class _Container>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category
+iterator_category(const _STLP_PRIV _DBG_iter_base<_Container>&) {
+ typedef typename _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return _Category();
+}
+# endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* INTERNAL_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_DBG_LIST_H
+#define _STLP_INTERNAL_DBG_LIST_H
+
+#ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_LIST _STLP_PRIV _STLP_NON_DBG_NAME(list) <_Tp, _Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&)
+{ return (_Tp*)0; }
+template <class _Tp, class _Alloc>
+inline bidirectional_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&)
+{ return bidirectional_iterator_tag(); }
+#endif
+
+template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
+class list :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<list<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_NON_DBG_LIST _Base;
+ typedef list<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST > _ConstructCheck;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+public:
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
+
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+private:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ typedef typename _Base::iterator _Base_iterator;
+
+public:
+ explicit list(const allocator_type& __a = allocator_type()) :
+ _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n, const _Tp& __x = _Tp(),
+#else
+ list(size_type __n, const _Tp& __x,
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n)
+ : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ list(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+#else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+#endif
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because insert does all of
+ // that anyway.
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#else
+
+ list(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+ list(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+#endif
+
+ list(const _Self& __x) :
+ _ConstructCheck(__x),
+ _M_non_dbg_impl(__x._M_non_dbg_impl) , _M_iter_list(&_M_non_dbg_impl) {}
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ //Should not invalidate end iterator
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ // those are here to enforce checking
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ reference back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+ const_reference back() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const _Tp& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const _Tp& __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ return iterator(&_M_iter_list,_M_non_dbg_impl.insert(__pos._M_iterator, __x) );
+ }
+
+#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*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ typedef typename _AreSameUnCVTypes<_InputIterator, iterator>::_Ret _IsListIterator;
+ typedef typename _AreSameUnCVTypes<_InputIterator, const_iterator>::_Ret _IsListConstIterator;
+ typedef typename _Lor2<_IsListIterator, _IsListConstIterator>::_Ret _DoCheck;
+# endif
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first, _DoCheck()))
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void insert(iterator __pos, const _Tp* __first, const _Tp* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ }
+
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first, _DoCheck()))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+#endif
+
+ void insert(iterator __pos, size_type __n, const _Tp& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+ void push_back(const_reference __x) { _M_non_dbg_impl.push_back(__x); }
+ void pop_back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(end());
+ _M_non_dbg_impl.pop_back();
+ }
+
+ void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
+ void pop_front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(begin());
+ _M_non_dbg_impl.pop_front();
+ }
+
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _Invalidate_iterator(__pos);
+ return iterator(&_M_iter_list,_M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, __last);
+ return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const _Tp& __x = _Tp()) {
+#else
+ void resize(size_type __new_size, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _Base_iterator __i = _M_non_dbg_impl.begin();
+ size_type __len = 0;
+ for ( ; __i != _M_non_dbg_impl.end() && __len < __new_size; ++__i, ++__len);
+
+ if (__len == __new_size)
+ erase(iterator(&_M_iter_list, __i), end());
+ else // __i == end()
+ _M_non_dbg_impl.insert(_M_non_dbg_impl.end(), __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*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/) {
+ _M_check_assign(__n);
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/) {
+ size_type __len = distance(__first, __last);
+ _M_check_assign(__len);
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+
+public:
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+#else
+ void assign(const _Tp* __first, const _Tp* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.assign(__first, __last);
+ }
+
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
+ }
+#endif
+
+private:
+ void _M_check_assign(size_type __n) {
+ size_type __size = size();
+ if (__n < __size) {
+ iterator __it = begin();
+ advance(__it, __n + 1);
+ _Invalidate_iterators(__it, end());
+ }
+ }
+
+public:
+ void assign(size_type __n, const _Tp& __val) {
+ _M_check_assign(__n);
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+ void remove(const _Tp& __x) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__x == *__first) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+
+ void clear() {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+
+public:
+ void splice(iterator __pos, _Self& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
+#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
+ if (get_allocator() == __x.get_allocator())
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ else
+#endif
+ // Std: 23.2.2.4:4
+ // end iterator is not invalidated:
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&(__x._M_iter_list),__i))
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
+#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
+ if (get_allocator() == __x.get_allocator())
+ _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
+ else
+#endif
+ // Std: 23.2.2.4:7
+ __x._Invalidate_iterator(__i);
+ }
+
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
+ _STLP_DEBUG_CHECK(this == &__x ? !_STLP_PRIV __check_range(__pos, __first, __last) : true)
+#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
+ if (this->get_allocator() == __x.get_allocator())
+ _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
+ else
+#endif
+ // Std: 23.2.2.4:12
+ __x._Invalidate_iterators(__first, __last);
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __first._M_iterator, __last._M_iterator);
+ }
+
+ void merge(_Self& __x) {
+#if !defined (_STLP_NO_EXTENSIONS)
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(begin()._M_iterator, end()._M_iterator))
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
+ if (this->get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+ void reverse() {
+ _M_non_dbg_impl.reverse();
+ }
+ void unique() {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (*__first == *__next) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+ void sort() {
+ _M_non_dbg_impl.sort();
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__pred(*__first)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __binary_pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (__binary_pred(*__first, *__next)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __comp) {
+#if !defined (_STLP_NO_EXTENSIONS)
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __comp))
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __comp))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __comp);
+ if (this->get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp) {
+ _M_non_dbg_impl.sort(__comp);
+ }
+#endif
+};
+
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_LIST
+
+#endif /* _STLP_INTERNAL_LIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_DBG_SLIST_H
+#define _STLP_INTERNAL_DBG_SLIST_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_SLIST _STLP_PRIV _STLP_NON_DBG_NAME(slist) <_Tp, _Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
+{ return (_Tp*)0; }
+
+template <class _Tp, class _Alloc>
+inline forward_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
+{ return forward_iterator_tag(); }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * slist special debug traits version.
+ */
+template <class _Traits>
+struct _SlistDbgTraits : _Traits {
+ typedef _SlistDbgTraits<typename _Traits::_ConstTraits> _ConstTraits;
+ typedef _SlistDbgTraits<typename _Traits::_NonConstTraits> _NonConstTraits;
+
+ /*
+ * We don't want the before_begin iterator to return false at _Dereferenceable
+ * call to do not break the current debug framework but calling * operator should
+ * fail.
+ */
+ template <class _Iterator>
+ static bool _Check(const _Iterator& __it)
+ { return !(__it._M_iterator == (__it._Get_container_ptr())->before_begin()); }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
+class slist :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<slist<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_NON_DBG_SLIST _Base;
+ typedef slist<_Tp,_Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST > _ConstructCheck;
+
+public:
+
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Const_traits<value_type> > > const_iterator;
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+private:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ typedef typename _Base::iterator _Base_iterator;
+
+public:
+ explicit slist(const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__a) , _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n, const value_type& __x = _Tp(),
+#else
+ slist(size_type __n, const value_type& __x,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n) : _M_non_dbg_impl(__n) , _M_iter_list(&_M_non_dbg_impl) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ slist(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+#else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+#endif
+ }
+
+#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)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#else
+
+ slist(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ slist(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+#endif
+
+ slist(const _Self& __x) :
+ _ConstructCheck(__x),
+ _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+ _Self& operator= (const _Self& __x) {
+ if (this != &__x) {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ ~slist() {}
+
+ void assign(size_type __n, const value_type& __val) {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+ iterator before_begin()
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
+ const_iterator before_begin() const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
+
+ iterator begin()
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin());}
+
+ iterator end()
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return _M_non_dbg_impl.front();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return _M_non_dbg_impl.front();
+ }
+ void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
+ void pop_front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _M_non_dbg_impl.pop_front();
+ }
+ iterator previous(const_iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ return iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
+ }
+ const_iterator previous(const_iterator __pos) const {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ return const_iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
+ }
+
+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*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ return iterator(&_M_iter_list,_M_non_dbg_impl.insert_after(__pos._M_iterator, __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) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator, __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
+ }
+ void assign(const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(__first, __last);
+ }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InIter>
+ void insert_after(iterator __pos, _InIter __first, _InIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+
+ template <class _InIter>
+ void insert(iterator __pos, _InIter __first, _InIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void insert_after(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+ void insert_after(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator, __first, __last);
+ }
+
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+ void insert(iterator __pos, const value_type* __first,
+ const value_type* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ }
+#endif
+
+#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*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos) {
+ return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+public:
+ iterator erase_after(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ iterator __tmp = __pos; ++__tmp;
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
+ _Invalidate_iterator(__tmp);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__pos._M_iterator));
+ }
+ iterator erase_after(iterator __before_first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __last, begin(), end()))
+ iterator __tmp = __before_first; ++__tmp;
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
+ _Invalidate_iterators(__tmp, __last);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__before_first._M_iterator, __last._M_iterator));
+ }
+
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_VERBOSE_ASSERT(__pos._M_iterator != _M_non_dbg_impl.before_begin(), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_iterator(__pos);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, __last);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+#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*/
+ _M_non_dbg_impl.resize(__new_size, __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*/
+
+ void clear() {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+
+public:
+ // 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) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ // 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) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__prev))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __prev))
+ iterator __elem = __prev; ++__elem;
+ _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl, __prev._M_iterator);
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_ite_owner(__elem, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterator(__elem);
+ }
+ }
+
+ // 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) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __before_last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __before_first))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_last))
+ iterator __first = __before_first; ++__first;
+ iterator __last = __before_last; ++__last;
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__first, __last);
+ }
+ _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl,
+ __before_first._M_iterator, __before_last._M_iterator);
+ }
+
+ // Linear in distance(begin(), __pos), and linear in __x.size().
+ void splice(iterator __pos, _Self& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ //__pos should be owned by *this and not be the before_begin iterator
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ //__i should be dereferenceable, not before_begin and be owned by __x
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list ,__i))
+ _STLP_VERBOSE_ASSERT(!(__i == __x.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterator(__i);
+ }
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
+ }
+
+ // 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) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ //_STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__first, __last);
+ }
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl,
+ __first._M_iterator, __last._M_iterator);
+ }
+
+ void reverse()
+ { _M_non_dbg_impl.reverse(); }
+
+ void remove(const value_type& __val) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__val == *__first) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+ void unique() {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (*__first == *__next) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+ void merge(_Self& __x) {
+ _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
+#if !defined (_STLP_NO_EXTENSIONS)
+ /* comments below due to bug in GCC compilers: ones eat all memory and die if see
+ * something like namespace_name::func_name() - ptr
+ */
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end()))
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+ void sort() {
+ _M_non_dbg_impl.sort();
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__pred(*__first)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (__binary_pred(*__first, *__next)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __ord) {
+ _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
+#if !defined (_STLP_NO_EXTENSIONS)
+ /* comments below due to bug in GCC compilers: ones eat all memory and die if see
+ * something like namespace_name::func_name() - ptr
+ */
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __ord))
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __ord))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __ord);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _M_non_dbg_impl.sort(__comp); }
+#endif
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_SLIST
+
+#endif /* _STLP_INTERNAL_DBG_SLIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_DBG_STRING_H
+#define _STLP_DBG_STRING_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_NON_DBG_STRING_NAME _STLP_NON_DBG_NAME(str)
+#define _STLP_NON_DBG_STRING _STLP_PRIV _STLP_NON_DBG_STRING_NAME <_CharT, _Traits, _Alloc>
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _CharT,class _Traits, class _Alloc>
+inline _CharT*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&)
+{ return (_CharT*)0; }
+template <class _CharT, class _Traits, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&)
+{ return random_access_iterator_tag(); }
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_string :
+#if !defined (__DMC__)
+ private
+#else
+ public
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
+ , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
+#endif
+{
+protected:
+ typedef _STLP_NON_DBG_STRING _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING > _ConstructCheck;
+ typedef typename _IsPOD<_CharT>::_Type _Char_Is_POD;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+ typedef typename _Base::traits_type traits_type;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+public: // Constructor, destructor, assignment.
+ typedef typename _Base::_Reserve_t _Reserve_t;
+
+private:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_all()
+ { _M_iter_list._Invalidate_all(); }
+ void _Compare_Capacity (size_type __old_capacity) {
+ if (this->capacity() > __old_capacity) {
+ _Invalidate_all();
+ }
+ }
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __f, const iterator& __l)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __f, __l); }
+
+public:
+#include <stl/_string_npos.h>
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ explicit basic_string(const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(_Reserve_t __r, size_t __n,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__r, __n, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _Self& __s)
+ : _ConstructCheck(__s),
+ _M_non_dbg_impl(__s._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__s._M_non_dbg_impl, __pos, __n, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _CharT* __s, size_type __n,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__s), _M_non_dbg_impl(__s, __n, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _CharT* __s,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__s),
+ _M_non_dbg_impl(__s, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(size_type __n, _CharT __c,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __c, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base >(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+#else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+#endif
+ }
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || defined(__MRC__) || defined(__SC__)
+ basic_string(const _CharT* __f, const _CharT* __l,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(__f, __l, __a), _M_iter_list(&_M_non_dbg_impl) {
+ }
+ basic_string(const_iterator __f, const_iterator __l,
+ const allocator_type & __a = allocator_type())
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(__f._M_iterator, __l._M_iterator, __a), _M_iter_list(&_M_non_dbg_impl) {
+ }
+#else
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l,
+ const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l)
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#endif
+
+private:
+ // constructor from non-debug version for substr
+ basic_string (const _Base& __x)
+ : _M_non_dbg_impl(__x), _M_iter_list(&_M_non_dbg_impl) {}
+
+public:
+ _Self& operator=(const _Self& __s) {
+ if (this != &__s) {
+ assign(__s);
+ }
+ return *this;
+ }
+
+ _Self& operator=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return assign(__s);
+ }
+
+ _Self& operator=(_CharT __c) {
+ return assign(1, __c);
+ }
+
+ // Iterators.
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ // Size, capacity, etc.
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type length() const { return _M_non_dbg_impl.length(); }
+ size_t max_size() const { return _M_non_dbg_impl.max_size(); }
+
+ void resize(size_type __n, _CharT __c) {
+ if (__n > capacity())
+ _Invalidate_all();
+ else if (__n < size())
+ _Invalidate_iterators(begin() + __n, end());
+ _M_non_dbg_impl.resize(__n, __c);
+ }
+ void resize(size_type __n) { resize(__n, _STLP_DEFAULT_CONSTRUCTED(_CharT)); }
+ size_type capacity() const { return _M_non_dbg_impl.capacity(); }
+
+ void reserve(size_type __s = 0) {
+ if (__s > capacity()) _Invalidate_all();
+ _M_non_dbg_impl.reserve(__s);
+ }
+
+ void clear() {
+ _Invalidate_all();
+ _M_non_dbg_impl.clear();
+ }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ const_reference operator[](size_type __n) const {
+ _STLP_VERBOSE_ASSERT(__n <= this->size(), _StlMsg_OUT_OF_BOUNDS);
+ return _M_non_dbg_impl[__n];
+ }
+
+ reference operator[](size_type __n) {
+ _STLP_VERBOSE_ASSERT(__n < this->size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
+ reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
+
+ // Append, operator+=, push_back.
+ _Self& operator+=(const _Self& __s) { return append(__s); }
+ _Self& operator+=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return append(__s);
+ }
+ _Self& operator+=(_CharT __c) { return append(1, __c); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ _Self& append(_InputIter __first, _InputIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ _Self& append(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__f, __l);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+ _Self& append(const _Self& __s) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const _Self& __s, size_type __pos, size_type __n) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s._M_non_dbg_impl, __pos, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(size_type __n, _CharT __c) {
+ size_type __old_capacity = this->capacity();
+ _M_non_dbg_impl.append(__n, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ void push_back(_CharT __c) {
+ size_type __old_capacity = this->capacity();
+ _M_non_dbg_impl.push_back(__c);
+ _Compare_Capacity(__old_capacity);
+ }
+
+ void pop_back() {
+ _Invalidate_iterator(this->end());
+ _M_non_dbg_impl.pop_back();
+ }
+
+ // Assign
+private:
+ void _M_check_assign(size_type __n) {
+ if (__n > capacity()) {
+ _Invalidate_all();
+ }
+ else if (__n < size()) {
+ _Invalidate_iterators(begin() + __n, end());
+ }
+ }
+
+public:
+ _Self& assign(const _Self& __s) {
+ _M_check_assign(__s.size());
+ _M_non_dbg_impl.assign(__s._M_non_dbg_impl);
+ return *this;
+ }
+
+ _Self& assign(const _Self& __s, size_type __pos, size_type __n) {
+ if (__pos < __s.size()) {
+ _M_check_assign((min) (__n, __s.size() - __pos));
+ }
+ _M_non_dbg_impl.assign(__s._M_non_dbg_impl, __pos, __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ _M_check_assign((min) (_Traits::length(__s), __n));
+ _M_non_dbg_impl.assign(__s, __s + __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ _M_check_assign(_Traits::length(__s));
+ _M_non_dbg_impl.assign(__s);
+ return *this;
+ }
+
+ _Self& assign(size_type __n, _CharT __c) {
+ _M_check_assign(__n);
+ _M_non_dbg_impl.assign(__n, __c);
+ return *this;
+ }
+
+#if defined(_STLP_MEMBER_TEMPLATES)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) {
+ _M_check_assign(__n);
+ _M_non_dbg_impl.assign((size_type)__n, (_CharT)__x);
+ }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
+ _M_check_assign(distance(__f, __l));
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
+ }
+public:
+ template <class _InputIter>
+ inline _Self& assign(_InputIter __first, _InputIter __last) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ return *this;
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ _Self& assign(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ _M_check_assign(distance(__f, __l));
+ _M_non_dbg_impl.assign(__f, __l);
+ return *this;
+ }
+ _Self& assign(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_check_assign(distance(__f, __l));
+ _M_non_dbg_impl.assign(__f._M_iterator, __l._M_iterator);
+ return *this;
+ }
+#endif
+
+ // Insert
+ _Self& insert(size_type __pos, const _Self& __s) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _Self& __s,
+ size_type __beg, size_type __n) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl, __beg, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __s, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return insert(__pos, __s, _Traits::length(__s));
+ }
+
+ _Self& insert(size_type __pos, size_type __n, _CharT __c) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __n, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ iterator insert(iterator __p, _CharT __c) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ size_type __old_capacity = capacity();
+ typename _Base::iterator __ret = _M_non_dbg_impl.insert(__p._M_iterator, __c);
+ _Compare_Capacity(__old_capacity);
+ return iterator(&_M_iter_list, __ret);
+ }
+
+ void insert(iterator __p, size_t __n, _CharT __c) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator, __n, __c);
+ _Compare_Capacity(__old_capacity);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+private:
+ template <class _RandomIter>
+ void _M_insert_aux (iterator __p, _RandomIter __first, _RandomIter __last,
+ const __true_type& /*_IsIterator*/)
+ { _M_non_dbg_impl.insert(__p._M_iterator, __first._M_iterator, __last._M_iterator); }
+
+ template<class _InputIter>
+ void _M_insert_aux (iterator __p, _InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIterator*/) {
+ _M_non_dbg_impl.insert(__p._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+
+public:
+ template <class _InputIter>
+ void insert(iterator __p, _InputIter __first, _InputIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+
+ /* In debug mode we are encapsulating non debug string iterators in debug one.
+ * Doing so the non debug implementation will not check for self insertion
+ * (x.insert(x.begin(), x.begin(), x.end()). To avoid this problem we try to
+ * guess when _InputIter is iterator or const_iterator and in this case call
+ * the non debug insert method with non debug string iterator.
+ */
+ typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsNonConstIterator;
+ typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
+ typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _IsIterator;
+
+ size_type __old_capacity = this->capacity();
+ _M_insert_aux(__p, __first, __last, _IsIterator());
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ void insert(iterator __p, const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f,__l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator, __f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ }
+ void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f,__l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator, __f, __l);
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+ // Erase.
+ _Self& erase(size_type __pos = 0, size_type __n = npos) {
+ if (__pos < size()) {
+ _Invalidate_iterators(begin() + __pos, end());
+ }
+ _M_non_dbg_impl.erase(__pos, __n);
+ return *this;
+ }
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _Invalidate_iterators(__pos, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __f, iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ _Invalidate_iterators(__f, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__f._M_iterator, __l._M_iterator));
+ }
+
+ // Substring.
+ _Self substr(size_type __pos = 0, size_type __n = npos) const
+ { return _M_non_dbg_impl.substr(__pos, __n); }
+
+ // Replace. (Conceptually equivalent to erase followed by insert.)
+ _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n, __s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n1, __s, __n2);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n1, __s);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n1, __n2, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, const _Self& __s) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, size_type __n, _CharT __c) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __n, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+private:
+ template <class _RandomIter>
+ void _M_replace_aux(iterator __first, iterator __last,
+ _RandomIter __f, _RandomIter __l, __true_type const& /*_IsIterator*/)
+ { _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f._M_iterator, __l._M_iterator); }
+
+ template <class _InputIter>
+ void _M_replace_aux(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l, __false_type const& /*_IsIterator*/) {
+ _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
+ }
+
+public:
+ template <class _InputIter>
+ _Self& replace(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+
+ /* See insert comment for reson of iterator detection.
+ */
+ typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsNonConstIterator;
+ typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
+ typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _IsIterator;
+
+ size_type __old_capacity = capacity();
+ _M_replace_aux(__first, __last, __f, __l, _IsIterator());
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ _Self& replace(iterator __first, iterator __last,
+ const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
+ __f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f, __l);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+ // Other modifier member functions.
+ void swap(_Self& __s) {
+ _M_iter_list._Swap_owners(__s._M_iter_list);
+ _M_non_dbg_impl.swap(__s._M_non_dbg_impl);
+ }
+
+ int compare(const _Self& __s) const
+ { return _M_non_dbg_impl.compare(__s._M_non_dbg_impl); }
+ int compare(size_type __pos, size_type __n, const _Self& __s) const
+ { return _M_non_dbg_impl.compare(__pos, __n, __s._M_non_dbg_impl); }
+ int compare(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) const
+ { return _M_non_dbg_impl.compare(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2); }
+ int compare(const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_non_dbg_impl.compare(__s);
+ }
+ int compare(size_type __pos, size_type __n, const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_non_dbg_impl.compare(__pos, __n, __s);
+ }
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s,
+ size_type __n2) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_non_dbg_impl.compare(__pos1, __n1, __s, __n2);
+ }
+
+ // Helper functions for compare.
+ static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
+ const _CharT* __f2, const _CharT* __l2)
+ { return _Base::_M_compare(__f1, __l1, __f2, __l2); }
+ static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1,
+ const _CharT* __f2, const _CharT* __l2)
+ { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2, __l2); }
+ static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
+ const_iterator __f2, const_iterator __l2)
+ { return _Base::_M_compare(__f1, __l1, __f2._M_iterator, __l2._M_iterator); }
+ static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1,
+ const_iterator __f2, const_iterator __l2)
+ { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2._M_iterator, __l2._M_iterator); }
+
+ const _CharT* c_str() const { return _M_non_dbg_impl.c_str(); }
+ const _CharT* data() const { return _M_non_dbg_impl.data(); }
+
+ size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
+ { return _M_non_dbg_impl.copy(__s, __n, __pos); }
+
+ // find.
+ size_type find(const _Self& __s, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find(__s._M_non_dbg_impl, __pos); }
+ size_type find(const _CharT* __s, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find(__s, __pos);
+ }
+ size_type find(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find(__s, __pos, __n);
+ }
+ // 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
+ { return _M_non_dbg_impl.find(__c, __pos); }
+
+ // rfind.
+ size_type rfind(const _Self& __s, size_type __pos = npos) const
+ { return _M_non_dbg_impl.rfind(__s._M_non_dbg_impl, __pos); }
+ size_type rfind(const _CharT* __s, size_type __pos = npos) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.rfind(__s, __pos);
+ }
+ size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.rfind(__s, __pos, __n);
+ }
+ size_type rfind(_CharT __c, size_type __pos = npos) const
+ { return _M_non_dbg_impl.rfind(__c, __pos); }
+
+ // find_first_of
+ size_type find_first_of(const _Self& __s, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_first_of(const _CharT* __s, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_of(__s, __pos);
+ }
+ size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_of(__s, __pos, __n);
+ }
+ size_type find_first_of(_CharT __c, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_of(__c, __pos); }
+
+ // find_last_of
+ size_type find_last_of(const _Self& __s, size_type __pos = npos) const
+ { return _M_non_dbg_impl.find_last_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_last_of(const _CharT* __s, size_type __pos = npos) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_of(__s, __pos);
+ }
+ size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_of(__s, __pos, __n);
+ }
+ size_type find_last_of(_CharT __c, size_type __pos = npos) const
+ { return _M_non_dbg_impl.rfind(__c, __pos); }
+
+ // find_first_not_of
+ size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_not_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_not_of(__s, __pos);
+ }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_not_of(__s, __pos, __n);
+ }
+ size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_not_of(__c, __pos); }
+
+ // find_last_not_of
+ size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const
+ { return _M_non_dbg_impl.find_last_not_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_not_of(__s, __pos);
+ }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_not_of(__s, __pos, __n);
+ }
+ size_type find_last_not_of(_CharT __c, size_type __pos = npos) const
+ { return _M_non_dbg_impl.find_last_not_of(__c, __pos); }
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+# include <stl/debug/_string_sum_methods.h>
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+};
+
+// This is a hook to instantiate STLport exports in a designated DLL
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME <char, char_traits<char>, allocator<char> > >;
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<char, char_traits<char>, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME <wchar_t, char_traits<wchar_t>, allocator<wchar_t> > >;
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+#undef _STLP_NON_DBG_STRING
+#undef _STLP_NON_DBG_STRING_NAME
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG)
+# 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;
+# else
+template <class _CharT, class _Traits, class _Alloc>
+const size_t basic_string<_CharT, _Traits, _Alloc>::npos;
+# endif
+#endif
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+#undef basic_string
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_DBG_STRING */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/*
+ * All the necessary methods used for template expressions with basic_string
+ * This file do not have to be macro guarded as it is only used in the _string.h
+ * file and it is a part of the basic_string definition.
+ */
+
+ template <class _Left, class _Right, class _StorageDir>
+ basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s)
+ : _M_non_dbg_impl(_Reserve_t(), __s.size(), __s.get_allocator()),
+ _M_iter_list(&_M_non_dbg_impl)
+ { _M_append_sum(__s, _M_non_dbg_impl); }
+
+ template <class _Left, class _Right, class _StorageDir>
+ basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a),
+ _M_iter_list(&_M_non_dbg_impl) {
+ size_type __size = __s.size();
+ if (__pos > __size)
+ //This call will generate the necessary out of range exception:
+ _M_non_dbg_impl.at(0);
+ else
+ _M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos), _M_non_dbg_impl);
+ }
+
+private:
+ _Base& _M_append_fast(_STLP_PRIV __char_wrapper<_CharT> __c, _Base &__str)
+ { return __str += __c.getValue(); }
+ _Base& _M_append_fast(_CharT const* __s, size_type __s_size, _Base &__str)
+ { return __str.append(__s, __s_size); }
+ _Base& _M_append_fast(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _Base &__str)
+ { return _M_append_fast(__s.c_str(), __s.size(), __str); }
+ _Base& _M_append_fast(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _Base &__str)
+ { return _M_append_fast(__s.b_str(), __str); }
+ _Base& _M_append_fast(_Self const& __s, _Base &__str)
+ { return _M_append_fast(__s.data(), __s.size(), __str); }
+ _Base& _M_append_fast(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _Base &__str)
+ { return __str; }
+ template <class _Left, class _Right, class _StorageDir>
+ _Base& _M_append_fast(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, _Base &__str)
+ { return _M_append_fast(__s.getRhs(), _M_append_fast(__s.getLhs(), __str)); }
+
+ _Base& _M_append_fast_pos(_STLP_PRIV __char_wrapper<_CharT> __c, _Base &__str, size_type /*__pos*/, size_type __n) {
+ if (__n == 0)
+ return __str;
+ return __str += __c.getValue();
+ }
+ _Base& _M_append_fast_pos(_CharT const* __s, size_type __s_size, _Base &__str,
+ size_type __pos, size_type __n)
+ { return __str.append(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos)); }
+ _Base& _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _Base &__str,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.c_str(), __s.size(), __str, __pos, __n); }
+ _Base& _M_append_fast_pos(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _Base &__str,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.b_str(), __str, __pos, __n); }
+ _Base& _M_append_fast_pos(_Self const& __s, _Base &__str, size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.data(), __s.size(), __str, __pos, __n); }
+ _Base& _M_append_fast_pos(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _Base &__str,
+ size_type /*__pos*/, size_type /*__n*/)
+ { return __str; }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Base& _M_append_fast_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ _Base &__str, size_type __pos, size_type __n) {
+ if (__n == 0) {
+ return __str;
+ }
+ size_type __lhs_size = __s.getLhs().size();
+ if (__pos < __lhs_size) {
+ if (__n < (__lhs_size - __pos)) {
+ return _M_append_fast_pos(__s.getLhs(), __str, __pos, __n);
+ } else {
+ return _M_append_fast_pos(__s.getRhs(), _M_append_fast_pos(__s.getLhs(), __str, __pos, __n),
+ 0, __n - (__lhs_size - __pos));
+ }
+ } else {
+ return _M_append_fast_pos(__s.getRhs(), __str, __pos - __lhs_size, __n);
+ }
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Self& _M_append_sum (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ _Base &__impl) {
+ _M_append_fast(__s, __impl);
+ return *this;
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Self& _M_append_sum_pos (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n, _Base &__impl) {
+ _M_non_dbg_impl.reserve(_M_non_dbg_impl.size() + (min) (__s.size() - __pos, __n));
+ _M_append_fast_pos(__s, __impl, __pos, __n);
+ return *this;
+ }
--- /dev/null
+/*
+ *
+ * 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_DBG_TREE_H
+#define _STLP_INTERNAL_DBG_TREE_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Key, class _Compare>
+class _DbgCompare {
+public:
+ _DbgCompare() {}
+ _DbgCompare(const _Compare& __cmp) : _M_non_dbg_cmp(__cmp) {}
+ _DbgCompare(const _DbgCompare& __cmp) : _M_non_dbg_cmp(__cmp._M_non_dbg_cmp) {}
+
+#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ bool operator () (const _Key& __lhs, const _Key& __rhs) const {
+#else
+ template <class _Kp1, class _Kp2>
+ bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const {
+#endif
+ if (_M_non_dbg_cmp(__lhs, __rhs)) {
+ _STLP_VERBOSE_ASSERT(!_M_non_dbg_cmp(__rhs, __lhs), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return true;
+ }
+ return false;
+ }
+
+ _Compare non_dbg_key_comp() const { return _M_non_dbg_cmp; }
+private:
+ _Compare _M_non_dbg_cmp;
+};
+
+#define _STLP_NON_DBG_TREE _STLP_PRIV _STLP_NON_DBG_NAME(Rb_tree) <_Key, _STLP_PRIV _DbgCompare<_Key, _Compare>, _Value, _KeyOfValue, _Traits, _Alloc>
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc >
+inline _Value*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&)
+{ return (_Value*)0; }
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc >
+inline bidirectional_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&)
+{ return bidirectional_iterator_tag(); }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits,
+ _STLP_DBG_ALLOCATOR_SELECT(_Value) >
+class _Rb_tree {
+ typedef _STLP_NON_DBG_TREE _Base;
+ typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self;
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+ typedef typename _Base::key_type key_type;
+
+ typedef typename _Traits::_NonConstTraits _NonConstIteTraits;
+ typedef typename _Traits::_ConstTraits _ConstIteTraits;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstIteTraits> > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstIteTraits> > const_iterator;
+
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+private:
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ typedef typename _Base::iterator _Base_iterator;
+ typedef typename _Base::const_iterator _Base_const_iterator;
+
+public:
+ _Rb_tree()
+ : _M_non_dbg_impl(), _M_iter_list(&_M_non_dbg_impl) {}
+ _Rb_tree(const _Compare& __comp)
+ : _M_non_dbg_impl(__comp), _M_iter_list(&_M_non_dbg_impl) {}
+ _Rb_tree(const _Compare& __comp, const allocator_type& __a)
+ : _M_non_dbg_impl(__comp, __a), _M_iter_list(&_M_non_dbg_impl) {}
+ _Rb_tree(const _Self& __x)
+ : _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+ _Rb_tree(__move_source<_Self> src):
+ _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+#else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+#endif
+ }
+
+ ~_Rb_tree() {}
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ //Should not invalidate end iterator:
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+ _Compare key_comp() const { return _M_non_dbg_impl.key_comp().non_dbg_key_comp(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_non_dbg_impl.count(__x); }
+
+ void swap(_Self& __t) {
+ _M_non_dbg_impl.swap(__t._M_non_dbg_impl);
+ _M_iter_list._Swap_owners(__t._M_iter_list);
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __k)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __k) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x) {
+ return pair<iterator, iterator>(iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)),
+ iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
+ return pair<const_iterator,const_iterator>(const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)),
+ const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)));
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range_unique(const _KT& __x) {
+ _STLP_STD::pair<_Base_iterator, _Base_iterator> __p;
+ __p = _M_non_dbg_impl.equal_range_unique(__x);
+ return pair<iterator, iterator>(iterator(&_M_iter_list, __p.first), iterator(&_M_iter_list, __p.second));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range_unique(const _KT& __x) const {
+ _STLP_STD::pair<_Base_const_iterator, _Base_const_iterator> __p;
+ __p = _M_non_dbg_impl.equal_range_unique(__x);
+ return pair<const_iterator, const_iterator>(const_iterator(&_M_iter_list, __p.first),
+ const_iterator(&_M_iter_list, __p.second));
+ }
+
+ pair<iterator,bool> insert_unique(const value_type& __x) {
+ _STLP_STD::pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__x);
+ return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
+ }
+ iterator insert_equal(const value_type& __x)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__x)); }
+
+ iterator insert_unique(iterator __pos, const value_type& __x) {
+ _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos))
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert_unique(__pos._M_iterator, __x));
+ }
+ iterator insert_equal(iterator __pos, const value_type& __x) {
+ _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __pos))
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__pos._M_iterator, __x));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template<class _InputIterator>
+ void insert_equal(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+ template<class _InputIterator>
+ void insert_unique(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void insert_unique(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_unique(__first._M_iterator, __last._M_iterator);
+ }
+ void insert_unique(const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last))
+ _M_non_dbg_impl.insert_unique(__first, __last);
+ }
+ void insert_equal(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_equal(__first._M_iterator, __last._M_iterator);
+ }
+ void insert_equal(const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last))
+ _M_non_dbg_impl.insert_equal(__first, __last);
+ }
+#endif
+
+ void erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_Dereferenceable(__pos))
+ _Invalidate_iterator(__pos);
+ _M_non_dbg_impl.erase(__pos._M_iterator);
+ }
+ size_type erase(const key_type& __x) {
+ pair<_Base_iterator,_Base_iterator> __p = _M_non_dbg_impl.equal_range(__x);
+ size_type __n = distance(__p.first, __p.second);
+ _Invalidate_iterators(iterator(&_M_iter_list, __p.first), iterator(&_M_iter_list, __p.second));
+ _M_non_dbg_impl.erase(__p.first, __p.second);
+ return __n;
+ }
+ size_type erase_unique(const key_type& __x) {
+ _Base_iterator __i = _M_non_dbg_impl.find(__x);
+ if (__i != _M_non_dbg_impl.end()) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __i));
+ _M_non_dbg_impl.erase(__i);
+ return 1;
+ }
+ return 0;
+ }
+
+ void erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, __last);
+ _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator);
+ }
+ void erase(const key_type* __first, const key_type* __last) {
+ while (__first != __last) erase(*__first++);
+ }
+
+ void clear() {
+ //should not invalidate end:
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_TREE
+
+#endif /* _STLP_INTERNAL_DBG_TREE_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_DBG_VECTOR_H
+#define _STLP_INTERNAL_DBG_VECTOR_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_VECTOR _STLP_PRIV _STLP_NON_DBG_NAME(vector) <_Tp, _Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&)
+{ return (_Tp*)0; }
+template <class _Tp, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&)
+{ return random_access_iterator_tag(); }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _NcIt>
+struct _Vector_const_traits;
+
+template <class _Tp, class _NcIt>
+struct _Vector_nonconst_traits {
+ typedef _Nonconst_traits<_Tp> _BaseT;
+ typedef _Tp value_type;
+ typedef _Tp& reference;
+ typedef _Tp* pointer;
+ typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits;
+ typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits;
+};
+
+template <class _Tp, class _NcIt>
+struct _Vector_const_traits {
+ typedef _Const_traits<_Tp> _BaseT;
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits;
+ typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Vector_nonconst_traits<bool, _Bit_iterator> {
+ typedef _Bit_iterator::value_type value_type;
+ typedef _Bit_iterator::reference reference;
+ typedef _Bit_iterator::pointer pointer;
+ typedef _Vector_const_traits<bool, _Bit_iterator> _ConstTraits;
+ typedef _Vector_nonconst_traits<bool, _Bit_iterator> _NonConstTraits;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Vector_const_traits<bool, _Bit_iterator> {
+ typedef _Bit_const_iterator::value_type value_type;
+ typedef _Bit_const_iterator::reference reference;
+ typedef _Bit_const_iterator::pointer pointer;
+ typedef _Vector_const_traits<bool, _Bit_iterator> _ConstTraits;
+ typedef _Vector_nonconst_traits<bool, _Bit_iterator> _NonConstTraits;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp, _STLP_DBG_ALLOCATOR_SELECT(_Tp) >
+class vector :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker< _STLP_NON_DBG_VECTOR >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<vector<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_NON_DBG_VECTOR _Base;
+ typedef vector<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_VECTOR > _ConstructCheck;
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ typedef _STLP_PRIV _DBG_iter<_Base,
+ _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_nonconst_traits<value_type, typename _Base::iterator> > > iterator;
+
+ typedef _STLP_PRIV _DBG_iter<_Base,
+ _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_const_traits<value_type, typename _Base::iterator> > > const_iterator;
+
+private:
+ void _Invalidate_all()
+ { _M_iter_list._Invalidate_all(); }
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ void _Check_Overflow(size_type __nb) {
+ if (size() + __nb > capacity())
+ _Invalidate_all();
+ }
+ void _Compare_Capacity (size_type __old_capacity) {
+ if (capacity() > __old_capacity) {
+ _Invalidate_all();
+ }
+ }
+
+public:
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ size_type capacity() const { return _M_non_dbg_impl.capacity(); }
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ reference operator[](size_type __n) {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ const_reference operator[](size_type __n) const {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
+ const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
+
+ explicit vector(const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n, const _Tp& __x = _Tp(),
+#else
+ vector(size_type __n, const _Tp& __x,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n)
+ : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ vector(const _Self& __x)
+ : _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+ vector(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+#else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+#endif
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#else
+ vector(const _Tp* __first, const _Tp* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last), _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ // mysterious VC++ bug ?
+ vector(const_iterator __first, const_iterator __last ,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ _Invalidate_all();
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ void reserve(size_type __n) {
+ if (capacity() < __n)
+ _Invalidate_all();
+ _M_non_dbg_impl.reserve(__n);
+ }
+
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ reference back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+ const_reference back() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos, const _Tp& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Check_Overflow(1);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos)
+ { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // 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 _AreSameUnCVTypes<_InputIterator, iterator>::_Ret _IsNonConstIterator;
+ typedef typename _AreSameUnCVTypes<_InputIterator, const_iterator>::_Ret _IsConstIterator;
+ typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _DoCheck;
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, _DoCheck()));
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ _Compare_Capacity(__old_capacity);
+ }
+#else
+ void insert (iterator __pos,
+ const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ _Compare_Capacity(__old_capacity);
+ }
+
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, __true_type()));
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ _Compare_Capacity(__old_capacity);
+}
+#endif
+
+ void insert (iterator __pos, size_type __n, const _Tp& __x){
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Check_Overflow(__n);
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+ void pop_back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(end());
+ _M_non_dbg_impl.pop_back();
+ }
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_iterators(__pos, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void resize(size_type __new_size, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ if (__new_size > capacity()) {
+ _Invalidate_all();
+ }
+ else if (__new_size < size()) {
+ _Invalidate_iterators(begin() + __new_size, end());
+ }
+ _M_non_dbg_impl.resize(__new_size, __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*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/) {
+ _M_check_assign(__n);
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+ size_type __old_size = size();
+ size_type __old_capacity = capacity();
+ iterator __old_end = end();
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ if (__old_capacity != 0) {
+ if (empty() || (capacity() > __old_capacity)) {
+ _Invalidate_all();
+ }
+ else if (size() < __old_size) {
+ _Invalidate_iterators(begin() + size(), __old_end);
+ }
+ }
+ }
+
+public:
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+#else
+private:
+ void _M_assign(const value_type *__first, const value_type *__last) {
+ size_type __len = distance(__first, __last);
+ _M_check_assign(__len);
+ _M_non_dbg_impl.assign(__first, __last);
+ }
+public:
+ void assign(const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last))
+ _M_assign(__first, __last);
+ }
+
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+ _M_assign(__first._M_iterator, __last._M_iterator);
+ }
+#endif
+
+private:
+ void _M_check_assign(size_type __n) {
+ if (__n > capacity()) {
+ _Invalidate_all();
+ }
+ else if (__n < size()) {
+ _Invalidate_iterators(begin() + __n, end());
+ }
+ }
+
+public:
+ void assign(size_type __n, const _Tp& __val) {
+ _M_check_assign(__n);
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+ void clear() {
+ _Invalidate_all();
+ _M_non_dbg_impl.clear();
+ }
+ void push_back(const _Tp& __x) {
+ _Check_Overflow(1);
+ _M_non_dbg_impl.push_back(__x);
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_VECTOR
+
+#endif /* _STLP_DBG_VECTOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 1998
+ * Mark of the Unicorn, 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. Mark of the Unicorn, Inc. makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+#if defined( _STLP_USE_MSIPL ) && !defined( _STLP_MSL_STRING_H_ )
+#define _STLP_MSL_STRING_H_
+
+//# define char_traits __msl_char_traits
+# define basic_string __msl_basic_string
+# define b_str_ref __msl_b_str_ref
+# define basic_istream __msl_basic_istream
+# define basic_ostream __msl_basic_ostream
+# define string __msl_string
+# define wstring __msl_wstring
+# define iterator_traits __msl_iterator_traits
+
+namespace std
+{
+ template<class charT, class traits> class basic_istream;
+ template<class charT, class traits> class basic_ostream;
+}
+
+# include _STLP_NATIVE_HEADER(string)
+// # undef char_traits
+# undef basic_string
+# undef b_str_ref
+# undef basic_istream
+# undef basic_ostream
+# undef string
+# undef wstring
+# undef iterator_traits
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2004
+ * 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.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_SPECIALIZED_DEQUE_H
+#define _STLP_SPECIALIZED_DEQUE_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * struct helper to cast deque iterators:
+ */
+template <class _StorageT, class _ValueT>
+struct _DequeIteCast {
+ typedef _Deque_iterator<_ValueT, _Nonconst_traits<_ValueT> > iterator;
+ typedef _Deque_iterator<_ValueT, _Const_traits<_ValueT> > const_iterator;
+ typedef _Deque_iterator<_StorageT, _Nonconst_traits<_StorageT> > storage_iterator;
+ typedef _Deque_iterator<_StorageT, _Const_traits<_StorageT> > const_storage_iterator;
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+
+ static iterator to_value_type_ite (storage_iterator const& __ite) {
+ iterator tmp;
+ tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node);
+ return tmp;
+ }
+ static storage_iterator to_storage_type_ite (iterator const& __ite) {
+ storage_iterator tmp;
+ tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node);
+ return tmp;
+ }
+
+ static const_iterator to_value_type_cite (const_storage_iterator const& __ite) {
+ const_iterator tmp;
+ tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node);
+ return tmp;
+ }
+
+ static const_storage_iterator to_storage_type_cite (const_iterator const& __ite) {
+ const_storage_iterator tmp;
+ tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node);
+ return tmp;
+ }
+};
+
+#define DEQUE_IMPL _STLP_PTR_IMPL_NAME(deque)
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<void***, void**, allocator<void**> >;
+_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Deque_base<void*,allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS DEQUE_IMPL<void*,allocator<void*> >;
+#endif
+
+#if defined (_STLP_DEBUG)
+# define deque _STLP_NON_DBG_NAME(deque)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
+class deque
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque)
+ : public __stlport_class<deque<_Tp, _Alloc> >
+#endif
+{
+ typedef typename _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV DEQUE_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef deque<_Tp, _Alloc> _Self;
+
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+ typedef _STLP_PRIV _DequeIteCast<_StorageType, _Tp> ite_cast_traits;
+
+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 random_access_iterator_tag _Iterator_category;
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+ typedef _STLP_PRIV _Deque_iterator<value_type, _Nonconst_traits<value_type> > iterator;
+ typedef _STLP_PRIV _Deque_iterator<value_type, _Const_traits<value_type> > const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+public: // Basic accessors
+ iterator begin() { return ite_cast_traits::to_value_type_ite(_M_impl.begin()); }
+ iterator end() { return ite_cast_traits::to_value_type_ite(_M_impl.end()); }
+ const_iterator begin() const { return ite_cast_traits::to_value_type_cite(_M_impl.begin()); }
+ const_iterator end() const { return ite_cast_traits::to_value_type_cite(_M_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(begin()); }
+
+ reference operator[](size_type __n)
+ { return cast_traits::to_value_type_ref(_M_impl[__n]); }
+ const_reference operator[](size_type __n) const
+ { return cast_traits::to_value_type_cref(_M_impl[__n]); }
+
+ reference at(size_type __n)
+ { return cast_traits::to_value_type_ref(_M_impl.at(__n)); }
+ const_reference at(size_type __n) const
+ { return cast_traits::to_value_type_cref(_M_impl.at(__n)); }
+
+ reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); }
+ reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); }
+ const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); }
+ const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); }
+
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+ bool empty() const { return _M_impl.empty(); }
+ allocator_type get_allocator() const { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+ explicit deque(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+ deque(const _Self& __x) : _M_impl(__x._M_impl) {}
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ deque(size_type __n, const value_type& __val,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__val), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+ // int,long variants may be needed
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n) : _M_impl(__n) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+#if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last,
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+#else
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+#endif
+#if defined (_STLP_USE_ITERATOR_WRAPPER)
+ insert(end(), __first, __last);
+#endif
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last)
+# if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last) {}
+# else
+ { insert(end(), __first, __last); }
+# endif
+# endif
+
+#else
+ deque(const_pointer __first, const_pointer __last,
+ const allocator_type& __a = allocator_type() )
+ : _M_impl(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+ deque(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _M_impl(ite_cast_traits::to_storage_type_cite(__first),
+ ite_cast_traits::to_storage_type_cite(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ deque(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+
+ _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; }
+
+ void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
+
+ void assign(size_type __n, const value_type& __val) {
+ _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_impl.assign(__n, __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.assign(typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+# else
+ _M_impl.assign(__first, __last);
+# endif
+ }
+#else
+ void assign(const_pointer __first, const_pointer __last)
+ { _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last)); }
+ void assign(const_iterator __first, const_iterator __last)
+ { _M_impl.assign(ite_cast_traits::to_storage_type_cite(__first),
+ ite_cast_traits::to_storage_type_cite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_back(const value_type& __t)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_back(cast_traits::to_storage_type_cref(__t)); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_front(const value_type& __t)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_front(cast_traits::to_storage_type_cref(__t)); }
+
+# if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back() { _M_impl.push_back(); }
+ void push_front() { _M_impl.push_front(); }
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_back() { _M_impl.pop_back(); }
+ void pop_front() { _M_impl.pop_front(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { return ite_cast_traits::to_value_type_ite(_M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ cast_traits::to_storage_type_cref(__x))); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __first, __last);
+# endif
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos,
+ const_pointer __first, const_pointer __last) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ ite_cast_traits::to_storage_type_cite(__first),
+ ite_cast_traits::to_storage_type_cite(__last));
+ }
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ iterator erase(iterator __pos)
+ { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__pos))); }
+
+ iterator erase(iterator __first, iterator __last)
+ { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__first),
+ ite_cast_traits::to_storage_type_ite(__last))); }
+ void clear() { _M_impl.clear(); }
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (deque)
+# undef deque
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef DEQUE_IMPL
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_SPECIALIZED_DEQUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_PTR_SPECIALIZED_LIST_H
+#define _STLP_PTR_SPECIALIZED_LIST_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define LIST_IMPL _STLP_PTR_IMPL_NAME(list)
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS _List_node<void*>;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _List_node<void*> >;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_List_node_base, _List_node<void*>, allocator<_List_node<void*> > >;
+_STLP_EXPORT_TEMPLATE_CLASS _List_base<void*, allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS LIST_IMPL<void*, allocator<void*> >;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_DEBUG)
+# define list _STLP_NON_DBG_NAME(list)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
+class list
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list)
+ : public __stlport_class<list<_Tp, _Alloc> >
+#endif
+{
+ typedef typename _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV LIST_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef typename _Base::iterator _BaseIte;
+ typedef typename _Base::const_iterator _BaseConstIte;
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+ typedef list<_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;
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+ typedef bidirectional_iterator_tag _Iterator_category;
+
+ typedef _STLP_PRIV _List_iterator<value_type, _Nonconst_traits<value_type> > iterator;
+ typedef _STLP_PRIV _List_iterator<value_type, _Const_traits<value_type> > const_iterator;
+
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+# if !(defined(__MRC__)||(defined(__SC__) && !defined(__DMC__)))
+ explicit
+# endif
+ list(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ list(size_type __n, const value_type& __val,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__val),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n)
+ : _M_impl(__n) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+# if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+# else
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+ insert(begin(), __first, __last);
+ }
+# endif
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last)
+# if !defined (_STLP_USE_WRAPPER_ITERATOR)
+ : _M_impl(__first, __last) {}
+# else
+ { insert(begin(), __first, __last); }
+# endif
+# endif
+
+#else /* _STLP_MEMBER_TEMPLATES */
+
+ list(const value_type *__first, const value_type *__last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+ list(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ list(const _Self& __x) : _M_impl(__x._M_impl) {}
+
+ list(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+
+ iterator begin() { return iterator(_M_impl.begin()._M_node); }
+ const_iterator begin() const { return const_iterator(_M_impl.begin()._M_node); }
+
+ iterator end() { return iterator(_M_impl.end()._M_node); }
+ const_iterator end() const { return const_iterator(_M_impl.end()._M_node); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ bool empty() const { return _M_impl.empty(); }
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(--end()); }
+ const_reference back() const { return *(--end()); }
+
+ void swap(_Self &__x) { _M_impl.swap(__x._M_impl); }
+ void clear() { _M_impl.clear(); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const_reference __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const_reference __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { return iterator(_M_impl.insert(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cref(__x))._M_node); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_impl.insert(_BaseIte(__pos._M_node), __n, __val); }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert(_BaseIte(__pos._M_node),
+ typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert(_BaseIte(__pos._M_node), __first, __last);
+# endif
+ }
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const value_type *__first, const value_type *__last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last)); }
+ void insert(iterator __pos, const_iterator __first, const_iterator __last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
+
+ void push_front(const value_type& __x) { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); }
+ void push_back(const value_type& __x) { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos) { return iterator(_M_impl.insert(__pos._M_node)._M_node); }
+ void push_front() { _M_impl.push_front();}
+ void push_back() { _M_impl.push_back();}
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ iterator erase(iterator __pos)
+ { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); }
+ iterator erase(iterator __first, iterator __last)
+ { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
+ {_M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));}
+
+ void pop_front() { _M_impl.pop_front(); }
+ void pop_back() { _M_impl.pop_back(); }
+
+ _Self& operator=(const _Self& __x)
+ { _M_impl = __x._M_impl; return *this; }
+ void assign(size_type __n, const value_type& __val)
+ { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
+ { _M_impl.assign(__n, __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.assign(typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+# else
+ _M_impl.assign(__first, __last);
+# endif
+ }
+#else
+ void assign(const value_type *__first, const value_type *__last) {
+ _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void assign(const_iterator __first, const_iterator __last)
+ { _M_impl.assign(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+#endif
+
+ void splice(iterator __pos, _Self& __x)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); }
+ void splice(iterator __pos, _Self& __x, iterator __i)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); }
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl,
+ _BaseIte(__first._M_node), _BaseIte(__last._M_node)); }
+
+ void remove(const_reference __val)
+ { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); }
+ void unique() { _M_impl.unique(); }
+ void merge(_Self& __x) { _M_impl.merge(__x._M_impl); }
+ void reverse() { _M_impl.reverse(); }
+ void sort() { _M_impl.sort(); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred)
+ { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); }
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __bin_pred)
+ { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__bin_pred)); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self &__x, _StrictWeakOrdering __comp)
+ { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (list)
+# undef list
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef LIST_IMPL
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_PTR_SPECIALIZED_LIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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.
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_PTR_SPECIALIZED_SET_H
+#define _STLP_PTR_SPECIALIZED_SET_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, Const_traits)
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC less<void*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+typedef _Rb_tree_node<void*> _Node;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Rb_tree_node_base, _Node, allocator<_Node> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree_base<void*, allocator<void*> >;
+# if defined (_STLP_DEBUG)
+_STLP_EXPORT_TEMPLATE_CLASS _DbgCompare<void*, less<void*> >;
+# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree)
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree<void*, _DbgCompare<void*, less<void*> >, void*, _Identity<void*>,
+ _SetTraitsT<void*>, allocator<void*> >;
+# undef _Rb_tree
+# endif
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree<void*, less<void*>, void*, _Identity<void*>,
+ _SetTraitsT<void*>, allocator<void*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) >
+class set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<set<_Key, _Compare, _Alloc> >
+#endif
+{
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes;
+ typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType;
+ typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType;
+ typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits;
+
+ typedef set<_Key, _Compare, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+protected:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _SetTraitsT<value_type> _SetTraits;
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _SetTraits, _Alloc> _Priv_Rep_type;
+
+ typedef _STLP_PRIV _SetTraitsT<_KeyStorageType> _SetStorageTraits;
+
+public:
+ //dums: need the following public for the __move_traits framework
+ typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType,
+ _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>,
+ _SetStorageTraits, _StorageTypeAlloc> _Rep_type;
+
+private:
+ typedef typename _Rep_type::iterator base_iterator;
+ typedef typename _Rep_type::const_iterator const_base_iterator;
+
+public:
+ typedef typename _Priv_Rep_type::pointer pointer;
+ typedef typename _Priv_Rep_type::const_pointer const_pointer;
+ typedef typename _Priv_Rep_type::reference reference;
+ typedef typename _Priv_Rep_type::const_reference const_reference;
+ typedef typename _Priv_Rep_type::iterator iterator;
+ typedef typename _Priv_Rep_type::const_iterator const_iterator;
+ typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Priv_Rep_type::size_type size_type;
+ typedef typename _Priv_Rep_type::difference_type difference_type;
+ typedef typename _Priv_Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing set
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+#if defined (_STLP_DEBUG)
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+#else
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._M_node); }
+#endif
+
+public:
+ set() : _M_t(_CompareStorageType(), _StorageTypeAlloc()) {}
+ explicit set(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
+ : _M_t(__comp, _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+# endif
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+#else
+ set(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+ _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ set(const value_type* __first, const value_type* __last,
+ const _Compare& __comp, const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+ _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ set(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc())
+ { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+
+ set(const_iterator __first, const_iterator __last,
+ const _Compare& __comp, const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType))
+ { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ set(const _Self& __x) : _M_t(__x._M_t) {}
+
+ set(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); }
+
+ iterator begin() { return _S_to_value_ite(_M_t.begin()); }
+ iterator end() { return _S_to_value_ite(_M_t.end()); }
+ const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); }
+ const_iterator end() const { return _S_to_value_ite(_M_t.end()); }
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+
+ // insert/erase
+ pair<iterator,bool> insert(const value_type& __x) {
+ pair<base_iterator, bool> ret = _M_t.insert_unique(cast_traits::to_storage_type_cref(__x));
+ return pair<iterator, bool>(_S_to_value_ite(ret.first), ret.second);
+ }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _S_to_value_ite(_M_t.insert_unique(_S_to_storage_ite(__pos), cast_traits::to_storage_type_cref(__x))); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+#else
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+ void insert(const value_type* __first, const value_type* __last) {
+ _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif
+ void erase(iterator __pos)
+ { _M_t.erase(_S_to_storage_ite(__pos)); }
+ size_type erase(const key_type& __x)
+ { return _M_t.erase_unique(cast_traits::to_storage_type_cref(__x)); }
+ void erase(iterator __first, iterator __last)
+ { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+ void clear() { _M_t.clear(); }
+
+ // set operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x)
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const
+ { return _M_t.find(cast_traits::to_storage_type_crefT(__x)) == _M_t.end() ? 0 : 1; }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x) {
+ pair<base_iterator, base_iterator> __ret;
+ __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
+ return pair<iterator, iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
+ pair<const_base_iterator, const_base_iterator> __ret;
+ __ret = _M_t.equal_range_unique(cast_traits::to_storage_type_crefT(__x));
+ return pair<const_iterator, const_iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, Const_traits)
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) >
+class multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<multiset<_Key, _Compare, _Alloc> >
+#endif
+{
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes;
+ typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType;
+ typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType;
+ typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits;
+
+ typedef multiset<_Key, _Compare, _Alloc> _Self;
+public:
+ // typedefs:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+protected:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _MultisetTraitsT<value_type> _MultisetTraits;
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _MultisetTraits, _Alloc> _Priv_Rep_type;
+
+ typedef _STLP_PRIV _MultisetTraitsT<_KeyStorageType> _MultisetStorageTraits;
+public:
+ //dums: need the following public for the __move_traits framework
+ typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType,
+ _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>,
+ _MultisetStorageTraits, _StorageTypeAlloc> _Rep_type;
+
+private:
+ typedef typename _Rep_type::iterator base_iterator;
+ typedef typename _Rep_type::const_iterator const_base_iterator;
+
+public:
+ typedef typename _Priv_Rep_type::pointer pointer;
+ typedef typename _Priv_Rep_type::const_pointer const_pointer;
+ typedef typename _Priv_Rep_type::reference reference;
+ typedef typename _Priv_Rep_type::const_reference const_reference;
+ typedef typename _Priv_Rep_type::iterator iterator;
+ typedef typename _Priv_Rep_type::const_iterator const_iterator;
+ typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Priv_Rep_type::size_type size_type;
+ typedef typename _Priv_Rep_type::difference_type difference_type;
+ typedef typename _Priv_Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing multiset
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+#if defined (_STLP_DEBUG)
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+#else
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._M_node); }
+#endif
+
+public:
+ multiset() : _M_t(_Compare(), _StorageTypeAlloc()) {}
+ explicit multiset(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp)
+ : _M_t(__comp, _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+# endif
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+
+#else
+ multiset(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+ _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ multiset(const value_type* __first, const value_type* __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+ _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ multiset(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc())
+ { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+
+ multiset(const_iterator __first, const_iterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType))
+ { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ multiset(const _Self& __x)
+ : _M_t(__x._M_t) {}
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ multiset(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); }
+
+ iterator begin() { return _S_to_value_ite(_M_t.begin()); }
+ iterator end() { return _S_to_value_ite(_M_t.end()); }
+ const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); }
+ const_iterator end() const { return _S_to_value_ite(_M_t.end()); }
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+
+ // insert/erase
+ iterator insert(const value_type& __x)
+ { return _S_to_value_ite(_M_t.insert_equal(cast_traits::to_storage_type_cref(__x))); }
+ iterator insert(iterator __pos, const value_type& __x) {
+ return _S_to_value_ite(_M_t.insert_equal(_S_to_storage_ite(__pos),
+ cast_traits::to_storage_type_cref(__x)));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+#else
+ void insert(const value_type* __first, const value_type* __last) {
+ _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void erase(iterator __pos)
+ { _M_t.erase(_S_to_storage_ite(__pos)); }
+ size_type erase(const key_type& __x)
+ { return _M_t.erase(cast_traits::to_storage_type_cref(__x)); }
+ void erase(iterator __first, iterator __last)
+ { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+ void clear() { _M_t.clear(); }
+
+ // multiset operations:
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x)
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const
+ { return _M_t.count(cast_traits::to_storage_type_crefT(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x) {
+ pair<base_iterator, base_iterator> __ret;
+ __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
+ return pair<iterator, iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
+ pair<const_base_iterator, const_base_iterator> __ret;
+ __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
+ return pair<const_iterator, const_iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_PTR_SPECIALIZED_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_SPECIALIZED_SLIST_H
+#define _STLP_SPECIALIZED_SLIST_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define SLIST_IMPL _STLP_PTR_IMPL_NAME(slist)
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS _Slist_node<void*>;
+typedef _Slist_node<void*> _VoidPtrSNode;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base, _VoidPtrSNode, allocator<_VoidPtrSNode> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Slist_base<void*, allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS SLIST_IMPL<void*, allocator<void*> >;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_DEBUG)
+# define slist _STLP_NON_DBG_NAME(slist)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
+class slist
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist)
+ : public __stlport_class<slist<_Tp, _Alloc> >
+#endif
+{
+ typedef typename _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV SLIST_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef typename _Base::iterator _BaseIte;
+ typedef typename _Base::const_iterator _BaseConstIte;
+ typedef slist<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+ typedef _STLP_PRIV _Slist_node_base _Node_base;
+
+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<value_type, _Nonconst_traits<value_type> > iterator;
+ typedef _STLP_PRIV _Slist_iterator<value_type, _Const_traits<value_type> > const_iterator;
+
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+
+public:
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+ explicit slist(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ slist(size_type __n, const value_type& __x,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__x), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n) : _M_impl(__n) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#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)
+# if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+# else
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+ insert_after(before_begin(), __first, __last);
+ }
+# endif
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ // VC++ needs this crazyness
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last)
+# if !defined (_STLP_USE_WRAPPER_ITERATOR)
+ : _M_impl(__first, __last) {}
+# else
+ { insert_after(before_begin(), __first, __last); }
+# endif
+# endif
+#else /* _STLP_MEMBER_TEMPLATES */
+ slist(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+ slist(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ slist(const _Self& __x) : _M_impl(__x._M_impl) {}
+ slist(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+
+ _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; }
+
+ void assign(size_type __n, const value_type& __val)
+ { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_impl.assign(__n, __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.assign(typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+# else
+ _M_impl.assign(__first, __last);
+# endif
+ }
+#else
+ void assign(const value_type *__first, const value_type *__last) {
+ _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void assign(const_iterator __first, const_iterator __last) {
+ _M_impl.assign(_BaseConstIte(__first._M_node),
+ _BaseConstIte(__last._M_node));
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator before_begin() { return iterator(_M_impl.before_begin()._M_node); }
+ const_iterator before_begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.before_begin()._M_node)); }
+
+ iterator begin() { return iterator(_M_impl.begin()._M_node); }
+ const_iterator begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.begin()._M_node));}
+
+ iterator end() { return iterator(_M_impl.end()._M_node); }
+ const_iterator end() const { return iterator(_M_impl.end()._M_node); }
+
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+ bool empty() const { return _M_impl.empty(); }
+
+ void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
+
+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 = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_front(const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); }
+
+# if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_front() { _M_impl.push_front();}
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_front() { _M_impl.pop_front(); }
+
+ iterator previous(const_iterator __pos)
+ { return iterator(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node); }
+ const_iterator previous(const_iterator __pos) const
+ { return const_iterator(const_cast<_Node_base*>(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node)); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert_after(iterator __pos, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cref(__x))._M_node); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos)
+ { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node))._M_node);}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert_after(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert_after(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_after_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&) {
+ _M_impl.insert_after(_BaseIte(__pos._M_node), __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_after_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert_after(_BaseIte(__pos._M_node),
+ typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert_after(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_after_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert_after(_BaseIte(__pos._M_node), __first, __last);
+# endif
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert_after(iterator __pos,
+ const_iterator __first, const_iterator __last)
+ { _M_impl.insert_after(_BaseIte(__pos._M_node),
+ _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+ void insert_after(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _M_impl.insert_after(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { return iterator(_M_impl.insert(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cref(__x))._M_node); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos)
+ { return iterator(_M_impl.insert(_BaseIte(__pos._M_node))._M_node); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&) {
+ _M_impl.insert(_BaseIte(__pos._M_node), __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert(_BaseIte(__pos._M_node), typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert(_BaseIte(__pos._M_node), __first, __last);
+# endif
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const_iterator __first, const_iterator __last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+ void insert(iterator __pos, const value_type* __first, const value_type* __last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator erase_after(iterator __pos)
+ { return iterator(_M_impl.erase_after(_BaseIte(__pos._M_node))._M_node); }
+ iterator erase_after(iterator __before_first, iterator __last)
+ { return iterator(_M_impl.erase_after(_BaseIte(__before_first._M_node),
+ _BaseIte(__last._M_node))._M_node); }
+
+ iterator erase(iterator __pos)
+ { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); }
+ iterator erase(iterator __first, iterator __last)
+ { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear() { _M_impl.clear(); }
+
+ void splice_after(iterator __pos, _Self& __x,
+ iterator __before_first, iterator __before_last)
+ { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl,
+ _BaseIte(__before_first._M_node), _BaseIte(__before_last._M_node)); }
+ void splice_after(iterator __pos, _Self& __x, iterator __prev)
+ { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__prev._M_node)); }
+ void splice_after(iterator __pos, _Self& __x)
+ { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl); }
+ void splice(iterator __pos, _Self& __x)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); }
+ void splice(iterator __pos, _Self& __x, iterator __i)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); }
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl,
+ _BaseIte(__first._M_node), _BaseIte(__last._M_node)); }
+
+ void reverse() { _M_impl.reverse(); }
+
+ void remove(const value_type& __val) { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); }
+ void unique() { _M_impl.unique(); }
+ void merge(_Self& __x) { _M_impl.merge(__x._M_impl); }
+ void sort() {_M_impl.sort(); }
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _Predicate>
+ void remove_if(_Predicate __pred)
+ { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __pred)
+ { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__pred)); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __comp)
+ { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (slist)
+# undef slist
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef SLIST_IMPL
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_SPECIALIZED_SLIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+#define _STLP_POINTERS_SPEC_TOOLS_H
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Some usefull declarations:
+template <class _Tp> struct less;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _StorageT, class _ValueT, class _BinaryPredicate>
+struct _BinaryPredWrapper;
+
+/*
+ * Since the compiler only allows at most one non-trivial
+ * implicit conversion we can make use of a shim class to
+ * be sure that functions below doesn't accept classes with
+ * implicit pointer conversion operators
+ */
+struct _ConstVolatileVoidPointerShim
+{ _ConstVolatileVoidPointerShim(const volatile void*); };
+
+//The dispatch functions:
+struct _VoidPointerShim
+{ _VoidPointerShim(void*); };
+struct _ConstVoidPointerShim
+{ _ConstVoidPointerShim(const void*); };
+struct _VolatileVoidPointerShim
+{ _VolatileVoidPointerShim(volatile void*); };
+
+template <class _Tp>
+char _UseVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseVoidPtrStorageType(const __true_type& /*POD*/, _VoidPointerShim);
+
+template <class _Tp>
+char _UseConstVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseConstVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseConstVoidPtrStorageType(const __true_type& /*POD*/, _ConstVoidPointerShim);
+
+template <class _Tp>
+char _UseVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, _VolatileVoidPointerShim);
+
+template <class _Tp>
+char _UseConstVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, _ConstVolatileVoidPointerShim);
+
+template <class _Tp>
+struct _StorageType {
+ typedef typename __type_traits<_Tp>::is_POD_type _PODType;
+ static _Tp __null_rep();
+
+ enum { use_void_ptr = (sizeof(_UseVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+ enum { use_const_void_ptr = (sizeof(_UseConstVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+ enum { use_volatile_void_ptr = (sizeof(_UseVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+ enum { use_const_volatile_void_ptr = (sizeof(_UseConstVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+
+ typedef typename __select<!use_const_volatile_void_ptr,
+ _Tp,
+ typename __select<use_void_ptr,
+ void*,
+ typename __select<use_const_void_ptr,
+ const void*,
+ typename __select<use_volatile_void_ptr,
+ volatile void*,
+ const volatile void*>::_Ret >::_Ret >::_Ret >::_Ret _QualifiedType;
+
+#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ /* If the compiler do not support the iterator_traits structure we cannot wrap
+ * iterators pass to container template methods. The iterator dereferenced value
+ * has to be storable without any cast in the chosen storage type. To guaranty
+ * that the void pointer has to be correctly qualified.
+ */
+ typedef _QualifiedType _Type;
+#else
+ /* With iterator_traits we can wrap passed iterators and make the necessary casts.
+ * We can always use a simple void* storage type:
+ */
+ typedef typename __select<use_const_volatile_void_ptr,
+ void*,
+ _Tp>::_Ret _Type;
+#endif
+};
+
+template <class _Tp, class _Compare>
+struct _AssocStorageTypes {
+ typedef _StorageType<_Tp> _StorageTypeInfo;
+ typedef typename _StorageTypeInfo::_Type _SType;
+
+ //We need to also check that the comparison functor used to instanciate the assoc container
+ //is the default Standard less implementation:
+ typedef typename _IsSTLportClass<_Compare>::_Ret _STLportLess;
+ enum { is_default_less = __type2bool<_STLportLess>::_Ret };
+
+ typedef typename __select<is_default_less, _SType, _Tp>::_Ret _KeyStorageType;
+ enum { ptr_type = _StorageTypeInfo::use_const_volatile_void_ptr };
+ typedef typename __select<is_default_less && ptr_type,
+ _BinaryPredWrapper<_KeyStorageType, _Tp, _Compare>,
+ _Compare>::_Ret _CompareStorageType;
+};
+
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/*
+ * Base struct to deal with qualifiers
+ */
+template <class _StorageT, class _QualifiedStorageT>
+struct _VoidCastTraitsAux {
+ typedef _QualifiedStorageT void_cv_type;
+ typedef _StorageT void_type;
+
+ static void_type * uncv_ptr(void_cv_type *__ptr)
+ { return __ptr; }
+ static void_type const* uncv_cptr(void_cv_type const*__ptr)
+ { return __ptr; }
+ static void_type ** uncv_pptr(void_cv_type **__ptr)
+ { return __ptr; }
+ static void_type & uncv_ref(void_cv_type & __ref)
+ { return __ref; }
+ static void_type const& uncv_cref(void_cv_type const& __ref)
+ { return __ref; }
+ static void_cv_type* cv_ptr(void_type *__ptr)
+ { return __ptr; }
+ static void_cv_type const* cv_cptr(void_type const*__ptr)
+ { return __ptr; }
+ static void_cv_type ** cv_pptr(void_type **__ptr)
+ { return __ptr; }
+ static void_cv_type & cv_ref(void_type & __ref)
+ { return __ref; }
+ static void_cv_type const& cv_cref(void_type const& __ref)
+ { return __ref; }
+};
+
+template <class _VoidCVType>
+struct _VoidCastTraitsAuxBase {
+ typedef _VoidCVType* void_cv_type;
+ typedef void* void_type;
+
+ static void_type* uncv_ptr(void_cv_type *__ptr)
+ { return __CONST_CAST(void_type*, __ptr); }
+ static void_type const* uncv_cptr(void_cv_type const*__ptr)
+ { return __CONST_CAST(void_type const*, __ptr); }
+ static void_type** uncv_pptr(void_cv_type **__ptr)
+ { return __CONST_CAST(void_type**, __ptr); }
+ static void_type& uncv_ref(void_cv_type &__ref)
+ { return __CONST_CAST(void_type&, __ref); }
+ static void_type const& uncv_cref(void_cv_type const& __ptr)
+ { return __CONST_CAST(void_type const&, __ptr); }
+ // The reverse versions
+ static void_cv_type * cv_ptr(void_type *__ptr)
+ { return __CONST_CAST(void_cv_type *, __ptr); }
+ static void_cv_type const* cv_cptr(void_type const*__ptr)
+ { return __CONST_CAST(void_cv_type const*, __ptr); }
+ static void_cv_type ** cv_pptr(void_type **__ptr)
+ { return __CONST_CAST(void_cv_type**, __ptr); }
+ static void_cv_type & cv_ref(void_type &__ref)
+ { return __CONST_CAST(void_cv_type &, __ref); }
+ static void_cv_type const& cv_cref(void_type const& __ref)
+ { return __CONST_CAST(void_cv_type const&, __ref); }
+};
+
+_STLP_TEMPLATE_NULL
+struct _VoidCastTraitsAux<void*, const void*> : _VoidCastTraitsAuxBase<void const>
+{};
+_STLP_TEMPLATE_NULL
+struct _VoidCastTraitsAux<void*, volatile void*> : _VoidCastTraitsAuxBase<void volatile>
+{};
+_STLP_TEMPLATE_NULL
+struct _VoidCastTraitsAux<void*, const volatile void*> : _VoidCastTraitsAuxBase<void const volatile>
+{};
+
+template <class _StorageT, class _ValueT>
+struct _CastTraits {
+ typedef _ValueT value_type;
+ typedef typename _StorageType<_ValueT>::_QualifiedType _QualifiedStorageT;
+ typedef _VoidCastTraitsAux<_StorageT, _QualifiedStorageT> cv_traits;
+ typedef typename cv_traits::void_type void_type;
+ typedef typename cv_traits::void_cv_type void_cv_type;
+
+ static value_type * to_value_type_ptr(void_type *__ptr)
+ { return __REINTERPRET_CAST(value_type *, cv_traits::cv_ptr(__ptr)); }
+ static value_type const* to_value_type_cptr(void_type const*__ptr)
+ { return __REINTERPRET_CAST(value_type const*, cv_traits::cv_cptr(__ptr)); }
+ static value_type ** to_value_type_pptr(void_type **__ptr)
+ { return __REINTERPRET_CAST(value_type **, cv_traits::cv_pptr(__ptr)); }
+ static value_type & to_value_type_ref(void_type &__ref)
+ { return __REINTERPRET_CAST(value_type &, cv_traits::cv_ref(__ref)); }
+ static value_type const& to_value_type_cref(void_type const& __ptr)
+ { return __REINTERPRET_CAST(value_type const&, cv_traits::cv_cref(__ptr)); }
+ // Reverse versions
+ static void_type * to_storage_type_ptr(value_type *__ptr)
+ { return cv_traits::uncv_ptr(__REINTERPRET_CAST(void_cv_type *, __ptr)); }
+ static void_type const* to_storage_type_cptr(value_type const*__ptr)
+ { return cv_traits::uncv_cptr(__REINTERPRET_CAST(void_cv_type const*, __ptr)); }
+ static void_type ** to_storage_type_pptr(value_type **__ptr)
+ { return cv_traits::uncv_pptr(__REINTERPRET_CAST(void_cv_type **, __ptr)); }
+ static void_type const& to_storage_type_cref(value_type const& __ref)
+ { return cv_traits::uncv_cref(__REINTERPRET_CAST(void_cv_type const&, __ref)); }
+
+ //Method used to treat set container template method extension
+ static void_type const& to_storage_type_crefT(value_type const& __ref)
+ { return to_storage_type_cref(__ref); }
+};
+
+template <class _Tp>
+struct _CastTraits<_Tp, _Tp> {
+ typedef _Tp storage_type;
+ typedef _Tp value_type;
+
+ static value_type * to_value_type_ptr(storage_type *__ptr)
+ { return __ptr; }
+ static value_type const* to_value_type_cptr(storage_type const*__ptr)
+ { return __ptr; }
+ static value_type ** to_value_type_pptr(storage_type **__ptr)
+ { return __ptr; }
+ static value_type & to_value_type_ref(storage_type &__ref)
+ { return __ref; }
+ static value_type const& to_value_type_cref(storage_type const&__ref)
+ { return __ref; }
+ // Reverse versions
+ static storage_type * to_storage_type_ptr(value_type *__ptr)
+ { return __ptr; }
+ static storage_type const* to_storage_type_cptr(value_type const*__ptr)
+ { return __ptr; }
+ static storage_type ** to_storage_type_pptr(value_type **__ptr)
+ { return __ptr; }
+ static storage_type const& to_storage_type_cref(value_type const& __ref)
+ { return __ref; }
+
+ //Method used to treat set container template method extension
+ template <class _Tp1>
+ static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref)
+ { return __ref; }
+};
+
+#define _STLP_USE_ITERATOR_WRAPPER
+
+template <class _StorageT, class _ValueT, class _Iterator>
+struct _IteWrapper {
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+ typedef iterator_traits<_Iterator> _IteTraits;
+
+ typedef typename _IteTraits::iterator_category iterator_category;
+ typedef _StorageT value_type;
+ typedef typename _IteTraits::difference_type difference_type;
+ typedef value_type* pointer;
+ typedef value_type const& const_reference;
+ //This wrapper won't be used for input so to avoid surprise
+ //the reference type will be a const reference:
+ typedef const_reference reference;
+
+ typedef _IteWrapper<_StorageT, _ValueT, _Iterator> _Self;
+ typedef _Self _Ite;
+
+ _IteWrapper(_Iterator &__ite) : _M_ite(__ite) {}
+
+ const_reference operator*() const { return cast_traits::to_storage_type_cref(*_M_ite); }
+
+ _Self& operator= (_Self const& __rhs) {
+ _M_ite = __rhs._M_ite;
+ return *this;
+ }
+
+ _Self& operator++() {
+ ++_M_ite;
+ return *this;
+ }
+
+ _Self& operator--() {
+ --_M_ite;
+ return *this;
+ }
+
+ _Self& operator += (difference_type __offset) {
+ _M_ite += __offset;
+ return *this;
+ }
+ difference_type operator -(_Self const& __other) const
+ { return _M_ite - __other._M_ite; }
+
+ bool operator == (_Self const& __other) const
+ { return _M_ite == __other._M_ite; }
+
+ bool operator != (_Self const& __other) const
+ { return _M_ite != __other._M_ite; }
+
+ bool operator < (_Self const& __rhs) const
+ { return _M_ite < __rhs._M_ite; }
+
+private:
+ _Iterator _M_ite;
+};
+
+template <class _Tp, class _Iterator>
+struct _IteWrapper<_Tp, _Tp, _Iterator>
+{ typedef _Iterator _Ite; };
+
+#else
+
+/*
+ * In this config the storage type is qualified in respect of the
+ * value_type qualification. Simple reinterpret_cast is enough.
+ */
+template <class _StorageT, class _ValueT>
+struct _CastTraits {
+ typedef _StorageT storage_type;
+ typedef _ValueT value_type;
+
+ static value_type * to_value_type_ptr(storage_type *__ptr)
+ { return __REINTERPRET_CAST(value_type*, __ptr); }
+ static value_type const* to_value_type_cptr(storage_type const*__ptr)
+ { return __REINTERPRET_CAST(value_type const*, __ptr); }
+ static value_type ** to_value_type_pptr(storage_type **__ptr)
+ { return __REINTERPRET_CAST(value_type **, __ptr); }
+ static value_type & to_value_type_ref(storage_type &__ref)
+ { return __REINTERPRET_CAST(value_type&, __ref); }
+ static value_type const& to_value_type_cref(storage_type const&__ref)
+ { return __REINTERPRET_CAST(value_type const&, __ref); }
+ // Reverse versions
+ static storage_type * to_storage_type_ptr(value_type *__ptr)
+ { return __REINTERPRET_CAST(storage_type*, __ptr); }
+ static storage_type const* to_storage_type_cptr(value_type const*__ptr)
+ { return __REINTERPRET_CAST(storage_type const*, __ptr); }
+ static storage_type ** to_storage_type_pptr(value_type **__ptr)
+ { return __REINTERPRET_CAST(storage_type **, __ptr); }
+ static storage_type const& to_storage_type_cref(value_type const&__ref)
+ { return __REINTERPRET_CAST(storage_type const&, __ref); }
+ template <class _Tp1>
+ static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref)
+ { return __ref; }
+};
+
+#endif
+
+//Wrapper functors:
+template <class _StorageT, class _ValueT, class _UnaryPredicate>
+struct _UnaryPredWrapper {
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+
+ _UnaryPredWrapper (_UnaryPredicate const& __pred) : _M_pred(__pred) {}
+
+ bool operator () (_StorageT const& __ref) const
+ { return _M_pred(cast_traits::to_value_type_cref(__ref)); }
+
+private:
+ _UnaryPredicate _M_pred;
+};
+
+template <class _StorageT, class _ValueT, class _BinaryPredicate>
+struct _BinaryPredWrapper {
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+
+ _BinaryPredWrapper () {}
+ _BinaryPredWrapper (_BinaryPredicate const& __pred) : _M_pred(__pred) {}
+
+ _BinaryPredicate get_pred() const { return _M_pred; }
+
+ bool operator () (_StorageT const& __fst, _StorageT const& __snd) const
+ { return _M_pred(cast_traits::to_value_type_cref(__fst), cast_traits::to_value_type_cref(__snd)); }
+
+ //Cast operator used to transparently access underlying predicate
+ //in set::key_comp() method
+ operator _BinaryPredicate() const
+ { return _M_pred; }
+
+private:
+ _BinaryPredicate _M_pred;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_POINTERS_SPEC_TOOLS_H */
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_SPECIALIZED_VECTOR_H
+#define _STLP_SPECIALIZED_VECTOR_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define VECTOR_IMPL _STLP_PTR_IMPL_NAME(vector)
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV _Vector_base<void*,allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV VECTOR_IMPL<void*, allocator<void*> >;
+#endif
+
+#if defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
+class vector
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector)
+ : public __stlport_class<vector<_Tp, _Alloc> >
+#endif
+{
+ /* In the vector implementation iterators are pointer which give a number
+ * of opportunities for optimization. To not break those optimizations
+ * iterators passed to template should not be wrapped for casting purpose.
+ * So vector implementation will always use a qualified void pointer type and
+ * won't use iterator wrapping.
+ */
+ typedef typename _STLP_PRIV _StorageType<_Tp>::_QualifiedType _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV VECTOR_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef vector<_Tp, _Alloc> _Self;
+
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ 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_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+ iterator begin() { return cast_traits::to_value_type_ptr(_M_impl.begin()); }
+ const_iterator begin() const { return cast_traits::to_value_type_cptr(_M_impl.begin()); }
+ iterator end() { return cast_traits::to_value_type_ptr(_M_impl.end()); }
+ const_iterator end() const { return cast_traits::to_value_type_cptr(_M_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+
+ size_type capacity() const { return _M_impl.capacity(); }
+ bool empty() const { return _M_impl.empty(); }
+
+ reference operator[](size_type __n) { return cast_traits::to_value_type_ref(_M_impl[__n]); }
+ const_reference operator[](size_type __n) const { return cast_traits::to_value_type_cref(_M_impl[__n]); }
+
+ reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); }
+ const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); }
+ reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); }
+ const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); }
+
+ reference at(size_type __n) { return cast_traits::to_value_type_ref(_M_impl.at(__n)); }
+ const_reference at(size_type __n) const { return cast_traits::to_value_type_cref(_M_impl.at(__n)); }
+
+ explicit vector(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ vector(size_type __n, const value_type& __val,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__val),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n)
+ : _M_impl(__n, allocator_type() ) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ vector(const _Self& __x)
+ : _M_impl(__x._M_impl) {}
+
+ explicit vector(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL )
+ : _M_impl(__first, __last,
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last)
+ : _M_impl(__first, __last) {}
+# endif
+
+#else
+ vector(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __x) { _M_impl = __x._M_impl; return *this; }
+
+ void reserve(size_type __n) {_M_impl.reserve(__n);}
+ void assign(size_type __n, const value_type& __val)
+ { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last)
+ { _M_impl.assign(__first, __last); }
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_back(const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { return cast_traits::to_value_type_ptr(_M_impl.insert(cast_traits::to_storage_type_ptr(__pos),
+ cast_traits::to_storage_type_cref(__x))); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_back() { _M_impl.push_back(); }
+ iterator insert(iterator __pos)
+ { return _M_impl.insert(cast_traits::to_storage_type_ptr(__pos)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last)
+ { _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __first, __last); }
+#else
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+ _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif
+
+ void insert (iterator __pos, size_type __n, const value_type& __x) {
+ _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __n, cast_traits::to_storage_type_cref(__x));
+ }
+
+ void pop_back() {_M_impl.pop_back();}
+ iterator erase(iterator __pos)
+ {return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__pos)));}
+ iterator erase(iterator __first, iterator __last) {
+ return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__first),
+ cast_traits::to_storage_type_ptr(__last)));
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear() { _M_impl.clear(); }
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (vector)
+# undef vector
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef VECTOR_IMPL
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_SPECIALIZED_VECTOR_H */
--- /dev/null
+/*
+ *
+ * Copyright (c) 2003
+ * François 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_TYPE_MANIPS_H
+#define _STLP_TYPE_MANIPS_H
+
+_STLP_BEGIN_NAMESPACE
+
+struct __true_type {};
+struct __false_type {};
+
+#if defined (_STLP_USE_NAMESPACES)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+using _STLP_STD::__true_type;
+using _STLP_STD::__false_type;
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+//bool to type
+template <int _Is>
+struct __bool2type
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct __bool2type<1> { typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct __bool2type<0> { typedef __false_type _Ret; };
+
+//type to bool
+template <class __bool_type>
+struct __type2bool { enum {_Ret = 1}; };
+
+_STLP_TEMPLATE_NULL
+struct __type2bool<__true_type> { enum {_Ret = 1}; };
+
+_STLP_TEMPLATE_NULL
+struct __type2bool<__false_type> { enum {_Ret = 0}; };
+
+//Negation
+template <class _BoolType>
+struct _Not { typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Not<__false_type> { typedef __true_type _Ret; };
+
+// logical and of 2 predicated
+template <class _P1, class _P2>
+struct _Land2 { typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Land2<__true_type, __true_type> { typedef __true_type _Ret; };
+
+// logical and of 3 predicated
+template <class _P1, class _P2, class _P3>
+struct _Land3 { typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Land3<__true_type, __true_type, __true_type> { typedef __true_type _Ret; };
+
+//logical or of 2 predicated
+template <class _P1, class _P2>
+struct _Lor2 { typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Lor2<__false_type, __false_type> { typedef __false_type _Ret; };
+
+// logical or of 3 predicated
+template <class _P1, class _P2, class _P3>
+struct _Lor3 { typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Lor3<__false_type, __false_type, __false_type> { typedef __false_type _Ret; };
+
+////////////////////////////////////////////////////////////////////////////////
+// class template __select
+// Selects one of two types based upon a boolean constant
+// Invocation: __select<_Cond, T, U>::Result
+// where:
+// flag is a compile-time boolean constant
+// T and U are types
+// Result evaluates to T if flag is true, and to U otherwise.
+////////////////////////////////////////////////////////////////////////////////
+// BEWARE: If the compiler do not support partial template specialization or nested template
+//classes the default behavior of the __select is to consider the condition as false and so return
+//the second template type!!
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <bool _Cond, class _Tp1, class _Tp2>
+struct __select { typedef _Tp1 _Ret; };
+
+template <class _Tp1, class _Tp2>
+struct __select<false, _Tp1, _Tp2> { typedef _Tp2 _Ret; };
+
+# if defined (__BORLANDC__)
+template <class _CondT, class _Tp1, class _Tp2>
+struct __selectT { typedef _Tp1 _Ret; };
+
+template <class _Tp1, class _Tp2>
+struct __selectT<__false_type, _Tp1, _Tp2> { typedef _Tp2 _Ret; };
+# endif
+
+#else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+template <int _Cond>
+struct __select_aux {
+ template <class _Tp1, class _Tp2>
+ struct _In {
+ typedef _Tp1 _Ret;
+ };
+};
+
+_STLP_TEMPLATE_NULL
+struct __select_aux<0> {
+ template <class _Tp1, class _Tp2>
+ struct _In {
+ typedef _Tp2 _Ret;
+ };
+};
+
+template <int _Cond, class _Tp1, class _Tp2>
+struct __select {
+ typedef typename __select_aux<_Cond>::_STLP_TEMPLATE _In<_Tp1, _Tp2>::_Ret _Ret;
+};
+# else /* _STLP_MEMBER_TEMPLATE_CLASSES */
+//default behavior
+template <int _Cond, class _Tp1, class _Tp2>
+struct __select {
+ typedef _Tp2 _Ret;
+};
+# endif /* _STLP_MEMBER_TEMPLATE_CLASSES */
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+// Boris : simulation technique is used here according to Adobe Open Source License Version 1.0.
+// Copyright 2000 Adobe Systems Incorporated and others. All rights reserved.
+// Authors: Mat Marcus and Jesse Jones
+// The original version of this source code may be found at
+// http://opensource.adobe.com.
+
+// These are the discriminating functions
+template <class _Tp>
+char _STLP_CALL _IsSameFun(bool, _Tp const volatile*, _Tp const volatile*); // no implementation is required
+char* _STLP_CALL _IsSameFun(bool, ...); // no implementation is required
+
+template <class _Tp1, class _Tp2>
+struct _IsSame {
+ static _Tp1* __null_rep1();
+ static _Tp2* __null_rep2();
+ enum { _Ret = (sizeof(_IsSameFun(false,__null_rep1(), __null_rep2())) == sizeof(char)) };
+ typedef typename __bool2type<_Ret>::_Ret _RetT;
+};
+
+#else
+
+template <class _Tp1, class _Tp2>
+struct _IsSameAux {
+ typedef __false_type _RetT;
+ enum { _Ret = 0 };
+};
+
+template <class _Tp>
+struct _UnConstType { typedef _Tp _Type; };
+
+template <class _Tp>
+struct _UnVolatileType { typedef _Tp _Type; };
+
+template <class _Tp>
+struct _UnCVType {
+ typedef typename _UnVolatileType<_Tp>::_Type _UnVType;
+ typedef typename _UnConstType<_UnVType>::_Type _Type;
+};
+
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct _IsSameAux<_Tp, _Tp> {
+ typedef __true_type _RetT;
+ enum { _Ret = 1 };
+};
+
+# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
+template <class _Tp>
+struct _UnConstType<const _Tp> { typedef _Tp _Type; };
+
+template <class _Tp>
+struct _UnVolatileType<volatile _Tp> { typedef _Tp _Type; };
+# endif
+
+# if defined(__BORLANDC__)
+template<class _Tp>
+struct _UnConstPtr { typedef _Tp _Type; };
+
+template<class _Tp>
+struct _UnConstPtr<_Tp*> { typedef _Tp _Type; };
+
+template<class _Tp>
+struct _UnConstPtr<const _Tp*> { typedef _Tp _Type; };
+# endif
+# endif
+
+template <class _Tp1, class _Tp2>
+struct _IsSame {
+ typedef typename _UnCVType<_Tp1>::_Type _Type1;
+ typedef typename _UnCVType<_Tp2>::_Type _Type2;
+
+ typedef _IsSameAux<_Type1, _Type2> _Aux;
+ enum { _Ret = _Aux::_Ret };
+ typedef typename _Aux::_RetT _RetT;
+};
+#endif
+
+/*
+ * The following struct will tell you if 2 types are the same, the limitations are:
+ * - it compares the types without the const or volatile qualifiers, int and const int
+ * will be considered as same for instance.
+ * - the previous remarks do not apply to pointer types, int* and int const* won't be
+ * considered as comparable. (int * and int *const are).
+ */
+template <class _Tp1, class _Tp2>
+struct _AreSameUnCVTypes {
+ enum { _Same = _IsSame<_Tp1, _Tp2>::_Ret };
+ typedef typename _IsSame<_Tp1, _Tp2>::_RetT _Ret;
+};
+
+/* Rather than introducing a new macro for the following constrution we use
+ * an existing one (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) that
+ * is used for a similar feature.
+ */
+#if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+template <class _Src, class _Dst>
+struct _ConversionHelper {
+ static char _Test(bool, _Dst);
+ static char* _Test(bool, ...);
+ static _Src _MakeSource();
+};
+
+template <class _Src, class _Dst>
+struct _IsConvertible {
+ typedef _ConversionHelper<_Src*, const volatile _Dst*> _H;
+ enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) };
+ typedef typename __bool2type<value>::_Ret _Ret;
+};
+
+/* This struct is intended to say if a pointer can be convertible to an other
+ * taking into account cv qualifications. It shouldn't be instanciated with
+ * something else than pointer type as it uses pass by value parameter that
+ * results in compilation error when parameter type has a special memory
+ * alignment
+ */
+template <class _Src, class _Dst>
+struct _IsCVConvertible {
+#if !defined (__BORLANDC__)
+ typedef _ConversionHelper<_Src, _Dst> _H;
+ enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) };
+#else
+ enum { _Is1 = __type2bool<_IsConst<_Src>::_Ret>::_Ret };
+ enum { _Is2 = _IsConvertible<_UnConstPtr<_Src>::_Type, _UnConstPtr<_Dst>::_Type>::value };
+ enum { value = _Is1 ? 0 : _Is2 };
+#endif
+ typedef typename __bool2type<value>::_Ret _Ret;
+};
+
+#else
+template <class _Src, class _Dst>
+struct _IsConvertible {
+ enum {value = 0};
+ typedef __false_type _Ret;
+};
+#endif
+
+template <class _Tp>
+struct _IsConst { typedef __false_type _Ret; };
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
+template <class _Tp>
+struct _IsConst <const _Tp> { typedef __true_type _Ret; };
+#endif
+
+# if defined(__BORLANDC__)
+template<class _Tp>
+struct _IsConst <const _Tp*> { typedef __true_type _Ret; };
+
+template<class _Tp>
+struct _IsConst <const volatile _Tp*> { typedef __true_type _Ret; };
+# endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_TYPE_MANIPS_H */
--- /dev/null
+/*
+ *
+ * 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_TYPE_TRAITS_H
+#define _STLP_TYPE_TRAITS_H
+
+/*
+This header file provides a framework for allowing compile time dispatch
+based on type attributes. This is useful when writing template code.
+For example, when making a copy of an array of an unknown type, it helps
+to know if the type has a trivial copy constructor or not, to help decide
+if a memcpy can be used.
+
+The class template __type_traits provides a series of typedefs each of
+which is either __true_type or __false_type. The argument to
+__type_traits can be any type. The typedefs within this template will
+attain their correct values by one of these means:
+ 1. The general instantiation contain conservative values which work
+ for all types.
+ 2. Specializations may be declared to make distinctions between types.
+ 3. Some compilers (such as the Silicon Graphics N32 and N64 compilers)
+ will automatically provide the appropriate specializations for all
+ types.
+
+EXAMPLE:
+
+//Copy an array of elements which have non-trivial copy constructors
+template <class T> void copy(T* source, T* destination, int n, __false_type);
+//Copy an array of elements which have trivial copy constructors. Use memcpy.
+template <class T> void copy(T* source, T* destination, int n, __true_type);
+
+//Copy an array of any type by using the most efficient copy mechanism
+template <class T> inline void copy(T* source,T* destination,int n) {
+ copy(source, destination, n,
+ typename __type_traits<T>::has_trivial_copy_constructor());
+}
+*/
+
+#ifdef __WATCOMC__
+# include <stl/_cwchar.h>
+#endif
+
+#ifndef _STLP_TYPE_MANIPS_H
+# include <stl/type_manips.h>
+#endif
+
+#ifdef _STLP_USE_BOOST_SUPPORT
+# include <stl/boost_type_traits.h>
+# include <boost/type_traits/add_reference.hpp>
+# include <boost/type_traits/add_const.hpp>
+#endif /* _STLP_USE_BOOST_SUPPORT */
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_USE_BOOST_SUPPORT)
+
+// The following could be written in terms of numeric_limits.
+// We're doing it separately to reduce the number of dependencies.
+
+template <class _Tp> struct _IsIntegral
+{ typedef __false_type _Ret; };
+
+# ifndef _STLP_NO_BOOL
+_STLP_TEMPLATE_NULL struct _IsIntegral<bool>
+{ typedef __true_type _Ret; };
+# endif /* _STLP_NO_BOOL */
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<char>
+{ typedef __true_type _Ret; };
+
+# ifndef _STLP_NO_SIGNED_BUILTINS
+_STLP_TEMPLATE_NULL struct _IsIntegral<signed char>
+{ typedef __true_type _Ret; };
+# endif
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned char>
+{ typedef __true_type _Ret; };
+
+# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
+_STLP_TEMPLATE_NULL struct _IsIntegral<wchar_t>
+{ typedef __true_type _Ret; };
+# endif /* _STLP_HAS_WCHAR_T */
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<short>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned short>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<int>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned int>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<long>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned long>
+{ typedef __true_type _Ret; };
+
+# ifdef _STLP_LONG_LONG
+_STLP_TEMPLATE_NULL struct _IsIntegral<_STLP_LONG_LONG>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned _STLP_LONG_LONG>
+{ typedef __true_type _Ret; };
+# endif /* _STLP_LONG_LONG */
+
+template <class _Tp> struct _IsRational
+{ typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsRational<float>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsRational<double>
+{ typedef __true_type _Ret; };
+
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+_STLP_TEMPLATE_NULL struct _IsRational<long double>
+{ typedef __true_type _Ret; };
+# endif
+
+// Forward declarations.
+template <class _Tp> struct __type_traits;
+template <class _IsPOD> struct __type_traits_aux {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __false_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __false_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_TEMPLATE_NULL
+struct __type_traits_aux<__false_type> {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __false_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __false_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_TEMPLATE_NULL
+struct __type_traits_aux<__true_type> {
+ typedef __true_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 __true_type is_POD_type;
+};
+
+template <class _Tp>
+struct _IsRef {
+ typedef __false_type _Ret;
+};
+
+# if defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+/*
+ * Boris : simulation technique is used here according to Adobe Open Source License Version 1.0.
+ * Copyright 2000 Adobe Systems Incorporated and others. All rights reserved.
+ * Authors: Mat Marcus and Jesse Jones
+ * The original version of this source code may be found at
+ * http://opensource.adobe.com.
+ */
+
+struct _PointerShim {
+ /*
+ * Since the compiler only allows at most one non-trivial
+ * implicit conversion we can make use of a shim class to
+ * be sure that IsPtr below doesn't accept classes with
+ * implicit pointer conversion operators
+ */
+ _PointerShim(const volatile void*); // no implementation
+};
+
+// These are the discriminating functions
+char _STLP_CALL _IsP(bool, _PointerShim); // no implementation is required
+char* _STLP_CALL _IsP(bool, ...); // no implementation is required
+
+template <class _Tp>
+struct _IsPtr {
+ /*
+ * This template meta function takes a type T
+ * and returns true exactly when T is a pointer.
+ * One can imagine meta-functions discriminating on
+ * other criteria.
+ */
+ static _Tp& __null_rep();
+ enum { _Ptr = (sizeof(_IsP(false,__null_rep())) == sizeof(char)) };
+ typedef typename __bool2type<_Ptr>::_Ret _Ret;
+
+};
+
+// we make general case dependant on the fact the type is actually a pointer.
+template <class _Tp>
+struct __type_traits : __type_traits_aux<typename _IsPtr<_Tp>::_Ret> {};
+
+# else /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */
+
+template <class _Tp> struct _IsPtr {
+ typedef __false_type _Ret;
+};
+
+template <class _Tp>
+struct __type_traits {
+ typedef __true_type this_dummy_member_must_be_first;
+ /* Do not remove this member. It informs a compiler which
+ automatically specializes __type_traits that this
+ __type_traits template is special. It just makes sure that
+ things work if an implementation is using a template
+ called __type_traits for something unrelated. */
+
+ /* The following restrictions should be observed for the sake of
+ compilers which automatically produce type specific specializations
+ of this class:
+ - You may reorder the members below if you wish
+ - You may remove any of the members below if you wish
+ - You must not rename members without making the corresponding
+ name change in the compiler
+ - Members you add will be treated like regular members unless
+
+ you add the appropriate support in the compiler. */
+# if !defined (_STLP_HAS_TYPE_TRAITS_INTRINSICS)
+ typedef __false_type has_trivial_default_constructor;
+ typedef __false_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __false_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+# else
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_CONSTRUCTOR(_Tp)>::_Ret has_trivial_default_constructor;
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_COPY(_Tp)>::_Ret has_trivial_copy_constructor;
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_ASSIGN(_Tp)>::_Ret has_trivial_assignment_operator;
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_DESTRUCTOR(_Tp)>::_Ret has_trivial_destructor;
+ typedef typename __bool2type<_STLP_IS_POD(_Tp)>::_Ret is_POD_type;
+# endif
+};
+
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp> struct _IsPtr<_Tp*>
+{ typedef __true_type _Ret; };
+template <class _Tp> struct _IsRef<_Tp&>
+{ typedef __true_type _Ret; };
+
+template <class _Tp> struct __type_traits<_Tp*> : __type_traits_aux<__true_type>
+{};
+# endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+# endif /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */
+
+// Provide some specializations. This is harmless for compilers that
+// have built-in __types_traits support, and essential for compilers
+// that don't.
+# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
+# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \
+_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {}; \
+_STLP_TEMPLATE_NULL struct __type_traits< const Type > : __type_traits_aux<__true_type> {}; \
+_STLP_TEMPLATE_NULL struct __type_traits< volatile Type > : __type_traits_aux<__true_type> {}; \
+_STLP_TEMPLATE_NULL struct __type_traits< const volatile Type > : __type_traits_aux<__true_type> {}
+# else
+# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \
+_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {};
+# endif
+
+# ifndef _STLP_NO_BOOL
+_STLP_DEFINE_TYPE_TRAITS_FOR(bool);
+# endif /* _STLP_NO_BOOL */
+_STLP_DEFINE_TYPE_TRAITS_FOR(char);
+# ifndef _STLP_NO_SIGNED_BUILTINS
+_STLP_DEFINE_TYPE_TRAITS_FOR(signed char);
+# endif
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned char);
+# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
+_STLP_DEFINE_TYPE_TRAITS_FOR(wchar_t);
+# endif /* _STLP_HAS_WCHAR_T */
+
+_STLP_DEFINE_TYPE_TRAITS_FOR(short);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned short);
+_STLP_DEFINE_TYPE_TRAITS_FOR(int);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned int);
+_STLP_DEFINE_TYPE_TRAITS_FOR(long);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned long);
+
+# ifdef _STLP_LONG_LONG
+_STLP_DEFINE_TYPE_TRAITS_FOR(_STLP_LONG_LONG);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned _STLP_LONG_LONG);
+# endif /* _STLP_LONG_LONG */
+
+_STLP_DEFINE_TYPE_TRAITS_FOR(float);
+_STLP_DEFINE_TYPE_TRAITS_FOR(double);
+
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+_STLP_DEFINE_TYPE_TRAITS_FOR(long double);
+# endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _ArePtrs, class _Src, class _Dst>
+struct _IsCVConvertibleIf
+{ typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; };
+
+template <class _Src, class _Dst>
+struct _IsCVConvertibleIf<__false_type, _Src, _Dst>
+{ typedef __false_type _Ret; };
+#else
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+template <class _ArePtrs>
+struct _IsCVConvertibleIfAux {
+ template <class _Src, class _Dst>
+ struct _In
+ { typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; };
+};
+
+_STLP_TEMPLATE_NULL
+struct _IsCVConvertibleIfAux<__false_type> {
+ template <class _Src, class _Dst>
+ struct _In
+ { typedef __false_type _Ret; };
+};
+
+template <class _ArePtrs, class _Src, class _Dst>
+struct _IsCVConvertibleIf {
+ typedef typename _IsCVConvertibleIfAux<_ArePtrs>::_STLP_TEMPLATE _In<_Src, _Dst>::_Ret _Ret;
+};
+# else
+/* default behavior: we prefer to miss an optimization rather than taking the risk of
+ * a compilation error if playing with types with exotic memory alignment.
+ */
+template <class _ArePtrs, class _Src, class _Dst>
+struct _IsCVConvertibleIf
+{ typedef __false_type _Ret; };
+# endif
+#endif
+
+template <class _Src, class _Dst>
+struct _TrivialNativeTypeCopy {
+ typedef typename _IsPtr<_Src>::_Ret _Ptr1;
+ typedef typename _IsPtr<_Dst>::_Ret _Ptr2;
+ typedef typename _Land2<_Ptr1, _Ptr2>::_Ret _BothPtrs;
+ typedef typename _IsCVConvertibleIf<_BothPtrs, _Src, _Dst>::_Ret _Convertible;
+ typedef typename _Land2<_BothPtrs, _Convertible>::_Ret _Trivial1;
+
+ typedef typename __bool2type<(sizeof(_Src) == sizeof(_Dst))>::_Ret _SameSize;
+
+ typedef typename _IsIntegral<_Src>::_Ret _Int1;
+ typedef typename _IsIntegral<_Dst>::_Ret _Int2;
+ typedef typename _Land2<_Int1, _Int2>::_Ret _BothInts;
+
+ typedef typename _IsRational<_Src>::_Ret _Rat1;
+ typedef typename _IsRational<_Dst>::_Ret _Rat2;
+ typedef typename _Land2<_Rat1, _Rat2>::_Ret _BothRats;
+
+ typedef typename _Lor2<_BothInts, _BothRats>::_Ret _BothNatives;
+ typedef typename _Land2<_BothNatives, _SameSize>::_Ret _Trivial2;
+
+ typedef typename _Lor2<_Trivial1, _Trivial2>::_Ret _Ret;
+};
+
+template <class _Src, class _Dst>
+struct _TrivialCopy {
+ typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet;
+
+#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
+ typedef typename __type_traits<_Src>::has_trivial_assignment_operator _Tr1;
+#else
+ typedef typename _UnConstPtr<_Src*>::_Type _Tp3;
+ typedef typename __type_traits<_Tp3>::has_trivial_assignment_operator _Tr1;
+#endif
+ typedef typename _AreSameUnCVTypes<_Src, _Dst>::_Ret _Tr2;
+ typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet;
+
+ typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Src, class _Dst>
+struct _TrivialUCopy {
+ typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet;
+
+#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
+ typedef typename __type_traits<_Src>::has_trivial_copy_constructor _Tr1;
+#else
+ typedef typename _UnConstPtr<_Src*>::_Type _Tp3;
+ typedef typename __type_traits<_Tp3>::has_trivial_copy_constructor _Tr1;
+#endif
+ typedef typename _AreSameUnCVTypes<_Src, _Dst>::_Ret _Tr2;
+ typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet;
+
+ typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Tp>
+struct _DefaultZeroValue {
+ typedef typename _IsIntegral<_Tp>::_Ret _Tr1;
+ typedef typename _IsRational<_Tp>::_Ret _Tr2;
+ typedef typename _IsPtr<_Tp>::_Ret _Tr3;
+ typedef typename _Lor3<_Tr1, _Tr2, _Tr3>::_Ret _Ret;
+};
+
+template <class _Tp>
+struct _TrivialInit {
+#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Tr1;
+#else
+ typedef typename _UnConstPtr<_Tp*>::_Type _Tp1;
+ typedef typename __type_traits<_Tp1>::has_trivial_copy_constructor _Tr1;
+#endif
+ typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2;
+ typedef typename _Not<_Tr2>::_Ret _Tr3;
+ typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+#endif /* !_STLP_USE_BOOST_SUPPORT */
+
+template <class _Tp>
+struct _IsPtrType {
+ typedef typename _IsPtr<_Tp>::_Ret _Type;
+ static _Type _Ret() { return _Type(); }
+};
+
+template <class _Tp>
+struct _IsRefType {
+ typedef typename _IsRef<_Tp>::_Ret _Type;
+ static _Type _Ret() { return _Type();}
+};
+
+template <class _Tp>
+struct __call_traits {
+#if defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS)
+ typedef typename __select< ::boost::is_reference<_Tp>::value,
+ _Tp, typename ::boost::add_reference< typename ::boost::add_const<_Tp>::type >::type>::_Ret param_type;
+#else
+ typedef const _Tp& param_type;
+#endif /* _STLP_USE_BOOST_SUPPORT */
+};
+
+#if !defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __call_traits<_Tp&>
+{ typedef _Tp& param_type; };
+#endif
+
+template <class _Tp1, class _Tp2>
+struct _BothPtrType {
+ typedef typename _IsPtr<_Tp1>::_Ret _IsPtr1;
+ typedef typename _IsPtr<_Tp2>::_Ret _IsPtr2;
+
+ typedef typename _Land2<_IsPtr1, _IsPtr2>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Tp1, class _Tp2, class _IsRef1, class _IsRef2>
+struct _OKToSwap {
+ typedef typename _AreSameUnCVTypes<_Tp1, _Tp2>::_Ret _Same;
+ typedef typename _Land3<_Same, _IsRef1, _IsRef2>::_Ret _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp1, class _Tp2, class _IsRef1, class _IsRef2>
+inline _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2>
+_IsOKToSwap(_Tp1*, _Tp2*, const _IsRef1&, const _IsRef2&)
+{ return _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2>(); }
+
+template <class _Src, class _Dst>
+inline _TrivialCopy<_Src, _Dst> _UseTrivialCopy(_Src*, _Dst*)
+{ return _TrivialCopy<_Src, _Dst>(); }
+
+template <class _Src, class _Dst>
+inline _TrivialUCopy<_Src, _Dst> _UseTrivialUCopy(_Src*, _Dst*)
+{ return _TrivialUCopy<_Src, _Dst>(); }
+
+template <class _Tp>
+inline _TrivialInit<_Tp> _UseTrivialInit(_Tp*)
+{ return _TrivialInit<_Tp>(); }
+
+template <class _Tp>
+struct _IsPOD {
+ typedef typename __type_traits<_Tp>::is_POD_type _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp>
+inline _IsPOD<_Tp> _Is_POD(_Tp*)
+{ return _IsPOD<_Tp>(); }
+
+template <class _Tp>
+struct _DefaultZeroValueQuestion {
+ typedef typename _DefaultZeroValue<_Tp>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Tp>
+inline _DefaultZeroValueQuestion<_Tp> _HasDefaultZeroValue(_Tp*)
+{ return _DefaultZeroValueQuestion<_Tp>(); }
+
+/*
+ * Base class used:
+ * - to simulate partial template specialization
+ * - to simulate partial function ordering
+ * - to recognize STLport class from user specialized one
+ */
+template <class _Tp>
+struct __stlport_class
+{ typedef _Tp _Type; };
+
+template <class _Tp>
+struct _IsSTLportClass {
+ typedef typename _IsConvertible<_Tp, __stlport_class<_Tp> >::_Ret _Ret;
+#if defined (__BORLANDC__)
+ enum { _Is = _IsConvertible<_Tp, __stlport_class<_Tp> >::value };
+#endif
+};
+
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _Tp>
+struct _SwapImplemented {
+ typedef typename _IsSTLportClass<_Tp>::_Ret _Ret;
+# if defined (__BORLANDC__)
+ enum { _Is = _IsSTLportClass<_Tp>::_Is };
+# endif
+};
+#endif
+
+template <class _Tp>
+class _TpWithState : private _Tp {
+ _TpWithState();
+ int _state;
+};
+
+/* This is an internal helper struct used to guess if we are working
+ * on a stateless class. It can only be instanciated with a class type. */
+template <class _Tp>
+struct _IsStateless {
+ enum { _Is = sizeof(_TpWithState<_Tp>) == sizeof(int) };
+ typedef typename __bool2type<_Is>::_Ret _Ret;
+};
+
+_STLP_END_NAMESPACE
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+# if defined (__BORLANDC__) || \
+ defined (__SUNPRO_CC) || \
+ (defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || \
+ (defined (__sgi) && defined (_COMPILER_VERSION)) || \
+ defined (__DMC__)
+# define _STLP_IS_POD_ITER(_It, _Tp) __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type()
+# else
+# define _STLP_IS_POD_ITER(_It, _Tp) typename __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type()
+# endif
+#else
+# define _STLP_IS_POD_ITER(_It, _Tp) _Is_POD( _STLP_VALUE_TYPE( _It, _Tp ) )._Answer()
+#endif
+
+#endif /* _STLP_TYPE_TRAITS_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_STREAMBUF
+#define _STLP_STREAMBUF
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1066
+# include <stl/_prolog.h>
+# endif
+
+# ifdef _STLP_PRAGMA_ONCE
+# pragma once
+# endif
+
+# include <stl/_ioserr.h>
+# include <stl/_streambuf.h>
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x1066)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+#endif /* _STLP_STREAMBUF */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 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_STREAMBUF_H
+#define _STLP_STREAMBUF_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2067
+# include <stl/_prolog.h>
+#endif
+
+#include <stl/_ioserr.h>
+
+#include <streambuf>
+
+#include <ios.h>
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+_STLP_USING_NAMESPACE(stlport)
+# else
+using _STLP_STD::basic_streambuf;
+using _STLP_STD::streambuf;
+# ifndef _STLP_NO_WCHAR_T
+using _STLP_STD::wstreambuf;
+# endif
+# endif
+#endif /* _STLP_HAS_NO_NAMESPACES */
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2067)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STREAMBUF_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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
+# define _STLP_STRING
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x68
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#if defined (_STLP_USE_OWN_NAMESPACE)
+# include <stl/_string.h>
+#endif
+
+#include <stl/_string_hash.h>
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+# include <stl/_string_io.h>
+#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:
+
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include string.h, which results in warnings and errors
+ */
+#ifndef _STLP_STRING_H
+
+#if !defined (RC_INVOKED)
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x269
+# include <stl/_prolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x269) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_STRING_H
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+# if (_STLP_OUTERMOST_HEADER_ID != 0x269) || defined (_STLP_DONT_POP_HEADER_ID)
+# include _STLP_NATIVE_C_HEADER(string.h)
+# else
+# if defined (__BORLANDC__)
+# include _STLP_NATIVE_CPP_C_HEADER(_str.h)
+# else
+# include _STLP_NATIVE_C_HEADER(string.h)
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x269)
+# if defined (__BORLANDC__) && defined (_STLP_IMPORT_VENDOR_CSTD)
+# include <using/cstring>
+# endif /* BORLAND */
+# endif
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x269)
+# 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 /* RC_INVOKED */
+#endif /* _STLP_STRING_H */
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+// WARNING: The classes defined in this header are DEPRECATED. This
+// header is defined in section D.7.1 of the C++ standard, and it
+// MAY BE REMOVED in a future standard revision. You should use the
+// header <sstream> instead.
+
+
+#ifndef _STLP_STRSTREAM
+#define _STLP_STRSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1070
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_ioserr.h>
+
+#ifndef _STLP_INTERNAL_STRSTREAM
+# include <stl/_strstream.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1070)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STRSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_STRSTREAM_H
+# define _STLP_STRSTREAM_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2071
+# include <stl/_prolog.h>
+#endif
+
+#include <strstream>
+
+#include <iostream.h>
+
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+
+using namespace _STLP_STD;
+
+# else
+
+using _STLP_STD::strstreambuf;
+using _STLP_STD::istrstream;
+using _STLP_STD::ostrstream;
+using _STLP_STD::strstream;
+
+# endif /* _STLP_BROKEN_USING_DIRECTIVE */
+
+#endif /* _STLP_HAS_NO_NAMESPACES */
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2071)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STRSTREAM_H */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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 0x272
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x272) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#ifdef _STLP_WCE_EVC3
+// only show message when directly including this file in a non-library build
+# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x272)
+# pragma message("eMbedded Visual C++ 3 doesn't have a time.h header; STLport won't include native time.h here")
+# endif
+#else
+# include _STLP_NATIVE_C_HEADER(time.h)
+#endif
+
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x272)
+# 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
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */
--- /dev/null
+/*
+ * 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_TYPEINFO
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x473
+# define _STLP_TYPEINFO
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x473)
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo)
+#else
+# ifndef _STLP_INTERNAL_TYPEINFO
+# include <stl/_typeinfo.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x473)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * 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_OLDSTD_typeinfo
+#define _STLP_OLDSTD_typeinfo
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x874
+# include <stl/_prolog.h>
+#endif
+
+#ifndef _STLP_NO_TYPEINFO
+
+# if defined (__GNUC__)
+# undef _STLP_OLDSTD_typeinfo
+# include <typeinfo>
+# define _STLP_OLDSTD_typeinfo
+# else
+# if !defined (__BORLANDC__) || (__BORLANDC__ < 0x580)
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo.h)
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(typeinfo.h)
+# endif
+# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x580) || \
+ defined (__DMC__)
+using std::type_info;
+using std::bad_typeid;
+using std::bad_cast;
+# endif
+# endif
+
+// if <typeinfo> already included, do not import anything
+
+# if defined (_STLP_USE_OWN_NAMESPACE) && !(defined (_STLP_TYPEINFO) && !defined (_STLP_NO_NEW_NEW_HEADER))
+
+_STLP_BEGIN_NAMESPACE
+
+using /*_STLP_VENDOR_EXCEPT_STD */ :: type_info;
+# if !(defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)))
+using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_typeid;
+# endif
+
+using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_cast;
+
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_OWN_NAMESPACE */
+
+#endif /* _STLP_NO_TYPEINFO */
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x874)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_OLDSTD_typeinfo */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 2004,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.
+ *
+ */
+
+#ifndef _STLP_UNORDERED_MAP
+#define _STLP_UNORDERED_MAP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x4030
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_unordered_map.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x4030)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_UNORDERED_MAP */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ * Copyright (c) 2004,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.
+ *
+ */
+
+#ifndef _STLP_UNORDERED_SET
+#define _STLP_UNORDERED_SET
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x4031
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_unordered_set.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x4031)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_UNORDERED_SET */
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+using _STLP_VENDOR_CSTD::size_t;
+
+#if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if defined (__MSL__) && __MC68K__ && !_No_BlockMove && __dest_os == __mac_os
+# undef memcpy
+# undef memmove
+inline void* memcpy(void* dst, const void* src, size_t len)
+{ return _STLP_VENDOR_CSTD::__memcpy(dst, src, len); }
+inline void* memmove(void* dst, const void* src, size_t len)
+{ return _STLP_VENDOR_CSTD::__memmove(dst, src, len); }
+# else
+using _STLP_VENDOR_CSTD::memmove;
+using _STLP_VENDOR_CSTD::memcpy;
+# endif
+
+# if !defined (_STLP_WCE)
+// these functions just don't exist on Windows CE
+# if !defined (ANDROID)
+// and these functions just don't exist on Android
+using _STLP_VENDOR_CSTD::strcoll;
+using _STLP_VENDOR_CSTD::strxfrm;
+# endif
+using _STLP_VENDOR_CSTD::strerror;
+# endif
+
+# if defined (__BORLANDC__)
+extern "C++" {
+# endif
+using _STLP_VENDOR_CSTD::memchr;
+using _STLP_VENDOR_CSTD::strchr;
+using _STLP_VENDOR_CSTD::strpbrk;
+using _STLP_VENDOR_CSTD::strrchr;
+using _STLP_VENDOR_CSTD::strstr;
+# if defined (__BORLANDC__)
+}
+# endif
+
+using _STLP_VENDOR_CSTD::memcmp;
+using _STLP_VENDOR_CSTD::memset;
+
+using _STLP_VENDOR_CSTD::strcat;
+
+# if !defined (strcmp)
+using _STLP_VENDOR_CSTD::strcmp;
+# endif
+
+# if !defined (strcpy)
+using _STLP_VENDOR_CSTD::strcpy;
+# endif
+using _STLP_VENDOR_CSTD::strcspn;
+using _STLP_VENDOR_CSTD::strlen;
+using _STLP_VENDOR_CSTD::strncat;
+using _STLP_VENDOR_CSTD::strncmp;
+
+using _STLP_VENDOR_CSTD::strncpy;
+using _STLP_VENDOR_CSTD::strspn;
+
+using _STLP_VENDOR_CSTD::strtok;
+#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
--- /dev/null
+cstring
+fstream
+iomanip
+ios
+iosfwd
+iostream
+istream
+locale
+ostream
+sstream
+streambuf
+strstream
--- /dev/null
+#ifdef _STLP_BROKEN_USING_DIRECTIVE
+using namespace _STLP_STD;
+#else
+using _STLP_NEW_IO_NAMESPACE::basic_filebuf;
+using _STLP_NEW_IO_NAMESPACE::filebuf;
+using _STLP_NEW_IO_NAMESPACE::basic_ifstream;
+using _STLP_NEW_IO_NAMESPACE::basic_ofstream;
+using _STLP_NEW_IO_NAMESPACE::ifstream;
+using _STLP_NEW_IO_NAMESPACE::ofstream;
+using _STLP_NEW_IO_NAMESPACE::basic_fstream;
+using _STLP_NEW_IO_NAMESPACE::fstream;
+
+# ifndef _STLP_NO_WIDE_STREAMS
+using _STLP_NEW_IO_NAMESPACE::wofstream;
+using _STLP_NEW_IO_NAMESPACE::wfilebuf;
+using _STLP_NEW_IO_NAMESPACE::wifstream;
+using _STLP_NEW_IO_NAMESPACE::wfstream;
+# endif
+#endif
--- /dev/null
+using ::streambuf;
+using ::ifstream;
+using ::ofstream;
+using ::fstream;
--- /dev/null
+using ::setiosflags;
+using ::resetiosflags;
+// using ::setbase;
+using ::setfill;
+using ::setprecision;
+using ::setw;
--- /dev/null
+using _STLP_OLD_IO_NAMESPACE::istream;
+using _STLP_OLD_IO_NAMESPACE::ostream;
+
+/* HP aCC include files re-define these when THREAD_SAFE */
+#if !defined(cin)
+using _STLP_OLD_IO_NAMESPACE::cin;
+#endif
+#if !defined(cout)
+using _STLP_OLD_IO_NAMESPACE::cout;
+#endif
+#if !defined(cerr)
+using _STLP_OLD_IO_NAMESPACE::cerr;
+#endif
+#if !defined(clog)
+using _STLP_OLD_IO_NAMESPACE::clog;
+#endif
+
+using _STLP_OLD_IO_NAMESPACE::endl;
+using _STLP_OLD_IO_NAMESPACE::ends;
+
+using _STLP_OLD_IO_NAMESPACE::ios;
+using _STLP_OLD_IO_NAMESPACE::flush;
+
+// using _STLP_OLD_IO_NAMESPACE::ws;
--- /dev/null
+using _STLP_OLD_IO_NAMESPACE::ostream;
+using _STLP_OLD_IO_NAMESPACE::endl;
+using _STLP_OLD_IO_NAMESPACE::ends;
+using _STLP_OLD_IO_NAMESPACE::flush;
+
+// using _STLP_OLD_IO_NAMESPACE::ws;
--- /dev/null
+using ::streambuf;
--- /dev/null
+using _STLP_OLD_IO_NAMESPACE::strstreambuf;
+using _STLP_OLD_IO_NAMESPACE::istrstream;
+using _STLP_OLD_IO_NAMESPACE::ostrstream;
+using _STLP_OLD_IO_NAMESPACE::strstream;
--- /dev/null
+using _STLP_NEW_IO_NAMESPACE::setiosflags;
+using _STLP_NEW_IO_NAMESPACE::resetiosflags;
+using _STLP_NEW_IO_NAMESPACE::setbase;
+using _STLP_NEW_IO_NAMESPACE::setfill;
+using _STLP_NEW_IO_NAMESPACE::setprecision;
+using _STLP_NEW_IO_NAMESPACE::setw;
--- /dev/null
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+using namespace _STLP_NEW_IO_NAMESPACE;
+# else
+
+using _STLP_NEW_IO_NAMESPACE::ios;
+using _STLP_NEW_IO_NAMESPACE::streamoff;
+using _STLP_NEW_IO_NAMESPACE::streamsize;
+
+using _STLP_NEW_IO_NAMESPACE::ios_base;
+using _STLP_NEW_IO_NAMESPACE::basic_ios;
+
+// _lib.std.ios.manip_, manipulators:
+using _STLP_NEW_IO_NAMESPACE::boolalpha;
+using _STLP_NEW_IO_NAMESPACE::noboolalpha;
+using _STLP_NEW_IO_NAMESPACE::showbase;
+using _STLP_NEW_IO_NAMESPACE::noshowbase;
+using _STLP_NEW_IO_NAMESPACE::showpoint;
+using _STLP_NEW_IO_NAMESPACE::noshowpoint;
+using _STLP_NEW_IO_NAMESPACE::showpos;
+using _STLP_NEW_IO_NAMESPACE::noshowpos;
+using _STLP_NEW_IO_NAMESPACE::skipws;
+using _STLP_NEW_IO_NAMESPACE::noskipws;
+using _STLP_NEW_IO_NAMESPACE::uppercase;
+using _STLP_NEW_IO_NAMESPACE::nouppercase;
+
+// _lib.adjustfield.manip_ adjustfield:
+using _STLP_NEW_IO_NAMESPACE::internal;
+using _STLP_NEW_IO_NAMESPACE::left;
+using _STLP_NEW_IO_NAMESPACE::right;
+
+// _lib.basefield.manip_ basefield:
+using _STLP_NEW_IO_NAMESPACE::dec;
+using _STLP_NEW_IO_NAMESPACE::hex;
+using _STLP_NEW_IO_NAMESPACE::oct;
+
+// _lib.floatfield.manip_ floatfield:
+using _STLP_NEW_IO_NAMESPACE::fixed;
+using _STLP_NEW_IO_NAMESPACE::scientific;
+
+# endif /* _STLP_BROKEN_USING_DIRECTIVE */
+
--- /dev/null
+# if defined (_STLP_USE_NEW_IOSTREAMS)
+using _STLP_NEW_IO_NAMESPACE::char_traits;
+using _STLP_NEW_IO_NAMESPACE::basic_ios;
+using _STLP_NEW_IO_NAMESPACE::basic_streambuf;
+using _STLP_NEW_IO_NAMESPACE::basic_istream;
+using _STLP_NEW_IO_NAMESPACE::basic_ostream;
+using _STLP_NEW_IO_NAMESPACE::basic_iostream;
+using _STLP_NEW_IO_NAMESPACE::basic_stringbuf;
+using _STLP_NEW_IO_NAMESPACE::basic_istringstream;
+using _STLP_NEW_IO_NAMESPACE::basic_ostringstream;
+using _STLP_NEW_IO_NAMESPACE::basic_stringstream;
+using _STLP_NEW_IO_NAMESPACE::basic_filebuf;
+using _STLP_NEW_IO_NAMESPACE::basic_ifstream;
+using _STLP_NEW_IO_NAMESPACE::basic_ofstream;
+using _STLP_NEW_IO_NAMESPACE::basic_fstream;
+using _STLP_NEW_IO_NAMESPACE::fpos;
+using _STLP_NEW_IO_NAMESPACE::istreambuf_iterator;
+using _STLP_NEW_IO_NAMESPACE::ostreambuf_iterator;
+using _STLP_NEW_IO_NAMESPACE::stringbuf;
+using _STLP_NEW_IO_NAMESPACE::istringstream;
+using _STLP_NEW_IO_NAMESPACE::ostringstream;
+using _STLP_NEW_IO_NAMESPACE::stringstream;
+# endif
+
+using _STLP_NEW_IO_NAMESPACE::ios;
+using _STLP_NEW_IO_NAMESPACE::streambuf;
+using _STLP_NEW_IO_NAMESPACE::istream;
+using _STLP_NEW_IO_NAMESPACE::ostream;
+using _STLP_NEW_IO_NAMESPACE::iostream;
+
+using _STLP_NEW_IO_NAMESPACE::filebuf;
+using _STLP_NEW_IO_NAMESPACE::ifstream;
+using _STLP_NEW_IO_NAMESPACE::ofstream;
+using _STLP_NEW_IO_NAMESPACE::fstream;
+
+using _STLP_NEW_IO_NAMESPACE::streampos;
+using _STLP_NEW_IO_NAMESPACE::streamoff;
+
+# if !defined (_STLP_NO_WIDE_STREAMS)
+using _STLP_NEW_IO_NAMESPACE::wios;
+using _STLP_NEW_IO_NAMESPACE::wstreambuf;
+using _STLP_NEW_IO_NAMESPACE::wistream;
+using _STLP_NEW_IO_NAMESPACE::wostream;
+using _STLP_NEW_IO_NAMESPACE::wiostream;
+using _STLP_NEW_IO_NAMESPACE::wstringbuf;
+using _STLP_NEW_IO_NAMESPACE::wistringstream;
+using _STLP_NEW_IO_NAMESPACE::wostringstream;
+using _STLP_NEW_IO_NAMESPACE::wstringstream;
+using _STLP_NEW_IO_NAMESPACE::wfilebuf;
+using _STLP_NEW_IO_NAMESPACE::wifstream;
+using _STLP_NEW_IO_NAMESPACE::wofstream;
+using _STLP_NEW_IO_NAMESPACE::wfstream;
+using _STLP_NEW_IO_NAMESPACE::wstreampos;
+# endif
--- /dev/null
+
+# include <using/istream>
+
+using _STLP_VENDOR_STD::cin;
+using _STLP_VENDOR_STD::cout;
+using _STLP_VENDOR_STD::cerr;
+using _STLP_VENDOR_STD::clog;
+
+# if ! defined (_STLP_NO_WIDE_STREAMS)
+using _STLP_VENDOR_STD::wcin;
+using _STLP_VENDOR_STD::wcout;
+using _STLP_VENDOR_STD::wcerr;
+using _STLP_VENDOR_STD::wclog;
+# endif
--- /dev/null
+# include <using/ostream>
+
+using _STLP_NEW_IO_NAMESPACE::basic_istream;
+using _STLP_NEW_IO_NAMESPACE::basic_iostream;
+
+using _STLP_NEW_IO_NAMESPACE::istream;
+using _STLP_NEW_IO_NAMESPACE::iostream;
+
+# if !defined (_STLP_NO_NATIVE_WIDE_STREAMS)
+using _STLP_NEW_IO_NAMESPACE::wistream;
+using _STLP_NEW_IO_NAMESPACE::wiostream;
+# endif
+
+#if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200))
+using _STLP_NEW_IO_NAMESPACE::ws;
+#endif
--- /dev/null
+#if !defined(_STLP_NO_IMPORT_LOCALE)
+
+// from <cwchar>
+#if !defined (_STLP_NO_MBSTATE_T)
+using _STLP_VENDOR_MB_NAMESPACE::mbstate_t;
+#endif
+
+// _lib.locale_, locale:
+using _STLP_NEW_IO_NAMESPACE::locale;
+using _STLP_NEW_IO_NAMESPACE::use_facet;
+using _STLP_NEW_IO_NAMESPACE::has_facet;
+
+// _lib.locale.convenience_, convenience interfaces:
+using _STLP_NEW_IO_NAMESPACE::isspace;
+using _STLP_NEW_IO_NAMESPACE::isprint;
+using _STLP_NEW_IO_NAMESPACE::iscntrl;
+using _STLP_NEW_IO_NAMESPACE::isupper;
+using _STLP_NEW_IO_NAMESPACE::islower;
+using _STLP_NEW_IO_NAMESPACE::isalpha;
+using _STLP_NEW_IO_NAMESPACE::isdigit;
+using _STLP_NEW_IO_NAMESPACE::ispunct;
+using _STLP_NEW_IO_NAMESPACE::isxdigit;
+using _STLP_NEW_IO_NAMESPACE::isalnum;
+using _STLP_NEW_IO_NAMESPACE::isgraph;
+using _STLP_NEW_IO_NAMESPACE::toupper;
+using _STLP_NEW_IO_NAMESPACE::tolower;
+
+// _lib.category.ctype_ and _lib.facet.ctype.special_, ctype:
+using _STLP_NEW_IO_NAMESPACE::ctype_base;
+using _STLP_NEW_IO_NAMESPACE::ctype;
+using _STLP_NEW_IO_NAMESPACE::ctype_byname;
+using _STLP_NEW_IO_NAMESPACE::codecvt_base;
+using _STLP_NEW_IO_NAMESPACE::codecvt;
+using _STLP_NEW_IO_NAMESPACE::codecvt_byname;
+
+// _lib.category.numeric_ and _lib.facet.numpunct_, numeric:
+using _STLP_NEW_IO_NAMESPACE::num_get;
+using _STLP_NEW_IO_NAMESPACE::num_put;
+using _STLP_NEW_IO_NAMESPACE::numpunct;
+using _STLP_NEW_IO_NAMESPACE::numpunct_byname;
+
+// _lib.category.collate_, collation:
+using _STLP_NEW_IO_NAMESPACE::collate;
+using _STLP_NEW_IO_NAMESPACE::collate_byname;
+
+// _lib.category.time_, date and time:
+using _STLP_NEW_IO_NAMESPACE::time_base;
+using _STLP_NEW_IO_NAMESPACE::time_get;
+using _STLP_NEW_IO_NAMESPACE::time_get_byname;
+using _STLP_NEW_IO_NAMESPACE::time_put;
+using _STLP_NEW_IO_NAMESPACE::time_put_byname;
+
+// _lib.category.monetary_, money:
+using _STLP_NEW_IO_NAMESPACE::money_base;
+using _STLP_NEW_IO_NAMESPACE::money_get;
+using _STLP_NEW_IO_NAMESPACE::money_put;
+using _STLP_NEW_IO_NAMESPACE::moneypunct;
+using _STLP_NEW_IO_NAMESPACE::moneypunct_byname;
+
+#if !defined (_STLP_OWN_IOSTREAMS) && !defined (_STLP_NO_NATIVE_MESSAGE_FACET)
+using _STLP_NEW_IO_NAMESPACE::messages_base;
+using _STLP_NEW_IO_NAMESPACE::messages;
+using _STLP_NEW_IO_NAMESPACE::messages_byname;
+#endif // _MSL_NO_MESSAGE_FACET
+#endif /* !defined(_STLP_NO_IMPORT_LOCALE) */
--- /dev/null
+using _STLP_NEW_IO_NAMESPACE::basic_ostream;
+using _STLP_NEW_IO_NAMESPACE::ostream;
+
+# ifndef _STLP_NO_WIDE_STREAMS
+using _STLP_NEW_IO_NAMESPACE::wostream;
+# endif
+
+using _STLP_NEW_IO_NAMESPACE::endl;
+using _STLP_NEW_IO_NAMESPACE::ends;
+using _STLP_NEW_IO_NAMESPACE::flush;
--- /dev/null
+using _STLP_NEW_IO_NAMESPACE::basic_stringbuf;
+using _STLP_NEW_IO_NAMESPACE::stringbuf;
+
+using _STLP_NEW_IO_NAMESPACE::basic_istringstream;
+using _STLP_NEW_IO_NAMESPACE::basic_ostringstream;
+using _STLP_NEW_IO_NAMESPACE::basic_stringstream;
+using _STLP_NEW_IO_NAMESPACE::istringstream;
+using _STLP_NEW_IO_NAMESPACE::ostringstream;
+using _STLP_NEW_IO_NAMESPACE::stringstream;
+
+#ifndef _STLP_NO_WIDE_STREAMS
+using _STLP_NEW_IO_NAMESPACE::wstringbuf;
+using _STLP_NEW_IO_NAMESPACE::wistringstream;
+using _STLP_NEW_IO_NAMESPACE::wostringstream;
+using _STLP_NEW_IO_NAMESPACE::wstringstream;
+#endif
--- /dev/null
+using _STLP_NEW_IO_NAMESPACE::basic_streambuf;
+using _STLP_NEW_IO_NAMESPACE::streambuf;
+#ifndef _STLP_NO_WIDE_STREAMS
+using _STLP_NEW_IO_NAMESPACE::wstreambuf;
+# endif
--- /dev/null
+using _STLP_NEW_IO_NAMESPACE::strstreambuf;
+using _STLP_NEW_IO_NAMESPACE::istrstream;
+using _STLP_NEW_IO_NAMESPACE::ostrstream;
+using _STLP_NEW_IO_NAMESPACE::strstream;
--- /dev/null
+/*
+ *
+ * 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
+#define _STLP_UTILITY
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x75
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifndef __TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+#if !defined (_STLP_DEBUG_H) && (defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS))
+# include <stl/debug/_debug.h>
+#endif
+
+#ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+# include _STLP_NATIVE_HEADER(utility)
+#else
+# if defined (_STLP_MSVC) && !defined (_STLP_INTERNAL_ITERATOR_H)
+# include <stl/_iterator.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x75)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_UTILITY */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * Copyright (c) 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_VALARRAY
+#define _STLP_VALARRAY
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x76
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_valarray.h>
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+# include _STLP_NATIVE_HEADER(valarray)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x76)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_VALARRAY */
+
+
+// Local Variables:
+// mode:C++
+// End:
--- /dev/null
+/*
+ *
+ * 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_VECTOR
+#define _STLP_VECTOR
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x77
+# include <stl/_prolog.h>
+# endif
+
+# ifdef _STLP_PRAGMA_ONCE
+# pragma once
+# endif
+
+# ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+# endif
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_STD) && ! defined (_STLP_MINIMUM_IMPORT_STD)
+# include _STLP_NATIVE_HEADER(vector)
+#endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x77)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+#endif /* _STLP_VECTOR */
+
+// Local Variables:
+// mode:C++
+// End:
+
--- /dev/null
+/*
+ * 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/_prolog.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__)
+/*
+# include <cstring>
+*/
+# include _STLP_NATIVE_CPP_C_HEADER(_str.h)
+# 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__)
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+# elif defined(__MWERKS__) && defined(N_PLAT_NLM)
+/*
+ * MSL library has wrong definition of wint_t (with -wchar_t on) in wchar_t.h header.
+ * IMHO the best way is to comment line
+ * typedef wchar_t wint_t;
+ * (I use this way).
+ *
+ * Another solution is to define _WINT_T (to avoid conflict with wint_t definitions in
+ * Novell SDK headers, _WCHAR_T defined in nlm_prefix.h). But you should define one
+ * before include any header from Novell's SDK, so this isn't too good choice.
+ *
+ * And third solution is don't use anyware (even here) wchar_t.h
+ *
+ * - ptr, 2003 and 2005-05-07
+ */
+/*
+#if __option(wchar_type)
+# define _WINT_T
+#endif
+*/
+# include _STLP_NATIVE_CPP_C_HEADER(wchar_t.h)
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+# include _STLP_NATIVE_C_HEADER(stdio.h)
+# include <unicode.h>
+int wcslen( const wchar_t *_wc );
+int wcscmp( const wchar_t *_wc1, const wchar_t *_wc2 );
+int wcsncmp( const wchar_t *_wc1, const wchar_t *_wc2, size_t n );
+wchar_t *wcsstr( const wchar_t *_wc1, const wchar_t *_wc2 );
+wchar_t *wcschr( const wchar_t *_wc1, wchar_t _wc2 );
+wchar_t *wcsrchr( const wchar_t *_wc1, wchar_t _wc2 );
+wchar_t *wcscpy( wchar_t *_wc1, const wchar_t *_wc2 );
+wchar_t *wcsncpy( wchar_t *_wc1, const wchar_t *_wc2, size_t n );
+wchar_t *wcspbrk( const wchar_t *_wc, const wchar_t *_wc2 );
+# else
+# include _STLP_NATIVE_C_HEADER(wchar.h)
+# 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
+
+/*
+ Local Variables:
+ mode:C++
+ End:
+*/
--- /dev/null
+/*
+ * 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 0x279
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x279) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 doesn't have wctype.h */
+#if !defined(_STLP_WCE_EVC3) && !defined(N_PLAT_NLM)
+# include _STLP_NATIVE_C_HEADER(wctype.h)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x279)
+# 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
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */