Commit df926268 by Jason Merrill Committed by Jason Merrill

algorithm [...]: Update to SGI STL 3.11.

	* algorithm alloc.h defalloc.h hash_map.h hash_set.h iterator
	memory pthread_alloc pthread_alloc.h rope ropeimpl.h stl_algo.h
	stl_algobase.h stl_alloc.h stl_bvector.h stl_config.h
	stl_construct.h stl_deque.h stl_function.h stl_hash_fun.h
	stl_hash_map.h stl_hash_set.h stl_hashtable.h stl_heap.h
	stl_iterator.h stl_list.h stl_map.h stl_multimap.h stl_multiset.h
	stl_numeric.h stl_pair.h stl_queue.h stl_raw_storage_iter.h
	stl_relops.h stl_rope.h stl_set.h stl_slist.h stl_stack.h
	stl_tempbuf.h stl_tree.h stl_uninitialized.h stl_vector.h
	tempbuf.h type_traits.h: Update to SGI STL 3.11.

From-SVN: r22190
parent 514a1f18
1998-09-02 Jason Merrill <jason@yorick.cygnus.com>
* algorithm alloc.h defalloc.h hash_map.h hash_set.h iterator
memory pthread_alloc pthread_alloc.h rope ropeimpl.h stl_algo.h
stl_algobase.h stl_alloc.h stl_bvector.h stl_config.h
stl_construct.h stl_deque.h stl_function.h stl_hash_fun.h
stl_hash_map.h stl_hash_set.h stl_hashtable.h stl_heap.h
stl_iterator.h stl_list.h stl_map.h stl_multimap.h stl_multiset.h
stl_numeric.h stl_pair.h stl_queue.h stl_raw_storage_iter.h
stl_relops.h stl_rope.h stl_set.h stl_slist.h stl_stack.h
stl_tempbuf.h stl_tree.h stl_uninitialized.h stl_vector.h
tempbuf.h type_traits.h: Update to SGI STL 3.11.
Fri Jul 10 15:20:09 1998 Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de> Fri Jul 10 15:20:09 1998 Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
* stl_tempbuf.h (temporary_buffer): Add missing typename. * stl_tempbuf.h (temporary_buffer): Add missing typename.
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <stl_algobase.h> #include <stl_algobase.h>
#include <stl_construct.h> #include <stl_construct.h>
#include <stl_uninitialized.h>
#include <stl_tempbuf.h> #include <stl_tempbuf.h>
#include <stl_algo.h> #include <stl_algo.h>
......
...@@ -33,7 +33,9 @@ using __STD::single_client_alloc; ...@@ -33,7 +33,9 @@ using __STD::single_client_alloc;
#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG #ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
using __STD::__malloc_alloc_oom_handler; using __STD::__malloc_alloc_oom_handler;
#endif /* __STL_STATIC_TEMPLATE_MEMBER_BUG */ #endif /* __STL_STATIC_TEMPLATE_MEMBER_BUG */
#ifdef __STL_USE_STD_ALLOCATORS
using __STD::allocator;
#endif /* __STL_USE_STD_ALLOCATORS */
#endif /* __STL_USE_NAMESPACES */ #endif /* __STL_USE_NAMESPACES */
......
...@@ -15,12 +15,13 @@ ...@@ -15,12 +15,13 @@
// Inclusion of this file is DEPRECATED. This is the original HP // Inclusion of this file is DEPRECATED. This is the original HP
// default allocator. It is provided only for backward compatibility. // 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 // DO NOT USE THIS FILE unless you have an old container implementation
// that requires an allocator with the HP-style interface. SGI STL // that requires an allocator with the HP-style interface.
// uses a different allocator interface. SGI-style allocators are not //
// parametrized with respect to the object type; they traffic in void * // Standard-conforming allocators have a very different interface. The
// pointers. This file is not included by any other SGI STL header. // standard default allocator is declared in the header <memory>.
#ifndef DEFALLOC_H #ifndef DEFALLOC_H
#define DEFALLOC_H #define DEFALLOC_H
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <stl_hashtable.h> #include <stl_hashtable.h>
#endif #endif
#include <algobase.h>
#include <stl_hash_map.h> #include <stl_hash_map.h>
#ifdef __STL_USE_NAMESPACES #ifdef __STL_USE_NAMESPACES
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <stl_hashtable.h> #include <stl_hashtable.h>
#endif #endif
#include <algobase.h>
#include <stl_hash_set.h> #include <stl_hash_set.h>
#ifdef __STL_USE_NAMESPACES #ifdef __STL_USE_NAMESPACES
......
...@@ -29,8 +29,12 @@ ...@@ -29,8 +29,12 @@
#include <stl_config.h> #include <stl_config.h>
#include <stl_relops.h> #include <stl_relops.h>
#include <stddef.h> #include <stddef.h> /* XXX should use <cstddef> */
#if 0 /* XXX define a flag for this */
#include <iostream>
#else
#include <iostream.h> #include <iostream.h>
#endif
#include <stl_iterator.h> #include <stl_iterator.h>
#endif /* __SGI_STL_ITERATOR */ #endif /* __SGI_STL_ITERATOR */
......
...@@ -22,64 +22,83 @@ ...@@ -22,64 +22,83 @@
#include <stl_uninitialized.h> #include <stl_uninitialized.h>
#include <stl_raw_storage_iter.h> #include <stl_raw_storage_iter.h>
// Note: auto_ptr is commented out in this release because the details
// of the interface are still being discussed by the C++ standardization
// committee. It will be included once the iterface is finalized.
#if 0 #if defined(__STL_MEMBER_TEMPLATES)
#if defined(_MUTABLE_IS_KEYWORD) && defined(_EXPLICIT_IS_KEYWORD) && \
defined(__STL_MEMBER_TEMPLATES)
__STL_BEGIN_NAMESPACE __STL_BEGIN_NAMESPACE
template <class X> class auto_ptr { template <class _Tp> class auto_ptr {
private: private:
X* ptr; _Tp* _M_ptr;
mutable bool owns;
public: public:
typedef X element_type; typedef _Tp element_type;
explicit auto_ptr(X* p = 0) __STL_NOTHROW : ptr(p), owns(p) {} explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {}
auto_ptr(const auto_ptr& a) __STL_NOTHROW : ptr(a.ptr), owns(a.owns) { auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {}
a.owns = 0; template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW
: _M_ptr(__a.release()) {}
auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW {
if (&__a != this) {
delete _M_ptr;
_M_ptr = __a.release();
}
return *this;
} }
template <class T> auto_ptr(const auto_ptr<T>& a) __STL_NOTHROW template <class _Tp1>
: ptr(a.ptr), owns(a.owns) { auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW {
a.owns = 0; if (__a.get() != this->get()) {
delete _M_ptr;
_M_ptr = __a.release();
}
return *this;
} }
~auto_ptr() __STL_NOTHROW { delete _M_ptr; }
auto_ptr& operator=(const auto_ptr& a) __STL_NOTHROW { _Tp& operator*() const __STL_NOTHROW {
if (&a != this) { return *_M_ptr;
if (owns)
delete ptr;
owns = a.owns;
ptr = a.ptr;
a.owns = 0;
}
} }
template <class T> auto_ptr& operator=(const auto_ptr<T>& a) __STL_NOTHROW { _Tp* operator->() const __STL_NOTHROW {
if (&a != this) { return _M_ptr;
if (owns) }
delete ptr; _Tp* get() const __STL_NOTHROW {
owns = a.owns; return _M_ptr;
ptr = a.ptr; }
a.owns = 0; _Tp* release() __STL_NOTHROW {
} _Tp* __tmp = _M_ptr;
_M_ptr = 0;
return __tmp;
} }
~auto_ptr() { void reset(_Tp* __p = 0) __STL_NOTHROW {
if (owns) delete _M_ptr;
delete ptr; _M_ptr = __p;
} }
X& operator*() const __STL_NOTHROW { return *ptr; } // According to the C++ standard, these conversions are required. Most
X* operator->() const __STL_NOTHROW { return ptr; } // present-day compilers, however, do not enforce that requirement---and,
X* get() const __STL_NOTHROW { return ptr; } // in fact, most present-day compilers do not support the language
X* release const __STL_NOTHROW { owns = false; return ptr } // features that these conversions rely on.
#ifdef __SGI_STL_USE_AUTO_PTR_CONVERSIONS
private:
template<class _Tp1> struct auto_ptr_ref {
_Tp1* _M_ptr;
auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
};
public:
auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW
: _M_ptr(__ref._M_ptr) {}
template <class _Tp1> operator auto_ptr_ref<_Tp1>() __STL_NOTHROW
{ return auto_ptr_ref<_Tp>(this.release()); }
template <class _Tp1> operator auto_ptr<_Tp1>() __STL_NOTHROW
{ return auto_ptr<_Tp1>(this->release()) }
#endif /* __SGI_STL_USE_AUTO_PTR_CONVERSIONS */
}; };
__STL_END_NAMESPACE __STL_END_NAMESPACE
#endif /* mutable && explicit && member templates */ #endif /* member templates */
#endif /* 0 */
#endif /* __SGI_STL_MEMORY */ #endif /* __SGI_STL_MEMORY */
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
#ifdef __STL_USE_NAMESPACES #ifdef __STL_USE_NAMESPACES
using __STD::__pthread_alloc_template; using __STD::_Pthread_alloc_template;
using __STL::pthread_alloc; using __STD::pthread_alloc;
#endif /* __STL_USE_NAMESPACES */ #endif /* __STL_USE_NAMESPACES */
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#define __SGI_STL_ROPE #define __SGI_STL_ROPE
#include <stl_algobase.h> #include <stl_algobase.h>
#include <tempbuf.h> #include <stl_tempbuf.h>
#include <stl_algo.h> #include <stl_algo.h>
#include <stl_function.h> #include <stl_function.h>
#include <stl_numeric.h> #include <stl_numeric.h>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -35,35 +35,47 @@ ...@@ -35,35 +35,47 @@
__STL_BEGIN_NAMESPACE __STL_BEGIN_NAMESPACE
template <class T> // construct and destroy. These functions are not part of the C++ standard,
inline void destroy(T* pointer) { // and are provided for backward compatibility with the HP STL.
pointer->~T();
template <class _Tp>
inline void destroy(_Tp* __pointer) {
__pointer->~_Tp();
}
template <class _T1, class _T2>
inline void construct(_T1* __p, const _T2& __value) {
new (__p) _T1(__value);
} }
template <class T1, class T2> template <class _T1>
inline void construct(T1* p, const T2& value) { inline void construct(_T1* __p) {
new (p) T1(value); new (__p) _T1();
} }
template <class ForwardIterator> template <class _ForwardIterator>
inline void inline void
__destroy_aux(ForwardIterator first, ForwardIterator last, __false_type) { __destroy_aux(_ForwardIterator __first, _ForwardIterator __last, __false_type)
for ( ; first < last; ++first) {
destroy(&*first); for ( ; __first < __last; ++__first)
destroy(&*__first);
} }
template <class ForwardIterator> template <class _ForwardIterator>
inline void __destroy_aux(ForwardIterator, ForwardIterator, __true_type) {} inline void __destroy_aux(_ForwardIterator, _ForwardIterator, __true_type) {}
template <class ForwardIterator, class T> template <class _ForwardIterator, class _Tp>
inline void __destroy(ForwardIterator first, ForwardIterator last, T*) { inline void
typedef typename __type_traits<T>::has_trivial_destructor trivial_destructor; __destroy(_ForwardIterator __first, _ForwardIterator __last, _Tp*)
__destroy_aux(first, last, trivial_destructor()); {
typedef typename __type_traits<_Tp>::has_trivial_destructor
_Trivial_destructor;
__destroy_aux(__first, __last, _Trivial_destructor());
} }
template <class ForwardIterator> template <class _ForwardIterator>
inline void destroy(ForwardIterator first, ForwardIterator last) { inline void destroy(_ForwardIterator __first, _ForwardIterator __last) {
__destroy(first, last, value_type(first)); __destroy(__first, __last, __VALUE_TYPE(__first));
} }
inline void destroy(char*, char*) {} inline void destroy(char*, char*) {}
......
/* /*
* Copyright (c) 1996 * Copyright (c) 1996-1998
* Silicon Graphics Computer Systems, Inc. * Silicon Graphics Computer Systems, Inc.
* *
* Permission to use, copy, modify, distribute and sell this software * Permission to use, copy, modify, distribute and sell this software
...@@ -35,53 +35,53 @@ ...@@ -35,53 +35,53 @@
__STL_BEGIN_NAMESPACE __STL_BEGIN_NAMESPACE
template <class Key> struct hash { }; template <class _Key> struct hash { };
inline size_t __stl_hash_string(const char* s) inline size_t __stl_hash_string(const char* __s)
{ {
unsigned long h = 0; unsigned long __h = 0;
for ( ; *s; ++s) for ( ; *__s; ++__s)
h = 5*h + *s; __h = 5*__h + *__s;
return size_t(h); return size_t(__h);
} }
__STL_TEMPLATE_NULL struct hash<char*> __STL_TEMPLATE_NULL struct hash<char*>
{ {
size_t operator()(const char* s) const { return __stl_hash_string(s); } size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
}; };
__STL_TEMPLATE_NULL struct hash<const char*> __STL_TEMPLATE_NULL struct hash<const char*>
{ {
size_t operator()(const char* s) const { return __stl_hash_string(s); } size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
}; };
__STL_TEMPLATE_NULL struct hash<char> { __STL_TEMPLATE_NULL struct hash<char> {
size_t operator()(char x) const { return x; } size_t operator()(char __x) const { return __x; }
}; };
__STL_TEMPLATE_NULL struct hash<unsigned char> { __STL_TEMPLATE_NULL struct hash<unsigned char> {
size_t operator()(unsigned char x) const { return x; } size_t operator()(unsigned char __x) const { return __x; }
}; };
__STL_TEMPLATE_NULL struct hash<signed char> { __STL_TEMPLATE_NULL struct hash<signed char> {
size_t operator()(unsigned char x) const { return x; } size_t operator()(unsigned char __x) const { return __x; }
}; };
__STL_TEMPLATE_NULL struct hash<short> { __STL_TEMPLATE_NULL struct hash<short> {
size_t operator()(short x) const { return x; } size_t operator()(short __x) const { return __x; }
}; };
__STL_TEMPLATE_NULL struct hash<unsigned short> { __STL_TEMPLATE_NULL struct hash<unsigned short> {
size_t operator()(unsigned short x) const { return x; } size_t operator()(unsigned short __x) const { return __x; }
}; };
__STL_TEMPLATE_NULL struct hash<int> { __STL_TEMPLATE_NULL struct hash<int> {
size_t operator()(int x) const { return x; } size_t operator()(int __x) const { return __x; }
}; };
__STL_TEMPLATE_NULL struct hash<unsigned int> { __STL_TEMPLATE_NULL struct hash<unsigned int> {
size_t operator()(unsigned int x) const { return x; } size_t operator()(unsigned int __x) const { return __x; }
}; };
__STL_TEMPLATE_NULL struct hash<long> { __STL_TEMPLATE_NULL struct hash<long> {
size_t operator()(long x) const { return x; } size_t operator()(long __x) const { return __x; }
}; };
__STL_TEMPLATE_NULL struct hash<unsigned long> { __STL_TEMPLATE_NULL struct hash<unsigned long> {
size_t operator()(unsigned long x) const { return x; } size_t operator()(unsigned long __x) const { return __x; }
}; };
__STL_END_NAMESPACE __STL_END_NAMESPACE
......
...@@ -33,35 +33,39 @@ ...@@ -33,35 +33,39 @@
__STL_BEGIN_NAMESPACE __STL_BEGIN_NAMESPACE
template <class T1, class T2> template <class _T1, class _T2>
struct pair { struct pair {
typedef T1 first_type; typedef _T1 first_type;
typedef T2 second_type; typedef _T2 second_type;
T1 first; _T1 first;
T2 second; _T2 second;
pair() : first(T1()), second(T2()) {} pair() : first(_T1()), second(_T2()) {}
pair(const T1& a, const T2& b) : first(a), second(b) {} pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
#ifdef __STL_MEMBER_TEMPLATES #ifdef __STL_MEMBER_TEMPLATES
template <class U1, class U2> template <class _U1, class _U2>
pair(const pair<U1, U2>& p) : first(p.first), second(p.second) {} pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
#endif #endif
}; };
template <class T1, class T2> template <class _T1, class _T2>
inline bool operator==(const pair<T1, T2>& x, const pair<T1, T2>& y) { inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
return x.first == y.first && x.second == y.second; {
return __x.first == __y.first && __x.second == __y.second;
} }
template <class T1, class T2> template <class _T1, class _T2>
inline bool operator<(const pair<T1, T2>& x, const pair<T1, T2>& y) { 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); {
return __x.first < __y.first ||
(!(__y.first < __x.first) && __x.second < __y.second);
} }
template <class T1, class T2> template <class _T1, class _T2>
inline pair<T1, T2> make_pair(const T1& x, const T2& y) { inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y)
return pair<T1, T2>(x, y); {
return pair<_T1, _T2>(__x, __y);
} }
__STL_END_NAMESPACE __STL_END_NAMESPACE
......
...@@ -34,92 +34,160 @@ ...@@ -34,92 +34,160 @@
__STL_BEGIN_NAMESPACE __STL_BEGIN_NAMESPACE
#ifndef __STL_LIMITED_DEFAULT_TEMPLATES #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
template <class T, class Sequence = deque<T> > template <class _Tp, class _Sequence = deque<_Tp> >
#else #else
template <class T, class Sequence> template <class _Tp, class _Sequence>
#endif #endif
class queue { class queue {
friend bool operator== __STL_NULL_TMPL_ARGS (const queue& x, const queue& y); friend bool operator== __STL_NULL_TMPL_ARGS (const queue&, const queue&);
friend bool operator< __STL_NULL_TMPL_ARGS (const queue& x, const queue& y); friend bool operator< __STL_NULL_TMPL_ARGS (const queue&, const queue&);
public: public:
typedef typename Sequence::value_type value_type; typedef typename _Sequence::value_type value_type;
typedef typename Sequence::size_type size_type; typedef typename _Sequence::size_type size_type;
typedef typename Sequence::reference reference; typedef _Sequence container_type;
typedef typename Sequence::const_reference const_reference;
typedef typename _Sequence::reference reference;
typedef typename _Sequence::const_reference const_reference;
protected: protected:
Sequence c; _Sequence _M_c;
public: public:
bool empty() const { return c.empty(); } queue() : _M_c() {}
size_type size() const { return c.size(); } explicit queue(const _Sequence& __c) : _M_c(__c) {}
reference front() { return c.front(); }
const_reference front() const { return c.front(); } bool empty() const { return _M_c.empty(); }
reference back() { return c.back(); } size_type size() const { return _M_c.size(); }
const_reference back() const { return c.back(); } reference front() { return _M_c.front(); }
void push(const value_type& x) { c.push_back(x); } const_reference front() const { return _M_c.front(); }
void pop() { c.pop_front(); } reference back() { return _M_c.back(); }
const_reference back() const { return _M_c.back(); }
void push(const value_type& __x) { _M_c.push_back(__x); }
void pop() { _M_c.pop_front(); }
}; };
template <class T, class Sequence> template <class _Tp, class _Sequence>
bool operator==(const queue<T, Sequence>& x, const queue<T, Sequence>& y) { bool
return x.c == y.c; operator==(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
{
return __x._M_c == __y._M_c;
}
template <class _Tp, class _Sequence>
bool
operator<(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
{
return __x._M_c < __y._M_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 T, class Sequence> template <class _Tp, class _Sequence>
bool operator<(const queue<T, Sequence>& x, const queue<T, Sequence>& y) { bool
return x.c < y.c; 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 */
#ifndef __STL_LIMITED_DEFAULT_TEMPLATES #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
template <class T, class Sequence = vector<T>, template <class _Tp, class _Sequence = vector<_Tp>,
class Compare = less<typename Sequence::value_type> > class _Compare = less<typename _Sequence::value_type> >
#else #else
template <class T, class Sequence, class Compare> template <class _Tp, class _Sequence, class _Compare>
#endif #endif
class priority_queue { class priority_queue {
public: public:
typedef typename Sequence::value_type value_type; typedef typename _Sequence::value_type value_type;
typedef typename Sequence::size_type size_type; typedef typename _Sequence::size_type size_type;
typedef typename Sequence::reference reference; typedef _Sequence container_type;
typedef typename Sequence::const_reference const_reference;
typedef typename _Sequence::reference reference;
typedef typename _Sequence::const_reference const_reference;
protected: protected:
Sequence c; _Sequence _M_c;
Compare comp; _Compare _M_comp;
public: public:
priority_queue() : c() {} priority_queue() : _M_c() {}
explicit priority_queue(const Compare& x) : c(), comp(x) {} explicit priority_queue(const _Compare& __x) : _M_c(), _M_comp(__x) {}
priority_queue(const _Compare& __x, const _Sequence& __s)
: _M_c(__s), _M_comp(__x)
{ make_heap(_M_c.begin(), _M_c.end(), _M_comp); }
#ifdef __STL_MEMBER_TEMPLATES #ifdef __STL_MEMBER_TEMPLATES
template <class InputIterator> template <class _InputIterator>
priority_queue(InputIterator first, InputIterator last, const Compare& x) priority_queue(_InputIterator __first, _InputIterator __last)
: c(first, last), comp(x) { make_heap(c.begin(), c.end(), comp); } : _M_c(__first, __last) { make_heap(_M_c.begin(), _M_c.end(), _M_comp); }
template <class InputIterator>
priority_queue(InputIterator first, InputIterator last) template <class _InputIterator>
: c(first, last) { make_heap(c.begin(), c.end(), comp); } priority_queue(_InputIterator __first,
_InputIterator __last, const _Compare& __x)
: _M_c(__first, __last), _M_comp(__x)
{ make_heap(_M_c.begin(), _M_c.end(), _M_comp); }
template <class _InputIterator>
priority_queue(_InputIterator __first, _InputIterator __last,
const _Compare& __x, const _Sequence& __s)
: _M_c(__s), _M_comp(__x)
{
_M_c.insert(_M_c.end(), __first, __last);
make_heap(_M_c.begin(), _M_c.end(), _M_comp);
}
#else /* __STL_MEMBER_TEMPLATES */ #else /* __STL_MEMBER_TEMPLATES */
priority_queue(const value_type* first, const value_type* last, priority_queue(const value_type* __first, const value_type* __last)
const Compare& x) : c(first, last), comp(x) { : _M_c(__first, __last) { make_heap(_M_c.begin(), _M_c.end(), _M_comp); }
make_heap(c.begin(), c.end(), comp);
priority_queue(const value_type* __first, const value_type* __last,
const _Compare& __x)
: _M_c(__first, __last), _M_comp(__x)
{ make_heap(_M_c.begin(), _M_c.end(), _M_comp); }
priority_queue(const value_type* __first, const value_type* __last,
const _Compare& __x, const _Sequence& __c)
: _M_c(__c), _M_comp(__x)
{
_M_c.insert(_M_c.end(), __first, __last);
make_heap(_M_c.begin(), _M_c.end(), _M_comp);
} }
priority_queue(const value_type* first, const value_type* last)
: c(first, last) { make_heap(c.begin(), c.end(), comp); }
#endif /* __STL_MEMBER_TEMPLATES */ #endif /* __STL_MEMBER_TEMPLATES */
bool empty() const { return c.empty(); } bool empty() const { return _M_c.empty(); }
size_type size() const { return c.size(); } size_type size() const { return _M_c.size(); }
const_reference top() const { return c.front(); } const_reference top() const { return _M_c.front(); }
void push(const value_type& x) { void push(const value_type& __x) {
__STL_TRY { __STL_TRY {
c.push_back(x); _M_c.push_back(__x);
push_heap(c.begin(), c.end(), comp); push_heap(_M_c.begin(), _M_c.end(), _M_comp);
} }
__STL_UNWIND(c.clear()); __STL_UNWIND(_M_c.clear());
} }
void pop() { void pop() {
__STL_TRY { __STL_TRY {
pop_heap(c.begin(), c.end(), comp); pop_heap(_M_c.begin(), _M_c.end(), _M_comp);
c.pop_back(); _M_c.pop_back();
} }
__STL_UNWIND(c.clear()); __STL_UNWIND(_M_c.clear());
} }
}; };
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
*/ */
/* NOTE: This is an internal header file, included by other STL headers. /* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly. * You should not attempt to use it directly.
*/ */
#ifndef __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H #ifndef __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H
...@@ -33,10 +33,10 @@ ...@@ -33,10 +33,10 @@
__STL_BEGIN_NAMESPACE __STL_BEGIN_NAMESPACE
template <class ForwardIterator, class T> template <class _ForwardIterator, class _Tp>
class raw_storage_iterator { class raw_storage_iterator {
protected: protected:
ForwardIterator iter; _ForwardIterator _M_iter;
public: public:
typedef output_iterator_tag iterator_category; typedef output_iterator_tag iterator_category;
typedef void value_type; typedef void value_type;
...@@ -44,38 +44,38 @@ public: ...@@ -44,38 +44,38 @@ public:
typedef void pointer; typedef void pointer;
typedef void reference; typedef void reference;
explicit raw_storage_iterator(ForwardIterator x) : iter(x) {} explicit raw_storage_iterator(_ForwardIterator __x) : _M_iter(__x) {}
raw_storage_iterator<ForwardIterator, T>& operator*() { return *this; } raw_storage_iterator& operator*() { return *this; }
raw_storage_iterator<ForwardIterator, T>& operator=(const T& element) { raw_storage_iterator& operator=(const _Tp& __element) {
construct(&*iter, element); construct(&*_M_iter, __element);
return *this; return *this;
} }
raw_storage_iterator<ForwardIterator, T>& operator++() { raw_storage_iterator<_ForwardIterator, _Tp>& operator++() {
++iter; ++_M_iter;
return *this; return *this;
} }
raw_storage_iterator<ForwardIterator, T> operator++(int) { raw_storage_iterator<_ForwardIterator, _Tp> operator++(int) {
raw_storage_iterator<ForwardIterator, T> tmp = *this; raw_storage_iterator<_ForwardIterator, _Tp> __tmp = *this;
++iter; ++_M_iter;
return tmp; return __tmp;
} }
}; };
#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION #ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class ForwardIterator, class T> template <class _ForwardIterator, class _Tp>
inline output_iterator_tag inline output_iterator_tag
iterator_category(const raw_storage_iterator<ForwardIterator, T>&) iterator_category(const raw_storage_iterator<_ForwardIterator, _Tp>&)
{ {
return output_iterator_tag(); return output_iterator_tag();
} }
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ #endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
#endif /* __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H */
__STL_END_NAMESPACE __STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H */
// Local Variables: // Local Variables:
// mode:C++ // mode:C++
// End: // End:
...@@ -33,24 +33,24 @@ ...@@ -33,24 +33,24 @@
__STL_BEGIN_RELOPS_NAMESPACE __STL_BEGIN_RELOPS_NAMESPACE
template <class T> template <class _Tp>
inline bool operator!=(const T& x, const T& y) { inline bool operator!=(const _Tp& __x, const _Tp& __y) {
return !(x == y); return !(__x == __y);
} }
template <class T> template <class _Tp>
inline bool operator>(const T& x, const T& y) { inline bool operator>(const _Tp& __x, const _Tp& __y) {
return y < x; return __y < __x;
} }
template <class T> template <class _Tp>
inline bool operator<=(const T& x, const T& y) { inline bool operator<=(const _Tp& __x, const _Tp& __y) {
return !(y < x); return !(__y < __x);
} }
template <class T> template <class _Tp>
inline bool operator>=(const T& x, const T& y) { inline bool operator>=(const _Tp& __x, const _Tp& __y) {
return !(x < y); return !(__x < __y);
} }
__STL_END_RELOPS_NAMESPACE __STL_END_RELOPS_NAMESPACE
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -34,39 +34,74 @@ ...@@ -34,39 +34,74 @@
__STL_BEGIN_NAMESPACE __STL_BEGIN_NAMESPACE
#ifndef __STL_LIMITED_DEFAULT_TEMPLATES #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
template <class T, class Sequence = deque<T> > template <class _Tp, class _Sequence = deque<_Tp> >
#else #else
template <class T, class Sequence> template <class _Tp, class _Sequence>
#endif #endif
class stack { class stack {
friend bool operator== __STL_NULL_TMPL_ARGS (const stack&, const stack&); friend bool operator== __STL_NULL_TMPL_ARGS (const stack&, const stack&);
friend bool operator< __STL_NULL_TMPL_ARGS (const stack&, const stack&); friend bool operator< __STL_NULL_TMPL_ARGS (const stack&, const stack&);
public: public:
typedef typename Sequence::value_type value_type; typedef typename _Sequence::value_type value_type;
typedef typename Sequence::size_type size_type; typedef typename _Sequence::size_type size_type;
typedef typename Sequence::reference reference; typedef _Sequence container_type;
typedef typename Sequence::const_reference const_reference;
typedef typename _Sequence::reference reference;
typedef typename _Sequence::const_reference const_reference;
protected: protected:
Sequence c; _Sequence _M_c;
public: public:
bool empty() const { return c.empty(); } stack() : _M_c() {}
size_type size() const { return c.size(); } explicit stack(const _Sequence& __s) : _M_c(__s) {}
reference top() { return c.back(); }
const_reference top() const { return c.back(); } bool empty() const { return _M_c.empty(); }
void push(const value_type& x) { c.push_back(x); } size_type size() const { return _M_c.size(); }
void pop() { c.pop_back(); } reference top() { return _M_c.back(); }
const_reference top() const { return _M_c.back(); }
void push(const value_type& __x) { _M_c.push_back(__x); }
void pop() { _M_c.pop_back(); }
}; };
template <class T, class Sequence> template <class _Tp, class _Seq>
bool operator==(const stack<T, Sequence>& x, const stack<T, Sequence>& y) { bool operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
return x.c == y.c; {
return __x._M_c == __y._M_c;
}
template <class _Tp, class _Seq>
bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{
return __x._M_c < __y._M_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 T, class Sequence> template <class _Tp, class _Seq>
bool operator<(const stack<T, Sequence>& x, const stack<T, Sequence>& y) { bool operator<=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
return x.c < y.c; {
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 __STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_STACK_H */ #endif /* __SGI_STL_INTERNAL_STACK_H */
......
...@@ -34,86 +34,119 @@ ...@@ -34,86 +34,119 @@
__STL_BEGIN_NAMESPACE __STL_BEGIN_NAMESPACE
template <class T> template <class _Tp>
pair<T*, ptrdiff_t> get_temporary_buffer(ptrdiff_t len, T*) { pair<_Tp*, ptrdiff_t>
if (len > ptrdiff_t(INT_MAX / sizeof(T))) __get_temporary_buffer(ptrdiff_t __len, _Tp*)
len = INT_MAX / sizeof(T); {
if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp)))
while (len > 0) { __len = INT_MAX / sizeof(_Tp);
T* tmp = (T*) malloc((size_t)len * sizeof(T));
if (tmp != 0) while (__len > 0) {
return pair<T*, ptrdiff_t>(tmp, len); _Tp* __tmp = (_Tp*) malloc((size_t)__len * sizeof(_Tp));
len /= 2; if (__tmp != 0)
return pair<_Tp*, ptrdiff_t>(__tmp, __len);
__len /= 2;
} }
return pair<T*, ptrdiff_t>((T*)0, 0); return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0);
} }
template <class T> #ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS
void return_temporary_buffer(T* p) {
free(p); template <class _Tp>
inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len) {
return __get_temporary_buffer(__len, (_Tp*) 0);
} }
template <class ForwardIterator, #endif /* __STL_EXPLICIT_FUNCTION_TMPL_ARGS */
class T
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION // This overload is not required by the standard; it is an extension.
= iterator_traits<ForwardIterator>::value_type // It is supported for backward compatibility with the HP STL, and
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ // because not all compilers support the language feature (explicit
> // function template arguments) that is required for the standard
class temporary_buffer { // 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: private:
ptrdiff_t original_len; ptrdiff_t _M_original_len;
ptrdiff_t len; ptrdiff_t _M_len;
T* buffer; _Tp* _M_buffer;
void allocate_buffer() { void _M_allocate_buffer() {
original_len = len; _M_original_len = _M_len;
buffer = 0; _M_buffer = 0;
if (len > (ptrdiff_t)(INT_MAX / sizeof(T))) if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp)))
len = INT_MAX / sizeof(T); _M_len = INT_MAX / sizeof(_Tp);
while (len > 0) { while (_M_len > 0) {
buffer = (T*) malloc(len * sizeof(T)); _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp));
if (buffer) if (_M_buffer)
break; break;
len /= 2; _M_len /= 2;
} }
} }
void initialize_buffer(const T&, __true_type) {} void _M_initialize_buffer(const _Tp&, __true_type) {}
void initialize_buffer(const T& val, __false_type) { void _M_initialize_buffer(const _Tp& val, __false_type) {
uninitialized_fill_n(buffer, len, val); uninitialized_fill_n(_M_buffer, _M_len, val);
} }
public: public:
ptrdiff_t size() const { return len; } ptrdiff_t size() const { return _M_len; }
ptrdiff_t requested_size() const { return original_len; } ptrdiff_t requested_size() const { return _M_original_len; }
T* begin() { return buffer; } _Tp* begin() { return _M_buffer; }
T* end() { return buffer + len; } _Tp* end() { return _M_buffer + _M_len; }
temporary_buffer(ForwardIterator first, ForwardIterator last) { _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) {
typedef typename __type_traits<_Tp>::has_trivial_default_constructor
_Trivial;
__STL_TRY { __STL_TRY {
len = 0; _M_len = 0;
distance(first, last, len); distance(__first, __last, _M_len);
allocate_buffer(); _M_allocate_buffer();
if (len > 0) if (_M_len > 0)
initialize_buffer(*first, _M_initialize_buffer(*__first, _Trivial());
typename __type_traits<T>::has_trivial_default_constructor());
} }
__STL_UNWIND(free(buffer); buffer = 0; len = 0); __STL_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0);
} }
~temporary_buffer() { ~_Temporary_buffer() {
destroy(buffer, buffer + len); destroy(_M_buffer, _M_buffer + _M_len);
free(buffer); free(_M_buffer);
} }
private: private:
temporary_buffer(const temporary_buffer&) {} // Disable copy constructor and assignment operator.
void operator=(const temporary_buffer&) {} _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 __STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_TEMPBUF_H */ #endif /* __SGI_STL_INTERNAL_TEMPBUF_H */
......
...@@ -30,15 +30,18 @@ ...@@ -30,15 +30,18 @@
#ifndef __SGI_STL_PAIR_H #ifndef __SGI_STL_PAIR_H
#include <pair.h> #include <pair.h>
#endif #endif
#include <limits.h> #include <limits.h> /* XXX should use <climits> */
#include <stddef.h> #include <stddef.h> /* XXX should use <cstddef> */
#include <stdlib.h> #include <stdlib.h> /* XXX should use <cstdlib> */
#ifndef __TYPE_TRAITS_H #ifndef __TYPE_TRAITS_H
#include <type_traits.h> #include <type_traits.h>
#endif #endif
#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H #ifndef __SGI_STL_INTERNAL_CONSTRUCT_H
#include <stl_construct.h> #include <stl_construct.h>
#endif #endif
#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H
#include <stl_uninitialized.h>
#endif
#ifndef __SGI_STL_INTERNAL_TEMPBUF_H #ifndef __SGI_STL_INTERNAL_TEMPBUF_H
#include <stl_tempbuf.h> #include <stl_tempbuf.h>
#endif #endif
......
...@@ -40,13 +40,14 @@ attain their correct values by one of these means: ...@@ -40,13 +40,14 @@ attain their correct values by one of these means:
EXAMPLE: EXAMPLE:
//Copy an array of elements which have non-trivial copy constructors //Copy an array of elements which have non-trivial copy constructors
template <class T> void copy(T* source,T* destination,int n,__false_type); 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. //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); 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 //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) { template <class T> inline void copy(T* source,T* destination,int n) {
copy(source,destination,n,typename __type_traits<T>::has_trivial_copy_constructor()); copy(source, destination, n,
typename __type_traits<T>::has_trivial_copy_constructor());
} }
*/ */
...@@ -57,7 +58,7 @@ struct __true_type { ...@@ -57,7 +58,7 @@ struct __true_type {
struct __false_type { struct __false_type {
}; };
template <class type> template <class _Tp>
struct __type_traits { struct __type_traits {
typedef __true_type this_dummy_member_must_be_first; typedef __true_type this_dummy_member_must_be_first;
/* Do not remove this member. It informs a compiler which /* Do not remove this member. It informs a compiler which
...@@ -90,6 +91,18 @@ struct __type_traits { ...@@ -90,6 +91,18 @@ struct __type_traits {
// have built-in __types_traits support, and essential for compilers // have built-in __types_traits support, and essential for compilers
// that don't. // 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> { __STL_TEMPLATE_NULL struct __type_traits<char> {
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
...@@ -114,6 +127,18 @@ __STL_TEMPLATE_NULL struct __type_traits<unsigned char> { ...@@ -114,6 +127,18 @@ __STL_TEMPLATE_NULL struct __type_traits<unsigned char> {
typedef __true_type is_POD_type; 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> { __STL_TEMPLATE_NULL struct __type_traits<short> {
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
...@@ -162,6 +187,26 @@ __STL_TEMPLATE_NULL struct __type_traits<unsigned long> { ...@@ -162,6 +187,26 @@ __STL_TEMPLATE_NULL struct __type_traits<unsigned long> {
typedef __true_type is_POD_type; 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> { __STL_TEMPLATE_NULL struct __type_traits<float> {
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
...@@ -188,8 +233,8 @@ __STL_TEMPLATE_NULL struct __type_traits<long double> { ...@@ -188,8 +233,8 @@ __STL_TEMPLATE_NULL struct __type_traits<long double> {
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION #ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class T> template <class _Tp>
struct __type_traits<T*> { struct __type_traits<_Tp*> {
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
...@@ -199,7 +244,31 @@ struct __type_traits<T*> { ...@@ -199,7 +244,31 @@ struct __type_traits<T*> {
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ #else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
struct __type_traits<char*> { __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_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
...@@ -207,7 +276,7 @@ struct __type_traits<char*> { ...@@ -207,7 +276,7 @@ struct __type_traits<char*> {
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
struct __type_traits<signed char*> { __STL_TEMPLATE_NULL struct __type_traits<const signed char*> {
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
...@@ -215,7 +284,7 @@ struct __type_traits<signed char*> { ...@@ -215,7 +284,7 @@ struct __type_traits<signed char*> {
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
struct __type_traits<unsigned char*> { __STL_TEMPLATE_NULL struct __type_traits<const unsigned char*> {
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
...@@ -226,6 +295,77 @@ struct __type_traits<unsigned char*> { ...@@ -226,6 +295,77 @@ struct __type_traits<unsigned char*> {
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ #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 */ #endif /* __TYPE_TRAITS_H */
// Local Variables: // Local Variables:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment