removed dependency on locally stored SGI STL header files

now compiler-supplied C++ library STL header files are used
compiles under GNU C++ 3
hash_map (an SGI extension to STL) replaced with map
std:: namespace prefix added to all STL class references
This commit is contained in:
darkeye 2001-09-05 20:11:16 +00:00
parent db79f2bbfb
commit 5c099e5c9f
100 changed files with 67 additions and 34616 deletions

View File

@ -1,47 +1,3 @@
Contents
--------
1. Standard Template Library license
2. GNU General Public License
1. Standard Template Library license
------------------------------------
Sources found in the stl directory are covered under the following
license:
Copyright (c) 1996
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.
2. GNU General Public License
-----------------------------
All source code in the src directory is covered under the
GNU General Public License (GNU GPL).

View File

@ -4,7 +4,7 @@ SUBDIRS = src man
sysconf_DATA = darkice.cfg
EXTRA_DIST = stl $(KDOC_DIR) darkice.cfg
EXTRA_DIST = $(KDOC_DIR) darkice.cfg
$(KDOC_DIR): kdocs

View File

@ -91,8 +91,8 @@ Config :: addLine ( const char * line ) throw ( Exception )
throw Exception( __FILE__, __LINE__, "no line");
}
string::size_type ix;
string str( line);
std::string::size_type ix;
std::string str( line);
/* delete everything after the first # */
if ( (ix = str.find( '#')) != str.npos ) {
@ -110,10 +110,11 @@ Config :: addLine ( const char * line ) throw ( Exception )
if ( str[0] == '[' && str[str.size()-1] == ']' ) {
// a new section starts
string section( str, 1, str.size()-2);
ConfigSection cSection;
pair<const string, ConfigSection> element( section, cSection);
pair<TableType::iterator, bool> res;
std::string section( str, 1, str.size()-2);
ConfigSection cSection;
std::pair<const std::string, ConfigSection>
element( section, cSection);
std::pair<TableType::iterator, bool> res;
res = table.insert( element);
@ -160,6 +161,13 @@ Config :: read ( istream & is ) throw ( Exception )
$Source$
$Log$
Revision 1.4 2001/09/05 20:11:15 darkeye
removed dependency on locally stored SGI STL header files
now compiler-supplied C++ library STL header files are used
compiles under GNU C++ 3
hash_map (an SGI extension to STL) replaced with map
std:: namespace prefix added to all STL class references
Revision 1.3 2001/08/30 17:25:56 darkeye
renamed configure.h to config.h

View File

@ -36,7 +36,7 @@
/* ============================================================ include files */
#include <hash_map>
#include <map>
#include <string>
#include <iostream.h>
@ -83,7 +83,7 @@ class Config : public virtual Referable
/**
* Type declaration of the hash table type.
*/
typedef hash_map<string, ConfigSection> TableType;
typedef std::map<std::string, ConfigSection> TableType;
/**
* Hash table holding the configuration sections.
@ -97,7 +97,7 @@ class Config : public virtual Referable
*
* @see ConfigSection
*/
string currentSection;
std::string currentSection;
protected:
@ -213,6 +213,13 @@ class Config : public virtual Referable
$Source$
$Log$
Revision 1.4 2001/09/05 20:11:15 darkeye
removed dependency on locally stored SGI STL header files
now compiler-supplied C++ library STL header files are used
compiles under GNU C++ 3
hash_map (an SGI extension to STL) replaced with map
std:: namespace prefix added to all STL class references
Revision 1.3 2000/11/13 18:46:50 darkeye
added kdoc-style documentation comments

View File

@ -68,8 +68,8 @@ ConfigSection :: add ( const char * key,
throw Exception( __FILE__, __LINE__, "no key or value");
}
pair<const string, string> element( key, value);
pair<TableType::iterator, bool> res;
std::pair<const std::string, std::string> element( key, value);
std::pair<TableType::iterator, bool> res;
res = table.insert( element);
@ -125,8 +125,8 @@ ConfigSection :: addLine ( const char * line ) throw ( Exception )
throw Exception( __FILE__, __LINE__, "no line");
}
string::size_type ix;
string str( line);
std::string::size_type ix;
std::string str( line);
/* delete everything after the first # */
if ( (ix = str.find( '#')) != str.npos ) {
@ -146,8 +146,8 @@ ConfigSection :: addLine ( const char * line ) throw ( Exception )
return false;
}
string key( str, 0, ix);
string value( str, ix + 1);
std::string key( str, 0, ix);
std::string value( str, ix + 1);
/* eat up all white space from the front of value */
if ( (ix = value.find_first_not_of( ' ')) != value.npos ) {
@ -168,6 +168,13 @@ ConfigSection :: addLine ( const char * line ) throw ( Exception )
$Source$
$Log$
Revision 1.5 2001/09/05 20:11:15 darkeye
removed dependency on locally stored SGI STL header files
now compiler-supplied C++ library STL header files are used
compiles under GNU C++ 3
hash_map (an SGI extension to STL) replaced with map
std:: namespace prefix added to all STL class references
Revision 1.4 2001/08/30 17:25:56 darkeye
renamed configure.h to config.h

View File

@ -36,7 +36,7 @@
/* ============================================================ include files */
#include <hash_map>
#include <map>
#include <string>
#include "Referable.h"
@ -74,7 +74,7 @@ class ConfigSection : public virtual Referable
/**
* Type of the hash table used in this class.
*/
typedef hash_map<string, string> TableType;
typedef std::map<std::string, std::string> TableType;
/**
* Hash table holding the configuration information.
@ -188,6 +188,13 @@ class ConfigSection : public virtual Referable
$Source$
$Log$
Revision 1.4 2001/09/05 20:11:15 darkeye
removed dependency on locally stored SGI STL header files
now compiler-supplied C++ library STL header files are used
compiles under GNU C++ 3
hash_map (an SGI extension to STL) replaced with map
std:: namespace prefix added to all STL class references
Revision 1.3 2000/11/13 18:46:50 darkeye
added kdoc-style documentation comments

View File

@ -71,10 +71,6 @@
#endif
#include <hash_map>
#include <string>
#include "Util.h"
#include "DarkIce.h"
@ -380,6 +376,13 @@ DarkIce :: run ( void ) throw ( Exception )
$Source$
$Log$
Revision 1.16 2001/09/05 20:11:15 darkeye
removed dependency on locally stored SGI STL header files
now compiler-supplied C++ library STL header files are used
compiles under GNU C++ 3
hash_map (an SGI extension to STL) replaced with map
std:: namespace prefix added to all STL class references
Revision 1.15 2001/08/30 17:25:56 darkeye
renamed configure.h to config.h

View File

@ -1,5 +1,5 @@
bin_PROGRAMS = darkice
INCLUDES = -I../stl @LAME_INCFLAGS@
INCLUDES = @LAME_INCFLAGS@
CXXFLAGS = -O2 -Wall -DVERSION="@VERSION@"
LDADD = @LAME_LDFLAGS@ @LINK_STATIC@

View File

@ -56,6 +56,9 @@
#include <iostream.h>
#include "Exception.h"
/* ================================================================ constants */
@ -79,8 +82,7 @@
*/
class Reporter
{
private:
/**
@ -127,7 +129,7 @@ class Reporter
* @exception Exception
*/
inline virtual
~Reporter ( void ) throw ()
~Reporter ( void ) throw ( Exception )
{
(Reporter::os)->flush();
}
@ -307,6 +309,13 @@ class Reporter
$Source$
$Log$
Revision 1.5 2001/09/05 20:11:15 darkeye
removed dependency on locally stored SGI STL header files
now compiler-supplied C++ library STL header files are used
compiles under GNU C++ 3
hash_map (an SGI extension to STL) replaced with map
std:: namespace prefix added to all STL class references
Revision 1.4 2001/08/30 17:25:56 darkeye
renamed configure.h to config.h

View File

@ -1,114 +0,0 @@
/*
*
* 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,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_ALGO_H
#define __SGI_STL_ALGO_H
#include <algobase.h>
#include <tempbuf.h>
#include <stl_algo.h>
#include <stl_numeric.h>
#ifdef __STL_USE_NAMESPACES
// Names from <stl_algo.h>
using __STD::for_each;
using __STD::find;
using __STD::find_if;
using __STD::adjacent_find;
using __STD::count;
using __STD::count_if;
using __STD::search;
using __STD::search_n;
using __STD::swap_ranges;
using __STD::transform;
using __STD::replace;
using __STD::replace_if;
using __STD::replace_copy;
using __STD::replace_copy_if;
using __STD::generate;
using __STD::generate_n;
using __STD::remove;
using __STD::remove_if;
using __STD::remove_copy;
using __STD::remove_copy_if;
using __STD::unique;
using __STD::unique_copy;
using __STD::reverse;
using __STD::reverse_copy;
using __STD::rotate;
using __STD::rotate_copy;
using __STD::random_shuffle;
using __STD::random_sample;
using __STD::random_sample_n;
using __STD::partition;
using __STD::stable_partition;
using __STD::sort;
using __STD::stable_sort;
using __STD::partial_sort;
using __STD::partial_sort_copy;
using __STD::nth_element;
using __STD::lower_bound;
using __STD::upper_bound;
using __STD::equal_range;
using __STD::binary_search;
using __STD::merge;
using __STD::inplace_merge;
using __STD::includes;
using __STD::set_union;
using __STD::set_intersection;
using __STD::set_difference;
using __STD::set_symmetric_difference;
using __STD::min_element;
using __STD::max_element;
using __STD::next_permutation;
using __STD::prev_permutation;
using __STD::find_first_of;
using __STD::find_end;
using __STD::is_sorted;
using __STD::is_heap;
// Names from stl_heap.h
using __STD::push_heap;
using __STD::pop_heap;
using __STD::make_heap;
using __STD::sort_heap;
// Names from <stl_numeric.h>
using __STD::accumulate;
using __STD::inner_product;
using __STD::partial_sum;
using __STD::adjacent_difference;
using __STD::power;
using __STD::iota;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_ALGO_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,71 +0,0 @@
/*
*
* 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,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_ALGOBASE_H
#define __SGI_STL_ALGOBASE_H
#ifndef __SGI_STL_PAIR_H
#include <pair.h>
#endif
#ifndef __SGI_STL_ITERATOR_H
#include <iterator.h>
#endif
#ifndef __SGI_STL_INTERNAL_ALGOBASE_H
#include <stl_algobase.h>
#endif
#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H
#include <stl_uninitialized.h>
#endif
#ifdef __STL_USE_NAMESPACES
// Names from stl_algobase.h
using __STD::iter_swap;
using __STD::swap;
using __STD::min;
using __STD::max;
using __STD::copy;
using __STD::copy_backward;
using __STD::copy_n;
using __STD::fill;
using __STD::fill_n;
using __STD::mismatch;
using __STD::equal;
using __STD::lexicographical_compare;
using __STD::lexicographical_compare_3way;
// Names from stl_uninitialized.h
using __STD::uninitialized_copy;
using __STD::uninitialized_copy_n;
using __STD::uninitialized_fill;
using __STD::uninitialized_fill_n;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_ALGOBASE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,40 +0,0 @@
/*
*
* 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,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_ALGORITHM
#define __SGI_STL_ALGORITHM
#include <stl_algobase.h>
#include <stl_construct.h>
#include <stl_uninitialized.h>
#include <stl_tempbuf.h>
#include <stl_algo.h>
#endif /* __SGI_STL_ALGORITHM */
// Local Variables:
// mode:C++
// End:

View File

@ -1,46 +0,0 @@
/*
* Copyright (c) 1996-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_ALLOC_H
#define __SGI_STL_ALLOC_H
#ifndef __STL_CONFIG_H
#include <stl_config.h>
#endif
#ifndef __SGI_STL_INTERNAL_ALLOC_H
#include <stl_alloc.h>
#endif
#ifdef __STL_USE_NAMESPACES
using __STD::__malloc_alloc_template;
using __STD::malloc_alloc;
using __STD::simple_alloc;
using __STD::debug_alloc;
using __STD::__default_alloc_template;
using __STD::alloc;
using __STD::single_client_alloc;
#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
using __STD::__malloc_alloc_oom_handler;
#endif /* __STL_STATIC_TEMPLATE_MEMBER_BUG */
#ifdef __STL_USE_STD_ALLOCATORS
using __STD::allocator;
#endif /* __STL_USE_STD_ALLOCATORS */
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_ALLOC_H */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -1,52 +0,0 @@
/*
*
* 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
* 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_BVECTOR_H
#define __SGI_STL_BVECTOR_H
#include <stl_range_errors.h>
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
#include <vector.h>
#else
#include <algobase.h>
#include <alloc.h>
#endif
#include <stl_bvector.h>
#ifdef __STL_USE_NAMESPACES
using __STD::bit_vector;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_BVECTOR_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,152 +0,0 @@
/*
* 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_CHAR_TRAITS_H
#define __SGI_STL_CHAR_TRAITS_H
#include <string.h>
#include <wchar.h>
#if defined(__STL_USE_NEW_IOSTREAMS) && !defined(__SGI_STL_IOSFWD)
#include <iosfwd>
#endif /* use new iostreams */
__STL_BEGIN_NAMESPACE
// Class __char_traits_base.
template <class _CharT, class _IntT> class __char_traits_base {
public:
typedef _CharT char_type;
typedef _IntT int_type;
#ifdef __STL_USE_NEW_IOSTREAMS
typedef streamoff off_type;
typedef streampos pos_type;
typedef mbstate_t state_type;
#endif /* __STL_USE_NEW_IOSTREAMS */
static void assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; }
static bool eq(const _CharT& __c1, const _CharT& __c2)
{ return __c1 == __c2; }
static bool lt(const _CharT& __c1, const _CharT& __c2)
{ return __c1 < __c2; }
static int compare(const _CharT* __s1, const _CharT* __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 length(const _CharT* __s) {
const _CharT __nullchar = _CharT();
size_t __i;
for (__i = 0; !eq(__s[__i], __nullchar); ++__i)
{}
return __i;
}
static const _CharT* find(const _CharT* __s, size_t __n, const _CharT& __c)
{
for ( ; __n > 0 ; ++__s, --__n)
if (eq(*__s, __c))
return __s;
return 0;
}
static _CharT* move(_CharT* __s1, const _CharT* __s2, size_t __n) {
memmove(__s1, __s2, __n * sizeof(_CharT));
return __s1;
}
static _CharT* copy(_CharT* __s1, const _CharT* __s2, size_t __n) {
memcpy(__s1, __s2, __n * sizeof(_CharT));
return __s1;
}
static _CharT* assign(_CharT* __s, size_t __n, _CharT __c) {
for (size_t __i = 0; __i < __n; ++__i)
__s[__i] = __c;
return __s;
}
static int_type not_eof(const int_type& __c) {
return !eq_int_type(__c, eof()) ? __c : 0;
}
static char_type to_char_type(const int_type& __c) {
return static_cast<char_type>(__c);
}
static int_type to_int_type(const char_type& __c) {
return static_cast<int_type>(__c);
}
static bool eq_int_type(const int_type& __c1, const int_type& __c2) {
return __c1 == __c2;
}
static int_type eof() {
return static_cast<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.
__STL_TEMPLATE_NULL class char_traits<char>
: public __char_traits_base<char, int>
{
public:
static char_type to_char_type(const int_type& __c) {
return static_cast<char_type>(static_cast<unsigned char>(__c));
}
static int_type to_int_type(const char_type& __c) {
return static_cast<unsigned char>(__c);
}
static int compare(const char* __s1, const char* __s2, size_t __n)
{ return memcmp(__s1, __s2, __n); }
static size_t length(const char* __s) { return strlen(__s); }
static void assign(char& __c1, const char& __c2) { __c1 = __c2; }
static char* assign(char* __s, size_t __n, char __c)
{ memset(__s, __c, __n); return __s; }
};
// Specialization for wchar_t.
__STL_TEMPLATE_NULL class char_traits<wchar_t>
: public __char_traits_base<wchar_t, wint_t>
{};
__STL_END_NAMESPACE
#endif /* __SGI_STL_CHAR_TRAITS_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,811 +0,0 @@
/*
* 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.
*/
#ifndef __CONCEPT_CHECKS_H
#define __CONCEPT_CHECKS_H
/*
Use these macro like assertions, but they assert properties
on types (usually template arguments). In technical terms they
verify whether a type "models" a "concept".
This set of requirements and the terminology used here is derived
from the book "Generic Programming and the STL" by Matt Austern
(Addison Wesley). For further information please consult that
book. The requirements also are intended to match the ANSI/ISO C++
standard.
This file covers the basic concepts and the iterator concepts.
There are several other files that provide the requirements
for the STL containers:
container_concepts.h
sequence_concepts.h
assoc_container_concepts.h
Jeremy Siek, 1999
TO DO:
- some issues with regards to concept classification and mutability
including AssociativeContianer -> ForwardContainer
and SortedAssociativeContainer -> ReversibleContainer
- HashedAssociativeContainer
- Allocator
- Function Object Concepts
*/
#ifndef __STL_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) \
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) \
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) \
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) \
static int __##__func##__ret##__arg##_unary_function_check
#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
do {} while(0)
#define __STL_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) \
do {} while(0)
#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
static int __##__opname##__ret##__first##__second##_require_binary_op
#else /* __STL_USE_CONCEPT_CHECKS */
// This macro tests whether the template argument "__type_var"
// satisfies the requirements of "__concept". Here is a list of concepts
// that we know how to check:
// _Allocator
// _Assignable
// _DefaultConstructible
// _EqualityComparable
// _LessThanComparable
// _TrivialIterator
// _InputIterator
// _OutputIterator
// _ForwardIterator
// _BidirectionalIterator
// _RandomAccessIterator
// _Mutable_TrivialIterator
// _Mutable_ForwardIterator
// _Mutable_BidirectionalIterator
// _Mutable_RandomAccessIterator
#define __STL_REQUIRES(__type_var, __concept) \
do { \
void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\
::__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) \
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) \
do { \
void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \
__type_y >::__type_X_not_same_as_type_Y; \
__x = __x; } while (0)
// function object checks
#define __STL_GENERATOR_CHECK(__func, __ret) \
do { \
__ret (*__x)( __func&) = \
_STL_GENERATOR_ERROR< \
__func, __ret>::__generator_requirement_violation; \
__x = __x; } while (0)
#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
do { \
__ret (*__x)( __func&, const __arg& ) = \
_STL_UNARY_FUNCTION_ERROR< \
__func, __ret, __arg>::__unary_function_requirement_violation; \
__x = __x; } while (0)
#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
do { \
__ret (*__x)( __func&, const __first&, const __second& ) = \
_STL_BINARY_FUNCTION_ERROR< \
__func, __ret, __first, __second>::__binary_function_requirement_violation; \
__x = __x; } while (0)
#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
do { \
__ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \
__ret, __first, __second>::__binary_operator_requirement_violation; \
__ret (*__y)( const __first&, const __second& ) = \
_STL_BINARY##__opname##_ERROR< __ret, __first, __second>:: \
__const_binary_operator_requirement_violation; \
__y = __y; __x = __x; } while (0)
#ifdef __STL_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)
#else
// Use this macro inside of template classes, where you would
// like to place requirements on the template arguments to the class
// 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) \
typedef void (* __func##__type_var##__concept)( __type_var ); \
template <__func##__type_var##__concept _Tp1> \
struct __dummy_struct_##__type_var##__concept { }; \
static __dummy_struct_##__type_var##__concept< \
__concept##_concept_specification< \
__type_var>::__concept##_requirement_violation> \
__dummy_ptr_##__type_var##__concept
#define __STL_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> \
struct __dummy_struct_##__type_x##__type_y##_same_type { }; \
static __dummy_struct_##__type_x##__type_y##_same_type< \
_STL_SAME_TYPE_ERROR<__type_x, __type_y>::__type_X_not_same_as_type_Y> \
__dummy_ptr_##__type_x##__type_y##_same_type
#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \
typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \
template <__f_##__func##__ret##_generator _Tp1> \
struct __dummy_struct_##__func##__ret##_generator { }; \
static __dummy_struct_##__func##__ret##_generator< \
_STL_GENERATOR_ERROR< \
__func, __ret>::__generator_requirement_violation> \
__dummy_ptr_##__func##__ret##_generator
#define __STL_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> \
struct __dummy_struct_##__func##__ret##__arg##_unary_check { }; \
static __dummy_struct_##__func##__ret##__arg##_unary_check< \
_STL_UNARY_FUNCTION_ERROR< \
__func, __ret, __arg>::__unary_function_requirement_violation> \
__dummy_ptr_##__func##__ret##__arg##_unary_check
#define __STL_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> \
struct __dummy_struct_##__func##__ret##__first##__second##_binary_check { }; \
static __dummy_struct_##__func##__ret##__first##__second##_binary_check< \
_STL_BINARY_FUNCTION_ERROR<__func, __ret, __first, __second>:: \
__binary_function_requirement_violation> \
__dummy_ptr_##__func##__ret##__first##__second##_binary_check
#define __STL_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> \
struct __dummy_struct_##__func##__ret##__first##__second##_binary_op { }; \
static __dummy_struct_##__func##__ret##__first##__second##_binary_op< \
_STL_BINARY##__opname##_ERROR<__ret, __first, __second>:: \
__binary_operator_requirement_violation> \
__dummy_ptr_##__func##__ret##__first##__second##_binary_op
#endif
/* helper class for finding non-const version of a type. Need to have
something to assign to etc. when testing constant iterators. */
template <class _Tp>
struct _Mutable_trait {
typedef _Tp _Type;
};
template <class _Tp>
struct _Mutable_trait<const _Tp> {
typedef _Tp _Type;
};
/* helper function for avoiding compiler warnings about unused variables */
template <class _Type>
void __sink_unused_warning(_Type) { }
template <class _TypeX, class _TypeY>
struct _STL_CONVERT_ERROR {
static void
__type_X_is_not_convertible_to_type_Y(_TypeX __x, _TypeY) {
_TypeY __y = __x;
__sink_unused_warning(__y);
}
};
template <class _Type> struct __check_equal { };
template <class _TypeX, class _TypeY>
struct _STL_SAME_TYPE_ERROR {
static void
__type_X_not_same_as_type_Y(_TypeX , _TypeY ) {
__check_equal<_TypeX> t1 = __check_equal<_TypeY>();
}
};
// Some Functon Object Checks
template <class _Func, class _Ret>
struct _STL_GENERATOR_ERROR {
static _Ret __generator_requirement_violation(_Func& __f) {
return __f();
}
};
template <class _Func>
struct _STL_GENERATOR_ERROR<_Func, void> {
static void __generator_requirement_violation(_Func& __f) {
__f();
}
};
template <class _Func, class _Ret, class _Arg>
struct _STL_UNARY_FUNCTION_ERROR {
static _Ret
__unary_function_requirement_violation(_Func& __f,
const _Arg& __arg) {
return __f(__arg);
}
};
template <class _Func, class _Arg>
struct _STL_UNARY_FUNCTION_ERROR<_Func, void, _Arg> {
static void
__unary_function_requirement_violation(_Func& __f,
const _Arg& __arg) {
__f(__arg);
}
};
template <class _Func, class _Ret, class _First, class _Second>
struct _STL_BINARY_FUNCTION_ERROR {
static _Ret
__binary_function_requirement_violation(_Func& __f,
const _First& __first,
const _Second& __second) {
return __f(__first, __second);
}
};
template <class _Func, class _First, class _Second>
struct _STL_BINARY_FUNCTION_ERROR<_Func, void, _First, _Second> {
static void
__binary_function_requirement_violation(_Func& __f,
const _First& __first,
const _Second& __second) {
__f(__first, __second);
}
};
#define __STL_DEFINE_BINARY_OP_CHECK(_OP, _NAME) \
template <class _Ret, class _First, class _Second> \
struct _STL_BINARY##_NAME##_ERROR { \
static _Ret \
__const_binary_operator_requirement_violation(const _First& __first, \
const _Second& __second) { \
return __first _OP __second; \
} \
static _Ret \
__binary_operator_requirement_violation(_First& __first, \
_Second& __second) { \
return __first _OP __second; \
} \
}
__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);
// ...
// TODO, add unary operators (prefix and postfix)
/*
The presence of this class is just to trick EDG into displaying
these error messages before any other errors. Without the
classes, the errors in the functions get reported after
other class errors deep inside the library. The name
choice just makes for an eye catching error message :)
*/
struct _STL_ERROR {
template <class _Type>
static _Type
__default_constructor_requirement_violation(_Type) {
return _Type();
}
template <class _Type>
static _Type
__assignment_operator_requirement_violation(_Type __a) {
__a = __a;
return __a;
}
template <class _Type>
static _Type
__copy_constructor_requirement_violation(_Type __a) {
_Type __c(__a);
return __c;
}
template <class _Type>
static _Type
__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 _Type& __b) {
__a = __b;
return __a;
}
template <class _Type>
static _Type
__less_than_comparable_requirement_violation(_Type __a, _Type __b) {
if (__a < __b || __a > __b || __a <= __b || __a >= __b) return __a;
return __b;
}
template <class _Type>
static _Type
__equality_comparable_requirement_violation(_Type __a, _Type __b) {
if (__a == __b || __a != __b) return __a;
return __b;
}
template <class _Iterator>
static void
__dereference_operator_requirement_violation(_Iterator __i) {
__sink_unused_warning(*__i);
}
template <class _Iterator>
static void
__dereference_operator_and_assignment_requirement_violation(_Iterator __i) {
*__i = *__i;
}
template <class _Iterator>
static void
__preincrement_operator_requirement_violation(_Iterator __i) {
++__i;
}
template <class _Iterator>
static void
__postincrement_operator_requirement_violation(_Iterator __i) {
__i++;
}
template <class _Iterator>
static void
__predecrement_operator_requirement_violation(_Iterator __i) {
--__i;
}
template <class _Iterator>
static void
__postdecrement_operator_requirement_violation(_Iterator __i) {
__i--;
}
template <class _Iterator, class _Type>
static void
__postincrement_operator_and_assignment_requirement_violation(_Iterator __i,
_Type __t) {
*__i++ = __t;
}
template <class _Iterator, class _Distance>
static _Iterator
__iterator_addition_assignment_requirement_violation(_Iterator __i,
_Distance __n) {
__i += __n;
return __i;
}
template <class _Iterator, class _Distance>
static _Iterator
__iterator_addition_requirement_violation(_Iterator __i, _Distance __n) {
__i = __i + __n;
__i = __n + __i;
return __i;
}
template <class _Iterator, class _Distance>
static _Iterator
__iterator_subtraction_assignment_requirement_violation(_Iterator __i,
_Distance __n) {
__i -= __n;
return __i;
}
template <class _Iterator, class _Distance>
static _Iterator
__iterator_subtraction_requirement_violation(_Iterator __i, _Distance __n) {
__i = __i - __n;
return __i;
}
template <class _Iterator, class _Distance>
static _Distance
__difference_operator_requirement_violation(_Iterator __i, _Iterator __j,
_Distance __n) {
__n = __i - __j;
return __n;
}
template <class _Exp, class _Type, class _Distance>
static _Type
__element_access_operator_requirement_violation(_Exp __x, _Type*,
_Distance __n) {
return __x[__n];
}
template <class _Exp, class _Type, class _Distance>
static void
__element_assignment_operator_requirement_violation(_Exp __x,
_Type* __t,
_Distance __n) {
__x[__n] = *__t;
}
}; /* _STL_ERROR */
/* Associated Type Requirements */
__STL_BEGIN_NAMESPACE
template <class _Iterator> struct iterator_traits;
__STL_END_NAMESPACE
template <class _Iter>
struct __value_type_type_definition_requirement_violation {
typedef typename __STD::iterator_traits<_Iter>::value_type value_type;
};
template <class _Iter>
struct __difference_type_type_definition_requirement_violation {
typedef typename __STD::iterator_traits<_Iter>::difference_type
difference_type;
};
template <class _Iter>
struct __reference_type_definition_requirement_violation {
typedef typename __STD::iterator_traits<_Iter>::reference reference;
};
template <class _Iter>
struct __pointer_type_definition_requirement_violation {
typedef typename __STD::iterator_traits<_Iter>::pointer pointer;
};
template <class _Iter>
struct __iterator_category_type_definition_requirement_violation {
typedef typename __STD::iterator_traits<_Iter>::iterator_category
iterator_category;
};
/* Assignable Requirements */
template <class _Type>
struct _Assignable_concept_specification {
static void _Assignable_requirement_violation(_Type __a) {
_STL_ERROR::__assignment_operator_requirement_violation(__a);
_STL_ERROR::__copy_constructor_requirement_violation(__a);
_STL_ERROR::__const_parameter_required_for_copy_constructor(__a,__a);
_STL_ERROR::__const_parameter_required_for_assignment_operator(__a,__a);
}
};
/* DefaultConstructible Requirements */
template <class _Type>
struct _DefaultConstructible_concept_specification {
static void _DefaultConstructible_requirement_violation(_Type __a) {
_STL_ERROR::__default_constructor_requirement_violation(__a);
}
};
/* EqualityComparable Requirements */
template <class _Type>
struct _EqualityComparable_concept_specification {
static void _EqualityComparable_requirement_violation(_Type __a) {
_STL_ERROR::__equality_comparable_requirement_violation(__a, __a);
}
};
/* LessThanComparable Requirements */
template <class _Type>
struct _LessThanComparable_concept_specification {
static void _LessThanComparable_requirement_violation(_Type __a) {
_STL_ERROR::__less_than_comparable_requirement_violation(__a, __a);
}
};
/* TrivialIterator Requirements */
template <class _TrivialIterator>
struct _TrivialIterator_concept_specification {
static void
_TrivialIterator_requirement_violation(_TrivialIterator __i) {
typedef typename
__value_type_type_definition_requirement_violation<_TrivialIterator>::
value_type __T;
// Refinement of Assignable
_Assignable_concept_specification<_TrivialIterator>::
_Assignable_requirement_violation(__i);
// Refinement of DefaultConstructible
_DefaultConstructible_concept_specification<_TrivialIterator>::
_DefaultConstructible_requirement_violation(__i);
// Refinement of EqualityComparable
_EqualityComparable_concept_specification<_TrivialIterator>::
_EqualityComparable_requirement_violation(__i);
// Valid Expressions
_STL_ERROR::__dereference_operator_requirement_violation(__i);
}
};
template <class _TrivialIterator>
struct _Mutable_TrivialIterator_concept_specification {
static void
_Mutable_TrivialIterator_requirement_violation(_TrivialIterator __i) {
_TrivialIterator_concept_specification<_TrivialIterator>::
_TrivialIterator_requirement_violation(__i);
// Valid Expressions
_STL_ERROR::__dereference_operator_and_assignment_requirement_violation(__i);
}
};
/* InputIterator Requirements */
template <class _InputIterator>
struct _InputIterator_concept_specification {
static void
_InputIterator_requirement_violation(_InputIterator __i) {
// Refinement of TrivialIterator
_TrivialIterator_concept_specification<_InputIterator>::
_TrivialIterator_requirement_violation(__i);
// Associated Types
__difference_type_type_definition_requirement_violation<_InputIterator>();
__reference_type_definition_requirement_violation<_InputIterator>();
__pointer_type_definition_requirement_violation<_InputIterator>();
__iterator_category_type_definition_requirement_violation<_InputIterator>();
// Valid Expressions
_STL_ERROR::__preincrement_operator_requirement_violation(__i);
_STL_ERROR::__postincrement_operator_requirement_violation(__i);
}
};
/* OutputIterator Requirements */
template <class _OutputIterator>
struct _OutputIterator_concept_specification {
static void
_OutputIterator_requirement_violation(_OutputIterator __i) {
// Refinement of Assignable
_Assignable_concept_specification<_OutputIterator>::
_Assignable_requirement_violation(__i);
// Associated Types
__iterator_category_type_definition_requirement_violation<_OutputIterator>();
// Valid Expressions
_STL_ERROR::__dereference_operator_requirement_violation(__i);
_STL_ERROR::__preincrement_operator_requirement_violation(__i);
_STL_ERROR::__postincrement_operator_requirement_violation(__i);
_STL_ERROR::
__postincrement_operator_and_assignment_requirement_violation(__i, *__i);
}
};
/* ForwardIterator Requirements */
template <class _ForwardIterator>
struct _ForwardIterator_concept_specification {
static void
_ForwardIterator_requirement_violation(_ForwardIterator __i) {
// Refinement of InputIterator
_InputIterator_concept_specification<_ForwardIterator>::
_InputIterator_requirement_violation(__i);
}
};
template <class _ForwardIterator>
struct _Mutable_ForwardIterator_concept_specification {
static void
_Mutable_ForwardIterator_requirement_violation(_ForwardIterator __i) {
_ForwardIterator_concept_specification<_ForwardIterator>::
_ForwardIterator_requirement_violation(__i);
// Refinement of OutputIterator
_OutputIterator_concept_specification<_ForwardIterator>::
_OutputIterator_requirement_violation(__i);
}
};
/* BidirectionalIterator Requirements */
template <class _BidirectionalIterator>
struct _BidirectionalIterator_concept_specification {
static void
_BidirectionalIterator_requirement_violation(_BidirectionalIterator __i) {
// Refinement of ForwardIterator
_ForwardIterator_concept_specification<_BidirectionalIterator>::
_ForwardIterator_requirement_violation(__i);
// Valid Expressions
_STL_ERROR::__predecrement_operator_requirement_violation(__i);
_STL_ERROR::__postdecrement_operator_requirement_violation(__i);
}
};
template <class _BidirectionalIterator>
struct _Mutable_BidirectionalIterator_concept_specification {
static void
_Mutable_BidirectionalIterator_requirement_violation(
_BidirectionalIterator __i)
{
_BidirectionalIterator_concept_specification<_BidirectionalIterator>::
_BidirectionalIterator_requirement_violation(__i);
// Refinement of mutable_ForwardIterator
_Mutable_ForwardIterator_concept_specification<_BidirectionalIterator>::
_Mutable_ForwardIterator_requirement_violation(__i);
typedef typename
__value_type_type_definition_requirement_violation<
_BidirectionalIterator>::value_type __T;
typename _Mutable_trait<__T>::_Type* __tmp_ptr = 0;
// Valid Expressions
_STL_ERROR::
__postincrement_operator_and_assignment_requirement_violation(__i,
*__tmp_ptr);
}
};
/* RandomAccessIterator Requirements */
template <class _RandAccIter>
struct _RandomAccessIterator_concept_specification {
static void
_RandomAccessIterator_requirement_violation(_RandAccIter __i) {
// Refinement of BidirectionalIterator
_BidirectionalIterator_concept_specification<_RandAccIter>::
_BidirectionalIterator_requirement_violation(__i);
// Refinement of LessThanComparable
_LessThanComparable_concept_specification<_RandAccIter>::
_LessThanComparable_requirement_violation(__i);
typedef typename
__value_type_type_definition_requirement_violation<_RandAccIter>
::value_type
value_type;
typedef typename
__difference_type_type_definition_requirement_violation<_RandAccIter>
::difference_type
_Dist;
typedef typename _Mutable_trait<_Dist>::_Type _MutDist;
// Valid Expressions
_STL_ERROR::__iterator_addition_assignment_requirement_violation(__i,
_MutDist());
_STL_ERROR::__iterator_addition_requirement_violation(__i,
_MutDist());
_STL_ERROR::
__iterator_subtraction_assignment_requirement_violation(__i,
_MutDist());
_STL_ERROR::__iterator_subtraction_requirement_violation(__i,
_MutDist());
_STL_ERROR::__difference_operator_requirement_violation(__i, __i,
_MutDist());
typename _Mutable_trait<value_type>::_Type* __dummy_ptr = 0;
_STL_ERROR::__element_access_operator_requirement_violation(__i,
__dummy_ptr,
_MutDist());
}
};
template <class _RandAccIter>
struct _Mutable_RandomAccessIterator_concept_specification {
static void
_Mutable_RandomAccessIterator_requirement_violation(_RandAccIter __i)
{
_RandomAccessIterator_concept_specification<_RandAccIter>::
_RandomAccessIterator_requirement_violation(__i);
// Refinement of mutable_BidirectionalIterator
_Mutable_BidirectionalIterator_concept_specification<_RandAccIter>::
_Mutable_BidirectionalIterator_requirement_violation(__i);
typedef typename
__value_type_type_definition_requirement_violation<_RandAccIter>
::value_type
value_type;
typedef typename
__difference_type_type_definition_requirement_violation<_RandAccIter>
::difference_type
_Dist;
typename _Mutable_trait<value_type>::_Type* __tmp_ptr = 0;
// Valid Expressions
_STL_ERROR::__element_assignment_operator_requirement_violation(__i,
__tmp_ptr, _Dist());
}
};
#define __STL_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);
template <class _Alloc>
struct _Allocator_concept_specification {
static void
_Allocator_requirement_violation(_Alloc __a) {
// Refinement of DefaultConstructible
_DefaultConstructible_concept_specification<_Alloc>::
_DefaultConstructible_requirement_violation(__a);
// Refinement of EqualityComparable
_EqualityComparable_concept_specification<_Alloc>::
_EqualityComparable_requirement_violation(__a);
// Associated Types
__value_type__typedef_requirement_violation<_Alloc>();
__difference_type__typedef_requirement_violation<_Alloc>();
__size_type__typedef_requirement_violation<_Alloc>();
__reference__typedef_requirement_violation<_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);
}
};
#endif /* __STL_USE_CONCEPT_CHECKS */
#endif /* __CONCEPT_CHECKS_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,247 +0,0 @@
/*
* 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.
*/
#ifndef __STL_CONTAINER_CONCEPTS_H
#define __STL_CONTAINER_CONCEPTS_H
#include <concept_checks.h>
#ifdef __STL_USE_CONCEPT_CHECKS
// This file covers the following concepts:
// _Container
// _ForwardContainer
// _ReversibleContainer
// _const_ReversibleContainer
// _RandomAccessContainer
//
struct _ERROR_IN_STL_CONTAINER {
/* Container expresssions */
template <class _Container>
static void
__begin_iterator_accessor_requirement_violation(_Container __c) {
__c.begin();
}
template <class _Container>
static void
__const_begin_iterator_accessor_requirement_violation(const _Container& __c) {
__c.begin();
}
template <class _Container>
static void
__end_iterator_accessor_requirement_violation(_Container __c) {
__c.end();
}
template <class _Container>
static void
__const_end_iterator_accessor_requirement_violation(const _Container& __c) {
__c.end();
}
template <class _Container>
static void
__rbegin_iterator_accessor_requirement_violation(_Container __c) {
__c.rbegin();
}
template <class _Container>
static void
__const_rbegin_iterator_accessor_requirement_violation(const _Container& __c) {
__c.rbegin();
}
template <class _Container>
static void
__rend_iterator_accessor_requirement_violation(_Container __c) {
__c.rend();
}
template <class _Container>
static void
__const_rend_iterator_accessor_requirement_violation(const _Container& __c) {
__c.rend();
}
template <class _Container>
static void
__size_function_must_be_const(const _Container& __c) {
__c.size();
}
template <class _Container>
static void
__size_function_requirement_violation(_Container& __c) {
__c.size();
__size_function_must_be_const(__c);
}
template <class _Container>
static void
__max_size_function_must_be_const(const _Container& __c) {
__c.max_size();
}
template <class _Container>
static void
__max_size_function_requirement_violation(_Container& __c) {
__c.max_size();
__max_size_function_must_be_const(__c);
}
template <class _Container>
static void
__empty_function_must_be_const(const _Container& __c) {
__c.empty();
}
template <class _Container>
static void
__empty_function_requirement_violation(_Container& __c) {
__c.empty();
__empty_function_must_be_const(__c);
}
template <class _Container>
static void
__swap_function_requirement_violation(_Container& __c) {
__c.swap(__c);
}
};
__STL_TYPEDEF_REQUIREMENT(iterator);
__STL_TYPEDEF_REQUIREMENT(const_iterator);
/* Containers */
template <class _Container>
struct _Container_concept_specification {
static void
_Container_requirement_violation(_Container __c) {
// Refinement of Assignable
_Assignable_concept_specification<_Container>::_Assignable_requirement_violation(__c);
// Associated Types
__value_type__typedef_requirement_violation<_Container>();
__difference_type__typedef_requirement_violation<_Container>();
__size_type__typedef_requirement_violation<_Container>();
__reference__typedef_requirement_violation<_Container>();
__const_reference__typedef_requirement_violation<_Container>();
__pointer__typedef_requirement_violation<_Container>();
__const_pointer__typedef_requirement_violation<_Container>();
__iterator__typedef_requirement_violation<_Container>();
__const_iterator__typedef_requirement_violation<_Container>();
// Valid Expressions
_ERROR_IN_STL_CONTAINER::__const_begin_iterator_accessor_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__const_end_iterator_accessor_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__begin_iterator_accessor_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__end_iterator_accessor_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__size_function_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__max_size_function_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__empty_function_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__swap_function_requirement_violation(__c);
// Requirements on Iterators
typedef typename _Container::iterator iter;
typedef typename _Container::const_iterator const_iter;
_InputIterator_concept_specification<const_iter>::_InputIterator_requirement_violation(const_iter());
_InputIterator_concept_specification<iter>::_InputIterator_requirement_violation(iter());
}
};
template <class _ForwardContainer>
struct _ForwardContainer_concept_specification {
static void
_ForwardContainer_requirement_violation(_ForwardContainer __c) {
// Refinement of Container
_Container_concept_specification<_ForwardContainer>::_Container_requirement_violation(__c);
// Requirements on Iterators
typedef typename _ForwardContainer::iterator iter;
typedef typename _ForwardContainer::const_iterator const_iter;
_ForwardIterator_concept_specification<const_iter>::_ForwardIterator_requirement_violation(const_iter());
_Mutable_ForwardIterator_concept_specification<iter>::_Mutable_ForwardIterator_requirement_violation(iter());
}
};
__STL_TYPEDEF_REQUIREMENT(reverse_iterator);
__STL_TYPEDEF_REQUIREMENT(const_reverse_iterator);
template <class _ReversibleContainer>
struct _ReversibleContainer_concept_specification {
static void
_ReversibleContainer_requirement_violation(_ReversibleContainer __c) {
// Refinement of ForwardContainer
_ForwardContainer_concept_specification<_ReversibleContainer>::_ForwardContainer_requirement_violation(__c);
// Associated types
__reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
__const_reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
// Valid Expressions
_ERROR_IN_STL_CONTAINER::__const_rbegin_iterator_accessor_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__const_rend_iterator_accessor_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__rbegin_iterator_accessor_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__rend_iterator_accessor_requirement_violation(__c);
// Requirements on Iterators
typedef typename _ReversibleContainer::iterator iter;
typedef typename _ReversibleContainer::const_iterator const_iter;
_BidirectionalIterator_concept_specification<const_iter>::_BidirectionalIterator_requirement_violation(const_iter());
_Mutable_BidirectionalIterator_concept_specification<iter>::_Mutable_BidirectionalIterator_requirement_violation(iter());
}
};
template <class _ReversibleContainer>
struct _const_ReversibleContainer_concept_specification {
static void
_const_ReversibleContainer_requirement_violation(_ReversibleContainer __c) {
// Refinement of Container (JGS, not ForwardContainer)
_Container_concept_specification<_ReversibleContainer>::_Container_requirement_violation(__c);
// Associated types
__reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
__const_reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
// Valid Expressions
_ERROR_IN_STL_CONTAINER::__const_rbegin_iterator_accessor_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__const_rend_iterator_accessor_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__rbegin_iterator_accessor_requirement_violation(__c);
_ERROR_IN_STL_CONTAINER::__rend_iterator_accessor_requirement_violation(__c);
// Requirements on Iterators
typedef typename _ReversibleContainer::iterator iter;
typedef typename _ReversibleContainer::const_iterator const_iter;
// This line won't compile on gcc 2.91 due to a compiler bug.
#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 91)
__BidirectionalIterator_concept_specification<const_iter>::_BidirectionalIterator_requirement_violation(const_iter());
#endif
}
};
template <class _RandomAccessContainer>
struct _RandomAccessContainer_concept_specification {
static void
_RandomAccessContainer_requirement_violation(_RandomAccessContainer __c) {
// Refinement of ReversibleContainer
_ReversibleContainer_concept_specification<_RandomAccessContainer>::_ReversibleContainer_requirement_violation(__c);
// Valid Expressions
typedef typename _RandomAccessContainer::value_type __T;
typedef typename _RandomAccessContainer::difference_type _Dist;
typedef typename _Mutable_trait<__T>::_Type Type;
typedef Type* _TypePtr;
typedef typename _Mutable_trait<_Dist>::_Type Dist;
_STL_ERROR::__element_access_operator_requirement_violation(__c,
_TypePtr(),
Dist());
// Requirements on Iterators
typedef typename _RandomAccessContainer::iterator iter;
typedef typename _RandomAccessContainer::const_iterator const_iter;
_RandomAccessIterator_concept_specification<const_iter>::_RandomAccessIterator_requirement_violation(const_iter());
_Mutable_RandomAccessIterator_concept_specification<iter>::_Mutable_RandomAccessIterator_requirement_violation(iter());
}
};
#endif /* if __STL_USE_CONCEPT_CHECKS */
#endif /* __STL_CONTAINER_CONCEPTS_H */

View File

@ -1,87 +0,0 @@
/*
*
* 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.
*
*/
// Inclusion of this file is DEPRECATED. This is the original HP
// default allocator. It is provided only for backward compatibility.
// This file WILL BE REMOVED in a future release.
//
// DO NOT USE THIS FILE unless you have an old container implementation
// that requires an allocator with the HP-style interface.
//
// Standard-conforming allocators have a very different interface. The
// standard default allocator is declared in the header <memory>.
#ifndef DEFALLOC_H
#define DEFALLOC_H
#include <new.h>
#include <stddef.h>
#include <stdlib.h>
#include <limits.h>
#include <iostream.h>
#include <algobase.h>
template <class T>
inline T* allocate(ptrdiff_t size, T*) {
set_new_handler(0);
T* tmp = (T*)(::operator new((size_t)(size * sizeof(T))));
if (tmp == 0) {
cerr << "out of memory" << endl;
exit(1);
}
return tmp;
}
template <class T>
inline void deallocate(T* buffer) {
::operator delete(buffer);
}
template <class T>
class allocator {
public:
typedef T value_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef T& reference;
typedef const T& const_reference;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
pointer allocate(size_type n) {
return ::allocate((difference_type)n, (pointer)0);
}
void deallocate(pointer p) { ::deallocate(p); }
pointer address(reference x) { return (pointer)&x; }
const_pointer const_address(const_reference x) {
return (const_pointer)&x;
}
size_type init_page_size() {
return max(size_type(1), size_type(4096/sizeof(T)));
}
size_type max_size() const {
return max(size_type(1), size_type(UINT_MAX/sizeof(T)));
}
};
class allocator<void> {
public:
typedef void* pointer;
};
#endif

View File

@ -1,41 +0,0 @@
/*
*
* 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_DEQUE
#define __SGI_STL_DEQUE
#include <stl_range_errors.h>
#include <stl_algobase.h>
#include <stl_alloc.h>
#include <stl_construct.h>
#include <stl_uninitialized.h>
#include <stl_deque.h>
#endif /* __SGI_STL_DEQUE */
// Local Variables:
// mode:C++
// End:

View File

@ -1,43 +0,0 @@
/*
*
* 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_DEQUE_H
#define __SGI_STL_DEQUE_H
#include <stl_range_errors.h>
#include <algobase.h>
#include <alloc.h>
#include <stl_deque.h>
#ifdef __STL_USE_NAMESPACES
using __STD::deque;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_DEQUE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,118 +0,0 @@
/*
*
* 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,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_FUNCTION_H
#define __SGI_STL_FUNCTION_H
#ifndef __STL_CONFIG_H
#include <stl_config.h>
#endif
#ifndef __SGI_STL_INTERNAL_RELOPS
#include <stl_relops.h>
#endif
#include <stddef.h>
#ifndef __SGI_STL_INTERNAL_FUNCTION_H
#include <stl_function.h>
#endif
#ifdef __STL_USE_NAMESPACE_FOR_RELOPS
// Names from stl_relops.h
using __STD_RELOPS::operator!=;
using __STD_RELOPS::operator>;
using __STD_RELOPS::operator<=;
using __STD_RELOPS::operator>=;
#endif /* __STL_USE_NAMESPACE_FOR_RELOPS */
#ifdef __STL_USE_NAMESPACES
// Names from stl_function.h
using __STD::unary_function;
using __STD::binary_function;
using __STD::plus;
using __STD::minus;
using __STD::multiplies;
using __STD::divides;
using __STD::identity_element;
using __STD::modulus;
using __STD::negate;
using __STD::equal_to;
using __STD::not_equal_to;
using __STD::greater;
using __STD::less;
using __STD::greater_equal;
using __STD::less_equal;
using __STD::logical_and;
using __STD::logical_or;
using __STD::logical_not;
using __STD::unary_negate;
using __STD::binary_negate;
using __STD::not1;
using __STD::not2;
using __STD::binder1st;
using __STD::binder2nd;
using __STD::bind1st;
using __STD::bind2nd;
using __STD::unary_compose;
using __STD::binary_compose;
using __STD::compose1;
using __STD::compose2;
using __STD::pointer_to_unary_function;
using __STD::pointer_to_binary_function;
using __STD::ptr_fun;
using __STD::identity;
using __STD::select1st;
using __STD::select2nd;
using __STD::project1st;
using __STD::project2nd;
using __STD::constant_void_fun;
using __STD::constant_unary_fun;
using __STD::constant_binary_fun;
using __STD::constant0;
using __STD::constant1;
using __STD::constant2;
using __STD::subtractive_rng;
using __STD::mem_fun_t;
using __STD::const_mem_fun_t;
using __STD::mem_fun_ref_t;
using __STD::const_mem_fun_ref_t;
using __STD::mem_fun1_t;
using __STD::const_mem_fun1_t;
using __STD::mem_fun1_ref_t;
using __STD::const_mem_fun1_ref_t;
using __STD::mem_fun;
using __STD::mem_fun_ref;
using __STD::mem_fun1;
using __STD::mem_fun1_ref;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_FUNCTION_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,26 +0,0 @@
/*
* 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_FUNCTIONAL
#define __SGI_STL_FUNCTIONAL
#include <stl_config.h>
#include <stddef.h>
#include <stl_function.h>
#endif /* __SGI_STL_FUNCTIONAL */
// Local Variables:
// mode:C++
// End:

View File

@ -1,40 +0,0 @@
/*
* Copyright (c) 1996
* 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.
*
*/
#ifndef __SGI_STL_HASH_MAP
#define __SGI_STL_HASH_MAP
#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
#include <stl_hashtable.h>
#endif
#include <stl_hash_map.h>
#endif /* __SGI_STL_HASH_MAP */
// Local Variables:
// mode:C++
// End:

View File

@ -1,49 +0,0 @@
/*
* Copyright (c) 1996
* 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.
*
*/
#ifndef __SGI_STL_HASH_MAP_H
#define __SGI_STL_HASH_MAP_H
#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
#include <stl_hashtable.h>
#endif
#include <algobase.h>
#include <stl_hash_map.h>
#ifdef __STL_USE_NAMESPACES
using __STD::hash;
using __STD::hashtable;
using __STD::hash_map;
using __STD::hash_multimap;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_HASH_MAP_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,40 +0,0 @@
/*
* Copyright (c) 1996
* 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.
*
*/
#ifndef __SGI_STL_HASH_SET
#define __SGI_STL_HASH_SET
#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
#include <stl_hashtable.h>
#endif
#include <stl_hash_set.h>
#endif /* __SGI_STL_HASH_SET */
// Local Variables:
// mode:C++
// End:

View File

@ -1,44 +0,0 @@
/*
* Copyright (c) 1996
* 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.
*
*/
#ifndef __SGI_STL_HASH_SET_H
#define __SGI_STL_HASH_SET_H
#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
#include <stl_hashtable.h>
#endif
#include <algobase.h>
#include <stl_hash_set.h>
#ifdef __STL_USE_NAMESPACES
using __STD::hash;
using __STD::hashtable;
using __STD::hash_set;
using __STD::hash_multiset;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_HASH_SET_H */

View File

@ -1,48 +0,0 @@
/*
* Copyright (c) 1996,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.
*
*
* 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 __SGI_STL_HASHTABLE_H
#define __SGI_STL_HASHTABLE_H
#include <stl_hashtable.h>
#include <algo.h>
#include <alloc.h>
#include <vector.h>
#ifdef __STL_USE_NAMESPACES
using __STD::hash;
using __STD::hashtable;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_HASHTABLE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,46 +0,0 @@
/*
*
* 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 <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:

View File

@ -1,47 +0,0 @@
/*
*
* 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,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_ITERATOR
#define __SGI_STL_ITERATOR
#include <stl_config.h>
#include <stl_relops.h>
#include <stddef.h>
#ifdef __STL_USE_NEW_IOSTREAMS
#include <iosfwd>
#else /* __STL_USE_NEW_IOSTREAMS */
#include <iostream.h>
#endif /* __STL_USE_NEW_IOSTREAMS */
#include <stl_iterator_base.h>
#include <stl_iterator.h>
#endif /* __SGI_STL_ITERATOR */
// Local Variables:
// mode:C++
// End:

View File

@ -1,113 +0,0 @@
/*
*
* 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
* 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_ITERATOR_H
#define __SGI_STL_ITERATOR_H
#ifndef __SGI_STL_FUNCTION_H
#include <function.h>
#endif
#include <stddef.h>
#ifdef __STL_USE_NEW_IOSTREAMS
#include <iosfwd>
#else /* __STL_USE_NEW_IOSTREAMS */
#include <iostream.h>
#endif /* __STL_USE_NEW_IOSTREAMS */
#ifndef __SGI_STL_INTERNAL_ITERATOR_BASE_H
#include <stl_iterator_base.h>
#endif
#ifndef __SGI_STL_INTERNAL_ITERATOR_H
#include <stl_iterator.h>
#endif
#ifndef __TYPE_TRAITS_H
#include <type_traits.h>
#endif
#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H
#include <stl_construct.h>
#endif
#ifndef __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H
#include <stl_raw_storage_iter.h>
#endif
#ifdef __STL_USE_NAMESPACES
// Names from stl_iterator.h
using __STD::input_iterator_tag;
using __STD::output_iterator_tag;
using __STD::forward_iterator_tag;
using __STD::bidirectional_iterator_tag;
using __STD::random_access_iterator_tag;
#if 0
using __STD::iterator;
#endif
using __STD::input_iterator;
using __STD::output_iterator;
using __STD::forward_iterator;
using __STD::bidirectional_iterator;
using __STD::random_access_iterator;
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
using __STD::iterator_traits;
#endif
using __STD::iterator_category;
using __STD::distance_type;
using __STD::value_type;
using __STD::distance;
using __STD::advance;
using __STD::insert_iterator;
using __STD::front_insert_iterator;
using __STD::back_insert_iterator;
using __STD::inserter;
using __STD::front_inserter;
using __STD::back_inserter;
using __STD::reverse_iterator;
using __STD::reverse_bidirectional_iterator;
using __STD::istream_iterator;
using __STD::ostream_iterator;
// Names from stl_construct.h
using __STD::construct;
using __STD::destroy;
// Names from stl_raw_storage_iter.h
using __STD::raw_storage_iterator;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_ITERATOR_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,537 +0,0 @@
/*
* 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 not portable code. Parts of numeric_limits<> are
* inherently machine-dependent. At present this file is suitable
* for the MIPS and ia32 architectures.
*/
#ifndef __SGI_CPP_LIMITS
#define __SGI_CPP_LIMITS
#include <limits.h>
#include <float.h>
#include <stl_config.h>
__STL_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
};
// The C++ standard (section 18.2.1) requires that some of the members of
// numeric_limits be static const data members that are given constant-
// initializers within the class declaration. On compilers where the
// __STL_STATIC_CONST_INIT_BUG macro is defined, it is impossible to write
// a standard-conforming numeric_limits class.
//
// There are two possible workarounds: either initialize the data
// members outside the class, or change them from data members to
// enums. Neither workaround is satisfactory: the former makes it
// impossible to use the data members in constant-expressions, and the
// latter means they have the wrong type and that it is impossible to
// take their addresses. We choose the former workaround.
#ifdef __STL_STATIC_CONST_INIT_BUG
# define __STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \
enum { __mem_name = __mem_value }
#else /* __STL_STATIC_CONST_INIT_BUG */
# define __STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \
static const __mem_type __mem_name = __mem_value
#endif /* __STL_STATIC_CONST_INIT_BUG */
// Base class for all specializations of numeric_limits.
template <class __number>
class _Numeric_limits_base {
public:
__STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, false);
static __number min() __STL_NOTHROW { return __number(); }
static __number max() __STL_NOTHROW { return __number(); }
__STL_DECLARE_LIMITS_MEMBER(int, digits, 0);
__STL_DECLARE_LIMITS_MEMBER(int, digits10, 0);
__STL_DECLARE_LIMITS_MEMBER(bool, is_signed, false);
__STL_DECLARE_LIMITS_MEMBER(bool, is_integer, false);
__STL_DECLARE_LIMITS_MEMBER(bool, is_exact, false);
__STL_DECLARE_LIMITS_MEMBER(int, radix, 0);
static __number epsilon() __STL_NOTHROW { return __number(); }
static __number round_error() __STL_NOTHROW { return __number(); }
__STL_DECLARE_LIMITS_MEMBER(int, min_exponent, 0);
__STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, 0);
__STL_DECLARE_LIMITS_MEMBER(int, max_exponent, 0);
__STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, 0);
__STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, false);
__STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, false);
__STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, false);
__STL_DECLARE_LIMITS_MEMBER(float_denorm_style,
has_denorm,
denorm_absent);
__STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false);
static __number infinity() __STL_NOTHROW { return __number(); }
static __number quiet_NaN() __STL_NOTHROW { return __number(); }
static __number signaling_NaN() __STL_NOTHROW { return __number(); }
static __number denorm_min() __STL_NOTHROW { return __number(); }
__STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, false);
__STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, false);
__STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, false);
__STL_DECLARE_LIMITS_MEMBER(bool, traps, false);
__STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false);
__STL_DECLARE_LIMITS_MEMBER(float_round_style,
round_style,
round_toward_zero);
};
#ifdef __STL_STATIC_CONST_INIT_BUG
# define __STL_DEFINE_NUMERIC_BASE_MEMBER(__type, __mem)
#else /* __STL_STATIC_CONST_INIT_BUG */
# define __STL_DEFINE_NUMERIC_BASE_MEMBER(__type, __mem) \
template <class __number> \
const __type _Numeric_limits_base<__number>:: __mem
#endif /* __STL_STATIC_CONST_INIT_BUG */
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_specialized);
__STL_DEFINE_NUMERIC_BASE_MEMBER(int, digits);
__STL_DEFINE_NUMERIC_BASE_MEMBER(int, digits10);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_signed);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_integer);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_exact);
__STL_DEFINE_NUMERIC_BASE_MEMBER(int, radix);
__STL_DEFINE_NUMERIC_BASE_MEMBER(int, min_exponent);
__STL_DEFINE_NUMERIC_BASE_MEMBER(int, max_exponent);
__STL_DEFINE_NUMERIC_BASE_MEMBER(int, min_exponent10);
__STL_DEFINE_NUMERIC_BASE_MEMBER(int, max_exponent10);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, has_infinity);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, has_quiet_NaN);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, has_signaling_NaN);
__STL_DEFINE_NUMERIC_BASE_MEMBER(float_denorm_style, has_denorm);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, has_denorm_loss);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_iec559);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_bounded);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_modulo);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, traps);
__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, tinyness_before);
__STL_DEFINE_NUMERIC_BASE_MEMBER(float_round_style, round_style);
// Base class for integers.
template <class _Int,
_Int __imin, _Int __imax,
int __idigits = -1, bool __ismod = true>
class _Integer_limits : public _Numeric_limits_base<_Int>
{
public:
__STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true);
static _Int min() __STL_NOTHROW { return __imin; }
static _Int max() __STL_NOTHROW { return __imax; }
__STL_DECLARE_LIMITS_MEMBER(int,
digits,
(__idigits < 0) ? (int)(sizeof(_Int) * CHAR_BIT)
- (__imin == 0 ? 0 : 1)
: __idigits);
__STL_DECLARE_LIMITS_MEMBER(int, digits10, (digits * 301) / 1000);
// log 2 = 0.301029995664...
__STL_DECLARE_LIMITS_MEMBER(bool, is_signed, __imin != 0);
__STL_DECLARE_LIMITS_MEMBER(bool, is_integer, true);
__STL_DECLARE_LIMITS_MEMBER(bool, is_exact, true);
__STL_DECLARE_LIMITS_MEMBER(int, radix, 2);
__STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true);
__STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, __ismod);
};
#ifdef __STL_STATIC_CONST_INIT_BUG
# define __STL_DEFINE_INTEGER_LIMITS_MEMBER(__type, __mem)
#else /* __STL_STATIC_CONST_INIT_BUG */
# define __STL_DEFINE_INTEGER_LIMITS_MEMBER(__type, __mem) \
template <class _Int, _Int __imin, _Int __imax, int __idig, bool __ismod> \
const __type _Integer_limits<_Int, __imin, __imax, __idig, __ismod>::__mem
#endif /* __STL_STATIC_CONST_INIT_BUG */
__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_specialized);
__STL_DEFINE_INTEGER_LIMITS_MEMBER(int, digits);
__STL_DEFINE_INTEGER_LIMITS_MEMBER(int, digits10);
__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_signed);
__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_integer);
__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_exact);
__STL_DEFINE_INTEGER_LIMITS_MEMBER(int, radix);
__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_bounded);
__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_modulo);
// 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:
__STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true);
__STL_DECLARE_LIMITS_MEMBER(int, digits, __Digits);
__STL_DECLARE_LIMITS_MEMBER(int, digits10, __Digits10);
__STL_DECLARE_LIMITS_MEMBER(bool, is_signed, true);
__STL_DECLARE_LIMITS_MEMBER(int, radix, 2);
__STL_DECLARE_LIMITS_MEMBER(int, min_exponent, __MinExp);
__STL_DECLARE_LIMITS_MEMBER(int, max_exponent, __MaxExp);
__STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, __MinExp10);
__STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, __MaxExp10);
__STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, true);
__STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, true);
__STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, true);
__STL_DECLARE_LIMITS_MEMBER(float_denorm_style,
has_denorm,
denorm_indeterminate);
__STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false);
__STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, __IsIEC559);
__STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true);
__STL_DECLARE_LIMITS_MEMBER(bool, traps, true);
__STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false);
__STL_DECLARE_LIMITS_MEMBER(float_round_style, round_style, __RoundStyle);
};
#ifdef __STL_STATIC_CONST_INIT_BUG
# define __STL_DEFINE_FLOAT_LIMITS_MEMBER(__type, __mem)
#else /* __STL_STATIC_CONST_INIT_BUG */
# define __STL_DEFINE_FLOAT_LIMITS_MEMBER(__type, __mem) \
template <class __Num, int __Dig, int __Dig10, \
int __MnX, int __MxX, int __MnX10, int __MxX10, \
bool __IsIEEE, float_round_style __Sty> \
const __type _Floating_limits<__Num, __Dig, __Dig10, \
__MnX, __MxX, __MnX10, __MxX10, \
__IsIEEE, __Sty>:: __mem
#endif /* __STL_STATIC_CONST_INIT_BUG */
__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, is_specialized);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, digits);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, digits10);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, is_signed);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, radix);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, min_exponent);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, max_exponent);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, min_exponent10);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, max_exponent10);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, has_infinity);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, has_quiet_NaN);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, has_signaling_NaN);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(float_denorm_style, has_denorm);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, has_denorm_loss);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, is_iec559);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, is_bounded);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, traps);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, tinyness_before);
__STL_DEFINE_FLOAT_LIMITS_MEMBER(float_round_style, round_style);
#undef __STL_DECLARE_NUMERIC_LIMITS_MEMBER
#undef __STL_DEFINE_NUMERIC_BASE_MEMBER
#undef __STL_DEFINE_INTEGER_LIMITS_MEMBER
#undef __STL_DEFINE_FLOAT_LIMITS_MEMBER
// Class numeric_limits
// The unspecialized class.
template<class _Tp>
class numeric_limits : public _Numeric_limits_base<_Tp> {};
// Specializations for all built-in integral types.
#ifndef __STL_NO_BOOL
__STL_TEMPLATE_NULL
class numeric_limits<bool>
: public _Integer_limits<bool, false, true, 1, false>
{};
#endif /* __STL_NO_BOOL */
__STL_TEMPLATE_NULL
class numeric_limits<char>
: public _Integer_limits<char, CHAR_MIN, CHAR_MAX>
{};
__STL_TEMPLATE_NULL
class numeric_limits<signed char>
: public _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX>
{};
__STL_TEMPLATE_NULL
class numeric_limits<unsigned char>
: public _Integer_limits<unsigned char, 0, UCHAR_MAX>
{};
#ifdef __STL_HAS_WCHAR_T
__STL_TEMPLATE_NULL
class numeric_limits<wchar_t>
: public _Integer_limits<wchar_t, INT_MIN, INT_MAX>
{};
#endif
__STL_TEMPLATE_NULL
class numeric_limits<short>
: public _Integer_limits<short, SHRT_MIN, SHRT_MAX>
{};
__STL_TEMPLATE_NULL
class numeric_limits<unsigned short>
: public _Integer_limits<unsigned short, 0, USHRT_MAX>
{};
__STL_TEMPLATE_NULL
class numeric_limits<int>
: public _Integer_limits<int, INT_MIN, INT_MAX>
{};
__STL_TEMPLATE_NULL
class numeric_limits<unsigned int>
: public _Integer_limits<unsigned int, 0, UINT_MAX>
{};
__STL_TEMPLATE_NULL
class numeric_limits<long>
: public _Integer_limits<long, LONG_MIN, LONG_MAX>
{};
__STL_TEMPLATE_NULL
class numeric_limits<unsigned long>
: public _Integer_limits<unsigned long, 0, ULONG_MAX>
{};
#ifdef __STL_LONG_LONG
// Some compilers have long long, but don't define the
// LONGLONG_MIN and LONGLONG_MAX macros in limits.h. This
// assumes that long long is 64 bits.
#if !defined(LONGLONG_MIN) && !defined(LONGLONG_MAX) \
&& !defined(ULONGLONG_MAX)
#define ULONGLONG_MAX 0xffffffffffffffffLLU
#define LONGLONG_MAX 0x7fffffffffffffffLL
#define LONGLONG_MIN (-LONGLONG_MAX - 1LL)
#endif
__STL_TEMPLATE_NULL
class numeric_limits<long long>
: public _Integer_limits<long long, LONGLONG_MIN, LONGLONG_MAX>
{};
__STL_TEMPLATE_NULL
class numeric_limits<unsigned long long>
: public _Integer_limits<unsigned long long, 0, ULONGLONG_MAX>
{};
#endif /* __STL_LONG_LONG */
// Specializations for all built-in floating-point type.
__STL_TEMPLATE_NULL class numeric_limits<float>
: public _Floating_limits<float,
FLT_MANT_DIG, // Binary digits of precision
FLT_DIG, // Decimal digits of precision
FLT_MIN_EXP, // Minimum exponent
FLT_MAX_EXP, // Maximum exponent
FLT_MIN_10_EXP, // Minimum base 10 exponent
FLT_MAX_10_EXP, // Maximum base 10 exponent
true, // conforms to iec559
round_to_nearest>
{
public:
static float min() __STL_NOTHROW { return FLT_MIN; }
static float denorm_min() __STL_NOTHROW { return FLT_MIN; }
static float max() __STL_NOTHROW { return FLT_MAX; }
static float epsilon() __STL_NOTHROW { return FLT_EPSILON; }
static float round_error() __STL_NOTHROW { return 0.5f; } // Units: ulps.
static float infinity() __STL_NOTHROW;
static float quiet_NaN() __STL_NOTHROW;
static float signaling_NaN() __STL_NOTHROW;
};
__STL_TEMPLATE_NULL class numeric_limits<double>
: public _Floating_limits<double,
DBL_MANT_DIG, // Binary digits of precision
DBL_DIG, // Decimal digits of precision
DBL_MIN_EXP, // Minimum exponent
DBL_MAX_EXP, // Maximum exponent
DBL_MIN_10_EXP, // Minimum base 10 exponent
DBL_MAX_10_EXP, // Maximum base 10 exponent
true, // conforms to iec559
round_to_nearest>
{
public:
static double min() __STL_NOTHROW { return DBL_MIN; }
static double denorm_min() __STL_NOTHROW { return DBL_MIN; }
static double max() __STL_NOTHROW { return DBL_MAX; }
static double epsilon() __STL_NOTHROW { return DBL_EPSILON; }
static double round_error() __STL_NOTHROW { return 0.5; } // Units: ulps.
static double infinity() __STL_NOTHROW;
static double quiet_NaN() __STL_NOTHROW;
static double signaling_NaN() __STL_NOTHROW;
};
__STL_TEMPLATE_NULL class numeric_limits<long double>
: public _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, // Doesn't conform to iec559
round_to_nearest>
{
public:
static long double min() __STL_NOTHROW { return LDBL_MIN; }
static long double denorm_min() __STL_NOTHROW { return LDBL_MIN; }
static long double max() __STL_NOTHROW { return LDBL_MAX; }
static long double epsilon() __STL_NOTHROW { return LDBL_EPSILON; }
static long double round_error() __STL_NOTHROW { return 4; } // Units: ulps.
static long double infinity() __STL_NOTHROW;
static long double quiet_NaN() __STL_NOTHROW;
static long double signaling_NaN() __STL_NOTHROW;
};
// We write special values (Inf and NaN) as bit patterns and
// cast the the appropriate floating-point types.
#if defined(_MIPSEB)
// Big-endian MIPS. float is 32 bits, double 64, long double 128.
#define _Define_float(__f, __h, __l) \
inline float numeric_limits<float>::__f() __STL_NOTHROW { \
static const unsigned short __x[2] = { __h, __l }; \
return *reinterpret_cast<const float*>(__x); }
#define _Define_double(__f, __h, __l) \
inline double numeric_limits<double>::__f() __STL_NOTHROW { \
static const unsigned short __x[4] = { __h, __l }; \
return *reinterpret_cast<const double*>(__x); }
#define _Define_ldouble(__f, __h, __l) \
inline long double numeric_limits<long double>::__f() __STL_NOTHROW { \
static const unsigned short __x[8] = { __h, __l }; \
return *reinterpret_cast<const long double*>(__x); }
_Define_float(infinity, 0x7f80, 0)
_Define_float(quiet_NaN, 0x7f81, 0)
_Define_float(signaling_NaN, 0x7fc1, 0)
_Define_double(infinity, 0x7ff0, 0)
_Define_double(quiet_NaN, 0x7ff1, 0)
_Define_double(signaling_NaN, 0x7ff9, 0)
_Define_ldouble(infinity, 0x7ff0, 0)
_Define_ldouble(quiet_NaN, 0x7ff1, 0)
_Define_ldouble(signaling_NaN, 0x7ff9, 0)
#elif defined(__i386) || defined(_M_IX86)
// Little-endian ia32. float is 32 bits, double 64, long double 80.
#define _Define_float(__f, __h, __l) \
inline float numeric_limits<float>::__f() __STL_NOTHROW { \
static const unsigned short __x[2] = { __l, __h }; \
return *reinterpret_cast<const float*>(__x); }
#define _Define_double(__f, __h, __l) \
inline double numeric_limits<double>::__f() __STL_NOTHROW { \
static const unsigned short __x[4] = { 0, 0, __l, __h }; \
return *reinterpret_cast<const double*>(__x); }
#define _Define_ldouble(__f, __h, __l) \
inline long double numeric_limits<long double>::__f() __STL_NOTHROW { \
static const unsigned short __x[5] = { 0, 0, 0, __l, __h }; \
return *reinterpret_cast<const long double*>(__x); }
_Define_float(infinity, 0x7f80, 0)
_Define_float(quiet_NaN, 0x7fa0, 0)
_Define_float(signaling_NaN, 0x7fc0, 0)
_Define_double(infinity, 0x7ff0, 0)
_Define_double(quiet_NaN, 0x7ff4, 0)
_Define_double(signaling_NaN, 0x7ff8, 0)
_Define_ldouble(infinity, 0x7fff, 0x8000)
_Define_ldouble(quiet_NaN, 0x7fff, 0xa000)
_Define_ldouble(signaling_NaN, 0x7fff, 0xc000)
#else
/* This is an architecture we don't know how to handle. Return some
obviously wrong values. */
#define _Define_float(__f) \
inline float numeric_limits<float>::__f() __STL_NOTHROW { \
return 0; }
#define _Define_double(__f) \
inline double numeric_limits<double>::__f() __STL_NOTHROW { \
return 0; }
#define _Define_ldouble(__f) \
inline long double numeric_limits<long double>::__f() __STL_NOTHROW { \
return 0; }
_Define_float(infinity)
_Define_float(quiet_NaN)
_Define_float(signaling_NaN)
_Define_double(infinity)
_Define_double(quiet_NaN)
_Define_double(signaling_NaN)
_Define_ldouble(infinity)
_Define_ldouble(quiet_NaN)
_Define_ldouble(signaling_NaN)
#endif
#undef _Define_float
#undef _Define_double
#undef _Define_ldouble
__STL_END_NAMESPACE
#endif /* __SGI_CPP_LIMITS */
// Local Variables:
// mode:C++
// End:

View File

@ -1,40 +0,0 @@
/*
*
* 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,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_LIST
#define __SGI_STL_LIST
#include <stl_algobase.h>
#include <stl_alloc.h>
#include <stl_construct.h>
#include <stl_uninitialized.h>
#include <stl_list.h>
#endif /* __SGI_STL_LIST */
// Local Variables:
// mode:C++
// End:

View File

@ -1,42 +0,0 @@
/*
*
* 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,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_LIST_H
#define __SGI_STL_LIST_H
#include <algobase.h>
#include <alloc.h>
#include <stl_list.h>
#ifdef __STL_USE_NAMESPACES
using __STD::list;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_LIST_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,40 +0,0 @@
/*
*
* 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,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_MAP
#define __SGI_STL_MAP
#ifndef __SGI_STL_INTERNAL_TREE_H
#include <stl_tree.h>
#endif
#include <stl_map.h>
#include <stl_multimap.h>
#endif /* __SGI_STL_MAP */
// Local Variables:
// mode:C++
// End:

View File

@ -1,46 +0,0 @@
/*
*
* 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,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_MAP_H
#define __SGI_STL_MAP_H
#ifndef __SGI_STL_INTERNAL_TREE_H
#include <stl_tree.h>
#endif
#include <algobase.h>
#include <alloc.h>
#include <stl_map.h>
#ifdef __STL_USE_NAMESPACES
using __STD::rb_tree;
using __STD::map;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_MAP_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,134 +0,0 @@
/*
* 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.
*
*/
#ifndef __SGI_STL_MEMORY
#define __SGI_STL_MEMORY
#include <stl_algobase.h>
#include <stl_alloc.h>
#include <stl_construct.h>
#include <stl_tempbuf.h>
#include <stl_uninitialized.h>
#include <stl_raw_storage_iter.h>
__STL_BEGIN_NAMESPACE
#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \
defined(__STL_MEMBER_TEMPLATES)
template<class _Tp1> struct auto_ptr_ref {
_Tp1* _M_ptr;
auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
};
#endif
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;
}
}
// According to the C++ standard, these conversions are required. Most
// present-day compilers, however, do not enforce that requirement---and,
// in fact, most present-day compilers do not support the language
// features that these conversions rely on.
#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \
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 */
};
__STL_END_NAMESPACE
#endif /* __SGI_STL_MEMORY */
// Local Variables:
// mode:C++
// End:

View File

@ -1,46 +0,0 @@
/*
*
* 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,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_MULTIMAP_H
#define __SGI_STL_MULTIMAP_H
#ifndef __SGI_STL_INTERNAL_TREE_H
#include <stl_tree.h>
#endif
#include <algobase.h>
#include <alloc.h>
#include <stl_multimap.h>
#ifdef __STL_USE_NAMESPACES
using __STD::rb_tree;
using __STD::multimap;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_MULTIMAP_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,46 +0,0 @@
/*
*
* 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,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_MULTISET_H
#define __SGI_STL_MULTISET_H
#ifndef __SGI_STL_INTERNAL_TREE_H
#include <stl_tree.h>
#endif
#include <algobase.h>
#include <alloc.h>
#include <stl_multiset.h>
#ifdef __STL_USE_NAMESPACES
using __STD::rb_tree;
using __STD::multiset;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_MULTISET_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,49 +0,0 @@
/*
*
* 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,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_NUMERIC
#define __SGI_STL_NUMERIC
#include <stl_config.h>
#include <stl_relops.h>
#include <stddef.h>
#ifdef __STL_USE_NEW_IOSTREAMS
#include <iostream>
#else /* __STL_USE_NEW_IOSTREAMS */
#include <iostream.h>
#endif /* __STL_USE_NEW_IOSTREAMS */
#include <stl_iterator_base.h>
#include <stl_iterator.h>
#include <stl_function.h>
#include <stl_numeric.h>
#endif /* __SGI_STL_NUMERIC */
// Local Variables:
// mode:C++
// End:

View File

@ -1,51 +0,0 @@
/*
*
* 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,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_PAIR_H
#define __SGI_STL_PAIR_H
#ifndef __STL_CONFIG_H
#include <stl_config.h>
#endif
#ifndef __SGI_STL_INTERNAL_RELOPS
#include <stl_relops.h>
#endif
#ifndef __SGI_STL_INTERNAL_PAIR_H
#include <stl_pair.h>
#endif
#ifdef __STL_USE_NAMESPACES
using __STD::pair;
using __STD::make_pair;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_PAIR_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,495 +0,0 @@
/*
* Copyright (c) 1996
* 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_PTHREAD_ALLOC
#define __SGI_STL_PTHREAD_ALLOC
// 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.
#include <errno.h>
#include <stl_config.h>
#include <stl_alloc.h>
#ifndef __RESTRICT
# define __RESTRICT
#endif
#ifndef __STL_NO_BAD_ALLOC
# include <new>
#endif
__STL_BEGIN_NAMESPACE
#define __STL_DATA_ALIGNMENT 8
union _Pthread_alloc_obj {
union _Pthread_alloc_obj * __free_list_link;
char __client_data[__STL_DATA_ALIGNMENT]; /* The client sees this. */
};
// Pthread allocators don't appear to the client to have meaningful
// instances. We do in fact need to associate some state with each
// thread. That state is represented by
// _Pthread_alloc_per_thread_state<_Max_size>.
template<size_t _Max_size>
struct _Pthread_alloc_per_thread_state {
typedef _Pthread_alloc_obj __obj;
enum { _S_NFREELISTS = _Max_size/__STL_DATA_ALIGNMENT };
_Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS];
_Pthread_alloc_per_thread_state<_Max_size> * __next;
// Free list link for list of available per thread structures.
// When one of these becomes available for reuse due to thread
// termination, any objects in its free list remain associated
// with it. The whole structure may then be used by a newly
// created thread.
_Pthread_alloc_per_thread_state() : __next(0)
{
memset((void *)__free_list, 0, (size_t) _S_NFREELISTS * sizeof(__obj *));
}
// Returns an object of size __n, and possibly adds to size n free list.
void *_M_refill(size_t __n);
};
// Pthread-specific allocator.
// The argument specifies the largest object size allocated from per-thread
// free lists. Larger objects are allocated using malloc_alloc.
// Max_size must be a power of 2.
template <size_t _Max_size = 128>
class _Pthread_alloc_template {
public: // but only for internal use:
typedef _Pthread_alloc_obj __obj;
// Allocates a chunk for nobjs of size size. nobjs may be reduced
// if it is inconvenient to allocate the requested number.
static char *_S_chunk_alloc(size_t __size, int &__nobjs);
enum {_S_ALIGN = __STL_DATA_ALIGNMENT};
static size_t _S_round_up(size_t __bytes) {
return (((__bytes) + (int) _S_ALIGN-1) & ~((int) _S_ALIGN - 1));
}
static size_t _S_freelist_index(size_t __bytes) {
return (((__bytes) + (int) _S_ALIGN-1)/(int)_S_ALIGN - 1);
}
private:
// Chunk allocation state. And other shared state.
// Protected by _S_chunk_allocator_lock.
static pthread_mutex_t _S_chunk_allocator_lock;
static char *_S_start_free;
static char *_S_end_free;
static size_t _S_heap_size;
static _Pthread_alloc_per_thread_state<_Max_size>* _S_free_per_thread_states;
static pthread_key_t _S_key;
static bool _S_key_initialized;
// Pthread key under which per thread state is stored.
// Allocator instances that are currently unclaimed by any thread.
static void _S_destructor(void *instance);
// Function to be called on thread exit to reclaim per thread
// state.
static _Pthread_alloc_per_thread_state<_Max_size> *_S_new_per_thread_state();
// Return a recycled or new per thread state.
static _Pthread_alloc_per_thread_state<_Max_size> *_S_get_per_thread_state();
// ensure that the current thread has an associated
// per thread state.
class _M_lock;
friend class _M_lock;
class _M_lock {
public:
_M_lock () { pthread_mutex_lock(&_S_chunk_allocator_lock); }
~_M_lock () { pthread_mutex_unlock(&_S_chunk_allocator_lock); }
};
public:
/* n must be > 0 */
static void * allocate(size_t __n)
{
__obj * volatile * __my_free_list;
__obj * __RESTRICT __result;
_Pthread_alloc_per_thread_state<_Max_size>* __a;
if (__n > _Max_size) {
return(malloc_alloc::allocate(__n));
}
if (!_S_key_initialized ||
!(__a = (_Pthread_alloc_per_thread_state<_Max_size>*)
pthread_getspecific(_S_key))) {
__a = _S_get_per_thread_state();
}
__my_free_list = __a -> __free_list + _S_freelist_index(__n);
__result = *__my_free_list;
if (__result == 0) {
void *__r = __a -> _M_refill(_S_round_up(__n));
return __r;
}
*__my_free_list = __result -> __free_list_link;
return (__result);
};
/* p may not be 0 */
static void deallocate(void *__p, size_t __n)
{
__obj *__q = (__obj *)__p;
__obj * volatile * __my_free_list;
_Pthread_alloc_per_thread_state<_Max_size>* __a;
if (__n > _Max_size) {
malloc_alloc::deallocate(__p, __n);
return;
}
if (!_S_key_initialized ||
!(__a = (_Pthread_alloc_per_thread_state<_Max_size> *)
pthread_getspecific(_S_key))) {
__a = _S_get_per_thread_state();
}
__my_free_list = __a->__free_list + _S_freelist_index(__n);
__q -> __free_list_link = *__my_free_list;
*__my_free_list = __q;
}
static void * reallocate(void *__p, size_t __old_sz, size_t __new_sz);
} ;
typedef _Pthread_alloc_template<> pthread_alloc;
template <size_t _Max_size>
void _Pthread_alloc_template<_Max_size>::_S_destructor(void * __instance)
{
_M_lock __lock_instance; // Need to acquire lock here.
_Pthread_alloc_per_thread_state<_Max_size>* __s =
(_Pthread_alloc_per_thread_state<_Max_size> *)__instance;
__s -> __next = _S_free_per_thread_states;
_S_free_per_thread_states = __s;
}
template <size_t _Max_size>
_Pthread_alloc_per_thread_state<_Max_size> *
_Pthread_alloc_template<_Max_size>::_S_new_per_thread_state()
{
/* lock already held here. */
if (0 != _S_free_per_thread_states) {
_Pthread_alloc_per_thread_state<_Max_size> *__result =
_S_free_per_thread_states;
_S_free_per_thread_states = _S_free_per_thread_states -> __next;
return __result;
} else {
return new _Pthread_alloc_per_thread_state<_Max_size>;
}
}
template <size_t _Max_size>
_Pthread_alloc_per_thread_state<_Max_size> *
_Pthread_alloc_template<_Max_size>::_S_get_per_thread_state()
{
/*REFERENCED*/
_M_lock __lock_instance; // Need to acquire lock here.
int __ret_code;
_Pthread_alloc_per_thread_state<_Max_size> * __result;
if (!_S_key_initialized) {
if (pthread_key_create(&_S_key, _S_destructor)) {
__THROW_BAD_ALLOC; // defined in stl_alloc.h
}
_S_key_initialized = true;
}
__result = _S_new_per_thread_state();
__ret_code = pthread_setspecific(_S_key, __result);
if (__ret_code) {
if (__ret_code == ENOMEM) {
__THROW_BAD_ALLOC;
} else {
// EINVAL
abort();
}
}
return __result;
}
/* We allocate memory in large chunks in order to avoid fragmenting */
/* the malloc heap too much. */
/* We assume that size is properly aligned. */
template <size_t _Max_size>
char *_Pthread_alloc_template<_Max_size>
::_S_chunk_alloc(size_t __size, int &__nobjs)
{
{
char * __result;
size_t __total_bytes;
size_t __bytes_left;
/*REFERENCED*/
_M_lock __lock_instance; // Acquire lock for this routine
__total_bytes = __size * __nobjs;
__bytes_left = _S_end_free - _S_start_free;
if (__bytes_left >= __total_bytes) {
__result = _S_start_free;
_S_start_free += __total_bytes;
return(__result);
} else if (__bytes_left >= __size) {
__nobjs = __bytes_left/__size;
__total_bytes = __size * __nobjs;
__result = _S_start_free;
_S_start_free += __total_bytes;
return(__result);
} else {
size_t __bytes_to_get =
2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
// Try to make use of the left-over piece.
if (__bytes_left > 0) {
_Pthread_alloc_per_thread_state<_Max_size>* __a =
(_Pthread_alloc_per_thread_state<_Max_size>*)
pthread_getspecific(_S_key);
__obj * volatile * __my_free_list =
__a->__free_list + _S_freelist_index(__bytes_left);
((__obj *)_S_start_free) -> __free_list_link = *__my_free_list;
*__my_free_list = (__obj *)_S_start_free;
}
# ifdef _SGI_SOURCE
// Try to get memory that's aligned on something like a
// cache line boundary, so as to avoid parceling out
// parts of the same line to different threads and thus
// possibly different processors.
{
const int __cache_line_size = 128; // probable upper bound
__bytes_to_get &= ~(__cache_line_size-1);
_S_start_free = (char *)memalign(__cache_line_size, __bytes_to_get);
if (0 == _S_start_free) {
_S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
}
}
# else /* !SGI_SOURCE */
_S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
# endif
_S_heap_size += __bytes_to_get;
_S_end_free = _S_start_free + __bytes_to_get;
}
}
// lock is released here
return(_S_chunk_alloc(__size, __nobjs));
}
/* Returns an object of size n, and optionally adds to size n free list.*/
/* We assume that n is properly aligned. */
/* We hold the allocation lock. */
template <size_t _Max_size>
void *_Pthread_alloc_per_thread_state<_Max_size>
::_M_refill(size_t __n)
{
int __nobjs = 128;
char * __chunk =
_Pthread_alloc_template<_Max_size>::_S_chunk_alloc(__n, __nobjs);
__obj * volatile * __my_free_list;
__obj * __result;
__obj * __current_obj, * __next_obj;
int __i;
if (1 == __nobjs) {
return(__chunk);
}
__my_free_list = __free_list
+ _Pthread_alloc_template<_Max_size>::_S_freelist_index(__n);
/* Build free list in chunk */
__result = (__obj *)__chunk;
*__my_free_list = __next_obj = (__obj *)(__chunk + __n);
for (__i = 1; ; __i++) {
__current_obj = __next_obj;
__next_obj = (__obj *)((char *)__next_obj + __n);
if (__nobjs - 1 == __i) {
__current_obj -> __free_list_link = 0;
break;
} else {
__current_obj -> __free_list_link = __next_obj;
}
}
return(__result);
}
template <size_t _Max_size>
void *_Pthread_alloc_template<_Max_size>
::reallocate(void *__p, size_t __old_sz, size_t __new_sz)
{
void * __result;
size_t __copy_sz;
if (__old_sz > _Max_size
&& __new_sz > _Max_size) {
return(realloc(__p, __new_sz));
}
if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
__result = allocate(__new_sz);
__copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
memcpy(__result, __p, __copy_sz);
deallocate(__p, __old_sz);
return(__result);
}
template <size_t _Max_size>
_Pthread_alloc_per_thread_state<_Max_size> *
_Pthread_alloc_template<_Max_size>::_S_free_per_thread_states = 0;
template <size_t _Max_size>
pthread_key_t _Pthread_alloc_template<_Max_size>::_S_key;
template <size_t _Max_size>
bool _Pthread_alloc_template<_Max_size>::_S_key_initialized = false;
template <size_t _Max_size>
pthread_mutex_t _Pthread_alloc_template<_Max_size>::_S_chunk_allocator_lock
= PTHREAD_MUTEX_INITIALIZER;
template <size_t _Max_size>
char *_Pthread_alloc_template<_Max_size>
::_S_start_free = 0;
template <size_t _Max_size>
char *_Pthread_alloc_template<_Max_size>
::_S_end_free = 0;
template <size_t _Max_size>
size_t _Pthread_alloc_template<_Max_size>
::_S_heap_size = 0;
#ifdef __STL_USE_STD_ALLOCATORS
template <class _Tp>
class pthread_allocator {
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;
template <class _NewType> struct rebind {
typedef pthread_allocator<_NewType> other;
};
pthread_allocator() __STL_NOTHROW {}
pthread_allocator(const pthread_allocator& a) __STL_NOTHROW {}
template <class _OtherType>
pthread_allocator(const pthread_allocator<_OtherType>&)
__STL_NOTHROW {}
~pthread_allocator() __STL_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) {
return __n != 0 ? static_cast<_Tp*>(_S_Alloc::allocate(__n * sizeof(_Tp)))
: 0;
}
// p is not permitted to be a null pointer.
void deallocate(pointer __p, size_type __n)
{ _S_Alloc::deallocate(__p, __n * sizeof(_Tp)); }
size_type max_size() const __STL_NOTHROW
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
void destroy(pointer _p) { _p->~_Tp(); }
};
template<>
class 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;
template <class _NewType> struct rebind {
typedef pthread_allocator<_NewType> other;
};
};
template <size_t _Max_size>
inline bool operator==(const _Pthread_alloc_template<_Max_size>&,
const _Pthread_alloc_template<_Max_size>&)
{
return true;
}
template <class _T1, class _T2>
inline bool operator==(const pthread_allocator<_T1>&,
const pthread_allocator<_T2>& a2)
{
return true;
}
template <class _T1, class _T2>
inline bool operator!=(const pthread_allocator<_T1>&,
const pthread_allocator<_T2>&)
{
return false;
}
template <class _Tp, size_t _Max_size>
struct _Alloc_traits<_Tp, _Pthread_alloc_template<_Max_size> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max_size> > _Alloc_type;
typedef __allocator<_Tp, _Pthread_alloc_template<_Max_size> >
allocator_type;
};
template <class _Tp, class _Atype, size_t _Max>
struct _Alloc_traits<_Tp, __allocator<_Atype, _Pthread_alloc_template<_Max> > >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max> > _Alloc_type;
typedef __allocator<_Tp, _Pthread_alloc_template<_Max> > allocator_type;
};
template <class _Tp, class _Atype>
struct _Alloc_traits<_Tp, pthread_allocator<_Atype> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, _Pthread_alloc_template<> > _Alloc_type;
typedef pthread_allocator<_Tp> allocator_type;
};
#endif /* __STL_USE_STD_ALLOCATORS */
__STL_END_NAMESPACE
#endif /* __SGI_STL_PTHREAD_ALLOC */
// Local Variables:
// mode:C++
// End:

View File

@ -1,31 +0,0 @@
/*
* Copyright (c) 1996-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_PTHREAD_ALLOC_H
#define __SGI_STL_PTHREAD_ALLOC_H
#include <pthread_alloc>
#ifdef __STL_USE_NAMESPACES
using __STD::_Pthread_alloc_template;
using __STD::pthread_alloc;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_PTHREAD_ALLOC_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,45 +0,0 @@
/*
*
* 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,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_QUEUE
#define __SGI_STL_QUEUE
#include <stl_algobase.h>
#include <stl_alloc.h>
#include <stl_construct.h>
#include <stl_uninitialized.h>
#include <stl_vector.h>
#include <stl_bvector.h>
#include <stl_heap.h>
#include <stl_deque.h>
#include <stl_function.h>
#include <stl_queue.h>
#endif /* __SGI_STL_QUEUE */
// Local Variables:
// mode:C++
// End:

View File

@ -1,32 +0,0 @@
/*
* 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_ROPE
#define __SGI_STL_ROPE
#include <stl_algobase.h>
#include <stl_tempbuf.h>
#include <stl_algo.h>
#include <stl_function.h>
#include <stl_numeric.h>
#include <stl_alloc.h>
#include <stl_construct.h>
#include <stl_uninitialized.h>
#include <stl_hash_fun.h>
#include <stl_rope.h>
#endif /* __SGI_STL_ROPE */
// Local Variables:
// mode:C++
// End:

View File

@ -1,34 +0,0 @@
/*
* 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_ROPE_H
#define __SGI_STL_ROPE_H
#include <hashtable.h>
#include <stl_rope.h>
#ifdef __STL_USE_NAMESPACES
using __STD::char_producer;
using __STD::sequence_buffer;
using __STD::rope;
using __STD::crope;
using __STD::wrope;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_ROPE_H */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -1,204 +0,0 @@
/*
* 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.
*/
#ifndef STL_SEQUENCE_CONCEPTS_H
#define STL_SEQUENCE_CONCEPTS_H
#include <container_concepts.h>
#ifdef __STL_USE_CONCEPT_CHECKS
// This file covers the following concepts:
// _Sequence
// _FrontInsertionSequence
// _BackInsertionSequence
struct _ERROR_IN_STL_SEQ {
template <class _XX>
static void
__fill_constructor_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
typename _XX::difference_type __n = typename _XX::difference_type();
_XX __x(__n, __t);
__sink_unused_warning(__x);
}
template <class _XX>
static void
__fill_default_constructor_requirement_violation(_XX& __s) {
_STL_ERROR::__default_constructor_requirement_violation(*__s.begin());
typename _XX::difference_type __n = typename _XX::difference_type();
_XX __x(__n);
__sink_unused_warning(__x);
}
template <class _XX>
static void
__range_constructor_requirement_violation(_XX& __s) {
_XX __x(__s.begin(), __s.end());
__sink_unused_warning(__x);
}
template <class _XX>
static void
__insert_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
typename _XX::iterator __p = typename _XX::iterator();
__p = __s.insert(__p, __t);
}
template <class _XX>
static void
__fill_insert_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
typename _XX::iterator __p = typename _XX::iterator();
typename _XX::difference_type __n = typename _XX::difference_type();
__s.insert(__p, __n, __t);
}
template <class _XX>
static void
__range_insert_function_requirement_violation(_XX& __s) {
typename _XX::iterator __p = typename _XX::iterator();
typename _XX::iterator __i = typename _XX::iterator();
typename _XX::iterator __j = typename _XX::iterator();
__s.insert(__p, __i, __j);
}
template <class _XX>
static void
__insert_element_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
std::pair<typename _XX::iterator, bool> __r;
__r = __s.insert(__t);
__sink_unused_warning(__r);
}
template <class _XX>
static void
__unconditional_insert_element_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
typename _XX::iterator __p;
__p = __s.insert(__t);
__sink_unused_warning(__p);
}
template <class _XX>
static void
__erase_function_requirement_violation(_XX& __s) {
typename _XX::iterator __p = typename _XX::iterator();
__p = __s.erase(__p);
}
template <class _XX>
static void
__range_erase_function_requirement_violation(_XX& __s) {
typename _XX::iterator __p = typename _XX::iterator();
typename _XX::iterator __q = typename _XX::iterator();
__p = __s.erase(__p, __q);
}
template <class _XX>
static void
__const_front_function_requirement_violation(const _XX& __s) {
typename _XX::const_reference __t = __s.front();
__sink_unused_warning(__t);
}
template <class _XX>
static void
__front_function_requirement_violation(_XX& __s) {
typename _XX::reference __t = __s.front();
__const_front_function_requirement_violation(__s);
__sink_unused_warning(__t);
}
template <class _XX>
static void
__const_back_function_requirement_violation(const _XX& __s) {
typename _XX::const_reference __t = __s.back();
__sink_unused_warning(__t);
}
template <class _XX>
static void
__back_function_requirement_violation(_XX& __s) {
typename _XX::reference __t = __s.back();
__const_back_function_requirement_violation(__s);
__sink_unused_warning(__t);
}
template <class _XX>
static void
__push_front_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
__s.push_front(__t);
}
template <class _XX>
static void
__pop_front_function_requirement_violation(_XX& __s) {
__s.pop_front();
}
template <class _XX>
static void
__push_back_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
__s.push_back(__t);
}
template <class _XX>
static void
__pop_back_function_requirement_violation(_XX& __s) {
__s.pop_back();
}
};
/* Sequence Containers */
template <class _Sequence>
struct _Sequence_concept_specification {
static void
_Sequence_requirement_violation(_Sequence __s) {
// Refinement of ForwardContainer
_ForwardContainer_concept_specification<_Sequence>::_ForwardContainer_requirement_violation(__s);
// Refinement of DefaultConstructible
_DefaultConstructible_concept_specification<_Sequence>::_DefaultConstructible_requirement_violation(__s);
// Valid Expressions
_ERROR_IN_STL_SEQ::__fill_constructor_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__fill_default_constructor_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__range_constructor_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__insert_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__fill_insert_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__range_insert_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__erase_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__range_erase_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__front_function_requirement_violation(__s);
}
};
template <class _FrontInsertionSequence>
struct _FrontInsertionSequence_concept_specification {
static void
_FrontInsertionSequence_requirement_violation(_FrontInsertionSequence __s) {
// Refinement of Sequence
_Sequence_concept_specification<_FrontInsertionSequence>::_Sequence_requirement_violation(__s);
// Valid Expressions
_ERROR_IN_STL_SEQ::__push_front_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__pop_front_function_requirement_violation(__s);
}
};
template <class _BackInsertionSequence>
struct _BackInsertionSequence_concept_specification {
static void
_BackInsertionSequence_requirement_violation(_BackInsertionSequence __s) {
// Refinement of Sequence
_Sequence_concept_specification<_BackInsertionSequence>::_Sequence_requirement_violation(__s);
// Valid Expressions
_ERROR_IN_STL_SEQ::__back_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__push_back_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__pop_back_function_requirement_violation(__s);
}
};
#endif /* if __STL_USE_CONCEPT_CHECKS */
#endif /* STL_SEQUENCE_CONCEPTS_H */

View File

@ -1,40 +0,0 @@
/*
*
* 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,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_SET
#define __SGI_STL_SET
#ifndef __SGI_STL_INTERNAL_TREE_H
#include <stl_tree.h>
#endif
#include <stl_set.h>
#include <stl_multiset.h>
#endif /* __SGI_STL_SET */
// Local Variables:
// mode:C++
// End:

View File

@ -1,46 +0,0 @@
/*
*
* 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,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_SET_H
#define __SGI_STL_SET_H
#ifndef __SGI_STL_INTERNAL_TREE_H
#include <stl_tree.h>
#endif
#include <algobase.h>
#include <alloc.h>
#include <stl_set.h>
#ifdef __STL_USE_NAMESPACES
using __STD::rb_tree;
using __STD::set;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_SET_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,28 +0,0 @@
/*
* 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_SLIST
#define __SGI_STL_SLIST
#include <stl_algobase.h>
#include <stl_alloc.h>
#include <stl_construct.h>
#include <stl_uninitialized.h>
#include <stl_slist.h>
#endif /* __SGI_STL_SLIST */
// Local Variables:
// mode:C++
// End:

View File

@ -1,30 +0,0 @@
/*
* 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_SLIST_H
#define __SGI_STL_SLIST_H
#include <algobase.h>
#include <alloc.h>
#include <stl_slist.h>
#ifdef __STL_USE_NAMESPACES
using __STD::slist;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_SLIST_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,41 +0,0 @@
/*
*
* 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,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_STACK
#define __SGI_STL_STACK
#include <stl_algobase.h>
#include <stl_alloc.h>
#include <stl_construct.h>
#include <stl_uninitialized.h>
#include <stl_deque.h>
#include <stl_stack.h>
#endif /* __SGI_STL_STACK */
// Local Variables:
// mode:C++
// End:

View File

@ -1,46 +0,0 @@
/*
*
* 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,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_STACK_H
#define __SGI_STL_STACK_H
#include <vector.h>
#include <deque.h>
#include <heap.h>
#include <stl_stack.h>
#include <stl_queue.h>
#ifdef __STL_USE_NAMESPACES
using __STD::stack;
using __STD::queue;
using __STD::priority_queue;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_STACK_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,96 +0,0 @@
/*
* 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_STDEXCEPT
#define __SGI_STDEXCEPT
#include <stl_exception.h>
#if defined(__STL_USE_EXCEPTIONS) || \
!(defined(_MIPS_SIM) && defined(_ABIO32) && _MIPS_SIM == _ABIO32)
#include <stl_string_fwd.h>
__STL_BEGIN_NAMESPACE
class __Named_exception : public __STL_EXCEPTION_BASE {
public:
__Named_exception(const string& __str) {
strncpy(_M_name, __get_c_string(__str), _S_bufsize);
_M_name[_S_bufsize - 1] = '\0';
}
virtual const char* what() const __STL_NOTHROW { return _M_name; }
private:
enum { _S_bufsize = 256 };
char _M_name[_S_bufsize];
};
class logic_error : public __Named_exception {
public:
logic_error(const string& __s) : __Named_exception(__s) {}
};
class runtime_error : public __Named_exception {
public:
runtime_error(const string& __s) : __Named_exception(__s) {}
};
class domain_error : public logic_error {
public:
domain_error(const string& __arg) : logic_error(__arg) {}
};
class invalid_argument : public logic_error {
public:
invalid_argument(const string& __arg) : logic_error(__arg) {}
};
class length_error : public logic_error {
public:
length_error(const string& __arg) : logic_error(__arg) {}
};
class out_of_range : public logic_error {
public:
out_of_range(const string& __arg) : logic_error(__arg) {}
};
class range_error : public runtime_error {
public:
range_error(const string& __arg) : runtime_error(__arg) {}
};
class overflow_error : public runtime_error {
public:
overflow_error(const string& __arg) : runtime_error(__arg) {}
};
class underflow_error : public runtime_error {
public:
underflow_error(const string& __arg) : runtime_error(__arg) {}
};
__STL_END_NAMESPACE
#ifndef __SGI_STL_STRING
#include <string>
#endif
#endif /* Not o32, and no exceptions */
#endif /* __SGI_STDEXCEPT */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -1,696 +0,0 @@
/*
*
* 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_ALGOBASE_H
#define __SGI_STL_INTERNAL_ALGOBASE_H
#ifndef __STL_CONFIG_H
#include <stl_config.h>
#endif
#ifndef __SGI_STL_INTERNAL_RELOPS
#include <stl_relops.h>
#endif
#ifndef __SGI_STL_INTERNAL_PAIR_H
#include <stl_pair.h>
#endif
#ifndef __TYPE_TRAITS_H
#include <type_traits.h>
#endif
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <stddef.h>
#include <new.h>
#ifdef __STL_USE_NEW_IOSTREAMS
#include <iosfwd>
#else /* __STL_USE_NEW_IOSTREAMS */
#include <iostream.h>
#endif /* __STL_USE_NEW_IOSTREAMS */
#ifndef __SGI_STL_INTERNAL_ITERATOR_H
#include <stl_iterator_base.h>
#include <stl_iterator.h>
#endif
// We pick up concept_checks.h from stl_iterator_base.h.
__STL_BEGIN_NAMESPACE
// swap and iter_swap
template <class _ForwardIter1, class _ForwardIter2, class _Tp>
inline void __iter_swap(_ForwardIter1 __a, _ForwardIter2 __b, _Tp*) {
_Tp __tmp = *__a;
*__a = *__b;
*__b = __tmp;
}
template <class _ForwardIter1, class _ForwardIter2>
inline void iter_swap(_ForwardIter1 __a, _ForwardIter2 __b) {
__STL_REQUIRES(_ForwardIter1, _Mutable_ForwardIterator);
__STL_REQUIRES(_ForwardIter2, _Mutable_ForwardIterator);
__STL_CONVERTIBLE(typename iterator_traits<_ForwardIter1>::value_type,
typename iterator_traits<_ForwardIter2>::value_type);
__STL_CONVERTIBLE(typename iterator_traits<_ForwardIter2>::value_type,
typename iterator_traits<_ForwardIter1>::value_type);
__iter_swap(__a, __b, __VALUE_TYPE(__a));
}
template <class _Tp>
inline void swap(_Tp& __a, _Tp& __b) {
__STL_REQUIRES(_Tp, _Assignable);
_Tp __tmp = __a;
__a = __b;
__b = __tmp;
}
//--------------------------------------------------
// min and max
#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x540 /* C++ Builder 4.0 */
#undef min
#undef max
template <class _Tp>
inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
__STL_REQUIRES(_Tp, _LessThanComparable);
return __b < __a ? __b : __a;
}
template <class _Tp>
inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
__STL_REQUIRES(_Tp, _LessThanComparable);
return __a < __b ? __b : __a;
}
#endif /* __BORLANDC__ */
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.
template <class _InputIter, class _OutputIter, class _Distance>
inline _OutputIter __copy(_InputIter __first, _InputIter __last,
_OutputIter __result,
input_iterator_tag, _Distance*)
{
for ( ; __first != __last; ++__result, ++__first)
*__result = *__first;
return __result;
}
template <class _RandomAccessIter, class _OutputIter, class _Distance>
inline _OutputIter
__copy(_RandomAccessIter __first, _RandomAccessIter __last,
_OutputIter __result, random_access_iterator_tag, _Distance*)
{
for (_Distance __n = __last - __first; __n > 0; --__n) {
*__result = *__first;
++__first;
++__result;
}
return __result;
}
template <class _Tp>
inline _Tp*
__copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result) {
memmove(__result, __first, sizeof(_Tp) * (__last - __first));
return __result + (__last - __first);
}
#if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER)
template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last,
_OutputIter __result, __false_type) {
return __copy(__first, __last, __result,
__ITERATOR_CATEGORY(__first),
__DISTANCE_TYPE(__first));
}
template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last,
_OutputIter __result, __true_type) {
return __copy(__first, __last, __result,
__ITERATOR_CATEGORY(__first),
__DISTANCE_TYPE(__first));
}
#ifndef __USLC__
template <class _Tp>
inline _Tp* __copy_aux2(_Tp* __first, _Tp* __last, _Tp* __result,
__true_type) {
return __copy_trivial(__first, __last, __result);
}
#endif /* __USLC__ */
template <class _Tp>
inline _Tp* __copy_aux2(const _Tp* __first, const _Tp* __last, _Tp* __result,
__true_type) {
return __copy_trivial(__first, __last, __result);
}
template <class _InputIter, class _OutputIter, class _Tp>
inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last,
_OutputIter __result, _Tp*) {
typedef typename __type_traits<_Tp>::has_trivial_assignment_operator
_Trivial;
return __copy_aux2(__first, __last, __result, _Trivial());
}
template <class _InputIter, class _OutputIter>
inline _OutputIter copy(_InputIter __first, _InputIter __last,
_OutputIter __result) {
__STL_REQUIRES(_InputIter, _InputIterator);
__STL_REQUIRES(_OutputIter, _OutputIterator);
return __copy_aux(__first, __last, __result, __VALUE_TYPE(__first));
}
// Hack for compilers that don't have partial ordering of function templates
// but do have partial specialization of class templates.
#elif defined(__STL_CLASS_PARTIAL_SPECIALIZATION)
template <class _InputIter, class _OutputIter, class _BoolType>
struct __copy_dispatch {
static _OutputIter copy(_InputIter __first, _InputIter __last,
_OutputIter __result) {
typedef typename iterator_traits<_InputIter>::iterator_category _Category;
typedef typename iterator_traits<_InputIter>::difference_type _Distance;
return __copy(__first, __last, __result, _Category(), (_Distance*) 0);
}
};
template <class _Tp>
struct __copy_dispatch<_Tp*, _Tp*, __true_type>
{
static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
return __copy_trivial(__first, __last, __result);
}
};
template <class _Tp>
struct __copy_dispatch<const _Tp*, _Tp*, __true_type>
{
static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
return __copy_trivial(__first, __last, __result);
}
};
template <class _InputIter, class _OutputIter>
inline _OutputIter copy(_InputIter __first, _InputIter __last,
_OutputIter __result) {
__STL_REQUIRES(_InputIter, _InputIterator);
__STL_REQUIRES(_OutputIter, _OutputIterator);
typedef typename iterator_traits<_InputIter>::value_type _Tp;
typedef typename __type_traits<_Tp>::has_trivial_assignment_operator
_Trivial;
return __copy_dispatch<_InputIter, _OutputIter, _Trivial>
::copy(__first, __last, __result);
}
// Fallback for compilers with neither partial ordering nor partial
// specialization. Define the faster version for the basic builtin
// types.
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
template <class _InputIter, class _OutputIter>
inline _OutputIter copy(_InputIter __first, _InputIter __last,
_OutputIter __result)
{
return __copy(__first, __last, __result,
__ITERATOR_CATEGORY(__first),
__DISTANCE_TYPE(__first));
}
#define __SGI_STL_DECLARE_COPY_TRIVIAL(_Tp) \
inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { \
memmove(__result, __first, sizeof(_Tp) * (__last - __first)); \
return __result + (__last - __first); \
}
__SGI_STL_DECLARE_COPY_TRIVIAL(char)
__SGI_STL_DECLARE_COPY_TRIVIAL(signed char)
__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned char)
__SGI_STL_DECLARE_COPY_TRIVIAL(short)
__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned short)
__SGI_STL_DECLARE_COPY_TRIVIAL(int)
__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned int)
__SGI_STL_DECLARE_COPY_TRIVIAL(long)
__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned long)
#ifdef __STL_HAS_WCHAR_T
__SGI_STL_DECLARE_COPY_TRIVIAL(wchar_t)
#endif
#ifdef _STL_LONG_LONG
__SGI_STL_DECLARE_COPY_TRIVIAL(long long)
__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned long long)
#endif
__SGI_STL_DECLARE_COPY_TRIVIAL(float)
__SGI_STL_DECLARE_COPY_TRIVIAL(double)
__SGI_STL_DECLARE_COPY_TRIVIAL(long double)
#undef __SGI_STL_DECLARE_COPY_TRIVIAL
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
//--------------------------------------------------
// copy_backward
template <class _BidirectionalIter1, class _BidirectionalIter2,
class _Distance>
inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first,
_BidirectionalIter1 __last,
_BidirectionalIter2 __result,
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,
random_access_iterator_tag,
_Distance*)
{
for (_Distance __n = __last - __first; __n > 0; --__n)
*--__result = *--__last;
return __result;
}
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
// This dispatch class is a workaround for compilers that do not
// have partial ordering of function templates. All we're doing is
// creating a specialization so that we can turn a call to copy_backward
// into a memmove whenever possible.
template <class _BidirectionalIter1, class _BidirectionalIter2,
class _BoolType>
struct __copy_backward_dispatch
{
typedef typename iterator_traits<_BidirectionalIter1>::iterator_category
_Cat;
typedef typename iterator_traits<_BidirectionalIter1>::difference_type
_Distance;
static _BidirectionalIter2 copy(_BidirectionalIter1 __first,
_BidirectionalIter1 __last,
_BidirectionalIter2 __result) {
return __copy_backward(__first, __last, __result, _Cat(), (_Distance*) 0);
}
};
template <class _Tp>
struct __copy_backward_dispatch<_Tp*, _Tp*, __true_type>
{
static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
const ptrdiff_t _Num = __last - __first;
memmove(__result - _Num, __first, sizeof(_Tp) * _Num);
return __result - _Num;
}
};
template <class _Tp>
struct __copy_backward_dispatch<const _Tp*, _Tp*, __true_type>
{
static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
return __copy_backward_dispatch<_Tp*, _Tp*, __true_type>
::copy(__first, __last, __result);
}
};
template <class _BI1, class _BI2>
inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) {
__STL_REQUIRES(_BI1, _BidirectionalIterator);
__STL_REQUIRES(_BI2, _Mutable_BidirectionalIterator);
__STL_CONVERTIBLE(typename iterator_traits<_BI1>::value_type,
typename iterator_traits<_BI2>::value_type);
typedef typename __type_traits<typename iterator_traits<_BI2>::value_type>
::has_trivial_assignment_operator
_Trivial;
return __copy_backward_dispatch<_BI1, _BI2, _Trivial>
::copy(__first, __last, __result);
}
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
template <class _BI1, class _BI2>
inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) {
return __copy_backward(__first, __last, __result,
__ITERATOR_CATEGORY(__first),
__DISTANCE_TYPE(__first));
}
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
//--------------------------------------------------
// copy_n (not part of the C++ standard)
template <class _InputIter, class _Size, class _OutputIter>
pair<_InputIter, _OutputIter> __copy_n(_InputIter __first, _Size __count,
_OutputIter __result,
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,
random_access_iterator_tag) {
_RAIter __last = __first + __count;
return pair<_RAIter, _OutputIter>(__last, copy(__first, __last, __result));
}
template <class _InputIter, class _Size, class _OutputIter>
inline pair<_InputIter, _OutputIter>
__copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
return __copy_n(__first, __count, __result,
__ITERATOR_CATEGORY(__first));
}
template <class _InputIter, class _Size, class _OutputIter>
inline pair<_InputIter, _OutputIter>
copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
__STL_REQUIRES(_InputIter, _InputIterator);
__STL_REQUIRES(_OutputIter, _OutputIterator);
return __copy_n(__first, __count, __result);
}
//--------------------------------------------------
// fill and fill_n
template <class _ForwardIter, class _Tp>
void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) {
__STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator);
for ( ; __first != __last; ++__first)
*__first = __value;
}
template <class _OutputIter, class _Size, class _Tp>
_OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) {
__STL_REQUIRES(_OutputIter, _OutputIterator);
for ( ; __n > 0; --__n, ++__first)
*__first = __value;
return __first;
}
// Specialization: for one-byte types we can use memset.
inline void fill(unsigned char* __first, unsigned char* __last,
const unsigned char& __c) {
unsigned char __tmp = __c;
memset(__first, __tmp, __last - __first);
}
inline void fill(signed char* __first, signed char* __last,
const signed char& __c) {
signed char __tmp = __c;
memset(__first, static_cast<unsigned char>(__tmp), __last - __first);
}
inline void fill(char* __first, char* __last, const char& __c) {
char __tmp = __c;
memset(__first, static_cast<unsigned char>(__tmp), __last - __first);
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Size>
inline unsigned char* fill_n(unsigned char* __first, _Size __n,
const unsigned char& __c) {
fill(__first, __first + __n, __c);
return __first + __n;
}
template <class _Size>
inline signed char* fill_n(char* __first, _Size __n,
const signed char& __c) {
fill(__first, __first + __n, __c);
return __first + __n;
}
template <class _Size>
inline char* fill_n(char* __first, _Size __n, const char& __c) {
fill(__first, __first + __n, __c);
return __first + __n;
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
//--------------------------------------------------
// equal and mismatch
template <class _InputIter1, class _InputIter2>
pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
_InputIter1 __last1,
_InputIter2 __first2) {
__STL_REQUIRES(_InputIter1, _InputIterator);
__STL_REQUIRES(_InputIter2, _InputIterator);
__STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type,
_EqualityComparable);
__STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type,
_EqualityComparable);
while (__first1 != __last1 && *__first1 == *__first2) {
++__first1;
++__first2;
}
return pair<_InputIter1, _InputIter2>(__first1, __first2);
}
template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
_InputIter1 __last1,
_InputIter2 __first2,
_BinaryPredicate __binary_pred) {
__STL_REQUIRES(_InputIter1, _InputIterator);
__STL_REQUIRES(_InputIter2, _InputIterator);
while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) {
++__first1;
++__first2;
}
return pair<_InputIter1, _InputIter2>(__first1, __first2);
}
template <class _InputIter1, class _InputIter2>
inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2) {
__STL_REQUIRES(_InputIter1, _InputIterator);
__STL_REQUIRES(_InputIter2, _InputIterator);
__STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type,
_EqualityComparable);
__STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type,
_EqualityComparable);
for ( ; __first1 != __last1; ++__first1, ++__first2)
if (*__first1 != *__first2)
return false;
return true;
}
template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _BinaryPredicate __binary_pred) {
__STL_REQUIRES(_InputIter1, _InputIterator);
__STL_REQUIRES(_InputIter2, _InputIterator);
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) {
__STL_REQUIRES(_InputIter1, _InputIterator);
__STL_REQUIRES(_InputIter2, _InputIterator);
__STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type,
_LessThanComparable);
__STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type,
_LessThanComparable);
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) {
__STL_REQUIRES(_InputIter1, _InputIterator);
__STL_REQUIRES(_InputIter2, _InputIterator);
for ( ; __first1 != __last1 && __first2 != __last2
; ++__first1, ++__first2) {
if (__comp(*__first1, *__first2))
return true;
if (__comp(*__first2, *__first1))
return false;
}
return __first1 == __last1 && __first2 != __last2;
}
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;
const int __result = memcmp(__first1, __first2, min(__len1, __len2));
return __result != 0 ? __result < 0 : __len1 < __len2;
}
inline bool lexicographical_compare(const char* __first1, const char* __last1,
const char* __first2, const char* __last2)
{
#if CHAR_MAX == SCHAR_MAX
return lexicographical_compare((const signed char*) __first1,
(const signed char*) __last1,
(const signed char*) __first2,
(const signed char*) __last2);
#else /* CHAR_MAX == SCHAR_MAX */
return lexicographical_compare((const unsigned char*) __first1,
(const unsigned char*) __last1,
(const unsigned char*) __first2,
(const unsigned char*) __last2);
#endif /* CHAR_MAX == SCHAR_MAX */
}
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)
return -1;
if (*__first2 < *__first1)
return 1;
++__first1;
++__first2;
}
if (__first2 == __last2) {
return !(__first1 == __last1);
}
else {
return -1;
}
}
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));
}
inline int
__lexicographical_compare_3way(const char* __first1, const char* __last1,
const char* __first2, const char* __last2)
{
#if CHAR_MAX == SCHAR_MAX
return __lexicographical_compare_3way(
(const signed char*) __first1,
(const signed char*) __last1,
(const signed char*) __first2,
(const signed char*) __last2);
#else
return __lexicographical_compare_3way((const unsigned char*) __first1,
(const unsigned char*) __last1,
(const unsigned char*) __first2,
(const unsigned char*) __last2);
#endif
}
template <class _InputIter1, class _InputIter2>
int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2)
{
__STL_REQUIRES(_InputIter1, _InputIterator);
__STL_REQUIRES(_InputIter2, _InputIterator);
__STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type,
_LessThanComparable);
__STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type,
_LessThanComparable);
return __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
}
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_ALGOBASE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,897 +0,0 @@
/*
* Copyright (c) 1996-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_ALLOC_H
#define __SGI_STL_INTERNAL_ALLOC_H
#ifdef __SUNPRO_CC
# define __PRIVATE public
// Extra access restrictions prevent us from really making some things
// private.
#else
# define __PRIVATE private
#endif
#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
# define __USE_MALLOC
#endif
// This implements some standard node allocators. These are
// NOT the same as the allocators in the C++ draft standard or in
// in the original STL. They do not encapsulate different pointer
// types; indeed we assume that there is only one pointer type.
// The allocation primitives are intended to allocate individual objects,
// not larger arenas as with the original STL allocators.
#ifndef __THROW_BAD_ALLOC
# if defined(__STL_NO_BAD_ALLOC) || !defined(__STL_USE_EXCEPTIONS)
# include <stdio.h>
# include <stdlib.h>
# define __THROW_BAD_ALLOC fprintf(stderr, "out of memory\n"); exit(1)
# else /* Standard conforming out-of-memory handling */
# include <new>
# define __THROW_BAD_ALLOC throw std::bad_alloc()
# endif
#endif
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#ifndef __RESTRICT
# define __RESTRICT
#endif
#ifdef __STL_THREADS
# include <stl_threads.h>
# define __NODE_ALLOCATOR_THREADS true
# ifdef __STL_SGI_THREADS
// We test whether threads are in use before locking.
// Perhaps this should be moved into stl_threads.h, but that
// probably makes it harder to avoid the procedure call when
// it isn't needed.
extern "C" {
extern int __us_rsthread_malloc;
}
// The above is copied from malloc.h. Including <malloc.h>
// would be cleaner but fails with certain levels of standard
// conformance.
# define __NODE_ALLOCATOR_LOCK if (threads && __us_rsthread_malloc) \
{ _S_node_allocator_lock._M_acquire_lock(); }
# define __NODE_ALLOCATOR_UNLOCK if (threads && __us_rsthread_malloc) \
{ _S_node_allocator_lock._M_release_lock(); }
# else /* !__STL_SGI_THREADS */
# define __NODE_ALLOCATOR_LOCK \
{ if (threads) _S_node_allocator_lock._M_acquire_lock(); }
# define __NODE_ALLOCATOR_UNLOCK \
{ if (threads) _S_node_allocator_lock._M_release_lock(); }
# endif
#else
// Thread-unsafe
# define __NODE_ALLOCATOR_LOCK
# define __NODE_ALLOCATOR_UNLOCK
# define __NODE_ALLOCATOR_THREADS false
#endif
__STL_BEGIN_NAMESPACE
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#endif
// Malloc-based allocator. Typically slower than default alloc below.
// Typically thread-safe and more storage efficient.
#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
# ifdef __DECLARE_GLOBALS_HERE
void (* __malloc_alloc_oom_handler)() = 0;
// g++ 2.7.2 does not handle static template data members.
# else
extern void (* __malloc_alloc_oom_handler)();
# endif
#endif
template <int __inst>
class __malloc_alloc_template {
private:
static void* _S_oom_malloc(size_t);
static void* _S_oom_realloc(void*, size_t);
#ifndef __STL_STATIC_TEMPLATE_MEMBER_BUG
static void (* __malloc_alloc_oom_handler)();
#endif
public:
static void* allocate(size_t __n)
{
void* __result = malloc(__n);
if (0 == __result) __result = _S_oom_malloc(__n);
return __result;
}
static void deallocate(void* __p, size_t /* __n */)
{
free(__p);
}
static void* reallocate(void* __p, size_t /* old_sz */, size_t __new_sz)
{
void* __result = realloc(__p, __new_sz);
if (0 == __result) __result = _S_oom_realloc(__p, __new_sz);
return __result;
}
static void (* __set_malloc_handler(void (*__f)()))()
{
void (* __old)() = __malloc_alloc_oom_handler;
__malloc_alloc_oom_handler = __f;
return(__old);
}
};
// malloc_alloc out-of-memory handling
#ifndef __STL_STATIC_TEMPLATE_MEMBER_BUG
template <int __inst>
void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0;
#endif
template <int __inst>
void*
__malloc_alloc_template<__inst>::_S_oom_malloc(size_t __n)
{
void (* __my_malloc_handler)();
void* __result;
for (;;) {
__my_malloc_handler = __malloc_alloc_oom_handler;
if (0 == __my_malloc_handler) { __THROW_BAD_ALLOC; }
(*__my_malloc_handler)();
__result = malloc(__n);
if (__result) return(__result);
}
}
template <int __inst>
void* __malloc_alloc_template<__inst>::_S_oom_realloc(void* __p, size_t __n)
{
void (* __my_malloc_handler)();
void* __result;
for (;;) {
__my_malloc_handler = __malloc_alloc_oom_handler;
if (0 == __my_malloc_handler) { __THROW_BAD_ALLOC; }
(*__my_malloc_handler)();
__result = realloc(__p, __n);
if (__result) return(__result);
}
}
typedef __malloc_alloc_template<0> malloc_alloc;
template<class _Tp, class _Alloc>
class simple_alloc {
public:
static _Tp* allocate(size_t __n)
{ return 0 == __n ? 0 : (_Tp*) _Alloc::allocate(__n * sizeof (_Tp)); }
static _Tp* allocate(void)
{ return (_Tp*) _Alloc::allocate(sizeof (_Tp)); }
static void deallocate(_Tp* __p, size_t __n)
{ if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); }
static void deallocate(_Tp* __p)
{ _Alloc::deallocate(__p, sizeof (_Tp)); }
};
// 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.
template <class _Alloc>
class debug_alloc {
private:
enum {_S_extra = 8}; // Size of space used to store size. Note
// that this must be large enough to preserve
// alignment.
public:
static void* allocate(size_t __n)
{
char* __result = (char*)_Alloc::allocate(__n + (int) _S_extra);
*(size_t*)__result = __n;
return __result + (int) _S_extra;
}
static void deallocate(void* __p, size_t __n)
{
char* __real_p = (char*)__p - (int) _S_extra;
assert(*(size_t*)__real_p == __n);
_Alloc::deallocate(__real_p, __n + (int) _S_extra);
}
static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz)
{
char* __real_p = (char*)__p - (int) _S_extra;
assert(*(size_t*)__real_p == __old_sz);
char* __result = (char*)
_Alloc::reallocate(__real_p, __old_sz + (int) _S_extra,
__new_sz + (int) _S_extra);
*(size_t*)__result = __new_sz;
return __result + (int) _S_extra;
}
};
# ifdef __USE_MALLOC
typedef malloc_alloc alloc;
typedef malloc_alloc single_client_alloc;
# else
// Default node allocator.
// With a reasonable compiler, this should be roughly as fast as the
// original STL class-specific allocators, but with less fragmentation.
// Default_alloc_template parameters are experimental and MAY
// DISAPPEAR in the future. Clients should just use alloc for now.
//
// Important implementation properties:
// 1. If the client request an object of size > _MAX_BYTES, the resulting
// object will be obtained directly from malloc.
// 2. In all other cases, we allocate an object of size exactly
// _S_round_up(requested_size). Thus the client has enough size
// information that we can return the object to the proper free list
// without permanently losing part of the object.
//
// The first template parameter specifies whether more than one thread
// may use this allocator. It is safe to allocate an object from
// one instance of a default_alloc and deallocate it with another
// one. This effectively transfers its ownership to the second one.
// This may have undesirable effects on reference locality.
// The second parameter is unreferenced and serves only to allow the
// creation of multiple default_alloc instances.
// Node that containers built on different allocator instances have
// different types, limiting the utility of this approach.
#if defined(__SUNPRO_CC) || defined(__GNUC__)
// breaks if we make these template class members:
enum {_ALIGN = 8};
enum {_MAX_BYTES = 128};
enum {_NFREELISTS = 16}; // _MAX_BYTES/_ALIGN
#endif
template <bool threads, int inst>
class __default_alloc_template {
private:
// Really we should use static const int x = N
// instead of enum { x = N }, but few compilers accept the former.
#if ! (defined(__SUNPRO_CC) || defined(__GNUC__))
enum {_ALIGN = 8};
enum {_MAX_BYTES = 128};
enum {_NFREELISTS = 16}; // _MAX_BYTES/_ALIGN
# endif
static size_t
_S_round_up(size_t __bytes)
{ return (((__bytes) + (size_t) _ALIGN-1) & ~((size_t) _ALIGN - 1)); }
__PRIVATE:
union _Obj {
union _Obj* _M_free_list_link;
char _M_client_data[1]; /* The client sees this. */
};
private:
# if defined(__SUNPRO_CC) || defined(__GNUC__) || defined(__HP_aCC)
static _Obj* __STL_VOLATILE _S_free_list[];
// Specifying a size results in duplicate def for 4.1
# else
static _Obj* __STL_VOLATILE _S_free_list[_NFREELISTS];
# endif
static size_t _S_freelist_index(size_t __bytes) {
return (((__bytes) + (size_t)_ALIGN-1)/(size_t)_ALIGN - 1);
}
// Returns an object of size __n, and optionally adds to size __n free list.
static void* _S_refill(size_t __n);
// Allocates a chunk for nobjs of size size. nobjs may be reduced
// if it is inconvenient to allocate the requested number.
static char* _S_chunk_alloc(size_t __size, int& __nobjs);
// Chunk allocation state.
static char* _S_start_free;
static char* _S_end_free;
static size_t _S_heap_size;
# ifdef __STL_THREADS
static _STL_mutex_lock _S_node_allocator_lock;
# endif
// It would be nice to use _STL_auto_lock here. But we
// don't need the NULL check. And we do need a test whether
// threads have actually been started.
class _Lock;
friend class _Lock;
class _Lock {
public:
_Lock() { __NODE_ALLOCATOR_LOCK; }
~_Lock() { __NODE_ALLOCATOR_UNLOCK; }
};
public:
/* __n must be > 0 */
static void* allocate(size_t __n)
{
void* __ret = 0;
if (__n > (size_t) _MAX_BYTES) {
__ret = malloc_alloc::allocate(__n);
}
else {
_Obj* __STL_VOLATILE* __my_free_list
= _S_free_list + _S_freelist_index(__n);
// Acquire the lock here with a constructor call.
// This ensures that it is released in exit or during stack
// unwinding.
# ifndef _NOTHREADS
/*REFERENCED*/
_Lock __lock_instance;
# endif
_Obj* __RESTRICT __result = *__my_free_list;
if (__result == 0)
__ret = _S_refill(_S_round_up(__n));
else {
*__my_free_list = __result -> _M_free_list_link;
__ret = __result;
}
}
return __ret;
};
/* __p may not be 0 */
static void deallocate(void* __p, size_t __n)
{
if (__n > (size_t) _MAX_BYTES)
malloc_alloc::deallocate(__p, __n);
else {
_Obj* __STL_VOLATILE* __my_free_list
= _S_free_list + _S_freelist_index(__n);
_Obj* __q = (_Obj*)__p;
// acquire lock
# ifndef _NOTHREADS
/*REFERENCED*/
_Lock __lock_instance;
# endif /* _NOTHREADS */
__q -> _M_free_list_link = *__my_free_list;
*__my_free_list = __q;
// lock is released here
}
}
static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz);
} ;
typedef __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0> alloc;
typedef __default_alloc_template<false, 0> single_client_alloc;
template <bool __threads, int __inst>
inline bool operator==(const __default_alloc_template<__threads, __inst>&,
const __default_alloc_template<__threads, __inst>&)
{
return true;
}
# ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <bool __threads, int __inst>
inline bool operator!=(const __default_alloc_template<__threads, __inst>&,
const __default_alloc_template<__threads, __inst>&)
{
return false;
}
# endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
/* We allocate memory in large chunks in order to avoid fragmenting */
/* the malloc heap too much. */
/* We assume that size is properly aligned. */
/* We hold the allocation lock. */
template <bool __threads, int __inst>
char*
__default_alloc_template<__threads, __inst>::_S_chunk_alloc(size_t __size,
int& __nobjs)
{
char* __result;
size_t __total_bytes = __size * __nobjs;
size_t __bytes_left = _S_end_free - _S_start_free;
if (__bytes_left >= __total_bytes) {
__result = _S_start_free;
_S_start_free += __total_bytes;
return(__result);
} else if (__bytes_left >= __size) {
__nobjs = (int)(__bytes_left/__size);
__total_bytes = __size * __nobjs;
__result = _S_start_free;
_S_start_free += __total_bytes;
return(__result);
} else {
size_t __bytes_to_get =
2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
// Try to make use of the left-over piece.
if (__bytes_left > 0) {
_Obj* __STL_VOLATILE* __my_free_list =
_S_free_list + _S_freelist_index(__bytes_left);
((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list;
*__my_free_list = (_Obj*)_S_start_free;
}
_S_start_free = (char*)malloc(__bytes_to_get);
if (0 == _S_start_free) {
size_t __i;
_Obj* __STL_VOLATILE* __my_free_list;
_Obj* __p;
// Try to make do with what we have. That can't
// hurt. We do not try smaller requests, since that tends
// to result in disaster on multi-process machines.
for (__i = __size;
__i <= (size_t) _MAX_BYTES;
__i += (size_t) _ALIGN) {
__my_free_list = _S_free_list + _S_freelist_index(__i);
__p = *__my_free_list;
if (0 != __p) {
*__my_free_list = __p -> _M_free_list_link;
_S_start_free = (char*)__p;
_S_end_free = _S_start_free + __i;
return(_S_chunk_alloc(__size, __nobjs));
// Any leftover piece will eventually make it to the
// right free list.
}
}
_S_end_free = 0; // In case of exception.
_S_start_free = (char*)malloc_alloc::allocate(__bytes_to_get);
// This should either throw an
// exception or remedy the situation. Thus we assume it
// succeeded.
}
_S_heap_size += __bytes_to_get;
_S_end_free = _S_start_free + __bytes_to_get;
return(_S_chunk_alloc(__size, __nobjs));
}
}
/* Returns an object of size __n, and optionally adds to size __n free list.*/
/* We assume that __n is properly aligned. */
/* We hold the allocation lock. */
template <bool __threads, int __inst>
void*
__default_alloc_template<__threads, __inst>::_S_refill(size_t __n)
{
int __nobjs = 20;
char* __chunk = _S_chunk_alloc(__n, __nobjs);
_Obj* __STL_VOLATILE* __my_free_list;
_Obj* __result;
_Obj* __current_obj;
_Obj* __next_obj;
int __i;
if (1 == __nobjs) return(__chunk);
__my_free_list = _S_free_list + _S_freelist_index(__n);
/* Build free list in chunk */
__result = (_Obj*)__chunk;
*__my_free_list = __next_obj = (_Obj*)(__chunk + __n);
for (__i = 1; ; __i++) {
__current_obj = __next_obj;
__next_obj = (_Obj*)((char*)__next_obj + __n);
if (__nobjs - 1 == __i) {
__current_obj -> _M_free_list_link = 0;
break;
} else {
__current_obj -> _M_free_list_link = __next_obj;
}
}
return(__result);
}
template <bool threads, int inst>
void*
__default_alloc_template<threads, inst>::reallocate(void* __p,
size_t __old_sz,
size_t __new_sz)
{
void* __result;
size_t __copy_sz;
if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES) {
return(realloc(__p, __new_sz));
}
if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
__result = allocate(__new_sz);
__copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
memcpy(__result, __p, __copy_sz);
deallocate(__p, __old_sz);
return(__result);
}
#ifdef __STL_THREADS
template <bool __threads, int __inst>
_STL_mutex_lock
__default_alloc_template<__threads, __inst>::_S_node_allocator_lock
__STL_MUTEX_INITIALIZER;
#endif
template <bool __threads, int __inst>
char* __default_alloc_template<__threads, __inst>::_S_start_free = 0;
template <bool __threads, int __inst>
char* __default_alloc_template<__threads, __inst>::_S_end_free = 0;
template <bool __threads, int __inst>
size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0;
template <bool __threads, int __inst>
typename __default_alloc_template<__threads, __inst>::_Obj* __STL_VOLATILE
__default_alloc_template<__threads, __inst> ::_S_free_list[
# if defined(__SUNPRO_CC) || defined(__GNUC__) || defined(__HP_aCC)
_NFREELISTS
# else
__default_alloc_template<__threads, __inst>::_NFREELISTS
# endif
] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
// The 16 zeros are necessary to make version 4.1 of the SunPro
// compiler happy. Otherwise it appears to allocate too little
// space for the array.
#endif /* ! __USE_MALLOC */
// 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.
#ifdef __STL_USE_STD_ALLOCATORS
template <class _Tp>
class allocator {
typedef alloc _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;
template <class _Tp1> struct rebind {
typedef allocator<_Tp1> other;
};
allocator() __STL_NOTHROW {}
allocator(const allocator&) __STL_NOTHROW {}
template <class _Tp1> allocator(const allocator<_Tp1>&) __STL_NOTHROW {}
~allocator() __STL_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) {
return __n != 0 ? static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp)))
: 0;
}
// __p is not permitted to be a null pointer.
void deallocate(pointer __p, size_type __n)
{ _Alloc::deallocate(__p, __n * sizeof(_Tp)); }
size_type max_size() const __STL_NOTHROW
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
void destroy(pointer __p) { __p->~_Tp(); }
};
template<>
class 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;
template <class _Tp1> struct rebind {
typedef allocator<_Tp1> other;
};
};
template <class _T1, class _T2>
inline bool operator==(const allocator<_T1>&, const allocator<_T2>&)
{
return true;
}
template <class _T1, class _T2>
inline bool operator!=(const allocator<_T1>&, const allocator<_T2>&)
{
return false;
}
// 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 {
_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;
template <class _Tp1> struct rebind {
typedef __allocator<_Tp1, _Alloc> other;
};
__allocator() __STL_NOTHROW {}
__allocator(const __allocator& __a) __STL_NOTHROW
: __underlying_alloc(__a.__underlying_alloc) {}
template <class _Tp1>
__allocator(const __allocator<_Tp1, _Alloc>& __a) __STL_NOTHROW
: __underlying_alloc(__a.__underlying_alloc) {}
~__allocator() __STL_NOTHROW {}
pointer address(reference __x) const { return &__x; }
const_pointer address(const_reference __x) const { return &__x; }
// __n is permitted to be 0.
_Tp* allocate(size_type __n, const void* = 0) {
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)
{ __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); }
size_type max_size() const __STL_NOTHROW
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
void destroy(pointer __p) { __p->~_Tp(); }
};
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;
template <class _Tp1> struct rebind {
typedef __allocator<_Tp1, _Alloc> other;
};
};
template <class _Tp, class _Alloc>
inline bool operator==(const __allocator<_Tp, _Alloc>& __a1,
const __allocator<_Tp, _Alloc>& __a2)
{
return __a1.__underlying_alloc == __a2.__underlying_alloc;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Tp, class _Alloc>
inline bool operator!=(const __allocator<_Tp, _Alloc>& __a1,
const __allocator<_Tp, _Alloc>& __a2)
{
return __a1.__underlying_alloc != __a2.__underlying_alloc;
}
#endif /* __STL_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.
template <int inst>
inline bool operator==(const __malloc_alloc_template<inst>&,
const __malloc_alloc_template<inst>&)
{
return true;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <int __inst>
inline bool operator!=(const __malloc_alloc_template<__inst>&,
const __malloc_alloc_template<__inst>&)
{
return false;
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
template <class _Alloc>
inline bool operator==(const debug_alloc<_Alloc>&,
const debug_alloc<_Alloc>&) {
return true;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Alloc>
inline bool operator!=(const debug_alloc<_Alloc>&,
const debug_alloc<_Alloc>&) {
return false;
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
// 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.
// Second, provide a mechanism so that containers can query whether or
// not the allocator has distinct instances. If not, the container
// can avoid wasting a word of memory to store an empty object.
// This adaptor uses partial specialization. The general case of
// _Alloc_traits<_Tp, _Alloc> assumes that _Alloc is a
// standard-conforming allocator, possibly with non-equal instances
// and non-static members. (It still behaves correctly even if _Alloc
// has static member and if all instances are equal. Refinements
// affect performance, not correctness.)
// There are always two members: allocator_type, which is a standard-
// conforming allocator type for allocating objects of type _Tp, and
// _S_instanceless, a static const member of type bool. If
// _S_instanceless is true, this means that there is no difference
// between any two instances of type allocator_type. Furthermore, if
// _S_instanceless is true, then _Alloc_traits has one additional
// member: _Alloc_type. This type encapsulates allocation and
// deallocation of objects of type _Tp through a static interface; it
// has two member functions, whose signatures are
// static _Tp* allocate(size_t)
// static void deallocate(_Tp*, size_t)
// The fully general version.
template <class _Tp, class _Allocator>
struct _Alloc_traits
{
static const bool _S_instanceless = false;
typedef typename _Allocator::__STL_TEMPLATE rebind<_Tp>::other
allocator_type;
};
template <class _Tp, class _Allocator>
const bool _Alloc_traits<_Tp, _Allocator>::_S_instanceless;
// The version for the default allocator.
template <class _Tp, class _Tp1>
struct _Alloc_traits<_Tp, allocator<_Tp1> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, alloc> _Alloc_type;
typedef allocator<_Tp> allocator_type;
};
// Versions for the predefined SGI-style allocators.
template <class _Tp, int __inst>
struct _Alloc_traits<_Tp, __malloc_alloc_template<__inst> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
};
template <class _Tp, bool __threads, int __inst>
struct _Alloc_traits<_Tp, __default_alloc_template<__threads, __inst> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, __default_alloc_template<__threads, __inst> >
_Alloc_type;
typedef __allocator<_Tp, __default_alloc_template<__threads, __inst> >
allocator_type;
};
template <class _Tp, class _Alloc>
struct _Alloc_traits<_Tp, debug_alloc<_Alloc> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type;
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, int __inst>
struct _Alloc_traits<_Tp,
__allocator<_Tp1, __malloc_alloc_template<__inst> > >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
};
template <class _Tp, class _Tp1, bool __thr, int __inst>
struct _Alloc_traits<_Tp,
__allocator<_Tp1,
__default_alloc_template<__thr, __inst> > >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, __default_alloc_template<__thr,__inst> >
_Alloc_type;
typedef __allocator<_Tp, __default_alloc_template<__thr,__inst> >
allocator_type;
};
template <class _Tp, class _Tp1, class _Alloc>
struct _Alloc_traits<_Tp, __allocator<_Tp1, debug_alloc<_Alloc> > >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type;
typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type;
};
#endif /* __STL_USE_STD_ALLOCATORS */
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
#endif
__STL_END_NAMESPACE
#undef __PRIVATE
#endif /* __SGI_STL_INTERNAL_ALLOC_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,896 +0,0 @@
/*
*
* 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-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.
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
#ifndef __SGI_STL_INTERNAL_BVECTOR_H
#define __SGI_STL_INTERNAL_BVECTOR_H
__STL_BEGIN_NAMESPACE
static const int __WORD_BIT = int(CHAR_BIT*sizeof(unsigned int));
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#pragma set woff 1375
#endif
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);
}
void flip() { *_M_p ^= _M_mask; }
};
inline void swap(_Bit_reference __x, _Bit_reference __y)
{
bool __tmp = __x;
__x = __y;
__y = __tmp;
}
struct _Bit_iterator_base : public random_access_iterator<bool, ptrdiff_t>
{
unsigned int* _M_p;
unsigned int _M_offset;
_Bit_iterator_base(unsigned int* __x, unsigned int __y)
: _M_p(__x), _M_offset(__y) {}
void _M_bump_up() {
if (_M_offset++ == __WORD_BIT - 1) {
_M_offset = 0;
++_M_p;
}
}
void _M_bump_down() {
if (_M_offset-- == 0) {
_M_offset = __WORD_BIT - 1;
--_M_p;
}
}
void _M_incr(ptrdiff_t __i) {
difference_type __n = __i + _M_offset;
_M_p += __n / __WORD_BIT;
__n = __n % __WORD_BIT;
if (__n < 0) {
_M_offset = (unsigned int) __n + __WORD_BIT;
--_M_p;
} else
_M_offset = (unsigned int) __n;
}
bool operator==(const _Bit_iterator_base& __i) const {
return _M_p == __i._M_p && _M_offset == __i._M_offset;
}
bool operator<(const _Bit_iterator_base& __i) const {
return _M_p < __i._M_p || (_M_p == __i._M_p && _M_offset < __i._M_offset);
}
bool operator!=(const _Bit_iterator_base& __i) const {
return !(*this == __i);
}
bool operator>(const _Bit_iterator_base& __i) const {
return __i < *this;
}
bool operator<=(const _Bit_iterator_base& __i) const {
return !(__i < *this);
}
bool operator>=(const _Bit_iterator_base& __i) const {
return !(*this < __i);
}
};
inline ptrdiff_t
operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
return __WORD_BIT * (__x._M_p - __y._M_p) + __x._M_offset - __y._M_offset;
}
struct _Bit_iterator : public _Bit_iterator_base
{
typedef _Bit_reference reference;
typedef _Bit_reference* pointer;
typedef _Bit_iterator iterator;
_Bit_iterator() : _Bit_iterator_base(0, 0) {}
_Bit_iterator(unsigned int* __x, unsigned int __y)
: _Bit_iterator_base(__x, __y) {}
reference operator*() const { return reference(_M_p, 1U << _M_offset); }
iterator& operator++() {
_M_bump_up();
return *this;
}
iterator operator++(int) {
iterator __tmp = *this;
_M_bump_up();
return __tmp;
}
iterator& operator--() {
_M_bump_down();
return *this;
}
iterator operator--(int) {
iterator __tmp = *this;
_M_bump_down();
return __tmp;
}
iterator& operator+=(difference_type __i) {
_M_incr(__i);
return *this;
}
iterator& operator-=(difference_type __i) {
*this += -__i;
return *this;
}
iterator operator+(difference_type __i) const {
iterator __tmp = *this;
return __tmp += __i;
}
iterator operator-(difference_type __i) const {
iterator __tmp = *this;
return __tmp -= __i;
}
reference operator[](difference_type __i) { return *(*this + __i); }
};
inline _Bit_iterator
operator+(ptrdiff_t __n, const _Bit_iterator& __x) { return __x + __n; }
struct _Bit_const_iterator : public _Bit_iterator_base
{
typedef bool reference;
typedef bool const_reference;
typedef const bool* pointer;
typedef _Bit_const_iterator const_iterator;
_Bit_const_iterator() : _Bit_iterator_base(0, 0) {}
_Bit_const_iterator(unsigned int* __x, unsigned int __y)
: _Bit_iterator_base(__x, __y) {}
_Bit_const_iterator(const _Bit_iterator& __x)
: _Bit_iterator_base(__x._M_p, __x._M_offset) {}
const_reference operator*() const {
return _Bit_reference(_M_p, 1U << _M_offset);
}
const_iterator& operator++() {
_M_bump_up();
return *this;
}
const_iterator operator++(int) {
const_iterator __tmp = *this;
_M_bump_up();
return __tmp;
}
const_iterator& operator--() {
_M_bump_down();
return *this;
}
const_iterator operator--(int) {
const_iterator __tmp = *this;
_M_bump_down();
return __tmp;
}
const_iterator& operator+=(difference_type __i) {
_M_incr(__i);
return *this;
}
const_iterator& operator-=(difference_type __i) {
*this += -__i;
return *this;
}
const_iterator operator+(difference_type __i) const {
const_iterator __tmp = *this;
return __tmp += __i;
}
const_iterator operator-(difference_type __i) const {
const_iterator __tmp = *this;
return __tmp -= __i;
}
const_reference operator[](difference_type __i) {
return *(*this + __i);
}
};
inline _Bit_const_iterator
operator+(ptrdiff_t __n, const _Bit_const_iterator& __x) { return __x + __n; }
// Bit-vector base class, which encapsulates the difference between
// old SGI-style allocators and standard-conforming allocators.
#ifdef __STL_USE_STD_ALLOCATORS
// Base class for ordinary allocators.
template <class _Allocator, bool __is_static>
class _Bvector_alloc_base {
public:
typedef typename _Alloc_traits<bool, _Allocator>::allocator_type
allocator_type;
allocator_type get_allocator() const { return _M_data_allocator; }
_Bvector_alloc_base(const allocator_type& __a)
: _M_data_allocator(__a), _M_start(), _M_finish(), _M_end_of_storage(0) {}
protected:
unsigned int* _M_bit_alloc(size_t __n)
{ return _M_data_allocator.allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
void _M_deallocate() {
if (_M_start._M_p)
_M_data_allocator.deallocate(_M_start._M_p,
_M_end_of_storage - _M_start._M_p);
}
typename _Alloc_traits<unsigned int, _Allocator>::allocator_type
_M_data_allocator;
_Bit_iterator _M_start;
_Bit_iterator _M_finish;
unsigned int* _M_end_of_storage;
};
// Specialization for instanceless allocators.
template <class _Allocator>
class _Bvector_alloc_base<_Allocator, true> {
public:
typedef typename _Alloc_traits<bool, _Allocator>::allocator_type
allocator_type;
allocator_type get_allocator() const { return allocator_type(); }
_Bvector_alloc_base(const allocator_type&)
: _M_start(), _M_finish(), _M_end_of_storage(0) {}
protected:
typedef typename _Alloc_traits<unsigned int, _Allocator>::_Alloc_type
_Alloc_type;
unsigned int* _M_bit_alloc(size_t __n)
{ return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
void _M_deallocate() {
if (_M_start._M_p)
_Alloc_type::deallocate(_M_start._M_p,
_M_end_of_storage - _M_start._M_p);
}
_Bit_iterator _M_start;
_Bit_iterator _M_finish;
unsigned int* _M_end_of_storage;
};
template <class _Alloc>
class _Bvector_base
: public _Bvector_alloc_base<_Alloc,
_Alloc_traits<bool, _Alloc>::_S_instanceless>
{
typedef _Bvector_alloc_base<_Alloc,
_Alloc_traits<bool, _Alloc>::_S_instanceless>
_Base;
public:
typedef typename _Base::allocator_type allocator_type;
_Bvector_base(const allocator_type& __a) : _Base(__a) {}
~_Bvector_base() { _Base::_M_deallocate(); }
};
#else /* __STL_USE_STD_ALLOCATORS */
template <class _Alloc>
class _Bvector_base
{
public:
typedef _Alloc allocator_type;
allocator_type get_allocator() const { return allocator_type(); }
_Bvector_base(const allocator_type&)
: _M_start(), _M_finish(), _M_end_of_storage(0) {}
~_Bvector_base() { _M_deallocate(); }
protected:
typedef simple_alloc<unsigned int, _Alloc> _Alloc_type;
unsigned int* _M_bit_alloc(size_t __n)
{ return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
void _M_deallocate() {
if (_M_start._M_p)
_Alloc_type::deallocate(_M_start._M_p,
_M_end_of_storage - _M_start._M_p);
}
_Bit_iterator _M_start;
_Bit_iterator _M_finish;
unsigned int* _M_end_of_storage;
};
#endif /* __STL_USE_STD_ALLOCATORS */
// 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(__STL_CLASS_PARTIAL_SPECIALIZATION) && !defined(__STL_NO_BOOL)
# define __SGI_STL_VECBOOL_TEMPLATE
# define __BVECTOR vector<bool, _Alloc>
# define __VECTOR vector
# define __BVECTOR_BASE _Bvector_base<_Alloc>
# define __BVECTOR_TMPL_LIST template <class _Alloc>
__STL_END_NAMESPACE
# include <stl_vector.h>
__STL_BEGIN_NAMESPACE
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION && !__STL_NO_BOOL */
# undef __SGI_STL_VECBOOL_TEMPLATE
# define __BVECTOR bit_vector
# define __VECTOR bit_vector
# define __BVECTOR_BASE _Bvector_base<__STL_DEFAULT_ALLOCATOR(bool) >
# define __BVECTOR_TMPL_LIST
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION && !__STL_NO_BOOL */
__BVECTOR_TMPL_LIST
class __BVECTOR : public __BVECTOR_BASE
{
public:
typedef bool value_type;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Bit_reference reference;
typedef bool const_reference;
typedef _Bit_reference* pointer;
typedef const bool* const_pointer;
typedef _Bit_iterator iterator;
typedef _Bit_const_iterator const_iterator;
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
typedef reverse_iterator<const_iterator> const_reverse_iterator;
typedef reverse_iterator<iterator> reverse_iterator;
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
typedef reverse_iterator<const_iterator, value_type, const_reference,
difference_type> const_reverse_iterator;
typedef reverse_iterator<iterator, value_type, reference, difference_type>
reverse_iterator;
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
typedef typename __BVECTOR_BASE::allocator_type allocator_type;
allocator_type get_allocator() const {
return __BVECTOR_BASE::get_allocator();
}
protected:
#ifdef __STL_USE_NAMESPACES
using __BVECTOR_BASE::_M_bit_alloc;
using __BVECTOR_BASE::_M_deallocate;
using __BVECTOR_BASE::_M_start;
using __BVECTOR_BASE::_M_finish;
using __BVECTOR_BASE::_M_end_of_storage;
#endif /* __STL_USE_NAMESPACES */
protected:
void _M_initialize(size_type __n) {
unsigned int* __q = _M_bit_alloc(__n);
_M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
_M_finish = _M_start + difference_type(__n);
}
void _M_insert_aux(iterator __position, bool __x) {
if (_M_finish._M_p != _M_end_of_storage) {
copy_backward(__position, _M_finish, _M_finish + 1);
*__position = __x;
++_M_finish;
}
else {
size_type __len = size() ? 2 * size() : __WORD_BIT;
unsigned int* __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
*__i++ = __x;
_M_finish = copy(__position, end(), __i);
_M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
}
}
#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void _M_initialize_range(_InputIterator __first, _InputIterator __last,
input_iterator_tag) {
_M_start = iterator();
_M_finish = iterator();
_M_end_of_storage = 0;
for ( ; __first != __last; ++__first)
push_back(*__first);
}
template <class _ForwardIterator>
void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag) {
size_type __n = 0;
distance(__first, __last, __n);
_M_initialize(__n);
copy(__first, __last, _M_start);
}
template <class _InputIterator>
void _M_insert_range(iterator __pos,
_InputIterator __first, _InputIterator __last,
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,
forward_iterator_tag) {
if (__first != __last) {
size_type __n = 0;
distance(__first, __last, __n);
if (capacity() - size() >= __n) {
copy_backward(__position, end(), _M_finish + difference_type(__n));
copy(__first, __last, __position);
_M_finish += difference_type(__n);
}
else {
size_type __len = size() + max(size(), __n);
unsigned int* __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
__i = copy(__first, __last, __i);
_M_finish = copy(__position, end(), __i);
_M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
}
}
}
#endif /* __STL_MEMBER_TEMPLATES */
public:
iterator begin() { return _M_start; }
const_iterator begin() const { return _M_start; }
iterator end() { return _M_finish; }
const_iterator end() const { return _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(_M_end_of_storage, 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)); }
#ifdef __STL_THROW_RANGE_ERRORS
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]; }
#endif /* __STL_THROW_RANGE_ERRORS */
explicit __VECTOR(const allocator_type& __a = allocator_type())
: __BVECTOR_BASE(__a) {}
__VECTOR(size_type __n, bool __value,
const allocator_type& __a = allocator_type())
: __BVECTOR_BASE(__a)
{
_M_initialize(__n);
fill(_M_start._M_p, _M_end_of_storage, __value ? ~0 : 0);
}
explicit __VECTOR(size_type __n)
: __BVECTOR_BASE(allocator_type())
{
_M_initialize(__n);
fill(_M_start._M_p, _M_end_of_storage, 0);
}
__VECTOR(const __VECTOR& __x) : __BVECTOR_BASE(__x.get_allocator()) {
_M_initialize(__x.size());
copy(__x.begin(), __x.end(), _M_start);
}
#ifdef __STL_MEMBER_TEMPLATES
// Check whether it's an integral type. If so, it's not an iterator.
template <class _Integer>
void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) {
_M_initialize(__n);
fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
}
template <class _InputIterator>
void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
__false_type) {
_M_initialize_range(__first, __last, __ITERATOR_CATEGORY(__first));
}
template <class _InputIterator>
__VECTOR(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: __BVECTOR_BASE(__a)
{
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_initialize_dispatch(__first, __last, _Integral());
}
#else /* __STL_MEMBER_TEMPLATES */
__VECTOR(const_iterator __first, const_iterator __last,
const allocator_type& __a = allocator_type())
: __BVECTOR_BASE(__a)
{
size_type __n = 0;
distance(__first, __last, __n);
_M_initialize(__n);
copy(__first, __last, _M_start);
}
__VECTOR(const bool* __first, const bool* __last,
const allocator_type& __a = allocator_type())
: __BVECTOR_BASE(__a)
{
size_type __n = 0;
distance(__first, __last, __n);
_M_initialize(__n);
copy(__first, __last, _M_start);
}
#endif /* __STL_MEMBER_TEMPLATES */
~__VECTOR() { }
__VECTOR& operator=(const __VECTOR& __x) {
if (&__x == this) return *this;
if (__x.size() > capacity()) {
_M_deallocate();
_M_initialize(__x.size());
}
copy(__x.begin(), __x.end(), begin());
_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(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
insert(end(), __n - size(), __x);
}
else {
erase(begin() + __n, end());
fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
}
}
void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); }
#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void assign(_InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_assign_dispatch(__first, __last, _Integral());
}
template <class _Integer>
void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
{ _M_fill_assign((size_t) __n, (bool) __val); }
template <class _InputIter>
void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type)
{ _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); }
template <class _InputIterator>
void _M_assign_aux(_InputIterator __first, _InputIterator __last,
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,
forward_iterator_tag) {
size_type __len = 0;
distance(__first, __last, __len);
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 /* __STL_MEMBER_TEMPLATES */
void reserve(size_type __n) {
if (capacity() < __n) {
unsigned int* __q = _M_bit_alloc(__n);
_M_finish = copy(begin(), end(), iterator(__q, 0));
_M_deallocate();
_M_start = iterator(__q, 0);
_M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__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 (_M_finish._M_p != _M_end_of_storage)
*_M_finish++ = __x;
else
_M_insert_aux(end(), __x);
}
void swap(__BVECTOR& __x) {
__STD::swap(_M_start, __x._M_start);
__STD::swap(_M_finish, __x._M_finish);
__STD::swap(_M_end_of_storage, __x._M_end_of_storage);
}
iterator insert(iterator __position, bool __x = bool()) {
difference_type __n = __position - begin();
if (_M_finish._M_p != _M_end_of_storage && __position == end())
*_M_finish++ = __x;
else
_M_insert_aux(__position, __x);
return begin() + __n;
}
#ifdef __STL_MEMBER_TEMPLATES
// 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,
__true_type) {
_M_fill_insert(__pos, __n, __x);
}
template <class _InputIterator>
void _M_insert_dispatch(iterator __pos,
_InputIterator __first, _InputIterator __last,
__false_type) {
_M_insert_range(__pos, __first, __last, __ITERATOR_CATEGORY(__first));
}
template <class _InputIterator>
void insert(iterator __position,
_InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_insert_dispatch(__position, __first, __last, _Integral());
}
#else /* __STL_MEMBER_TEMPLATES */
void insert(iterator __position,
const_iterator __first, const_iterator __last) {
if (__first == __last) return;
size_type __n = 0;
distance(__first, __last, __n);
if (capacity() - size() >= __n) {
copy_backward(__position, end(), _M_finish + __n);
copy(__first, __last, __position);
_M_finish += __n;
}
else {
size_type __len = size() + max(size(), __n);
unsigned int* __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
__i = copy(__first, __last, __i);
_M_finish = copy(__position, end(), __i);
_M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
}
}
void insert(iterator __position, const bool* __first, const bool* __last) {
if (__first == __last) return;
size_type __n = 0;
distance(__first, __last, __n);
if (capacity() - size() >= __n) {
copy_backward(__position, end(), _M_finish + __n);
copy(__first, __last, __position);
_M_finish += __n;
}
else {
size_type __len = size() + max(size(), __n);
unsigned int* __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
__i = copy(__first, __last, __i);
_M_finish = copy(__position, end(), __i);
_M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
}
}
#endif /* __STL_MEMBER_TEMPLATES */
void _M_fill_insert(iterator __position, size_type __n, bool __x) {
if (__n == 0) return;
if (capacity() - size() >= __n) {
copy_backward(__position, end(), _M_finish + difference_type(__n));
fill(__position, __position + difference_type(__n), __x);
_M_finish += difference_type(__n);
}
else {
size_type __len = size() + max(size(), __n);
unsigned int* __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
fill_n(__i, __n, __x);
_M_finish = copy(__position, end(), __i + difference_type(__n));
_M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
}
}
void insert(iterator __position, size_type __n, bool __x) {
_M_fill_insert(__position, __n, __x);
}
void pop_back() { --_M_finish; }
iterator erase(iterator __position) {
if (__position + 1 != end())
copy(__position + 1, end(), __position);
--_M_finish;
return __position;
}
iterator erase(iterator __first, iterator __last) {
_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 = _M_start._M_p; __p != _M_end_of_storage; ++__p)
*__p = ~*__p;
}
void clear() { erase(begin(), end()); }
};
#ifdef __SGI_STL_VECBOOL_TEMPLATE
// This typedef is non-standard. It is provided for backward compatibility.
typedef vector<bool, alloc> bit_vector;
#else /* __SGI_STL_VECBOOL_TEMPLATE */
inline void swap(bit_vector& __x, bit_vector& __y) {
__x.swap(__y);
}
inline bool
operator==(const bit_vector& __x, const bit_vector& __y)
{
return (__x.size() == __y.size() &&
equal(__x.begin(), __x.end(), __y.begin()));
}
inline bool
operator!=(const bit_vector& __x, const bit_vector& __y)
{
return !(__x == __y);
}
inline bool
operator<(const bit_vector& __x, const bit_vector& __y)
{
return lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end());
}
inline bool operator>(const bit_vector& __x, const bit_vector& __y)
{
return __y < __x;
}
inline bool operator<=(const bit_vector& __x, const bit_vector& __y)
{
return !(__y < __x);
}
inline bool operator>=(const bit_vector& __x, const bit_vector& __y)
{
return !(__x < __y);
}
#endif /* __SGI_STL_VECBOOL_TEMPLATE */
#undef __SGI_STL_VECBOOL_TEMPLATE
#undef __BVECTOR
#undef __VECTOR
#undef __BVECTOR_BASE
#undef __BVECTOR_TMPL_LIST
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
#pragma reset woff 1375
#endif
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_BVECTOR_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,576 +0,0 @@
/*
*
* 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
# 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
# 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:

View File

@ -1,124 +0,0 @@
/*
*
* 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,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_CONSTRUCT_H
#define __SGI_STL_INTERNAL_CONSTRUCT_H
#include <new.h>
__STL_BEGIN_NAMESPACE
// construct and destroy. These functions are not part of the C++ standard,
// and are provided for backward compatibility with the HP STL. We also
// provide internal names _Construct and _Destroy that can be used within
// the library, so that standard-conforming pieces don't have to rely on
// non-standard extensions.
// Internal names
template <class _T1, class _T2>
inline void _Construct(_T1* __p, const _T2& __value) {
new ((void*) __p) _T1(__value);
}
template <class _T1>
inline void _Construct(_T1* __p) {
new ((void*) __p) _T1();
}
template <class _Tp>
inline void _Destroy(_Tp* __pointer) {
__pointer->~_Tp();
}
template <class _ForwardIterator>
void
__destroy_aux(_ForwardIterator __first, _ForwardIterator __last, __false_type)
{
for ( ; __first != __last; ++__first)
destroy(&*__first);
}
template <class _ForwardIterator>
inline void __destroy_aux(_ForwardIterator, _ForwardIterator, __true_type) {}
template <class _ForwardIterator, class _Tp>
inline void
__destroy(_ForwardIterator __first, _ForwardIterator __last, _Tp*)
{
typedef typename __type_traits<_Tp>::has_trivial_destructor
_Trivial_destructor;
__destroy_aux(__first, __last, _Trivial_destructor());
}
template <class _ForwardIterator>
inline void _Destroy(_ForwardIterator __first, _ForwardIterator __last) {
__destroy(__first, __last, __VALUE_TYPE(__first));
}
inline void _Destroy(char*, char*) {}
inline void _Destroy(int*, int*) {}
inline void _Destroy(long*, long*) {}
inline void _Destroy(float*, float*) {}
inline void _Destroy(double*, double*) {}
#ifdef __STL_HAS_WCHAR_T
inline void _Destroy(wchar_t*, wchar_t*) {}
#endif /* __STL_HAS_WCHAR_T */
// --------------------------------------------------
// Old names from the HP STL.
template <class _T1, class _T2>
inline void construct(_T1* __p, const _T2& __value) {
_Construct(__p, __value);
}
template <class _T1>
inline void construct(_T1* __p) {
_Construct(__p);
}
template <class _Tp>
inline void destroy(_Tp* __pointer) {
_Destroy(__pointer);
}
template <class _ForwardIterator>
inline void destroy(_ForwardIterator __first, _ForwardIterator __last) {
_Destroy(__first, __last);
}
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_CONSTRUCT_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,69 +0,0 @@
/*
* 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 __SGI_STL_INTERNAL_CTRAITS_FUNCTIONS_H
#define __SGI_STL_INTERNAL_CTRAITS_FUNCTIONS_H
// This file contains a few small adapters that allow a character
// traits class to be used as a function object.
__STL_BEGIN_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_int_traits
: public binary_function<typename _Traits::char_type,
typename _Traits::int_type,
bool>
{
bool operator()(const typename _Traits::char_type& __x,
const typename _Traits::int_type& __y) const
{ return _Traits::eq_int_type(_Traits::to_int_type(__x), __y); }
};
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); }
};
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_CTRAITS_FUNCTIONS_H */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) 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.
*/
#ifndef __SGI_STL_EXCEPTION_H
#define __SGI_STL_EXCEPTION_H
// This header exists solely for portability. Normally it just includes
// the header <exception>.
// 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.
#include <stl_config.h>
#ifndef __STL_NO_EXCEPTION_HEADER
#include <exception>
#define __STL_EXCEPTION_BASE exception
#else /* __STL_NO_EXCEPTION_HEADER */
__STL_BEGIN_NAMESPACE
class _Exception {
public:
virtual ~_Exception() __STL_NOTHROW {}
virtual const char* what() const __STL_NOTHROW { return ""; }
};
#define __STL_EXCEPTION_BASE _Exception
__STL_END_NAMESPACE
#endif /* __STL_NO_EXCEPTION_HEADER */
#endif /* __SGI_STL_EXCEPTION_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,725 +0,0 @@
/*
*
* 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_FUNCTION_H
#define __SGI_STL_INTERNAL_FUNCTION_H
__STL_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 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; }
};
template <class _Tp>
struct multiplies : public binary_function<_Tp,_Tp,_Tp> {
_Tp 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; }
};
// 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);
}
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 equal_to : public binary_function<_Tp,_Tp,bool>
{
bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; }
};
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 less : 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 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; }
};
template <class _Predicate>
class unary_negate
: public unary_function<typename _Predicate::argument_type, bool> {
protected:
_Predicate _M_pred;
public:
explicit unary_negate(const _Predicate& __x) : _M_pred(__x) {}
bool operator()(const typename _Predicate::argument_type& __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 _Predicate::first_argument_type,
typename _Predicate::second_argument_type,
bool> {
protected:
_Predicate _M_pred;
public:
explicit binary_negate(const _Predicate& __x) : _M_pred(__x) {}
bool operator()(const typename _Predicate::first_argument_type& __x,
const typename _Predicate::second_argument_type& __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 _Operation::second_argument_type,
typename _Operation::result_type> {
protected:
_Operation op;
typename _Operation::first_argument_type value;
public:
binder1st(const _Operation& __x,
const typename _Operation::first_argument_type& __y)
: op(__x), value(__y) {}
typename _Operation::result_type
operator()(const typename _Operation::second_argument_type& __x) const {
return op(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 _Operation::first_argument_type,
typename _Operation::result_type> {
protected:
_Operation op;
typename _Operation::second_argument_type value;
public:
binder2nd(const _Operation& __x,
const typename _Operation::second_argument_type& __y)
: op(__x), value(__y) {}
typename _Operation::result_type
operator()(const typename _Operation::first_argument_type& __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));
}
// unary_compose and binary_compose (extensions, not part of the standard).
template <class _Operation1, class _Operation2>
class unary_compose
: public unary_function<typename _Operation2::argument_type,
typename _Operation1::result_type>
{
protected:
_Operation1 _M_fn1;
_Operation2 _M_fn2;
public:
unary_compose(const _Operation1& __x, const _Operation2& __y)
: _M_fn1(__x), _M_fn2(__y) {}
typename _Operation1::result_type
operator()(const typename _Operation2::argument_type& __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 _Operation2::argument_type,
typename _Operation1::result_type> {
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) { }
typename _Operation1::result_type
operator()(const typename _Operation2::argument_type& __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);
}
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 _Arg, class _Result>
inline pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg))
{
return pointer_to_unary_function<_Arg, _Result>(__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);
}
};
template <class _Arg1, class _Arg2, class _Result>
inline pointer_to_binary_function<_Arg1,_Arg2,_Result>
ptr_fun(_Result (*__x)(_Arg1, _Arg2)) {
return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__x);
}
// identity is an extensions: it is not part of the standard.
template <class _Tp>
struct _Identity : public unary_function<_Tp,_Tp> {
const _Tp& operator()(const _Tp& __x) const { return __x; }
};
template <class _Tp> struct identity : public _Identity<_Tp> {};
// select1st and select2nd are extensions: they are not part of the standard.
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;
}
};
template <class _Pair> struct select1st : public _Select1st<_Pair> {};
template <class _Pair> struct select2nd : public _Select2nd<_Pair> {};
// 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; }
};
template <class _Arg1, class _Arg2>
struct project1st : public _Project1st<_Arg1, _Arg2> {};
template <class _Arg1, class _Arg2>
struct project2nd : public _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.)
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; }
};
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;
}
};
template <class _Result>
struct constant_void_fun : public _Constant_void_fun<_Result> {
constant_void_fun(const _Result& __v) : _Constant_void_fun<_Result>(__v) {}
};
template <class _Result,
class _Argument __STL_DEPENDENT_DEFAULT_TMPL(_Result)>
struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument>
{
constant_unary_fun(const _Result& __v)
: _Constant_unary_fun<_Result, _Argument>(__v) {}
};
template <class _Result,
class _Arg1 __STL_DEPENDENT_DEFAULT_TMPL(_Result),
class _Arg2 __STL_DEPENDENT_DEFAULT_TMPL(_Arg1)>
struct constant_binary_fun
: public _Constant_binary_fun<_Result, _Arg1, _Arg2>
{
constant_binary_fun(const _Result& __v)
: _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<unsigned int, unsigned int> {
private:
unsigned int _M_table[55];
size_t _M_index1;
size_t _M_index2;
public:
unsigned int operator()(unsigned int __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(unsigned int __seed)
{
unsigned int __k = 1;
_M_table[54] = __seed;
size_t __i;
for (__i = 0; __i < 54; __i++) {
size_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(161803398u); }
};
// 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.
// (mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
// but they are provided for backward compatibility.)
template <class _Ret, class _Tp>
class mem_fun_t : public unary_function<_Tp*,_Ret> {
public:
explicit mem_fun_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) {}
_Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }
private:
_Ret (_Tp::*_M_f)();
};
template <class _Ret, class _Tp>
class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {
public:
explicit const_mem_fun_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) {}
_Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }
private:
_Ret (_Tp::*_M_f)() const;
};
template <class _Ret, class _Tp>
class mem_fun_ref_t : public unary_function<_Tp,_Ret> {
public:
explicit mem_fun_ref_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) {}
_Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }
private:
_Ret (_Tp::*_M_f)();
};
template <class _Ret, class _Tp>
class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {
public:
explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) {}
_Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
private:
_Ret (_Tp::*_M_f)() const;
};
template <class _Ret, class _Tp, class _Arg>
class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {
public:
explicit mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
_Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
private:
_Ret (_Tp::*_M_f)(_Arg);
};
template <class _Ret, class _Tp, class _Arg>
class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {
public:
explicit const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
_Ret operator()(const _Tp* __p, _Arg __x) const
{ return (__p->*_M_f)(__x); }
private:
_Ret (_Tp::*_M_f)(_Arg) const;
};
template <class _Ret, class _Tp, class _Arg>
class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
public:
explicit mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
_Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
private:
_Ret (_Tp::*_M_f)(_Arg);
};
template <class _Ret, class _Tp, class _Arg>
class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
public:
explicit const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
_Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
private:
_Ret (_Tp::*_M_f)(_Arg) const;
};
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class _Tp>
class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
public:
explicit mem_fun_t(void (_Tp::*__pf)()) : _M_f(__pf) {}
void operator()(_Tp* __p) const { (__p->*_M_f)(); }
private:
void (_Tp::*_M_f)();
};
template <class _Tp>
class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {
public:
explicit const_mem_fun_t(void (_Tp::*__pf)() const) : _M_f(__pf) {}
void operator()(const _Tp* __p) const { (__p->*_M_f)(); }
private:
void (_Tp::*_M_f)() const;
};
template <class _Tp>
class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
public:
explicit mem_fun_ref_t(void (_Tp::*__pf)()) : _M_f(__pf) {}
void operator()(_Tp& __r) const { (__r.*_M_f)(); }
private:
void (_Tp::*_M_f)();
};
template <class _Tp>
class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
public:
explicit const_mem_fun_ref_t(void (_Tp::*__pf)() const) : _M_f(__pf) {}
void operator()(const _Tp& __r) const { (__r.*_M_f)(); }
private:
void (_Tp::*_M_f)() const;
};
template <class _Tp, class _Arg>
class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {
public:
explicit mem_fun1_t(void (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
private:
void (_Tp::*_M_f)(_Arg);
};
template <class _Tp, class _Arg>
class const_mem_fun1_t<void, _Tp, _Arg>
: public binary_function<const _Tp*,_Arg,void> {
public:
explicit const_mem_fun1_t(void (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
private:
void (_Tp::*_M_f)(_Arg) const;
};
template <class _Tp, class _Arg>
class mem_fun1_ref_t<void, _Tp, _Arg>
: public binary_function<_Tp,_Arg,void> {
public:
explicit mem_fun1_ref_t(void (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
private:
void (_Tp::*_M_f)(_Arg);
};
template <class _Tp, class _Arg>
class const_mem_fun1_ref_t<void, _Tp, _Arg>
: public binary_function<_Tp,_Arg,void> {
public:
explicit const_mem_fun1_ref_t(void (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
private:
void (_Tp::*_M_f)(_Arg) const;
};
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
// 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 _Ret, class _Tp>
inline mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)())
{ return mem_fun_t<_Ret,_Tp>(__f); }
template <class _Ret, class _Tp>
inline const_mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)() const)
{ return const_mem_fun_t<_Ret,_Tp>(__f); }
template <class _Ret, class _Tp>
inline mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)())
{ return mem_fun_ref_t<_Ret,_Tp>(__f); }
template <class _Ret, class _Tp>
inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const)
{ return const_mem_fun_ref_t<_Ret,_Tp>(__f); }
template <class _Ret, class _Tp, class _Arg>
inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg))
{ return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
inline const_mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg) const)
{ return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
inline mem_fun1_ref_t<_Ret,_Tp,_Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
{ return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg>
mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
{ return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg))
{ return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
inline const_mem_fun1_t<_Ret,_Tp,_Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg) const)
{ return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
inline mem_fun1_ref_t<_Ret,_Tp,_Arg> mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
{ return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg>
mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
{ return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_FUNCTION_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,93 +0,0 @@
/*
* 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 __SGI_STL_HASH_FUN_H
#define __SGI_STL_HASH_FUN_H
#include <stddef.h>
__STL_BEGIN_NAMESPACE
template <class _Key> struct hash { };
inline size_t __stl_hash_string(const char* __s)
{
unsigned long __h = 0;
for ( ; *__s; ++__s)
__h = 5*__h + *__s;
return size_t(__h);
}
__STL_TEMPLATE_NULL struct hash<char*>
{
size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
};
__STL_TEMPLATE_NULL struct hash<const char*>
{
size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
};
__STL_TEMPLATE_NULL struct hash<char> {
size_t operator()(char __x) const { return __x; }
};
__STL_TEMPLATE_NULL struct hash<unsigned char> {
size_t operator()(unsigned char __x) const { return __x; }
};
__STL_TEMPLATE_NULL struct hash<signed char> {
size_t operator()(unsigned char __x) const { return __x; }
};
__STL_TEMPLATE_NULL struct hash<short> {
size_t operator()(short __x) const { return __x; }
};
__STL_TEMPLATE_NULL struct hash<unsigned short> {
size_t operator()(unsigned short __x) const { return __x; }
};
__STL_TEMPLATE_NULL struct hash<int> {
size_t operator()(int __x) const { return __x; }
};
__STL_TEMPLATE_NULL struct hash<unsigned int> {
size_t operator()(unsigned int __x) const { return __x; }
};
__STL_TEMPLATE_NULL struct hash<long> {
size_t operator()(long __x) const { return __x; }
};
__STL_TEMPLATE_NULL struct hash<unsigned long> {
size_t operator()(unsigned long __x) const { return __x; }
};
__STL_END_NAMESPACE
#endif /* __SGI_STL_HASH_FUN_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,532 +0,0 @@
/*
* Copyright (c) 1996
* 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 __SGI_STL_INTERNAL_HASH_MAP_H
#define __SGI_STL_INTERNAL_HASH_MAP_H
#include <concept_checks.h>
__STL_BEGIN_NAMESPACE
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#pragma set woff 1375
#endif
// Forward declaration of equality operator; needed for friend declaration.
template <class _Key, class _Tp,
class _HashFcn __STL_DEPENDENT_DEFAULT_TMPL(hash<_Key>),
class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Key>),
class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
class hash_map;
template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
inline bool operator==(const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&,
const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&);
template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
class _Alloc>
class hash_map
{
// requirements:
__STL_CLASS_REQUIRES(_Key, _Assignable);
__STL_CLASS_REQUIRES(_Tp, _Assignable);
__STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Key);
__STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Key, _Key);
private:
typedef hashtable<pair<const _Key,_Tp>,_Key,_HashFcn,
_Select1st<pair<const _Key,_Tp> >,_EqualKey,_Alloc> _Ht;
_Ht _M_ht;
public:
typedef typename _Ht::key_type key_type;
typedef _Tp data_type;
typedef _Tp mapped_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(); }
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) {}
#ifdef __STL_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); }
template <class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __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); }
#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 /*__STL_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(hash_map& __hs) { _M_ht.swap(__hs._M_ht); }
#ifdef __STL_MEMBER_TEMPLATES
template <class _K1, class _T1, class _HF, class _EqK, class _Al>
friend bool operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&,
const hash_map<_K1, _T1, _HF, _EqK, _Al>&);
#else /* __STL_MEMBER_TEMPLATES */
friend bool __STD_QUALIFIER
operator== __STL_NULL_TMPL_ARGS (const hash_map&, const hash_map&);
#endif /* __STL_MEMBER_TEMPLATES */
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 __STL_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 /*__STL_MEMBER_TEMPLATES */
pair<iterator,bool> insert_noresize(const value_type& __obj)
{ return _M_ht.insert_unique_noresize(__obj); }
iterator find(const key_type& __key) { return _M_ht.find(__key); }
const_iterator find(const key_type& __key) const
{ return _M_ht.find(__key); }
_Tp& operator[](const key_type& __key) {
return _M_ht.find_or_insert(value_type(__key, _Tp())).second;
}
size_type count(const key_type& __key) const { return _M_ht.count(__key); }
pair<iterator, iterator> equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); }
pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type erase(const key_type& __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); }
};
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
inline bool
operator==(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
{
return __hm1._M_ht == __hm2._M_ht;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
inline bool
operator!=(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) {
return !(__hm1 == __hm2);
}
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
inline void
swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
{
__hm1.swap(__hm2);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
// Forward declaration of equality operator; needed for friend declaration.
template <class _Key, class _Tp,
class _HashFcn __STL_DEPENDENT_DEFAULT_TMPL(hash<_Key>),
class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Key>),
class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
class hash_multimap;
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
inline bool
operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2);
template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
class _Alloc>
class hash_multimap
{
// requirements:
__STL_CLASS_REQUIRES(_Key, _Assignable);
__STL_CLASS_REQUIRES(_Tp, _Assignable);
__STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Key);
__STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Key, _Key);
private:
typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFcn,
_Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc>
_Ht;
_Ht _M_ht;
public:
typedef typename _Ht::key_type key_type;
typedef _Tp data_type;
typedef _Tp mapped_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(); }
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) {}
#ifdef __STL_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); }
template <class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __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); }
#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 /*__STL_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(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); }
#ifdef __STL_MEMBER_TEMPLATES
template <class _K1, class _T1, class _HF, class _EqK, class _Al>
friend bool operator== (const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&,
const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&);
#else /* __STL_MEMBER_TEMPLATES */
friend bool __STD_QUALIFIER
operator== __STL_NULL_TMPL_ARGS (const hash_multimap&,const hash_multimap&);
#endif /* __STL_MEMBER_TEMPLATES */
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 __STL_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 /*__STL_MEMBER_TEMPLATES */
iterator insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); }
iterator find(const key_type& __key) { return _M_ht.find(__key); }
const_iterator find(const key_type& __key) const
{ return _M_ht.find(__key); }
size_type count(const key_type& __key) const { return _M_ht.count(__key); }
pair<iterator, iterator> equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); }
pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type erase(const key_type& __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); }
};
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
inline bool
operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2)
{
return __hm1._M_ht == __hm2._M_ht;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
inline bool
operator!=(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2) {
return !(__hm1 == __hm2);
}
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
inline void
swap(hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
{
__hm1.swap(__hm2);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
// Specialization of insert_iterator so that it will work for hash_map
// and hash_multimap.
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
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& __value) {
container->insert(__value);
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& __value) {
container->insert(__value);
return *this;
}
insert_iterator<_Container>& operator*() { return *this; }
insert_iterator<_Container>& operator++() { return *this; }
insert_iterator<_Container>& operator++(int) { return *this; }
};
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
#pragma reset woff 1375
#endif
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_HASH_MAP_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,514 +0,0 @@
/*
* Copyright (c) 1996
* 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 __SGI_STL_INTERNAL_HASH_SET_H
#define __SGI_STL_INTERNAL_HASH_SET_H
#include <concept_checks.h>
__STL_BEGIN_NAMESPACE
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#pragma set woff 1375
#endif
// Forward declaration of equality operator; needed for friend declaration.
template <class _Value,
class _HashFcn __STL_DEPENDENT_DEFAULT_TMPL(hash<_Value>),
class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Value>),
class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
class hash_set;
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2);
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class hash_set
{
// requirements:
__STL_CLASS_REQUIRES(_Value, _Assignable);
__STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Value);
__STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Value, _Value);
private:
typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
_EqualKey, _Alloc> _Ht;
_Ht _M_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::const_pointer pointer;
typedef typename _Ht::const_pointer const_pointer;
typedef typename _Ht::const_reference reference;
typedef typename _Ht::const_reference const_reference;
typedef typename _Ht::const_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(); }
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()) {}
hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
#ifdef __STL_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 = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
#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 /*__STL_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(hash_set& __hs) { _M_ht.swap(__hs._M_ht); }
#ifdef __STL_MEMBER_TEMPLATES
template <class _Val, class _HF, class _EqK, class _Al>
friend bool operator== (const hash_set<_Val, _HF, _EqK, _Al>&,
const hash_set<_Val, _HF, _EqK, _Al>&);
#else /* __STL_MEMBER_TEMPLATES */
friend bool __STD_QUALIFIER
operator== __STL_NULL_TMPL_ARGS (const hash_set&, const hash_set&);
#endif /* __STL_MEMBER_TEMPLATES */
iterator begin() const { return _M_ht.begin(); }
iterator end() const { return _M_ht.end(); }
public:
pair<iterator, bool> insert(const value_type& __obj)
{
pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj);
return pair<iterator,bool>(__p.first, __p.second);
}
#ifdef __STL_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 /*__STL_MEMBER_TEMPLATES */
pair<iterator, bool> insert_noresize(const value_type& __obj)
{
pair<typename _Ht::iterator, bool> __p =
_M_ht.insert_unique_noresize(__obj);
return pair<iterator, bool>(__p.first, __p.second);
}
iterator find(const key_type& __key) const { return _M_ht.find(__key); }
size_type count(const key_type& __key) const { return _M_ht.count(__key); }
pair<iterator, iterator> equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type erase(const key_type& __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); }
};
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2)
{
return __hs1._M_ht == __hs2._M_ht;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator!=(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2) {
return !(__hs1 == __hs2);
}
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline void
swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
{
__hs1.swap(__hs2);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
template <class _Value,
class _HashFcn __STL_DEPENDENT_DEFAULT_TMPL(hash<_Value>),
class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Value>),
class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
class hash_multiset;
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2);
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class hash_multiset
{
// requirements:
__STL_CLASS_REQUIRES(_Value, _Assignable);
__STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Value);
__STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Value, _Value);
private:
typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
_EqualKey, _Alloc> _Ht;
_Ht _M_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::const_pointer pointer;
typedef typename _Ht::const_pointer const_pointer;
typedef typename _Ht::const_reference reference;
typedef typename _Ht::const_reference const_reference;
typedef typename _Ht::const_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(); }
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,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
#ifdef __STL_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 = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
#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 /*__STL_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(hash_multiset& hs) { _M_ht.swap(hs._M_ht); }
#ifdef __STL_MEMBER_TEMPLATES
template <class _Val, class _HF, class _EqK, class _Al>
friend bool operator== (const hash_multiset<_Val, _HF, _EqK, _Al>&,
const hash_multiset<_Val, _HF, _EqK, _Al>&);
#else /* __STL_MEMBER_TEMPLATES */
friend bool __STD_QUALIFIER
operator== __STL_NULL_TMPL_ARGS (const hash_multiset&,const hash_multiset&);
#endif /* __STL_MEMBER_TEMPLATES */
iterator begin() const { return _M_ht.begin(); }
iterator end() const { return _M_ht.end(); }
public:
iterator insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); }
#ifdef __STL_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 /*__STL_MEMBER_TEMPLATES */
iterator insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); }
iterator find(const key_type& __key) const { return _M_ht.find(__key); }
size_type count(const key_type& __key) const { return _M_ht.count(__key); }
pair<iterator, iterator> equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type erase(const key_type& __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); }
};
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
{
return __hs1._M_ht == __hs2._M_ht;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator!=(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
return !(__hs1 == __hs2);
}
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline void
swap(hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
__hs1.swap(__hs2);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
// Specialization of insert_iterator so that it will work for hash_set
// and hash_multiset.
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
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& __value) {
container->insert(__value);
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& __value) {
container->insert(__value);
return *this;
}
insert_iterator<_Container>& operator*() { return *this; }
insert_iterator<_Container>& operator++() { return *this; }
insert_iterator<_Container>& operator++(int) { return *this; }
};
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
#pragma reset woff 1375
#endif
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_HASH_SET_H */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -1,297 +0,0 @@
/*
*
* 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:

View File

@ -1,964 +0,0 @@
/*
*
* 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_H
#define __SGI_STL_INTERNAL_ITERATOR_H
__STL_BEGIN_NAMESPACE
template <class _Container>
class back_insert_iterator {
protected:
_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;
explicit back_insert_iterator(_Container& __x) : container(&__x) {}
back_insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value) {
container->push_back(__value);
return *this;
}
back_insert_iterator<_Container>& operator*() { return *this; }
back_insert_iterator<_Container>& operator++() { return *this; }
back_insert_iterator<_Container>& operator++(int) { return *this; }
};
#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class _Container>
inline output_iterator_tag
iterator_category(const back_insert_iterator<_Container>&)
{
return output_iterator_tag();
}
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
template <class _Container>
inline back_insert_iterator<_Container> back_inserter(_Container& __x) {
return back_insert_iterator<_Container>(__x);
}
template <class _Container>
class front_insert_iterator {
protected:
_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;
explicit front_insert_iterator(_Container& __x) : container(&__x) {}
front_insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value) {
container->push_front(__value);
return *this;
}
front_insert_iterator<_Container>& operator*() { return *this; }
front_insert_iterator<_Container>& operator++() { return *this; }
front_insert_iterator<_Container>& operator++(int) { return *this; }
};
#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class _Container>
inline output_iterator_tag
iterator_category(const front_insert_iterator<_Container>&)
{
return output_iterator_tag();
}
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
template <class _Container>
inline front_insert_iterator<_Container> front_inserter(_Container& __x) {
return front_insert_iterator<_Container>(__x);
}
template <class _Container>
class insert_iterator {
protected:
_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, typename _Container::iterator __i)
: container(&__x), iter(__i) {}
insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value) {
iter = container->insert(iter, __value);
++iter;
return *this;
}
insert_iterator<_Container>& operator*() { return *this; }
insert_iterator<_Container>& operator++() { return *this; }
insert_iterator<_Container>& operator++(int) { return *this; }
};
#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class _Container>
inline output_iterator_tag
iterator_category(const insert_iterator<_Container>&)
{
return output_iterator_tag();
}
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
template <class _Container, class _Iterator>
inline
insert_iterator<_Container> inserter(_Container& __x, _Iterator __i)
{
typedef typename _Container::iterator __iter;
return insert_iterator<_Container>(__x, __iter(__i));
}
#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
template <class _BidirectionalIterator, class _Tp, class _Reference = _Tp&,
class _Distance = ptrdiff_t>
#else
template <class _BidirectionalIterator, class _Tp, class _Reference,
class _Distance>
#endif
class reverse_bidirectional_iterator {
typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
_Reference, _Distance> _Self;
protected:
_BidirectionalIterator current;
public:
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Tp* pointer;
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;
}
#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
#endif /* __SGI_STL_NO_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;
}
};
#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class _BidirectionalIterator, class _Tp, class _Reference,
class _Distance>
inline bidirectional_iterator_tag
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*
value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
_Reference, _Distance>&)
{
return (_Tp*) 0;
}
template <class _BidirectionalIterator, class _Tp, class _Reference,
class _Distance>
inline _Distance*
distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator,
_Tp,
_Reference, _Distance>&)
{
return (_Distance*) 0;
}
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
template <class _BiIter, class _Tp, class _Ref, class _Distance>
inline bool operator==(
const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __x,
const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __y)
{
return __x.base() == __y.base();
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _BiIter, class _Tp, class _Ref, class _Distance>
inline bool operator!=(
const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __x,
const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __y)
{
return !(__x == __y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
#ifdef __STL_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
{
protected:
_Iterator current;
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;
typedef reverse_iterator<_Iterator> _Self;
public:
reverse_iterator() {}
explicit reverse_iterator(iterator_type __x) : current(__x) {}
reverse_iterator(const _Self& __x) : current(__x.current) {}
#ifdef __STL_MEMBER_TEMPLATES
template <class _Iter>
reverse_iterator(const reverse_iterator<_Iter>& __x)
: current(__x.base()) {}
#endif /* __STL_MEMBER_TEMPLATES */
iterator_type base() const { return current; }
reference operator*() const {
_Iterator __tmp = current;
return *--__tmp;
}
#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
#endif /* __SGI_STL_NO_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 operator==(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y) {
return __x.base() == __y.base();
}
template <class _Iterator>
inline bool operator<(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y) {
return __y.base() < __x.base();
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Iterator>
inline bool operator!=(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y) {
return !(__x == __y);
}
template <class _Iterator>
inline bool operator>(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y) {
return __y < __x;
}
template <class _Iterator>
inline bool operator<=(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y) {
return !(__y < __x);
}
template <class _Iterator>
inline bool operator>=(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y) {
return !(__x < __y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
template <class _Iterator>
inline typename reverse_iterator<_Iterator>::difference_type
operator-(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y) {
return __y.base() - __x.base();
}
template <class _Iterator>
inline reverse_iterator<_Iterator>
operator+(typename reverse_iterator<_Iterator>::difference_type __n,
const reverse_iterator<_Iterator>& __x) {
return reverse_iterator<_Iterator>(__x.base() - __n);
}
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
// This is the old version of reverse_iterator, as found in the original
// HP STL. It does not use partial specialization.
#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
template <class _RandomAccessIterator, class _Tp, class _Reference = _Tp&,
class _Distance = ptrdiff_t>
#else
template <class _RandomAccessIterator, class _Tp, class _Reference,
class _Distance>
#endif
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;
typedef _Tp* pointer;
typedef _Reference reference;
reverse_iterator() {}
explicit reverse_iterator(_RandomAccessIterator __x) : current(__x) {}
_RandomAccessIterator base() const { return current; }
_Reference operator*() const { return *(current - 1); }
#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
#endif /* __SGI_STL_NO_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+(_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); }
};
template <class _RandomAccessIterator, class _Tp,
class _Reference, class _Distance>
inline random_access_iterator_tag
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* value_type(const reverse_iterator<_RandomAccessIterator, _Tp,
_Reference, _Distance>&)
{
return (_Tp*) 0;
}
template <class _RandomAccessIterator, class _Tp,
class _Reference, class _Distance>
inline _Distance*
distance_type(const reverse_iterator<_RandomAccessIterator,
_Tp, _Reference, _Distance>&)
{
return (_Distance*) 0;
}
template <class _RandomAccessIterator, class _Tp,
class _Reference, class _Distance>
inline bool
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
operator<(const reverse_iterator<_RandomAccessIterator, _Tp,
_Reference, _Distance>& __x,
const reverse_iterator<_RandomAccessIterator, _Tp,
_Reference, _Distance>& __y)
{
return __y.base() < __x.base();
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _RandomAccessIterator, class _Tp,
class _Reference, class _Distance>
inline bool
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
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
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
operator>=(const reverse_iterator<_RandomAccessIterator, _Tp,
_Reference, _Distance>& __x,
const reverse_iterator<_RandomAccessIterator, _Tp,
_Reference, _Distance>& __y) {
return !(__x < __y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
template <class _RandomAccessIterator, class _Tp,
class _Reference, class _Distance>
inline _Distance
operator-(const reverse_iterator<_RandomAccessIterator, _Tp,
_Reference, _Distance>& __x,
const reverse_iterator<_RandomAccessIterator, _Tp,
_Reference, _Distance>& __y)
{
return __y.base() - __x.base();
}
template <class _RandAccIter, class _Tp, class _Ref, class _Dist>
inline reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>
operator+(_Dist __n,
const reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>& __x)
{
return reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>(__x.base() - __n);
}
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
// istream_iterator and ostream_iterator look very different if we're
// using new, templatized iostreams than if we're using the old cfront
// version.
#ifdef __STL_USE_NEW_IOSTREAMS
template <class _Tp,
class _CharT = char, class _Traits = char_traits<_CharT>,
class _Dist = ptrdiff_t>
class istream_iterator {
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) {}
istream_iterator(istream_type& __s) : _M_stream(&__s) { _M_read(); }
reference operator*() const { return _M_value; }
pointer operator->() const { return &(operator*()); }
istream_iterator& operator++() {
_M_read();
return *this;
}
istream_iterator operator++(int) {
istream_iterator __tmp = *this;
_M_read();
return __tmp;
}
bool _M_equal(const istream_iterator& __x) const
{ return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); }
private:
istream_type* _M_stream;
_Tp _M_value;
bool _M_ok;
void _M_read() {
_M_ok = (_M_stream && *_M_stream) ? true : false;
if (_M_ok) {
*_M_stream >> _M_value;
_M_ok = *_M_stream ? true : false;
}
}
};
template <class _Tp, class _CharT, class _Traits, class _Dist>
inline bool
operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,
const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) {
return __x._M_equal(__y);
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Tp, class _CharT, class _Traits, class _Dist>
inline bool
operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,
const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) {
return !__x._M_equal(__y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
template <class _Tp,
class _CharT = char, class _Traits = char_traits<_CharT> >
class ostream_iterator {
public:
typedef _CharT char_type;
typedef _Traits traits_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;
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) {}
ostream_iterator<_Tp>& operator=(const _Tp& __value) {
*_M_stream << __value;
if (_M_string) *_M_stream << _M_string;
return *this;
}
ostream_iterator<_Tp>& operator*() { return *this; }
ostream_iterator<_Tp>& operator++() { return *this; }
ostream_iterator<_Tp>& operator++(int) { return *this; }
private:
ostream_type* _M_stream;
const _CharT* _M_string;
};
// The default template argument is declared in iosfwd
// We do not read any characters until operator* is called. The first
// time operator* is called, it calls getc. Subsequent calls to getc
// return a cached character, and calls to operator++ use snextc. Before
// operator* or operator++ has been called, _M_is_initialized is false.
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;
public:
istreambuf_iterator(streambuf_type* __p = 0) { this->_M_init(__p); }
istreambuf_iterator(istream_type& __is) { this->_M_init(__is.rdbuf()); }
char_type operator*() const
{ return _M_is_initialized ? _M_c : _M_dereference_aux(); }
istreambuf_iterator& operator++() { this->_M_nextc(); return *this; }
istreambuf_iterator operator++(int) {
if (!_M_is_initialized)
_M_postincr_aux();
istreambuf_iterator __tmp = *this;
this->_M_nextc();
return __tmp;
}
bool equal(const istreambuf_iterator& __i) const {
return this->_M_is_initialized && __i._M_is_initialized
? this->_M_eof == __i._M_eof
: this->_M_equal_aux(__i);
}
private:
void _M_init(streambuf_type* __p) {
_M_buf = __p;
_M_eof = !__p;
_M_is_initialized = _M_eof;
}
char_type _M_dereference_aux() const;
bool _M_equal_aux(const istreambuf_iterator&) const;
void _M_postincr_aux();
void _M_nextc() {
int_type __c = _M_buf->snextc();
_M_c = traits_type::to_char_type(__c);
_M_eof = traits_type::eq_int_type(__c, traits_type::eof());
_M_is_initialized = true;
}
void _M_getc() const {
int_type __c = _M_buf->sgetc();
_M_c = traits_type::to_char_type(__c);
_M_eof = traits_type::eq_int_type(__c, traits_type::eof());
_M_is_initialized = true;
}
private:
streambuf_type* _M_buf;
mutable _CharT _M_c;
mutable bool _M_eof : 1;
mutable bool _M_is_initialized : 1;
};
template<class _CharT, class _Traits>
_CharT istreambuf_iterator<_CharT, _Traits>::_M_dereference_aux() const
{
this->_M_getc();
return _M_c;
}
template<class _CharT, class _Traits>
bool istreambuf_iterator<_CharT, _Traits>
::_M_equal_aux(const istreambuf_iterator& __i) const
{
if (!this->_M_is_initialized)
this->_M_getc();
if (!__i._M_is_initialized)
__i._M_getc();
return this->_M_eof == __i._M_eof;
}
template<class _CharT, class _Traits>
void istreambuf_iterator<_CharT, _Traits>::_M_postincr_aux()
{
this->_M_getc();
}
template<class _CharT, class _Traits>
inline bool operator==(const istreambuf_iterator<_CharT, _Traits>& __x,
const istreambuf_iterator<_CharT, _Traits>& __y) {
return __x.equal(__y);
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template<class _CharT, class _Traits>
inline bool operator!=(const istreambuf_iterator<_CharT, _Traits>& __x,
const istreambuf_iterator<_CharT, _Traits>& __y) {
return !__x.equal(__y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
// 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;
public:
ostreambuf_iterator(streambuf_type* __buf) : _M_buf(__buf), _M_ok(__buf) {}
ostreambuf_iterator(ostream_type& __o)
: _M_buf(__o.rdbuf()), _M_ok(__o.rdbuf() != 0) {}
ostreambuf_iterator& operator=(char_type __c) {
_M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c),
traits_type::eof());
return *this;
}
ostreambuf_iterator& operator*() { return *this; }
ostreambuf_iterator& operator++() { return *this; }
ostreambuf_iterator& operator++(int) { return *this; }
bool failed() const { return !_M_ok; }
private:
streambuf_type* _M_buf;
bool _M_ok;
};
#else /* __STL_USE_NEW_IOSTREAMS */
template <class _Tp, class _Dist = ptrdiff_t> class istream_iterator;
template <class _Tp, class _Dist>
inline bool operator==(const istream_iterator<_Tp, _Dist>&,
const istream_iterator<_Tp, _Dist>&);
template <class _Tp, class _Dist>
class istream_iterator {
#ifdef __STL_TEMPLATE_FRIENDS
template <class _T1, class _D1>
friend bool operator==(const istream_iterator<_T1, _D1>&,
const istream_iterator<_T1, _D1>&);
#else /* __STL_TEMPLATE_FRIENDS */
friend bool __STD_QUALIFIER
operator== __STL_NULL_TMPL_ARGS (const istream_iterator&,
const istream_iterator&);
#endif /* __STL_TEMPLATE_FRIENDS */
protected:
istream* _M_stream;
_Tp _M_value;
bool _M_end_marker;
void _M_read() {
_M_end_marker = (*_M_stream) ? true : false;
if (_M_end_marker) *_M_stream >> _M_value;
_M_end_marker = (*_M_stream) ? true : false;
}
public:
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(&cin), _M_end_marker(false) {}
istream_iterator(istream& __s) : _M_stream(&__s) { _M_read(); }
reference operator*() const { return _M_value; }
#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
#endif /* __SGI_STL_NO_ARROW_OPERATOR */
istream_iterator<_Tp, _Dist>& operator++() {
_M_read();
return *this;
}
istream_iterator<_Tp, _Dist> operator++(int) {
istream_iterator<_Tp, _Dist> __tmp = *this;
_M_read();
return __tmp;
}
};
#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class _Tp, class _Dist>
inline input_iterator_tag
iterator_category(const istream_iterator<_Tp, _Dist>&)
{
return input_iterator_tag();
}
template <class _Tp, class _Dist>
inline _Tp*
value_type(const istream_iterator<_Tp, _Dist>&) { return (_Tp*) 0; }
template <class _Tp, class _Dist>
inline _Dist*
distance_type(const istream_iterator<_Tp, _Dist>&) { return (_Dist*)0; }
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
template <class _Tp, class _Distance>
inline bool operator==(const istream_iterator<_Tp, _Distance>& __x,
const istream_iterator<_Tp, _Distance>& __y) {
return (__x._M_stream == __y._M_stream &&
__x._M_end_marker == __y._M_end_marker) ||
__x._M_end_marker == false && __y._M_end_marker == false;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Tp, class _Distance>
inline bool operator!=(const istream_iterator<_Tp, _Distance>& __x,
const istream_iterator<_Tp, _Distance>& __y) {
return !(__x == __y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
template <class _Tp>
class ostream_iterator {
protected:
ostream* _M_stream;
const char* _M_string;
public:
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
ostream_iterator(ostream& __s) : _M_stream(&__s), _M_string(0) {}
ostream_iterator(ostream& __s, const char* __c)
: _M_stream(&__s), _M_string(__c) {}
ostream_iterator<_Tp>& operator=(const _Tp& __value) {
*_M_stream << __value;
if (_M_string) *_M_stream << _M_string;
return *this;
}
ostream_iterator<_Tp>& operator*() { return *this; }
ostream_iterator<_Tp>& operator++() { return *this; }
ostream_iterator<_Tp>& operator++(int) { return *this; }
};
#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class _Tp>
inline output_iterator_tag
iterator_category(const ostream_iterator<_Tp>&) {
return output_iterator_tag();
}
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
#endif /* __STL_USE_NEW_IOSTREAMS */
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_ITERATOR_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,367 +0,0 @@
/*
*
* 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>
__STL_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 {};
// 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;
};
#ifdef __STL_USE_NAMESPACES
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;
};
#endif /* __STL_USE_NAMESPACES */
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
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)
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
template <class _Tp, class _Distance>
inline input_iterator_tag
iterator_category(const input_iterator<_Tp, _Distance>&)
{ return input_iterator_tag(); }
inline output_iterator_tag iterator_category(const output_iterator&)
{ return output_iterator_tag(); }
template <class _Tp, class _Distance>
inline forward_iterator_tag
iterator_category(const forward_iterator<_Tp, _Distance>&)
{ return forward_iterator_tag(); }
template <class _Tp, class _Distance>
inline bidirectional_iterator_tag
iterator_category(const bidirectional_iterator<_Tp, _Distance>&)
{ return bidirectional_iterator_tag(); }
template <class _Tp, class _Distance>
inline random_access_iterator_tag
iterator_category(const random_access_iterator<_Tp, _Distance>&)
{ return random_access_iterator_tag(); }
template <class _Tp>
inline random_access_iterator_tag iterator_category(const _Tp*)
{ return random_access_iterator_tag(); }
template <class _Tp, class _Distance>
inline _Tp* value_type(const input_iterator<_Tp, _Distance>&)
{ return (_Tp*)(0); }
template <class _Tp, class _Distance>
inline _Tp* value_type(const forward_iterator<_Tp, _Distance>&)
{ return (_Tp*)(0); }
template <class _Tp, class _Distance>
inline _Tp* value_type(const bidirectional_iterator<_Tp, _Distance>&)
{ return (_Tp*)(0); }
template <class _Tp, class _Distance>
inline _Tp* value_type(const random_access_iterator<_Tp, _Distance>&)
{ return (_Tp*)(0); }
template <class _Tp>
inline _Tp* value_type(const _Tp*) { return (_Tp*)(0); }
template <class _Tp, class _Distance>
inline _Distance* distance_type(const input_iterator<_Tp, _Distance>&)
{
return (_Distance*)(0);
}
template <class _Tp, class _Distance>
inline _Distance* distance_type(const forward_iterator<_Tp, _Distance>&)
{
return (_Distance*)(0);
}
template <class _Tp, class _Distance>
inline _Distance*
distance_type(const bidirectional_iterator<_Tp, _Distance>&)
{
return (_Distance*)(0);
}
template <class _Tp, class _Distance>
inline _Distance*
distance_type(const random_access_iterator<_Tp, _Distance>&)
{
return (_Distance*)(0);
}
template <class _Tp>
inline ptrdiff_t* distance_type(const _Tp*) { return (ptrdiff_t*)(0); }
// Without partial specialization we can't use iterator_traits, so
// we must keep the old iterator query functions around.
#define __ITERATOR_CATEGORY(__i) iterator_category(__i)
#define __DISTANCE_TYPE(__i) distance_type(__i)
#define __VALUE_TYPE(__i) value_type(__i)
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
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));
}
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,885 +0,0 @@
/*
*
* 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,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_LIST_H
#define __SGI_STL_INTERNAL_LIST_H
#include <concept_checks.h>
__STL_BEGIN_NAMESPACE
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#pragma set woff 1375
#endif
struct _List_node_base {
_List_node_base* _M_next;
_List_node_base* _M_prev;
};
template <class _Tp>
struct _List_node : public _List_node_base {
_Tp _M_data;
};
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) {}
_List_iterator_base() {}
void _M_incr() { _M_node = _M_node->_M_next; }
void _M_decr() { _M_node = _M_node->_M_prev; }
bool operator==(const _List_iterator_base& __x) const {
return _M_node == __x._M_node;
}
bool operator!=(const _List_iterator_base& __x) const {
return _M_node != __x._M_node;
}
};
template<class _Tp, class _Ref, class _Ptr>
struct _List_iterator : public _List_iterator_base {
typedef _List_iterator<_Tp,_Tp&,_Tp*> iterator;
typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;
typedef _List_iterator<_Tp,_Ref,_Ptr> _Self;
typedef _Tp value_type;
typedef _Ptr pointer;
typedef _Ref reference;
typedef _List_node<_Tp> _Node;
_List_iterator(_Node* __x) : _List_iterator_base(__x) {}
_List_iterator() {}
_List_iterator(const iterator& __x) : _List_iterator_base(__x._M_node) {}
reference operator*() const { return ((_Node*) _M_node)->_M_data; }
#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
#endif /* __SGI_STL_NO_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;
}
};
#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
inline bidirectional_iterator_tag
iterator_category(const _List_iterator_base&)
{
return bidirectional_iterator_tag();
}
template <class _Tp, class _Ref, class _Ptr>
inline _Tp*
value_type(const _List_iterator<_Tp, _Ref, _Ptr>&)
{
return 0;
}
inline ptrdiff_t*
distance_type(const _List_iterator_base&)
{
return 0;
}
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
// Base class that encapsulates details of allocators. Three cases:
// an ordinary standard-conforming allocator, a standard-conforming
// allocator with no non-static data, and an SGI-style allocator.
// This complexity is necessary only because we're worrying about backward
// compatibility and because we want to avoid wasting storage on an
// allocator instance if it isn't necessary.
#ifdef __STL_USE_STD_ALLOCATORS
// Base for general standard-conforming allocators.
template <class _Tp, class _Allocator, bool _IsStatic>
class _List_alloc_base {
public:
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
allocator_type;
allocator_type get_allocator() const { return _Node_allocator; }
_List_alloc_base(const allocator_type& __a) : _Node_allocator(__a) {}
protected:
_List_node<_Tp>* _M_get_node()
{ return _Node_allocator.allocate(1); }
void _M_put_node(_List_node<_Tp>* __p)
{ _Node_allocator.deallocate(__p, 1); }
protected:
typename _Alloc_traits<_List_node<_Tp>, _Allocator>::allocator_type
_Node_allocator;
_List_node<_Tp>* _M_node;
};
// Specialization for instanceless allocators.
template <class _Tp, class _Allocator>
class _List_alloc_base<_Tp, _Allocator, true> {
public:
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
allocator_type;
allocator_type get_allocator() const { return allocator_type(); }
_List_alloc_base(const allocator_type&) {}
protected:
typedef typename _Alloc_traits<_List_node<_Tp>, _Allocator>::_Alloc_type
_Alloc_type;
_List_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); }
void _M_put_node(_List_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); }
protected:
_List_node<_Tp>* _M_node;
};
template <class _Tp, class _Alloc>
class _List_base
: public _List_alloc_base<_Tp, _Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless>
{
public:
typedef _List_alloc_base<_Tp, _Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless>
_Base;
typedef typename _Base::allocator_type allocator_type;
_List_base(const allocator_type& __a) : _Base(__a) {
_M_node = _M_get_node();
_M_node->_M_next = _M_node;
_M_node->_M_prev = _M_node;
}
~_List_base() {
clear();
_M_put_node(_M_node);
}
void clear();
};
#else /* __STL_USE_STD_ALLOCATORS */
template <class _Tp, class _Alloc>
class _List_base
{
public:
typedef _Alloc allocator_type;
allocator_type get_allocator() const { return allocator_type(); }
_List_base(const allocator_type&) {
_M_node = _M_get_node();
_M_node->_M_next = _M_node;
_M_node->_M_prev = _M_node;
}
~_List_base() {
clear();
_M_put_node(_M_node);
}
void clear();
protected:
typedef simple_alloc<_List_node<_Tp>, _Alloc> _Alloc_type;
_List_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); }
void _M_put_node(_List_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); }
protected:
_List_node<_Tp>* _M_node;
};
#endif /* __STL_USE_STD_ALLOCATORS */
template <class _Tp, class _Alloc>
void
_List_base<_Tp,_Alloc>::clear()
{
_List_node<_Tp>* __cur = (_List_node<_Tp>*) _M_node->_M_next;
while (__cur != _M_node) {
_List_node<_Tp>* __tmp = __cur;
__cur = (_List_node<_Tp>*) __cur->_M_next;
_Destroy(&__tmp->_M_data);
_M_put_node(__tmp);
}
_M_node->_M_next = _M_node;
_M_node->_M_prev = _M_node;
}
template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
class list : protected _List_base<_Tp, _Alloc> {
// requirements:
__STL_CLASS_REQUIRES(_Tp, _Assignable);
typedef _List_base<_Tp, _Alloc> _Base;
protected:
typedef void* _Void_pointer;
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 _List_node<_Tp> _Node;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef typename _Base::allocator_type allocator_type;
allocator_type get_allocator() const { return _Base::get_allocator(); }
public:
typedef _List_iterator<_Tp,_Tp&,_Tp*> iterator;
typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
typedef reverse_iterator<const_iterator> const_reverse_iterator;
typedef reverse_iterator<iterator> reverse_iterator;
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
typedef reverse_bidirectional_iterator<const_iterator,value_type,
const_reference,difference_type>
const_reverse_iterator;
typedef reverse_bidirectional_iterator<iterator,value_type,reference,
difference_type>
reverse_iterator;
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
protected:
#ifdef __STL_HAS_NAMESPACES
using _Base::_M_node;
using _Base::_M_put_node;
using _Base::_M_get_node;
#endif /* __STL_HAS_NAMESPACES */
protected:
_Node* _M_create_node(const _Tp& __x)
{
_Node* __p = _M_get_node();
__STL_TRY {
_Construct(&__p->_M_data, __x);
}
__STL_UNWIND(_M_put_node(__p));
return __p;
}
_Node* _M_create_node()
{
_Node* __p = _M_get_node();
__STL_TRY {
_Construct(&__p->_M_data);
}
__STL_UNWIND(_M_put_node(__p));
return __p;
}
public:
explicit list(const allocator_type& __a = allocator_type()) : _Base(__a) {}
iterator begin() { return (_Node*)(_M_node->_M_next); }
const_iterator begin() const { return (_Node*)(_M_node->_M_next); }
iterator end() { return _M_node; }
const_iterator end() const { return _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_node->_M_next == _M_node; }
size_type size() const {
size_type __result = 0;
distance(begin(), end(), __result);
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()); }
void swap(list<_Tp, _Alloc>& __x) { __STD::swap(_M_node, __x._M_node); }
iterator insert(iterator __position, const _Tp& __x) {
_Node* __tmp = _M_create_node(__x);
__tmp->_M_next = __position._M_node;
__tmp->_M_prev = __position._M_node->_M_prev;
__position._M_node->_M_prev->_M_next = __tmp;
__position._M_node->_M_prev = __tmp;
return __tmp;
}
iterator insert(iterator __position) { return insert(__position, _Tp()); }
#ifdef __STL_MEMBER_TEMPLATES
// 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,
__true_type) {
_M_fill_insert(__pos, (size_type) __n, (_Tp) __x);
}
template <class _InputIterator>
void _M_insert_dispatch(iterator __pos,
_InputIterator __first, _InputIterator __last,
__false_type);
template <class _InputIterator>
void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_insert_dispatch(__pos, __first, __last, _Integral());
}
#else /* __STL_MEMBER_TEMPLATES */
void insert(iterator __position, const _Tp* __first, const _Tp* __last);
void insert(iterator __position,
const_iterator __first, const_iterator __last);
#endif /* __STL_MEMBER_TEMPLATES */
void insert(iterator __pos, size_type __n, const _Tp& __x)
{ _M_fill_insert(__pos, __n, __x); }
void _M_fill_insert(iterator __pos, size_type __n, const _Tp& __x);
void push_front(const _Tp& __x) { insert(begin(), __x); }
void push_front() {insert(begin());}
void push_back(const _Tp& __x) { insert(end(), __x); }
void push_back() {insert(end());}
iterator erase(iterator __position) {
_List_node_base* __next_node = __position._M_node->_M_next;
_List_node_base* __prev_node = __position._M_node->_M_prev;
_Node* __n = (_Node*) __position._M_node;
__prev_node->_M_next = __next_node;
__next_node->_M_prev = __prev_node;
_Destroy(&__n->_M_data);
_M_put_node(__n);
return iterator((_Node*) __next_node);
}
iterator erase(iterator __first, iterator __last);
void clear() { _Base::clear(); }
void resize(size_type __new_size, const _Tp& __x);
void resize(size_type __new_size) { this->resize(__new_size, _Tp()); }
void pop_front() { erase(begin()); }
void pop_back() {
iterator __tmp = end();
erase(--__tmp);
}
list(size_type __n, const _Tp& __value,
const allocator_type& __a = allocator_type())
: _Base(__a)
{ insert(begin(), __n, __value); }
explicit list(size_type __n)
: _Base(allocator_type())
{ insert(begin(), __n, _Tp()); }
#ifdef __STL_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 = allocator_type())
: _Base(__a)
{ insert(begin(), __first, __last); }
#else /* __STL_MEMBER_TEMPLATES */
list(const _Tp* __first, const _Tp* __last,
const allocator_type& __a = allocator_type())
: _Base(__a)
{ this->insert(begin(), __first, __last); }
list(const_iterator __first, const_iterator __last,
const allocator_type& __a = allocator_type())
: _Base(__a)
{ this->insert(begin(), __first, __last); }
#endif /* __STL_MEMBER_TEMPLATES */
list(const list<_Tp, _Alloc>& __x) : _Base(__x.get_allocator())
{ insert(begin(), __x.begin(), __x.end()); }
~list() { }
list<_Tp, _Alloc>& operator=(const list<_Tp, _Alloc>& __x);
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); }
void _M_fill_assign(size_type __n, const _Tp& __val);
#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void assign(_InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_assign_dispatch(__first, __last, _Integral());
}
template <class _Integer>
void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
{ _M_fill_assign((size_type) __n, (_Tp) __val); }
template <class _InputIterator>
void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
__false_type);
#endif /* __STL_MEMBER_TEMPLATES */
protected:
void transfer(iterator __position, iterator __first, iterator __last) {
if (__position != __last) {
// Remove [first, last) from its old position.
__last._M_node->_M_prev->_M_next = __position._M_node;
__first._M_node->_M_prev->_M_next = __last._M_node;
__position._M_node->_M_prev->_M_next = __first._M_node;
// Splice [first, last) into its new position.
_List_node_base* __tmp = __position._M_node->_M_prev;
__position._M_node->_M_prev = __last._M_node->_M_prev;
__last._M_node->_M_prev = __first._M_node->_M_prev;
__first._M_node->_M_prev = __tmp;
}
}
public:
void splice(iterator __position, list& __x) {
if (!__x.empty())
this->transfer(__position, __x.begin(), __x.end());
}
void splice(iterator __position, list&, iterator __i) {
iterator __j = __i;
++__j;
if (__position == __i || __position == __j) return;
this->transfer(__position, __i, __j);
}
void splice(iterator __position, list&, iterator __first, iterator __last) {
if (__first != __last)
this->transfer(__position, __first, __last);
}
void remove(const _Tp& __value);
void unique();
void merge(list& __x);
void reverse();
void sort();
#ifdef __STL_MEMBER_TEMPLATES
template <class _Predicate> void remove_if(_Predicate);
template <class _BinaryPredicate> void unique(_BinaryPredicate);
template <class _StrictWeakOrdering> void merge(list&, _StrictWeakOrdering);
template <class _StrictWeakOrdering> void sort(_StrictWeakOrdering);
#endif /* __STL_MEMBER_TEMPLATES */
};
template <class _Tp, class _Alloc>
inline bool
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;
}
template <class _Tp, class _Alloc>
inline bool operator<(const list<_Tp,_Alloc>& __x,
const list<_Tp,_Alloc>& __y)
{
return lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end());
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Tp, class _Alloc>
inline bool operator!=(const list<_Tp,_Alloc>& __x,
const list<_Tp,_Alloc>& __y) {
return !(__x == __y);
}
template <class _Tp, class _Alloc>
inline bool operator>(const list<_Tp,_Alloc>& __x,
const list<_Tp,_Alloc>& __y) {
return __y < __x;
}
template <class _Tp, class _Alloc>
inline bool operator<=(const list<_Tp,_Alloc>& __x,
const list<_Tp,_Alloc>& __y) {
return !(__y < __x);
}
template <class _Tp, class _Alloc>
inline bool operator>=(const list<_Tp,_Alloc>& __x,
const list<_Tp,_Alloc>& __y) {
return !(__x < __y);
}
template <class _Tp, class _Alloc>
inline void
swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
{
__x.swap(__y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp, class _Alloc> template <class _InputIter>
void
list<_Tp, _Alloc>::_M_insert_dispatch(iterator __position,
_InputIter __first, _InputIter __last,
__false_type)
{
for ( ; __first != __last; ++__first)
insert(__position, *__first);
}
#else /* __STL_MEMBER_TEMPLATES */
template <class _Tp, class _Alloc>
void
list<_Tp, _Alloc>::insert(iterator __position,
const _Tp* __first, const _Tp* __last)
{
for ( ; __first != __last; ++__first)
insert(__position, *__first);
}
template <class _Tp, class _Alloc>
void
list<_Tp, _Alloc>::insert(iterator __position,
const_iterator __first, const_iterator __last)
{
for ( ; __first != __last; ++__first)
insert(__position, *__first);
}
#endif /* __STL_MEMBER_TEMPLATES */
template <class _Tp, class _Alloc>
void
list<_Tp, _Alloc>::_M_fill_insert(iterator __position,
size_type __n, const _Tp& __x)
{
for ( ; __n > 0; --__n)
insert(__position, __x);
}
template <class _Tp, class _Alloc>
typename list<_Tp,_Alloc>::iterator list<_Tp, _Alloc>::erase(iterator __first,
iterator __last)
{
while (__first != __last)
erase(__first++);
return __last;
}
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());
}
#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp, class _Alloc> template <class _InputIter>
void
list<_Tp, _Alloc>::_M_assign_dispatch(_InputIter __first2, _InputIter __last2,
__false_type)
{
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);
}
#endif /* __STL_MEMBER_TEMPLATES */
template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::remove(const _Tp& __value)
{
iterator __first = begin();
iterator __last = end();
while (__first != __last) {
iterator __next = __first;
++__next;
if (*__first == __value) erase(__first);
__first = __next;
}
}
template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::unique()
{
iterator __first = begin();
iterator __last = end();
if (__first == __last) return;
iterator __next = __first;
while (++__next != __last) {
if (*__first == *__next)
erase(__next);
else
__first = __next;
__next = __first;
}
}
template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::merge(list<_Tp, _Alloc>& __x)
{
iterator __first1 = begin();
iterator __last1 = end();
iterator __first2 = __x.begin();
iterator __last2 = __x.end();
while (__first1 != __last1 && __first2 != __last2)
if (*__first2 < *__first1) {
iterator __next = __first2;
transfer(__first1, __first2, ++__next);
__first2 = __next;
}
else
++__first1;
if (__first2 != __last2) transfer(__last1, __first2, __last2);
}
inline void __List_base_reverse(_List_node_base* __p)
{
_List_node_base* __tmp = __p;
do {
__STD::swap(__tmp->_M_next, __tmp->_M_prev);
__tmp = __tmp->_M_prev; // Old next node is now prev.
} while (__tmp != __p);
}
template <class _Tp, class _Alloc>
inline void list<_Tp, _Alloc>::reverse()
{
__List_base_reverse(this->_M_node);
}
template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::sort()
{
// Do nothing if the list has length 0 or 1.
if (_M_node->_M_next != _M_node && _M_node->_M_next->_M_next != _M_node) {
list<_Tp, _Alloc> __carry;
list<_Tp, _Alloc> __counter[64];
int __fill = 0;
while (!empty()) {
__carry.splice(__carry.begin(), *this, begin());
int __i = 0;
while(__i < __fill && !__counter[__i].empty()) {
__counter[__i].merge(__carry);
__carry.swap(__counter[__i++]);
}
__carry.swap(__counter[__i]);
if (__i == __fill) ++__fill;
}
for (int __i = 1; __i < __fill; ++__i)
__counter[__i].merge(__counter[__i-1]);
swap(__counter[__fill-1]);
}
}
#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp, class _Alloc> template <class _Predicate>
void list<_Tp, _Alloc>::remove_if(_Predicate __pred)
{
iterator __first = begin();
iterator __last = end();
while (__first != __last) {
iterator __next = __first;
++__next;
if (__pred(*__first)) erase(__first);
__first = __next;
}
}
template <class _Tp, class _Alloc> template <class _BinaryPredicate>
void list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
{
iterator __first = begin();
iterator __last = end();
if (__first == __last) return;
iterator __next = __first;
while (++__next != __last) {
if (__binary_pred(*__first, *__next))
erase(__next);
else
__first = __next;
__next = __first;
}
}
template <class _Tp, class _Alloc> template <class _StrictWeakOrdering>
void list<_Tp, _Alloc>::merge(list<_Tp, _Alloc>& __x,
_StrictWeakOrdering __comp)
{
iterator __first1 = begin();
iterator __last1 = end();
iterator __first2 = __x.begin();
iterator __last2 = __x.end();
while (__first1 != __last1 && __first2 != __last2)
if (__comp(*__first2, *__first1)) {
iterator __next = __first2;
transfer(__first1, __first2, ++__next);
__first2 = __next;
}
else
++__first1;
if (__first2 != __last2) transfer(__last1, __first2, __last2);
}
template <class _Tp, class _Alloc> template <class _StrictWeakOrdering>
void list<_Tp, _Alloc>::sort(_StrictWeakOrdering __comp)
{
// Do nothing if the list has length 0 or 1.
if (_M_node->_M_next != _M_node && _M_node->_M_next->_M_next != _M_node) {
list<_Tp, _Alloc> __carry;
list<_Tp, _Alloc> __counter[64];
int __fill = 0;
while (!empty()) {
__carry.splice(__carry.begin(), *this, begin());
int __i = 0;
while(__i < __fill && !__counter[__i].empty()) {
__counter[__i].merge(__carry, __comp);
__carry.swap(__counter[__i++]);
}
__carry.swap(__counter[__i]);
if (__i == __fill) ++__fill;
}
for (int __i = 1; __i < __fill; ++__i)
__counter[__i].merge(__counter[__i-1], __comp);
swap(__counter[__fill-1]);
}
}
#endif /* __STL_MEMBER_TEMPLATES */
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
#pragma reset woff 1375
#endif
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_LIST_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,295 +0,0 @@
/*
*
* 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,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_MAP_H
#define __SGI_STL_INTERNAL_MAP_H
#include <concept_checks.h>
__STL_BEGIN_NAMESPACE
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#pragma set woff 1375
#endif
// Forward declarations of operators == and <, needed for friend declarations.
template <class _Key, class _Tp,
class _Compare __STL_DEPENDENT_DEFAULT_TMPL(less<_Key>),
class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
class map;
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator==(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y);
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator<(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y);
template <class _Key, class _Tp, class _Compare, class _Alloc>
class map {
public:
// requirements:
__STL_CLASS_REQUIRES(_Tp, _Assignable);
__STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key);
// 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 :
_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);
}
};
private:
typedef _Rb_tree<key_type, value_type,
_Select1st<value_type>, key_compare, _Alloc> _Rep_type;
_Rep_type _M_t; // red-black tree representing map
public:
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;
// allocation/deallocation
map() : _M_t(_Compare(), allocator_type()) {}
explicit map(const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) {}
#ifdef __STL_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 = allocator_type())
: _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
#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 /* __STL_MEMBER_TEMPLATES */
map(const map<_Key,_Tp,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
map<_Key,_Tp,_Compare,_Alloc>&
operator=(const map<_Key, _Tp, _Compare, _Alloc>& __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(); }
_Tp& operator[](const key_type& __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, _Tp()));
return (*__i).second;
}
void swap(map<_Key,_Tp,_Compare,_Alloc>& __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 position, const value_type& __x)
{ return _M_t.insert_unique(position, __x); }
#ifdef __STL_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 /* __STL_MEMBER_TEMPLATES */
void erase(iterator __position) { _M_t.erase(__position); }
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(); }
// map operations:
iterator find(const key_type& __x) { return _M_t.find(__x); }
const_iterator find(const key_type& __x) const { return _M_t.find(__x); }
size_type count(const key_type& __x) const {
return _M_t.find(__x) == _M_t.end() ? 0 : 1;
}
iterator lower_bound(const key_type& __x) {return _M_t.lower_bound(__x); }
const_iterator lower_bound(const key_type& __x) const {
return _M_t.lower_bound(__x);
}
iterator upper_bound(const key_type& __x) {return _M_t.upper_bound(__x); }
const_iterator upper_bound(const key_type& __x) const {
return _M_t.upper_bound(__x);
}
pair<iterator,iterator> equal_range(const key_type& __x) {
return _M_t.equal_range(__x);
}
pair<const_iterator,const_iterator> equal_range(const key_type& __x) const {
return _M_t.equal_range(__x);
}
#ifdef __STL_TEMPLATE_FRIENDS
template <class _K1, class _T1, class _C1, class _A1>
friend bool operator== (const map<_K1, _T1, _C1, _A1>&,
const map<_K1, _T1, _C1, _A1>&);
template <class _K1, class _T1, class _C1, class _A1>
friend bool operator< (const map<_K1, _T1, _C1, _A1>&,
const map<_K1, _T1, _C1, _A1>&);
#else /* __STL_TEMPLATE_FRIENDS */
friend bool __STD_QUALIFIER
operator== __STL_NULL_TMPL_ARGS (const map&, const map&);
friend bool __STD_QUALIFIER
operator< __STL_NULL_TMPL_ARGS (const map&, const map&);
#endif /* __STL_TEMPLATE_FRIENDS */
};
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator==(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) {
return __x._M_t == __y._M_t;
}
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator<(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) {
return __x._M_t < __y._M_t;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator!=(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) {
return !(__x == __y);
}
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator>(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) {
return __y < __x;
}
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator<=(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) {
return !(__y < __x);
}
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator>=(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) {
return !(__x < __y);
}
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline void swap(map<_Key,_Tp,_Compare,_Alloc>& __x,
map<_Key,_Tp,_Compare,_Alloc>& __y) {
__x.swap(__y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
#pragma reset woff 1375
#endif
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_MAP_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,282 +0,0 @@
/*
*
* 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,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_MULTIMAP_H
#define __SGI_STL_INTERNAL_MULTIMAP_H
#include <concept_checks.h>
__STL_BEGIN_NAMESPACE
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#pragma set woff 1375
#endif
// Forward declaration of operators < and ==, needed for friend declaration.
template <class _Key, class _Tp,
class _Compare __STL_DEPENDENT_DEFAULT_TMPL(less<_Key>),
class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
class multimap;
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y);
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y);
template <class _Key, class _Tp, class _Compare, class _Alloc>
class multimap {
// requirements:
__STL_CLASS_REQUIRES(_Tp, _Assignable);
__STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key);
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:
_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);
}
};
private:
typedef _Rb_tree<key_type, value_type,
_Select1st<value_type>, key_compare, _Alloc> _Rep_type;
_Rep_type _M_t; // red-black tree representing multimap
public:
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;
// allocation/deallocation
multimap() : _M_t(_Compare(), allocator_type()) { }
explicit multimap(const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) { }
#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
multimap(_InputIterator __first, _InputIterator __last)
: _M_t(_Compare(), allocator_type())
{ _M_t.insert_equal(__first, __last); }
template <class _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _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 /* __STL_MEMBER_TEMPLATES */
multimap(const multimap<_Key,_Tp,_Compare,_Alloc>& __x) : _M_t(__x._M_t) { }
multimap<_Key,_Tp,_Compare,_Alloc>&
operator=(const multimap<_Key,_Tp,_Compare,_Alloc>& __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(multimap<_Key,_Tp,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); }
// insert/erase
iterator insert(const value_type& __x) { return _M_t.insert_equal(__x); }
iterator insert(iterator __position, const value_type& __x) {
return _M_t.insert_equal(__position, __x);
}
#ifdef __STL_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 /* __STL_MEMBER_TEMPLATES */
void erase(iterator __position) { _M_t.erase(__position); }
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:
iterator find(const key_type& __x) { return _M_t.find(__x); }
const_iterator find(const key_type& __x) const { return _M_t.find(__x); }
size_type count(const key_type& __x) const { return _M_t.count(__x); }
iterator lower_bound(const key_type& __x) {return _M_t.lower_bound(__x); }
const_iterator lower_bound(const key_type& __x) const {
return _M_t.lower_bound(__x);
}
iterator upper_bound(const key_type& __x) {return _M_t.upper_bound(__x); }
const_iterator upper_bound(const key_type& __x) const {
return _M_t.upper_bound(__x);
}
pair<iterator,iterator> equal_range(const key_type& __x) {
return _M_t.equal_range(__x);
}
pair<const_iterator,const_iterator> equal_range(const key_type& __x) const {
return _M_t.equal_range(__x);
}
#ifdef __STL_TEMPLATE_FRIENDS
template <class _K1, class _T1, class _C1, class _A1>
friend bool operator== (const multimap<_K1, _T1, _C1, _A1>&,
const multimap<_K1, _T1, _C1, _A1>&);
template <class _K1, class _T1, class _C1, class _A1>
friend bool operator< (const multimap<_K1, _T1, _C1, _A1>&,
const multimap<_K1, _T1, _C1, _A1>&);
#else /* __STL_TEMPLATE_FRIENDS */
friend bool __STD_QUALIFIER
operator== __STL_NULL_TMPL_ARGS (const multimap&, const multimap&);
friend bool __STD_QUALIFIER
operator< __STL_NULL_TMPL_ARGS (const multimap&, const multimap&);
#endif /* __STL_TEMPLATE_FRIENDS */
};
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
return __x._M_t == __y._M_t;
}
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
return __x._M_t < __y._M_t;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator!=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
return !(__x == __y);
}
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator>(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
return __y < __x;
}
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator<=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
return !(__y < __x);
}
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator>=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
return !(__x < __y);
}
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline void swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x,
multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
__x.swap(__y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
#pragma reset woff 1375
#endif
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_MULTIMAP_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,274 +0,0 @@
/*
*
* 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
* 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_MULTISET_H
#define __SGI_STL_INTERNAL_MULTISET_H
#include <concept_checks.h>
__STL_BEGIN_NAMESPACE
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#pragma set woff 1375
#endif
// Forward declaration of operators < and ==, needed for friend declaration.
template <class _Key, class _Compare __STL_DEPENDENT_DEFAULT_TMPL(less<_Key>),
class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) >
class multiset;
template <class _Key, class _Compare, class _Alloc>
inline bool operator==(const multiset<_Key,_Compare,_Alloc>& __x,
const multiset<_Key,_Compare,_Alloc>& __y);
template <class _Key, class _Compare, class _Alloc>
inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x,
const multiset<_Key,_Compare,_Alloc>& __y);
template <class _Key, class _Compare, class _Alloc>
class multiset {
// requirements:
__STL_CLASS_REQUIRES(_Key, _Assignable);
__STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key);
public:
// typedefs:
typedef _Key key_type;
typedef _Key value_type;
typedef _Compare key_compare;
typedef _Compare value_compare;
private:
typedef _Rb_tree<key_type, value_type,
_Identity<value_type>, key_compare, _Alloc> _Rep_type;
_Rep_type _M_t; // red-black tree representing multiset
public:
typedef typename _Rep_type::const_pointer pointer;
typedef typename _Rep_type::const_pointer const_pointer;
typedef typename _Rep_type::const_reference reference;
typedef typename _Rep_type::const_reference const_reference;
typedef typename _Rep_type::const_iterator iterator;
typedef typename _Rep_type::const_iterator const_iterator;
typedef typename _Rep_type::const_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;
// allocation/deallocation
multiset() : _M_t(_Compare(), allocator_type()) {}
explicit multiset(const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) {}
#ifdef __STL_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 = allocator_type())
: _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
#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 /* __STL_MEMBER_TEMPLATES */
multiset(const multiset<_Key,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
multiset<_Key,_Compare,_Alloc>&
operator=(const multiset<_Key,_Compare,_Alloc>& __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() const { return _M_t.begin(); }
iterator end() const { return _M_t.end(); }
reverse_iterator rbegin() const { return _M_t.rbegin(); }
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(multiset<_Key,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); }
// insert/erase
iterator insert(const value_type& __x) {
return _M_t.insert_equal(__x);
}
iterator insert(iterator __position, const value_type& __x) {
typedef typename _Rep_type::iterator _Rep_iterator;
return _M_t.insert_equal((_Rep_iterator&)__position, __x);
}
#ifdef __STL_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 /* __STL_MEMBER_TEMPLATES */
void erase(iterator __position) {
typedef typename _Rep_type::iterator _Rep_iterator;
_M_t.erase((_Rep_iterator&)__position);
}
size_type erase(const key_type& __x) {
return _M_t.erase(__x);
}
void erase(iterator __first, iterator __last) {
typedef typename _Rep_type::iterator _Rep_iterator;
_M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last);
}
void clear() { _M_t.clear(); }
// multiset operations:
iterator find(const key_type& __x) const { return _M_t.find(__x); }
size_type count(const key_type& __x) const { return _M_t.count(__x); }
iterator lower_bound(const key_type& __x) const {
return _M_t.lower_bound(__x);
}
iterator upper_bound(const key_type& __x) const {
return _M_t.upper_bound(__x);
}
pair<iterator,iterator> equal_range(const key_type& __x) const {
return _M_t.equal_range(__x);
}
#ifdef __STL_TEMPLATE_FRIENDS
template <class _K1, class _C1, class _A1>
friend bool operator== (const multiset<_K1,_C1,_A1>&,
const multiset<_K1,_C1,_A1>&);
template <class _K1, class _C1, class _A1>
friend bool operator< (const multiset<_K1,_C1,_A1>&,
const multiset<_K1,_C1,_A1>&);
#else /* __STL_TEMPLATE_FRIENDS */
friend bool __STD_QUALIFIER
operator== __STL_NULL_TMPL_ARGS (const multiset&, const multiset&);
friend bool __STD_QUALIFIER
operator< __STL_NULL_TMPL_ARGS (const multiset&, const multiset&);
#endif /* __STL_TEMPLATE_FRIENDS */
};
template <class _Key, class _Compare, class _Alloc>
inline bool operator==(const multiset<_Key,_Compare,_Alloc>& __x,
const multiset<_Key,_Compare,_Alloc>& __y) {
return __x._M_t == __y._M_t;
}
template <class _Key, class _Compare, class _Alloc>
inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x,
const multiset<_Key,_Compare,_Alloc>& __y) {
return __x._M_t < __y._M_t;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Key, class _Compare, class _Alloc>
inline bool operator!=(const multiset<_Key,_Compare,_Alloc>& __x,
const multiset<_Key,_Compare,_Alloc>& __y) {
return !(__x == __y);
}
template <class _Key, class _Compare, class _Alloc>
inline bool operator>(const multiset<_Key,_Compare,_Alloc>& __x,
const multiset<_Key,_Compare,_Alloc>& __y) {
return __y < __x;
}
template <class _Key, class _Compare, class _Alloc>
inline bool operator<=(const multiset<_Key,_Compare,_Alloc>& __x,
const multiset<_Key,_Compare,_Alloc>& __y) {
return !(__y < __x);
}
template <class _Key, class _Compare, class _Alloc>
inline bool operator>=(const multiset<_Key,_Compare,_Alloc>& __x,
const multiset<_Key,_Compare,_Alloc>& __y) {
return !(__x < __y);
}
template <class _Key, class _Compare, class _Alloc>
inline void swap(multiset<_Key,_Compare,_Alloc>& __x,
multiset<_Key,_Compare,_Alloc>& __y) {
__x.swap(__y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
#pragma reset woff 1375
#endif
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_MULTISET_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,255 +0,0 @@
/*
*
* 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,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_NUMERIC_H
#define __SGI_STL_INTERNAL_NUMERIC_H
__STL_BEGIN_NAMESPACE
template <class _InputIterator, class _Tp>
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
{
__STL_REQUIRES(_InputIterator, _InputIterator);
for ( ; __first != __last; ++__first)
__init = __init + *__first;
return __init;
}
template <class _InputIterator, class _Tp, class _BinaryOperation>
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
_BinaryOperation __binary_op)
{
__STL_REQUIRES(_InputIterator, _InputIterator);
for ( ; __first != __last; ++__first)
__init = __binary_op(__init, *__first);
return __init;
}
template <class _InputIterator1, class _InputIterator2, class _Tp>
_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _Tp __init)
{
__STL_REQUIRES(_InputIterator2, _InputIterator);
__STL_REQUIRES(_InputIterator2, _InputIterator);
for ( ; __first1 != __last1; ++__first1, ++__first2)
__init = __init + (*__first1 * *__first2);
return __init;
}
template <class _InputIterator1, class _InputIterator2, class _Tp,
class _BinaryOperation1, class _BinaryOperation2>
_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _Tp __init,
_BinaryOperation1 __binary_op1,
_BinaryOperation2 __binary_op2)
{
__STL_REQUIRES(_InputIterator2, _InputIterator);
__STL_REQUIRES(_InputIterator2, _InputIterator);
for ( ; __first1 != __last1; ++__first1, ++__first2)
__init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
return __init;
}
template <class _InputIterator, class _OutputIterator, class _Tp>
_OutputIterator
__partial_sum(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Tp*)
{
_Tp __value = *__first;
while (++__first != __last) {
__value = __value + *__first;
*++__result = __value;
}
return ++__result;
}
template <class _InputIterator, class _OutputIterator>
_OutputIterator
partial_sum(_InputIterator __first, _InputIterator __last,
_OutputIterator __result)
{
__STL_REQUIRES(_InputIterator, _InputIterator);
__STL_REQUIRES(_OutputIterator, _OutputIterator);
if (__first == __last) return __result;
*__result = *__first;
return __partial_sum(__first, __last, __result, __VALUE_TYPE(__first));
}
template <class _InputIterator, class _OutputIterator, class _Tp,
class _BinaryOperation>
_OutputIterator
__partial_sum(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Tp*, _BinaryOperation __binary_op)
{
_Tp __value = *__first;
while (++__first != __last) {
__value = __binary_op(__value, *__first);
*++__result = __value;
}
return ++__result;
}
template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
_OutputIterator
partial_sum(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _BinaryOperation __binary_op)
{
__STL_REQUIRES(_InputIterator, _InputIterator);
__STL_REQUIRES(_OutputIterator, _OutputIterator);
if (__first == __last) return __result;
*__result = *__first;
return __partial_sum(__first, __last, __result, __VALUE_TYPE(__first),
__binary_op);
}
template <class _InputIterator, class _OutputIterator, class _Tp>
_OutputIterator
__adjacent_difference(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Tp*)
{
_Tp __value = *__first;
while (++__first != __last) {
_Tp __tmp = *__first;
*++__result = __tmp - __value;
__value = __tmp;
}
return ++__result;
}
template <class _InputIterator, class _OutputIterator>
_OutputIterator
adjacent_difference(_InputIterator __first,
_InputIterator __last, _OutputIterator __result)
{
__STL_REQUIRES(_InputIterator, _InputIterator);
__STL_REQUIRES(_OutputIterator, _OutputIterator);
if (__first == __last) return __result;
*__result = *__first;
return __adjacent_difference(__first, __last, __result,
__VALUE_TYPE(__first));
}
template <class _InputIterator, class _OutputIterator, class _Tp,
class _BinaryOperation>
_OutputIterator
__adjacent_difference(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Tp*,
_BinaryOperation __binary_op) {
_Tp __value = *__first;
while (++__first != __last) {
_Tp __tmp = *__first;
*++__result = __binary_op(__tmp, __value);
__value = __tmp;
}
return ++__result;
}
template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
_OutputIterator
adjacent_difference(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _BinaryOperation __binary_op)
{
__STL_REQUIRES(_InputIterator, _InputIterator);
__STL_REQUIRES(_OutputIterator, _OutputIterator);
if (__first == __last) return __result;
*__result = *__first;
return __adjacent_difference(__first, __last, __result,
__VALUE_TYPE(__first),
__binary_op);
}
// Returns __x ** __n, where __n >= 0. _Note that "multiplication"
// is required to be associative, but not necessarily commutative.
template <class _Tp, class _Integer, class _MonoidOperation>
_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr)
{
if (__n == 0)
return identity_element(__opr);
else {
while ((__n & 1) == 0) {
__n >>= 1;
__x = __opr(__x, __x);
}
_Tp __result = __x;
__n >>= 1;
while (__n != 0) {
__x = __opr(__x, __x);
if ((__n & 1) != 0)
__result = __opr(__result, __x);
__n >>= 1;
}
return __result;
}
}
template <class _Tp, class _Integer>
inline _Tp __power(_Tp __x, _Integer __n)
{
return __power(__x, __n, multiplies<_Tp>());
}
// 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 __power(__x, __n, __opr);
}
template <class _Tp, class _Integer>
inline _Tp power(_Tp __x, _Integer __n)
{
return __power(__x, __n);
}
// iota is not part of the C++ standard. It is an extension.
template <class _ForwardIter, class _Tp>
void
iota(_ForwardIter __first, _ForwardIter __last, _Tp __value)
{
__STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator);
__STL_CONVERTIBLE(_Tp, typename iterator_traits<_ForwardIter>::value_type);
while (__first != __last)
*__first++ = __value++;
}
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_NUMERIC_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,101 +0,0 @@
/*
*
* 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,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_PAIR_H
#define __SGI_STL_INTERNAL_PAIR_H
__STL_BEGIN_NAMESPACE
template <class _T1, class _T2>
struct pair {
typedef _T1 first_type;
typedef _T2 second_type;
_T1 first;
_T2 second;
pair() : first(_T1()), second(_T2()) {}
pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
#ifdef __STL_MEMBER_TEMPLATES
template <class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
#endif
};
template <class _T1, class _T2>
inline bool 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 operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
{
return __x.first < __y.first ||
(!(__y.first < __x.first) && __x.second < __y.second);
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _T1, class _T2>
inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return !(__x == __y);
}
template <class _T1, class _T2>
inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return __y < __x;
}
template <class _T1, class _T2>
inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return !(__y < __x);
}
template <class _T1, class _T2>
inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return !(__x < __y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
template <class _T1, class _T2>
inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y)
{
return pair<_T1, _T2>(__x, __y);
}
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_PAIR_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,243 +0,0 @@
/*
*
* 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,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_QUEUE_H
#define __SGI_STL_INTERNAL_QUEUE_H
#include <sequence_concepts.h>
__STL_BEGIN_NAMESPACE
// Forward declarations of operators < and ==, needed for friend declaration.
template <class _Tp,
class _Sequence __STL_DEPENDENT_DEFAULT_TMPL(deque<_Tp>) >
class queue;
template <class _Tp, class _Seq>
inline bool operator==(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&);
template <class _Tp, class _Seq>
inline bool operator<(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&);
template <class _Tp, class _Sequence>
class queue {
// requirements:
__STL_CLASS_REQUIRES(_Tp, _Assignable);
__STL_CLASS_REQUIRES(_Sequence, _FrontInsertionSequence);
__STL_CLASS_REQUIRES(_Sequence, _BackInsertionSequence);
typedef typename _Sequence::value_type _Sequence_value_type;
__STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type);
#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp1, class _Seq1>
friend bool operator== (const queue<_Tp1, _Seq1>&,
const queue<_Tp1, _Seq1>&);
template <class _Tp1, class _Seq1>
friend bool operator< (const queue<_Tp1, _Seq1>&,
const queue<_Tp1, _Seq1>&);
#else /* __STL_MEMBER_TEMPLATES */
friend bool __STD_QUALIFIER
operator== __STL_NULL_TMPL_ARGS (const queue&, const queue&);
friend bool __STD_QUALIFIER
operator< __STL_NULL_TMPL_ARGS (const queue&, const queue&);
#endif /* __STL_MEMBER_TEMPLATES */
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:
_Sequence c;
public:
queue() : c() {}
explicit queue(const _Sequence& __c) : c(__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(); }
};
template <class _Tp, class _Sequence>
bool
operator==(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
{
return __x.c == __y.c;
}
template <class _Tp, class _Sequence>
bool
operator<(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
{
return __x.c < __y.c;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Tp, class _Sequence>
bool
operator!=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
{
return !(__x == __y);
}
template <class _Tp, class _Sequence>
bool
operator>(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
{
return __y < __x;
}
template <class _Tp, class _Sequence>
bool
operator<=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
{
return !(__y < __x);
}
template <class _Tp, class _Sequence>
bool
operator>=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
{
return !(__x < __y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
template <class _Tp,
class _Sequence __STL_DEPENDENT_DEFAULT_TMPL(vector<_Tp>),
class _Compare
__STL_DEPENDENT_DEFAULT_TMPL(less<typename _Sequence::value_type>) >
class priority_queue {
// requirements:
__STL_CLASS_REQUIRES(_Tp, _Assignable);
__STL_CLASS_REQUIRES(_Sequence, _Sequence);
__STL_CLASS_REQUIRES(_Sequence, _RandomAccessContainer);
typedef typename _Sequence::value_type _Sequence_value_type;
__STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type);
__STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp);
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:
_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); }
#ifdef __STL_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 /* __STL_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 /* __STL_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) {
__STL_TRY {
c.push_back(__x);
push_heap(c.begin(), c.end(), comp);
}
__STL_UNWIND(c.clear());
}
void pop() {
__STL_TRY {
pop_heap(c.begin(), c.end(), comp);
c.pop_back();
}
__STL_UNWIND(c.clear());
}
};
// no equality is provided
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_QUEUE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,71 +0,0 @@
/*
* 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 __STL_RANGE_ERRORS_H
#define __STL_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.
// __STL_DONT_THROW_RANGE_ERRORS is a hook so that users can disable
// this exception throwing.
#include <stl_config.h>
#if defined(__STL_CAN_THROW_RANGE_ERRORS) && \
defined(__STL_USE_EXCEPTIONS) && \
!defined(__STL_DONT_THROW_RANGE_ERRORS)
# define __STL_THROW_RANGE_ERRORS
#endif
// For the SGI 7.3 compiler, declare these functions here and define them
// elsewhere.
#if defined(__STL_THROW_RANGE_ERRORS) && \
defined(__sgi) && !defined(__GNUC__) && \
_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
__STL_BEGIN_NAMESPACE
void __stl_throw_range_error(const char* __msg);
void __stl_throw_length_error(const char* __msg);
__STL_END_NAMESPACE
// For other compilers where we're throwing range errors, include the
// stdexcept header and throw the appropriate exceptions directly.
#elif defined(__STL_THROW_RANGE_ERRORS)
#include <stdexcept>
__STL_BEGIN_NAMESPACE
inline void __stl_throw_range_error(const char* __msg)
{ throw range_error(__msg); }
inline void __stl_throw_length_error(const char* __msg)
{ throw length_error(__msg); }
__STL_END_NAMESPACE
// Otherwise, define inline functions that do nothing.
#else
__STL_BEGIN_NAMESPACE
inline void __stl_throw_range_error(const char*) {}
inline void __stl_throw_length_error(const char*) {}
__STL_END_NAMESPACE
#endif
#endif /* __STL_RANGE_ERRORS_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,81 +0,0 @@
/*
*
* 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
* 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_RAW_STORAGE_ITERATOR_H
#define __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H
__STL_BEGIN_NAMESPACE
template <class _ForwardIterator, class _Tp>
class raw_storage_iterator {
protected:
_ForwardIterator _M_iter;
public:
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
explicit raw_storage_iterator(_ForwardIterator __x) : _M_iter(__x) {}
raw_storage_iterator& operator*() { return *this; }
raw_storage_iterator& operator=(const _Tp& __element) {
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;
}
};
#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class _ForwardIterator, class _Tp>
inline output_iterator_tag
iterator_category(const raw_storage_iterator<_ForwardIterator, _Tp>&)
{
return output_iterator_tag();
}
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,62 +0,0 @@
/*
*
* 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,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.
*
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
#ifndef __SGI_STL_INTERNAL_RELOPS
#define __SGI_STL_INTERNAL_RELOPS
__STL_BEGIN_RELOPS_NAMESPACE
template <class _Tp>
inline bool operator!=(const _Tp& __x, const _Tp& __y) {
return !(__x == __y);
}
template <class _Tp>
inline bool operator>(const _Tp& __x, const _Tp& __y) {
return __y < __x;
}
template <class _Tp>
inline bool operator<=(const _Tp& __x, const _Tp& __y) {
return !(__y < __x);
}
template <class _Tp>
inline bool operator>=(const _Tp& __x, const _Tp& __y) {
return !(__x < __y);
}
__STL_END_RELOPS_NAMESPACE
#endif /* __SGI_STL_INTERNAL_RELOPS */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -1,268 +0,0 @@
/*
*
* 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,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_SET_H
#define __SGI_STL_INTERNAL_SET_H
#include <concept_checks.h>
__STL_BEGIN_NAMESPACE
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#pragma set woff 1375
#endif
// Forward declarations of operators < and ==, needed for friend declaration.
template <class _Key, class _Compare __STL_DEPENDENT_DEFAULT_TMPL(less<_Key>),
class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) >
class set;
template <class _Key, class _Compare, class _Alloc>
inline bool operator==(const set<_Key,_Compare,_Alloc>& __x,
const set<_Key,_Compare,_Alloc>& __y);
template <class _Key, class _Compare, class _Alloc>
inline bool operator<(const set<_Key,_Compare,_Alloc>& __x,
const set<_Key,_Compare,_Alloc>& __y);
template <class _Key, class _Compare, class _Alloc>
class set {
// requirements:
__STL_CLASS_REQUIRES(_Key, _Assignable);
__STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key);
public:
// typedefs:
typedef _Key key_type;
typedef _Key value_type;
typedef _Compare key_compare;
typedef _Compare value_compare;
private:
typedef _Rb_tree<key_type, value_type,
_Identity<value_type>, key_compare, _Alloc> _Rep_type;
_Rep_type _M_t; // red-black tree representing set
public:
typedef typename _Rep_type::const_pointer pointer;
typedef typename _Rep_type::const_pointer const_pointer;
typedef typename _Rep_type::const_reference reference;
typedef typename _Rep_type::const_reference const_reference;
typedef typename _Rep_type::const_iterator iterator;
typedef typename _Rep_type::const_iterator const_iterator;
typedef typename _Rep_type::const_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;
// allocation/deallocation
set() : _M_t(_Compare(), allocator_type()) {}
explicit set(const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) {}
#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
set(_InputIterator __first, _InputIterator __last)
: _M_t(_Compare(), allocator_type())
{ _M_t.insert_unique(__first, __last); }
template <class _InputIterator>
set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _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 /* __STL_MEMBER_TEMPLATES */
set(const set<_Key,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
set<_Key,_Compare,_Alloc>& operator=(const set<_Key, _Compare, _Alloc>& __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() const { return _M_t.begin(); }
iterator end() const { return _M_t.end(); }
reverse_iterator rbegin() const { return _M_t.rbegin(); }
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(set<_Key,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); }
// insert/erase
pair<iterator,bool> insert(const value_type& __x) {
pair<typename _Rep_type::iterator, bool> __p = _M_t.insert_unique(__x);
return pair<iterator, bool>(__p.first, __p.second);
}
iterator insert(iterator __position, const value_type& __x) {
typedef typename _Rep_type::iterator _Rep_iterator;
return _M_t.insert_unique((_Rep_iterator&)__position, __x);
}
#ifdef __STL_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 /* __STL_MEMBER_TEMPLATES */
void erase(iterator __position) {
typedef typename _Rep_type::iterator _Rep_iterator;
_M_t.erase((_Rep_iterator&)__position);
}
size_type erase(const key_type& __x) {
return _M_t.erase(__x);
}
void erase(iterator __first, iterator __last) {
typedef typename _Rep_type::iterator _Rep_iterator;
_M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last);
}
void clear() { _M_t.clear(); }
// set operations:
iterator find(const key_type& __x) const { return _M_t.find(__x); }
size_type count(const key_type& __x) const {
return _M_t.find(__x) == _M_t.end() ? 0 : 1;
}
iterator lower_bound(const key_type& __x) const {
return _M_t.lower_bound(__x);
}
iterator upper_bound(const key_type& __x) const {
return _M_t.upper_bound(__x);
}
pair<iterator,iterator> equal_range(const key_type& __x) const {
return _M_t.equal_range(__x);
}
#ifdef __STL_TEMPLATE_FRIENDS
template <class _K1, class _C1, class _A1>
friend bool operator== (const set<_K1,_C1,_A1>&, const set<_K1,_C1,_A1>&);
template <class _K1, class _C1, class _A1>
friend bool operator< (const set<_K1,_C1,_A1>&, const set<_K1,_C1,_A1>&);
#else /* __STL_TEMPLATE_FRIENDS */
friend bool __STD_QUALIFIER
operator== __STL_NULL_TMPL_ARGS (const set&, const set&);
friend bool __STD_QUALIFIER
operator< __STL_NULL_TMPL_ARGS (const set&, const set&);
#endif /* __STL_TEMPLATE_FRIENDS */
};
template <class _Key, class _Compare, class _Alloc>
inline bool operator==(const set<_Key,_Compare,_Alloc>& __x,
const set<_Key,_Compare,_Alloc>& __y) {
return __x._M_t == __y._M_t;
}
template <class _Key, class _Compare, class _Alloc>
inline bool operator<(const set<_Key,_Compare,_Alloc>& __x,
const set<_Key,_Compare,_Alloc>& __y) {
return __x._M_t < __y._M_t;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Key, class _Compare, class _Alloc>
inline bool operator!=(const set<_Key,_Compare,_Alloc>& __x,
const set<_Key,_Compare,_Alloc>& __y) {
return !(__x == __y);
}
template <class _Key, class _Compare, class _Alloc>
inline bool operator>(const set<_Key,_Compare,_Alloc>& __x,
const set<_Key,_Compare,_Alloc>& __y) {
return __y < __x;
}
template <class _Key, class _Compare, class _Alloc>
inline bool operator<=(const set<_Key,_Compare,_Alloc>& __x,
const set<_Key,_Compare,_Alloc>& __y) {
return !(__y < __x);
}
template <class _Key, class _Compare, class _Alloc>
inline bool operator>=(const set<_Key,_Compare,_Alloc>& __x,
const set<_Key,_Compare,_Alloc>& __y) {
return !(__x < __y);
}
template <class _Key, class _Compare, class _Alloc>
inline void swap(set<_Key,_Compare,_Alloc>& __x,
set<_Key,_Compare,_Alloc>& __y) {
__x.swap(__y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
#pragma reset woff 1375
#endif
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_SET_H */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -1,143 +0,0 @@
/*
*
* 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,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_STACK_H
#define __SGI_STL_INTERNAL_STACK_H
#include <sequence_concepts.h>
__STL_BEGIN_NAMESPACE
// Forward declarations of operators == and <, needed for friend declaration.
template <class _Tp,
class _Sequence __STL_DEPENDENT_DEFAULT_TMPL(deque<_Tp>) >
class stack;
template <class _Tp, class _Seq>
bool operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y);
template <class _Tp, class _Seq>
bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y);
template <class _Tp, class _Sequence>
class stack {
// requirements:
__STL_CLASS_REQUIRES(_Tp, _Assignable);
__STL_CLASS_REQUIRES(_Sequence, _BackInsertionSequence);
typedef typename _Sequence::value_type _Sequence_value_type;
__STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type);
#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp1, class _Seq1>
friend bool operator== (const stack<_Tp1, _Seq1>&,
const stack<_Tp1, _Seq1>&);
template <class _Tp1, class _Seq1>
friend bool operator< (const stack<_Tp1, _Seq1>&,
const stack<_Tp1, _Seq1>&);
#else /* __STL_MEMBER_TEMPLATES */
friend bool __STD_QUALIFIER
operator== __STL_NULL_TMPL_ARGS (const stack&, const stack&);
friend bool __STD_QUALIFIER
operator< __STL_NULL_TMPL_ARGS (const stack&, const stack&);
#endif /* __STL_MEMBER_TEMPLATES */
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:
_Sequence c;
public:
stack() : c() {}
explicit stack(const _Sequence& __s) : c(__s) {}
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(); }
};
template <class _Tp, class _Seq>
bool operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{
return __x.c == __y.c;
}
template <class _Tp, class _Seq>
bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{
return __x.c < __y.c;
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Tp, class _Seq>
bool operator!=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{
return !(__x == __y);
}
template <class _Tp, class _Seq>
bool operator>(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{
return __y < __x;
}
template <class _Tp, class _Seq>
bool operator<=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{
return !(__y < __x);
}
template <class _Tp, class _Seq>
bool operator>=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{
return !(__x < __y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_STACK_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,40 +0,0 @@
/*
* 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_STRING_FWD_H
#define __SGI_STL_STRING_FWD_H
#include <stddef.h>
#include <stl_config.h>
#include <stl_alloc.h>
#include <char_traits.h>
__STL_BEGIN_NAMESPACE
template <class _CharT,
class _Traits = char_traits<_CharT>,
class _Alloc = __STL_DEFAULT_ALLOCATOR(_CharT) >
class basic_string;
typedef basic_string<char> string;
typedef basic_string<wchar_t> wstring;
static const char* __get_c_string(const string&);
__STL_END_NAMESPACE
#endif /* __SGI_STL_STRING_FWD_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,162 +0,0 @@
/*
*
* 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,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_TEMPBUF_H
#define __SGI_STL_INTERNAL_TEMPBUF_H
__STL_BEGIN_NAMESPACE
template <class _Tp>
pair<_Tp*, ptrdiff_t>
__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);
}
#ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS
template <class _Tp>
inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len) {
return __get_temporary_buffer(__len, (_Tp*) 0);
}
#endif /* __STL_EXPLICIT_FUNCTION_TMPL_ARGS */
// 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> get_temporary_buffer(ptrdiff_t __len, _Tp*) {
return __get_temporary_buffer(__len, (_Tp*) 0);
}
template <class _Tp>
void return_temporary_buffer(_Tp* __p) {
free(__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&, __true_type) {}
void _M_initialize_buffer(const _Tp& val, __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
__STL_TRY {
_M_len = 0;
distance(__first, __last, _M_len);
_M_allocate_buffer();
if (_M_len > 0)
_M_initialize_buffer(*__first, _Trivial());
}
__STL_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0);
}
~_Temporary_buffer() {
destroy(_M_buffer, _M_buffer + _M_len);
free(_M_buffer);
}
private:
// Disable copy constructor and assignment operator.
_Temporary_buffer(const _Temporary_buffer&) {}
void operator=(const _Temporary_buffer&) {}
};
// Class temporary_buffer is not part of the standard. It is an extension.
template <class _ForwardIterator,
class _Tp
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
= typename iterator_traits<_ForwardIterator>::value_type
#endif /* __STL_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() {}
};
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_TEMPBUF_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,374 +0,0 @@
/*
* 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.
*/
// WARNING: This is an internal header file, included by other C++
// standard library headers. You should not attempt to use this header
// file directly.
// Stl_config.h should be included before this file.
#ifndef __SGI_STL_INTERNAL_THREADS_H
#define __SGI_STL_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.
#if defined(__STL_SGI_THREADS)
#include <mutex.h>
#include <time.h>
#elif defined(__STL_PTHREADS)
#include <pthread.h>
#elif defined(__STL_UITHREADS)
#include <thread.h>
#include <synch.h>
#elif defined(__STL_WIN32THREADS)
#include <windows.h>
#endif
__STL_BEGIN_NAMESPACE
// Class _Refcount_Base provides a type, _RC_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.
// Hack for SGI o32 compilers.
#if defined(__STL_SGI_THREADS) && !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 */
struct _Refcount_Base
{
// The type _RC_t
# ifdef __STL_WIN32THREADS
typedef long _RC_t;
# else
typedef size_t _RC_t;
#endif
// The data member _M_ref_count
volatile _RC_t _M_ref_count;
// Constructor
# ifdef __STL_PTHREADS
pthread_mutex_t _M_ref_count_lock;
_Refcount_Base(_RC_t __n) : _M_ref_count(__n)
{ pthread_mutex_init(&_M_ref_count_lock, 0); }
# elif defined(__STL_UITHREADS)
mutex_t _M_ref_count_lock;
_Refcount_Base(_RC_t __n) : _M_ref_count(__n)
{ mutex_init(&_M_ref_count_lock, USYNC_THREAD, 0); }
# else
_Refcount_Base(_RC_t __n) : _M_ref_count(__n) {}
# endif
// _M_incr and _M_decr
# ifdef __STL_SGI_THREADS
void _M_incr() { __add_and_fetch(&_M_ref_count, 1); }
_RC_t _M_decr() { return __add_and_fetch(&_M_ref_count, (size_t) -1); }
# elif defined (__STL_WIN32THREADS)
void _M_incr() { InterlockedIncrement((_RC_t*)&_M_ref_count); }
_RC_t _M_decr() { return InterlockedDecrement((_RC_t*)&_M_ref_count); }
# elif defined(__STL_PTHREADS)
void _M_incr() {
pthread_mutex_lock(&_M_ref_count_lock);
++_M_ref_count;
pthread_mutex_unlock(&_M_ref_count_lock);
}
_RC_t _M_decr() {
pthread_mutex_lock(&_M_ref_count_lock);
volatile _RC_t __tmp = --_M_ref_count;
pthread_mutex_unlock(&_M_ref_count_lock);
return __tmp;
}
# elif defined(__STL_UITHREADS)
void _M_incr() {
mutex_lock(&_M_ref_count_lock);
++_M_ref_count;
mutex_unlock(&_M_ref_count_lock);
}
_RC_t _M_decr() {
mutex_lock(&_M_ref_count_lock);
/*volatile*/ _RC_t __tmp = --_M_ref_count;
mutex_unlock(&_M_ref_count_lock);
return __tmp;
}
# else /* No threads */
void _M_incr() { ++_M_ref_count; }
_RC_t _M_decr() { return --_M_ref_count; }
# endif
};
// Atomic swap on unsigned long
// 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.
# ifdef __STL_SGI_THREADS
inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64))
return test_and_set(__p, __q);
# else
return __test_and_set(__p, (unsigned long)__q);
# endif
}
# elif defined(__STL_WIN32THREADS)
inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
return (unsigned long) InterlockedExchange((LPLONG)__p, (LONG)__q);
}
# elif defined(__STL_PTHREADS)
// We use a template here only to get a unique initialized instance.
template<int __dummy>
struct _Swap_lock_struct {
static pthread_mutex_t _S_swap_lock;
};
template<int __dummy>
pthread_mutex_t
_Swap_lock_struct<__dummy>::_S_swap_lock = PTHREAD_MUTEX_INITIALIZER;
// This should be portable, but performance is expected
// to be quite awful. This really needs platform specific
// code.
inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
pthread_mutex_lock(&_Swap_lock_struct<0>::_S_swap_lock);
unsigned long __result = *__p;
*__p = __q;
pthread_mutex_unlock(&_Swap_lock_struct<0>::_S_swap_lock);
return __result;
}
# elif defined(__STL_UITHREADS)
// We use a template here only to get a unique initialized instance.
template<int __dummy>
struct _Swap_lock_struct {
static mutex_t _S_swap_lock;
};
template<int __dummy>
mutex_t
_Swap_lock_struct<__dummy>::_S_swap_lock = DEFAULTMUTEX;
// This should be portable, but performance is expected
// to be quite awful. This really needs platform specific
// code.
inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
mutex_lock(&_Swap_lock_struct<0>::_S_swap_lock);
unsigned long __result = *__p;
*__p = __q;
mutex_unlock(&_Swap_lock_struct<0>::_S_swap_lock);
return __result;
}
# elif defined (__STL_SOLARIS_THREADS)
// any better solutions ?
// We use a template here only to get a unique initialized instance.
template<int __dummy>
struct _Swap_lock_struct {
static mutex_t _S_swap_lock;
};
# if ( __STL_STATIC_TEMPLATE_DATA > 0 )
template<int __dummy>
mutex_t
_Swap_lock_struct<__dummy>::_S_swap_lock = DEFAULTMUTEX;
# else
__DECLARE_INSTANCE(mutex_t, _Swap_lock_struct<__dummy>::_S_swap_lock,
=DEFAULTMUTEX);
# endif /* ( __STL_STATIC_TEMPLATE_DATA > 0 ) */
// This should be portable, but performance is expected
// to be quite awful. This really needs platform specific
// code.
inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
mutex_lock(&_Swap_lock_struct<0>::_S_swap_lock);
unsigned long __result = *__p;
*__p = __q;
mutex_unlock(&_Swap_lock_struct<0>::_S_swap_lock);
return __result;
}
# else
static inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
unsigned long __result = *__p;
*__p = __q;
return __result;
}
# endif
// Locking class. Note that this class *does not have a constructor*.
// It must be initialized either statically, with __STL_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.
// Helper struct. This is a workaround for various compilers that don't
// handle static variables in inline functions properly.
template <int __inst>
struct _STL_mutex_spin {
enum { __low_max = 30, __high_max = 1000 };
// Low if we suspect uniprocessor, high for multiprocessor.
static unsigned __max;
static unsigned __last;
};
template <int __inst>
unsigned _STL_mutex_spin<__inst>::__max = _STL_mutex_spin<__inst>::__low_max;
template <int __inst>
unsigned _STL_mutex_spin<__inst>::__last = 0;
struct _STL_mutex_lock
{
#if defined(__STL_SGI_THREADS) || defined(__STL_WIN32THREADS)
// It should be relatively easy to get this to work on any modern Unix.
volatile unsigned long _M_lock;
void _M_initialize() { _M_lock = 0; }
static void _S_nsec_sleep(int __log_nsec) {
# ifdef __STL_SGI_THREADS
struct timespec __ts;
/* Max sleep is 2**27nsec ~ 60msec */
__ts.tv_sec = 0;
__ts.tv_nsec = 1 << __log_nsec;
nanosleep(&__ts, 0);
# elif defined(__STL_WIN32THREADS)
if (__log_nsec <= 20) {
Sleep(0);
} else {
Sleep(1 << (__log_nsec - 20));
}
# else
# error unimplemented
# endif
}
void _M_acquire_lock() {
volatile unsigned long* __lock = &this->_M_lock;
if (!_Atomic_swap((unsigned long*)__lock, 1)) {
return;
}
unsigned __my_spin_max = _STL_mutex_spin<0>::__max;
unsigned __my_last_spins = _STL_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;
continue;
}
if (!_Atomic_swap((unsigned long*)__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.
_STL_mutex_spin<0>::__last = __i;
_STL_mutex_spin<0>::__max = _STL_mutex_spin<0>::__high_max;
return;
}
}
// We are probably being scheduled against the other process. Sleep.
_STL_mutex_spin<0>::__max = _STL_mutex_spin<0>::__low_max;
for (__i = 0 ;; ++__i) {
int __log_nsec = __i + 6;
if (__log_nsec > 27) __log_nsec = 27;
if (!_Atomic_swap((unsigned long *)__lock, 1)) {
return;
}
_S_nsec_sleep(__log_nsec);
}
}
void _M_release_lock() {
volatile unsigned long* __lock = &_M_lock;
# if defined(__STL_SGI_THREADS) && defined(__GNUC__) && __mips >= 3
asm("sync");
*__lock = 0;
# elif defined(__STL_SGI_THREADS) && __mips >= 3 \
&& (defined (_ABIN32) || defined(_ABI64))
__lock_release(__lock);
# else
*__lock = 0;
// This is not sufficient on many multiprocessors, since
// writes to protected variables and the lock may be reordered.
# endif
}
// We no longer use win32 critical sections.
// They appear to be slower in the contention-free case,
// and they appear difficult to initialize without introducing a race.
#elif defined(__STL_PTHREADS)
pthread_mutex_t _M_lock;
void _M_initialize() { pthread_mutex_init(&_M_lock, NULL); }
void _M_acquire_lock() { pthread_mutex_lock(&_M_lock); }
void _M_release_lock() { pthread_mutex_unlock(&_M_lock); }
#elif defined(__STL_UITHREADS)
mutex_t _M_lock;
void _M_initialize() { mutex_init(&_M_lock, USYNC_THREAD, 0); }
void _M_acquire_lock() { mutex_lock(&_M_lock); }
void _M_release_lock() { mutex_unlock(&_M_lock); }
#else /* No threads */
void _M_initialize() {}
void _M_acquire_lock() {}
void _M_release_lock() {}
#endif
};
#ifdef __STL_PTHREADS
// Pthreads locks must be statically initialized to something other than
// the default value of zero.
# define __STL_MUTEX_INITIALIZER = { PTHREAD_MUTEX_INITIALIZER }
#elif defined(__STL_UITHREADS)
// UIthreads locks must be statically initialized to something other than
// the default value of zero.
# define __STL_MUTEX_INITIALIZER = { DEFAULTMUTEX }
#elif defined(__STL_SGI_THREADS) || defined(__STL_WIN32THREADS)
# define __STL_MUTEX_INITIALIZER = { 0 }
#else
# define __STL_MUTEX_INITIALIZER
#endif
// A locking class that uses _STL_mutex_lock. The constructor takes a
// reference to an _STL_mutex_lock, 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 _STL_auto_lock
{
_STL_mutex_lock& _M_lock;
_STL_auto_lock(_STL_mutex_lock& __lock) : _M_lock(__lock)
{ _M_lock._M_acquire_lock(); }
~_STL_auto_lock() { _M_lock._M_release_lock(); }
private:
void operator=(const _STL_auto_lock&);
_STL_auto_lock(const _STL_auto_lock&);
};
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_THREADS_H */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -1,279 +0,0 @@
/*
*
* 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,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_UNINITIALIZED_H
#define __SGI_STL_INTERNAL_UNINITIALIZED_H
__STL_BEGIN_NAMESPACE
// uninitialized_copy
// Valid if copy construction is equivalent to assignment, and if the
// destructor is trivial.
template <class _InputIter, class _ForwardIter>
inline _ForwardIter
__uninitialized_copy_aux(_InputIter __first, _InputIter __last,
_ForwardIter __result,
__true_type)
{
return copy(__first, __last, __result);
}
template <class _InputIter, class _ForwardIter>
_ForwardIter
__uninitialized_copy_aux(_InputIter __first, _InputIter __last,
_ForwardIter __result,
__false_type)
{
_ForwardIter __cur = __result;
__STL_TRY {
for ( ; __first != __last; ++__first, ++__cur)
_Construct(&*__cur, *__first);
return __cur;
}
__STL_UNWIND(_Destroy(__result, __cur));
}
template <class _InputIter, class _ForwardIter, class _Tp>
inline _ForwardIter
__uninitialized_copy(_InputIter __first, _InputIter __last,
_ForwardIter __result, _Tp*)
{
typedef typename __type_traits<_Tp>::is_POD_type _Is_POD;
return __uninitialized_copy_aux(__first, __last, __result, _Is_POD());
}
template <class _InputIter, class _ForwardIter>
inline _ForwardIter
uninitialized_copy(_InputIter __first, _InputIter __last,
_ForwardIter __result)
{
return __uninitialized_copy(__first, __last, __result,
__VALUE_TYPE(__result));
}
inline char* uninitialized_copy(const char* __first, const char* __last,
char* __result) {
memmove(__result, __first, __last - __first);
return __result + (__last - __first);
}
inline wchar_t*
uninitialized_copy(const wchar_t* __first, const wchar_t* __last,
wchar_t* __result)
{
memmove(__result, __first, sizeof(wchar_t) * (__last - __first));
return __result + (__last - __first);
}
// uninitialized_copy_n (not part of the C++ standard)
template <class _InputIter, class _Size, class _ForwardIter>
pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result,
input_iterator_tag)
{
_ForwardIter __cur = __result;
__STL_TRY {
for ( ; __count > 0 ; --__count, ++__first, ++__cur)
_Construct(&*__cur, *__first);
return pair<_InputIter, _ForwardIter>(__first, __cur);
}
__STL_UNWIND(_Destroy(__result, __cur));
}
template <class _RandomAccessIter, class _Size, class _ForwardIter>
inline pair<_RandomAccessIter, _ForwardIter>
__uninitialized_copy_n(_RandomAccessIter __first, _Size __count,
_ForwardIter __result,
random_access_iterator_tag) {
_RandomAccessIter __last = __first + __count;
return pair<_RandomAccessIter, _ForwardIter>(
__last,
uninitialized_copy(__first, __last, __result));
}
template <class _InputIter, class _Size, class _ForwardIter>
inline pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result) {
return __uninitialized_copy_n(__first, __count, __result,
__ITERATOR_CATEGORY(__first));
}
template <class _InputIter, class _Size, class _ForwardIter>
inline pair<_InputIter, _ForwardIter>
uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result) {
return __uninitialized_copy_n(__first, __count, __result,
__ITERATOR_CATEGORY(__first));
}
// Valid if copy construction is equivalent to assignment, and if the
// destructor is trivial.
template <class _ForwardIter, class _Tp>
inline void
__uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last,
const _Tp& __x, __true_type)
{
fill(__first, __last, __x);
}
template <class _ForwardIter, class _Tp>
void
__uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last,
const _Tp& __x, __false_type)
{
_ForwardIter __cur = __first;
__STL_TRY {
for ( ; __cur != __last; ++__cur)
_Construct(&*__cur, __x);
}
__STL_UNWIND(_Destroy(__first, __cur));
}
template <class _ForwardIter, class _Tp, class _Tp1>
inline void __uninitialized_fill(_ForwardIter __first,
_ForwardIter __last, const _Tp& __x, _Tp1*)
{
typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD;
__uninitialized_fill_aux(__first, __last, __x, _Is_POD());
}
template <class _ForwardIter, class _Tp>
inline void uninitialized_fill(_ForwardIter __first,
_ForwardIter __last,
const _Tp& __x)
{
__uninitialized_fill(__first, __last, __x, __VALUE_TYPE(__first));
}
// Valid if copy construction is equivalent to assignment, and if the
// destructor is trivial.
template <class _ForwardIter, class _Size, class _Tp>
inline _ForwardIter
__uninitialized_fill_n_aux(_ForwardIter __first, _Size __n,
const _Tp& __x, __true_type)
{
return fill_n(__first, __n, __x);
}
template <class _ForwardIter, class _Size, class _Tp>
_ForwardIter
__uninitialized_fill_n_aux(_ForwardIter __first, _Size __n,
const _Tp& __x, __false_type)
{
_ForwardIter __cur = __first;
__STL_TRY {
for ( ; __n > 0; --__n, ++__cur)
_Construct(&*__cur, __x);
return __cur;
}
__STL_UNWIND(_Destroy(__first, __cur));
}
template <class _ForwardIter, class _Size, class _Tp, class _Tp1>
inline _ForwardIter
__uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x, _Tp1*)
{
typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD;
return __uninitialized_fill_n_aux(__first, __n, __x, _Is_POD());
}
template <class _ForwardIter, class _Size, class _Tp>
inline _ForwardIter
uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x)
{
return __uninitialized_fill_n(__first, __n, __x, __VALUE_TYPE(__first));
}
// 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, result + (last1 - first1) + (last2 - first2)).
template <class _InputIter1, class _InputIter2, class _ForwardIter>
inline _ForwardIter
__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_ForwardIter __result)
{
_ForwardIter __mid = uninitialized_copy(__first1, __last1, __result);
__STL_TRY {
return uninitialized_copy(__first2, __last2, __mid);
}
__STL_UNWIND(_Destroy(__result, __mid));
}
// __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);
__STL_TRY {
return uninitialized_copy(__first, __last, __mid);
}
__STL_UNWIND(_Destroy(__result, __mid));
}
// __uninitialized_copy_fill
// Copies [first1, last1) into [first2, first2 + (last1 - first1)), and
// fills [first2 + (last1 - first1), last2) with x.
template <class _InputIter, class _ForwardIter, class _Tp>
inline void
__uninitialized_copy_fill(_InputIter __first1, _InputIter __last1,
_ForwardIter __first2, _ForwardIter __last2,
const _Tp& __x)
{
_ForwardIter __mid2 = uninitialized_copy(__first1, __last1, __first2);
__STL_TRY {
uninitialized_fill(__mid2, __last2, __x);
}
__STL_UNWIND(_Destroy(__first2, __mid2));
}
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_UNINITIALIZED_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,869 +0,0 @@
/*
*
* 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
* 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_VECTOR_H
#define __SGI_STL_INTERNAL_VECTOR_H
#include <concept_checks.h>
__STL_BEGIN_NAMESPACE
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#pragma set woff 1375
#endif
// The vector base class serves 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.
#ifdef __STL_USE_STD_ALLOCATORS
// Base class for ordinary allocators.
template <class _Tp, class _Allocator, bool _IsStatic>
class _Vector_alloc_base {
public:
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
allocator_type;
allocator_type get_allocator() const { return _M_data_allocator; }
_Vector_alloc_base(const allocator_type& __a)
: _M_data_allocator(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
{}
protected:
allocator_type _M_data_allocator;
_Tp* _M_start;
_Tp* _M_finish;
_Tp* _M_end_of_storage;
_Tp* _M_allocate(size_t __n)
{ return _M_data_allocator.allocate(__n); }
void _M_deallocate(_Tp* __p, size_t __n)
{ if (__p) _M_data_allocator.deallocate(__p, __n); }
};
// Specialization for allocators that have the property that we don't
// actually have to store an allocator object.
template <class _Tp, class _Allocator>
class _Vector_alloc_base<_Tp, _Allocator, true> {
public:
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
allocator_type;
allocator_type get_allocator() const { return allocator_type(); }
_Vector_alloc_base(const allocator_type&)
: _M_start(0), _M_finish(0), _M_end_of_storage(0)
{}
protected:
_Tp* _M_start;
_Tp* _M_finish;
_Tp* _M_end_of_storage;
typedef typename _Alloc_traits<_Tp, _Allocator>::_Alloc_type _Alloc_type;
_Tp* _M_allocate(size_t __n)
{ return _Alloc_type::allocate(__n); }
void _M_deallocate(_Tp* __p, size_t __n)
{ _Alloc_type::deallocate(__p, __n);}
};
template <class _Tp, class _Alloc>
struct _Vector_base
: public _Vector_alloc_base<_Tp, _Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless>
{
typedef _Vector_alloc_base<_Tp, _Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless>
_Base;
typedef typename _Base::allocator_type allocator_type;
_Vector_base(const allocator_type& __a) : _Base(__a) {}
_Vector_base(size_t __n, const allocator_type& __a) : _Base(__a) {
_M_start = _M_allocate(__n);
_M_finish = _M_start;
_M_end_of_storage = _M_start + __n;
}
~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); }
};
#else /* __STL_USE_STD_ALLOCATORS */
template <class _Tp, class _Alloc>
class _Vector_base {
public:
typedef _Alloc allocator_type;
allocator_type get_allocator() const { return allocator_type(); }
_Vector_base(const _Alloc&)
: _M_start(0), _M_finish(0), _M_end_of_storage(0) {}
_Vector_base(size_t __n, const _Alloc&)
: _M_start(0), _M_finish(0), _M_end_of_storage(0)
{
_M_start = _M_allocate(__n);
_M_finish = _M_start;
_M_end_of_storage = _M_start + __n;
}
~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); }
protected:
_Tp* _M_start;
_Tp* _M_finish;
_Tp* _M_end_of_storage;
typedef simple_alloc<_Tp, _Alloc> _M_data_allocator;
_Tp* _M_allocate(size_t __n)
{ return _M_data_allocator::allocate(__n); }
void _M_deallocate(_Tp* __p, size_t __n)
{ _M_data_allocator::deallocate(__p, __n); }
};
#endif /* __STL_USE_STD_ALLOCATORS */
template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
class vector : protected _Vector_base<_Tp, _Alloc>
{
// requirements:
__STL_CLASS_REQUIRES(_Tp, _Assignable);
private:
typedef _Vector_base<_Tp, _Alloc> _Base;
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 typename _Base::allocator_type allocator_type;
allocator_type get_allocator() const { return _Base::get_allocator(); }
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
typedef reverse_iterator<const_iterator> const_reverse_iterator;
typedef reverse_iterator<iterator> reverse_iterator;
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
typedef reverse_iterator<const_iterator, value_type, const_reference,
difference_type> const_reverse_iterator;
typedef reverse_iterator<iterator, value_type, reference, difference_type>
reverse_iterator;
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
protected:
#ifdef __STL_HAS_NAMESPACES
using _Base::_M_allocate;
using _Base::_M_deallocate;
using _Base::_M_start;
using _Base::_M_finish;
using _Base::_M_end_of_storage;
#endif /* __STL_HAS_NAMESPACES */
protected:
void _M_insert_aux(iterator __position, const _Tp& __x);
void _M_insert_aux(iterator __position);
public:
iterator begin() { return _M_start; }
const_iterator begin() const { return _M_start; }
iterator end() { return _M_finish; }
const_iterator end() const { return _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) / sizeof(_Tp); }
size_type capacity() const
{ return size_type(_M_end_of_storage - begin()); }
bool empty() const
{ return begin() == end(); }
reference operator[](size_type __n) { return *(begin() + __n); }
const_reference operator[](size_type __n) const { return *(begin() + __n); }
#ifdef __STL_THROW_RANGE_ERRORS
void _M_range_check(size_type __n) const {
if (__n >= this->size())
__stl_throw_range_error("vector");
}
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]; }
#endif /* __STL_THROW_RANGE_ERRORS */
explicit vector(const allocator_type& __a = allocator_type())
: _Base(__a) {}
vector(size_type __n, const _Tp& __value,
const allocator_type& __a = allocator_type())
: _Base(__n, __a)
{ _M_finish = uninitialized_fill_n(_M_start, __n, __value); }
explicit vector(size_type __n)
: _Base(__n, allocator_type())
{ _M_finish = uninitialized_fill_n(_M_start, __n, _Tp()); }
vector(const vector<_Tp, _Alloc>& __x)
: _Base(__x.size(), __x.get_allocator())
{ _M_finish = uninitialized_copy(__x.begin(), __x.end(), _M_start); }
#ifdef __STL_MEMBER_TEMPLATES
// 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 = allocator_type()) : _Base(__a) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_initialize_aux(__first, __last, _Integral());
}
template <class _Integer>
void _M_initialize_aux(_Integer __n, _Integer __value, __true_type) {
_M_start = _M_allocate(__n);
_M_end_of_storage = _M_start + __n;
_M_finish = uninitialized_fill_n(_M_start, __n, __value);
}
template <class _InputIterator>
void _M_initialize_aux(_InputIterator __first, _InputIterator __last,
__false_type) {
_M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first));
}
#else
vector(const _Tp* __first, const _Tp* __last,
const allocator_type& __a = allocator_type())
: _Base(__last - __first, __a)
{ _M_finish = uninitialized_copy(__first, __last, _M_start); }
#endif /* __STL_MEMBER_TEMPLATES */
~vector() { destroy(_M_start, _M_finish); }
vector<_Tp, _Alloc>& operator=(const vector<_Tp, _Alloc>& __x);
void reserve(size_type __n) {
if (capacity() < __n) {
const size_type __old_size = size();
iterator __tmp = _M_allocate_and_copy(__n, _M_start, _M_finish);
destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __tmp;
_M_finish = __tmp + __old_size;
_M_end_of_storage = _M_start + __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);
#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void assign(_InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_assign_dispatch(__first, __last, _Integral());
}
template <class _Integer>
void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
{ _M_fill_assign((size_type) __n, (_Tp) __val); }
template <class _InputIter>
void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type)
{ _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); }
template <class _InputIterator>
void _M_assign_aux(_InputIterator __first, _InputIterator __last,
input_iterator_tag);
template <class _ForwardIterator>
void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag);
#endif /* __STL_MEMBER_TEMPLATES */
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(const _Tp& __x) {
if (_M_finish != _M_end_of_storage) {
construct(_M_finish, __x);
++_M_finish;
}
else
_M_insert_aux(end(), __x);
}
void push_back() {
if (_M_finish != _M_end_of_storage) {
construct(_M_finish);
++_M_finish;
}
else
_M_insert_aux(end());
}
void swap(vector<_Tp, _Alloc>& __x) {
__STD::swap(_M_start, __x._M_start);
__STD::swap(_M_finish, __x._M_finish);
__STD::swap(_M_end_of_storage, __x._M_end_of_storage);
}
iterator insert(iterator __position, const _Tp& __x) {
size_type __n = __position - begin();
if (_M_finish != _M_end_of_storage && __position == end()) {
construct(_M_finish, __x);
++_M_finish;
}
else
_M_insert_aux(__position, __x);
return begin() + __n;
}
iterator insert(iterator __position) {
size_type __n = __position - begin();
if (_M_finish != _M_end_of_storage && __position == end()) {
construct(_M_finish);
++_M_finish;
}
else
_M_insert_aux(__position);
return begin() + __n;
}
#ifdef __STL_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 _Is_integer<_InputIterator>::_Integral _Integral;
_M_insert_dispatch(__pos, __first, __last, _Integral());
}
template <class _Integer>
void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
__true_type)
{ _M_fill_insert(__pos, (size_type) __n, (_Tp) __val); }
template <class _InputIterator>
void _M_insert_dispatch(iterator __pos,
_InputIterator __first, _InputIterator __last,
__false_type) {
_M_range_insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first));
}
#else /* __STL_MEMBER_TEMPLATES */
void insert(iterator __position,
const_iterator __first, const_iterator __last);
#endif /* __STL_MEMBER_TEMPLATES */
void insert (iterator __pos, size_type __n, const _Tp& __x)
{ _M_fill_insert(__pos, __n, __x); }
void _M_fill_insert (iterator __pos, size_type __n, const _Tp& __x);
void pop_back() {
--_M_finish;
destroy(_M_finish);
}
iterator erase(iterator __position) {
if (__position + 1 != end())
copy(__position + 1, _M_finish, __position);
--_M_finish;
destroy(_M_finish);
return __position;
}
iterator erase(iterator __first, iterator __last) {
iterator __i = copy(__last, _M_finish, __first);
destroy(__i, _M_finish);
_M_finish = _M_finish - (__last - __first);
return __first;
}
void resize(size_type __new_size, const _Tp& __x) {
if (__new_size < size())
erase(begin() + __new_size, end());
else
insert(end(), __new_size - size(), __x);
}
void resize(size_type __new_size) { resize(__new_size, _Tp()); }
void clear() { erase(begin(), end()); }
protected:
#ifdef __STL_MEMBER_TEMPLATES
template <class _ForwardIterator>
iterator _M_allocate_and_copy(size_type __n, _ForwardIterator __first,
_ForwardIterator __last)
{
iterator __result = _M_allocate(__n);
__STL_TRY {
uninitialized_copy(__first, __last, __result);
return __result;
}
__STL_UNWIND(_M_deallocate(__result, __n));
}
#else /* __STL_MEMBER_TEMPLATES */
iterator _M_allocate_and_copy(size_type __n, const_iterator __first,
const_iterator __last)
{
iterator __result = _M_allocate(__n);
__STL_TRY {
uninitialized_copy(__first, __last, __result);
return __result;
}
__STL_UNWIND(_M_deallocate(__result, __n));
}
#endif /* __STL_MEMBER_TEMPLATES */
#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void _M_range_initialize(_InputIterator __first,
_InputIterator __last, 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, forward_iterator_tag)
{
size_type __n = 0;
distance(__first, __last, __n);
_M_start = _M_allocate(__n);
_M_end_of_storage = _M_start + __n;
_M_finish = uninitialized_copy(__first, __last, _M_start);
}
template <class _InputIterator>
void _M_range_insert(iterator __pos,
_InputIterator __first, _InputIterator __last,
input_iterator_tag);
template <class _ForwardIterator>
void _M_range_insert(iterator __pos,
_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag);
#endif /* __STL_MEMBER_TEMPLATES */
};
template <class _Tp, class _Alloc>
inline bool
operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
{
return __x.size() == __y.size() &&
equal(__x.begin(), __x.end(), __y.begin());
}
template <class _Tp, class _Alloc>
inline bool
operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
{
return lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end());
}
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Tp, class _Alloc>
inline void swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)
{
__x.swap(__y);
}
template <class _Tp, class _Alloc>
inline bool
operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) {
return !(__x == __y);
}
template <class _Tp, class _Alloc>
inline bool
operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) {
return __y < __x;
}
template <class _Tp, class _Alloc>
inline bool
operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) {
return !(__y < __x);
}
template <class _Tp, class _Alloc>
inline bool
operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) {
return !(__x < __y);
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
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()) {
iterator __tmp = _M_allocate_and_copy(__xlen, __x.begin(), __x.end());
destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __tmp;
_M_end_of_storage = _M_start + __xlen;
}
else if (size() >= __xlen) {
iterator __i = copy(__x.begin(), __x.end(), begin());
destroy(__i, _M_finish);
}
else {
copy(__x.begin(), __x.begin() + size(), _M_start);
uninitialized_copy(__x.begin() + size(), __x.end(), _M_finish);
}
_M_finish = _M_start + __xlen;
}
return *this;
}
template <class _Tp, class _Alloc>
void vector<_Tp, _Alloc>::_M_fill_assign(size_t __n, const value_type& __val)
{
if (__n > capacity()) {
vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator());
__tmp.swap(*this);
}
else if (__n > size()) {
fill(begin(), end(), __val);
_M_finish = uninitialized_fill_n(_M_finish, __n - size(), __val);
}
else
erase(fill_n(begin(), __n, __val), end());
}
#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp, class _Alloc> template <class _InputIter>
void vector<_Tp, _Alloc>::_M_assign_aux(_InputIter __first, _InputIter __last,
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 _Tp, class _Alloc> template <class _ForwardIter>
void
vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIter __first, _ForwardIter __last,
forward_iterator_tag) {
size_type __len = 0;
distance(__first, __last, __len);
if (__len > capacity()) {
iterator __tmp = _M_allocate_and_copy(__len, __first, __last);
destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __tmp;
_M_end_of_storage = _M_finish = _M_start + __len;
}
else if (size() >= __len) {
iterator __new_finish = copy(__first, __last, _M_start);
destroy(__new_finish, _M_finish);
_M_finish = __new_finish;
}
else {
_ForwardIter __mid = __first;
advance(__mid, size());
copy(__first, __mid, _M_start);
_M_finish = uninitialized_copy(__mid, __last, _M_finish);
}
}
#endif /* __STL_MEMBER_TEMPLATES */
template <class _Tp, class _Alloc>
void
vector<_Tp, _Alloc>::_M_insert_aux(iterator __position, const _Tp& __x)
{
if (_M_finish != _M_end_of_storage) {
construct(_M_finish, *(_M_finish - 1));
++_M_finish;
_Tp __x_copy = __x;
copy_backward(__position, _M_finish - 2, _M_finish - 1);
*__position = __x_copy;
}
else {
const size_type __old_size = size();
const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
iterator __new_start = _M_allocate(__len);
iterator __new_finish = __new_start;
__STL_TRY {
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
construct(__new_finish, __x);
++__new_finish;
__new_finish = uninitialized_copy(__position, _M_finish, __new_finish);
}
__STL_UNWIND((destroy(__new_start,__new_finish),
_M_deallocate(__new_start,__len)));
destroy(begin(), end());
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start;
_M_finish = __new_finish;
_M_end_of_storage = __new_start + __len;
}
}
template <class _Tp, class _Alloc>
void
vector<_Tp, _Alloc>::_M_insert_aux(iterator __position)
{
if (_M_finish != _M_end_of_storage) {
construct(_M_finish, *(_M_finish - 1));
++_M_finish;
copy_backward(__position, _M_finish - 2, _M_finish - 1);
*__position = _Tp();
}
else {
const size_type __old_size = size();
const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
iterator __new_start = _M_allocate(__len);
iterator __new_finish = __new_start;
__STL_TRY {
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
construct(__new_finish);
++__new_finish;
__new_finish = uninitialized_copy(__position, _M_finish, __new_finish);
}
__STL_UNWIND((destroy(__new_start,__new_finish),
_M_deallocate(__new_start,__len)));
destroy(begin(), end());
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start;
_M_finish = __new_finish;
_M_end_of_storage = __new_start + __len;
}
}
template <class _Tp, class _Alloc>
void vector<_Tp, _Alloc>::_M_fill_insert(iterator __position, size_type __n,
const _Tp& __x)
{
if (__n != 0) {
if (size_type(_M_end_of_storage - _M_finish) >= __n) {
_Tp __x_copy = __x;
const size_type __elems_after = _M_finish - __position;
iterator __old_finish = _M_finish;
if (__elems_after > __n) {
uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
_M_finish += __n;
copy_backward(__position, __old_finish - __n, __old_finish);
fill(__position, __position + __n, __x_copy);
}
else {
uninitialized_fill_n(_M_finish, __n - __elems_after, __x_copy);
_M_finish += __n - __elems_after;
uninitialized_copy(__position, __old_finish, _M_finish);
_M_finish += __elems_after;
fill(__position, __old_finish, __x_copy);
}
}
else {
const size_type __old_size = size();
const size_type __len = __old_size + max(__old_size, __n);
iterator __new_start = _M_allocate(__len);
iterator __new_finish = __new_start;
__STL_TRY {
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
__new_finish = uninitialized_fill_n(__new_finish, __n, __x);
__new_finish
= uninitialized_copy(__position, _M_finish, __new_finish);
}
__STL_UNWIND((destroy(__new_start,__new_finish),
_M_deallocate(__new_start,__len)));
destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start;
_M_finish = __new_finish;
_M_end_of_storage = __new_start + __len;
}
}
}
#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp, class _Alloc> template <class _InputIterator>
void
vector<_Tp, _Alloc>::_M_range_insert(iterator __pos,
_InputIterator __first,
_InputIterator __last,
input_iterator_tag)
{
for ( ; __first != __last; ++__first) {
__pos = insert(__pos, *__first);
++__pos;
}
}
template <class _Tp, class _Alloc> template <class _ForwardIterator>
void
vector<_Tp, _Alloc>::_M_range_insert(iterator __position,
_ForwardIterator __first,
_ForwardIterator __last,
forward_iterator_tag)
{
if (__first != __last) {
size_type __n = 0;
distance(__first, __last, __n);
if (size_type(_M_end_of_storage - _M_finish) >= __n) {
const size_type __elems_after = _M_finish - __position;
iterator __old_finish = _M_finish;
if (__elems_after > __n) {
uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
_M_finish += __n;
copy_backward(__position, __old_finish - __n, __old_finish);
copy(__first, __last, __position);
}
else {
_ForwardIterator __mid = __first;
advance(__mid, __elems_after);
uninitialized_copy(__mid, __last, _M_finish);
_M_finish += __n - __elems_after;
uninitialized_copy(__position, __old_finish, _M_finish);
_M_finish += __elems_after;
copy(__first, __mid, __position);
}
}
else {
const size_type __old_size = size();
const size_type __len = __old_size + max(__old_size, __n);
iterator __new_start = _M_allocate(__len);
iterator __new_finish = __new_start;
__STL_TRY {
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
__new_finish = uninitialized_copy(__first, __last, __new_finish);
__new_finish
= uninitialized_copy(__position, _M_finish, __new_finish);
}
__STL_UNWIND((destroy(__new_start,__new_finish),
_M_deallocate(__new_start,__len)));
destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start;
_M_finish = __new_finish;
_M_end_of_storage = __new_start + __len;
}
}
}
#else /* __STL_MEMBER_TEMPLATES */
template <class _Tp, class _Alloc>
void
vector<_Tp, _Alloc>::insert(iterator __position,
const_iterator __first,
const_iterator __last)
{
if (__first != __last) {
size_type __n = 0;
distance(__first, __last, __n);
if (size_type(_M_end_of_storage - _M_finish) >= __n) {
const size_type __elems_after = _M_finish - __position;
iterator __old_finish = _M_finish;
if (__elems_after > __n) {
uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
_M_finish += __n;
copy_backward(__position, __old_finish - __n, __old_finish);
copy(__first, __last, __position);
}
else {
uninitialized_copy(__first + __elems_after, __last, _M_finish);
_M_finish += __n - __elems_after;
uninitialized_copy(__position, __old_finish, _M_finish);
_M_finish += __elems_after;
copy(__first, __first + __elems_after, __position);
}
}
else {
const size_type __old_size = size();
const size_type __len = __old_size + max(__old_size, __n);
iterator __new_start = _M_allocate(__len);
iterator __new_finish = __new_start;
__STL_TRY {
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
__new_finish = uninitialized_copy(__first, __last, __new_finish);
__new_finish
= uninitialized_copy(__position, _M_finish, __new_finish);
}
__STL_UNWIND((destroy(__new_start,__new_finish),
_M_deallocate(__new_start,__len)));
destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start;
_M_finish = __new_finish;
_M_end_of_storage = __new_start + __len;
}
}
}
#endif /* __STL_MEMBER_TEMPLATES */
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
#pragma reset woff 1375
#endif
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_VECTOR_H */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -1,61 +0,0 @@
/*
*
* 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
* 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_TEMPBUF_H
#define __SGI_STL_TEMPBUF_H
#ifndef __SGI_STL_PAIR_H
#include <pair.h>
#endif
#include <limits.h> /* XXX should use <climits> */
#include <stddef.h> /* XXX should use <cstddef> */
#include <stdlib.h> /* XXX should use <cstdlib> */
#ifndef __TYPE_TRAITS_H
#include <type_traits.h>
#endif
#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H
#include <stl_construct.h>
#endif
#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H
#include <stl_uninitialized.h>
#endif
#ifndef __SGI_STL_INTERNAL_TEMPBUF_H
#include <stl_tempbuf.h>
#endif
#ifdef __STL_USE_NAMESPACES
using __STD::get_temporary_buffer;
using __STD::return_temporary_buffer;
using __STD::temporary_buffer;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_TEMPBUF_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,46 +0,0 @@
/*
*
* Copyright (c) 1996,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.
*
*
* 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.
*
*
*/
#ifndef __SGI_STL_TREE_H
#define __SGI_STL_TREE_H
#ifndef __SGI_STL_INTERNAL_TREE_H
#include <stl_tree.h>
#endif
#include <algobase.h>
#include <alloc.h>
#ifdef __STL_USE_NAMESPACES
using __STD::rb_tree;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_TREE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,373 +0,0 @@
/*
*
* 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 __TYPE_TRAITS_H
#define __TYPE_TRAITS_H
#ifndef __STL_CONFIG_H
#include <stl_config.h>
#endif
/*
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());
}
*/
struct __true_type {
};
struct __false_type {
};
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. */
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;
};
// Provide some specializations. This is harmless for compilers that
// have built-in __types_traits support, and essential for compilers
// that don't.
#ifndef __STL_NO_BOOL
__STL_TEMPLATE_NULL struct __type_traits<bool> {
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;
};
#endif /* __STL_NO_BOOL */
__STL_TEMPLATE_NULL struct __type_traits<char> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<signed char> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<unsigned char> {
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;
};
#ifdef __STL_HAS_WCHAR_T
__STL_TEMPLATE_NULL struct __type_traits<wchar_t> {
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;
};
#endif /* __STL_HAS_WCHAR_T */
__STL_TEMPLATE_NULL struct __type_traits<short> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<unsigned short> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<int> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<unsigned int> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<long> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<unsigned long> {
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;
};
#ifdef __STL_LONG_LONG
__STL_TEMPLATE_NULL struct __type_traits<long long> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<unsigned long long> {
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;
};
#endif /* __STL_LONG_LONG */
__STL_TEMPLATE_NULL struct __type_traits<float> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<double> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<long double> {
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;
};
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class _Tp>
struct __type_traits<_Tp*> {
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;
};
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
__STL_TEMPLATE_NULL struct __type_traits<char*> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<signed char*> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<unsigned char*> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<const char*> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<const signed char*> {
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;
};
__STL_TEMPLATE_NULL struct __type_traits<const unsigned char*> {
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;
};
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
// 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 _Is_integer {
typedef __false_type _Integral;
};
#ifndef __STL_NO_BOOL
__STL_TEMPLATE_NULL struct _Is_integer<bool> {
typedef __true_type _Integral;
};
#endif /* __STL_NO_BOOL */
__STL_TEMPLATE_NULL struct _Is_integer<char> {
typedef __true_type _Integral;
};
__STL_TEMPLATE_NULL struct _Is_integer<signed char> {
typedef __true_type _Integral;
};
__STL_TEMPLATE_NULL struct _Is_integer<unsigned char> {
typedef __true_type _Integral;
};
#ifdef __STL_HAS_WCHAR_T
__STL_TEMPLATE_NULL struct _Is_integer<wchar_t> {
typedef __true_type _Integral;
};
#endif /* __STL_HAS_WCHAR_T */
__STL_TEMPLATE_NULL struct _Is_integer<short> {
typedef __true_type _Integral;
};
__STL_TEMPLATE_NULL struct _Is_integer<unsigned short> {
typedef __true_type _Integral;
};
__STL_TEMPLATE_NULL struct _Is_integer<int> {
typedef __true_type _Integral;
};
__STL_TEMPLATE_NULL struct _Is_integer<unsigned int> {
typedef __true_type _Integral;
};
__STL_TEMPLATE_NULL struct _Is_integer<long> {
typedef __true_type _Integral;
};
__STL_TEMPLATE_NULL struct _Is_integer<unsigned long> {
typedef __true_type _Integral;
};
#ifdef __STL_LONG_LONG
__STL_TEMPLATE_NULL struct _Is_integer<long long> {
typedef __true_type _Integral;
};
__STL_TEMPLATE_NULL struct _Is_integer<unsigned long long> {
typedef __true_type _Integral;
};
#endif /* __STL_LONG_LONG */
#endif /* __TYPE_TRAITS_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,38 +0,0 @@
/*
*
* 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,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_UTILITY
#define __SGI_STL_UTILITY
#include <stl_config.h>
#include <stl_relops.h>
#include <stl_pair.h>
#endif /* __SGI_STL_UTILITY */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +0,0 @@
/*
*
* 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
* 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_VECTOR
#define __SGI_STL_VECTOR
#include <stl_range_errors.h>
#include <stl_algobase.h>
#include <stl_alloc.h>
#include <stl_construct.h>
#include <stl_uninitialized.h>
#include <stl_vector.h>
#include <stl_bvector.h>
#endif /* __SGI_STL_VECTOR */
// Local Variables:
// mode:C++
// End:

View File

@ -1,43 +0,0 @@
/*
*
* 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
* 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_VECTOR_H
#define __SGI_STL_VECTOR_H
#include <stl_range_errors.h>
#include <algobase.h>
#include <alloc.h>
#include <stl_vector.h>
#ifdef __STL_USE_NAMESPACES
using __STD::vector;
#endif /* __STL_USE_NAMESPACES */
#endif /* __SGI_STL_VECTOR_H */
// Local Variables:
// mode:C++
// End: