c++config: Simplify debug namespaces.

2006-02-21  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/c++config: Simplify debug namespaces.
	* include/ext/hash_set: Specialize insert_iterator after norm,
	debug containers have been (optionally) declared. Use nested
	namespaces.	
	* include/ext/hash_map: Same.
	* include/debug/hash_map.h (insert): Add specialization for value
	pointer types.
	* include/debug/hash_set.h (insert): Same.
	* include/debug/hash_multimap.h: Change __gnu_debug_def to __debug.
	* include/debug/set.h: Same.
	* include/debug/bitset: Same.
	* include/debug/multiset.h: Same.
	* include/debug/hash_multiset.h: Same.
	* include/debug/vector: Same.
	* include/debug/map.h: Same.
	* include/debug/deque: Same.
	* include/debug/list: Same.
	* include/debug/multimap.h. Same.
	* include/debug/macros.h: Use __gnu_debug.
	* include/debug/debug.h: Same.
	* include/debug/formatter.h: Same.
	* include/debug/safe_sequence.h: Same.
	* include/debug/functions.h: Same.
	* include/debug/safe_base.h: Same.
	* include/debug/safe_iterator.h: Same.
	* include/debug/safe_iterator.tcc: Same.
	(_M_invalidate): Adjust compare order.
	* include/debug/string: Change std::__gnu_debug to __gnu_debug.
	* include/ext/hashtable.h: Formatting fixes.
	* include/bits/stl_map.h: Formatting fixes.		
	* src/compatibility.cc: Adjust compatibility symbols for old debug
	mode model.	
	* src/debug_list.cc: Tweak.
	* src/debug.cc: Adjust namespaces.
	* docs/html/debug_mode.html: Adjust namespace names.
	* testsuite/25_algorithms/heap/heap.cc: Restore _GLIBCXX_DEBUG
	macro guards, as count values differ when in debug mode.	
	* testsuite/23_containers/vector/26412.cc: Move to...
	* testsuite/23_containers/vector/26412-1.cc: ... here.
	* testsuite/23_containers/vector/26412-2.cc: Add.

	* include/ext/pb_assoc/detail/standard_policies.hpp
	(PB_ASSOC_HASH_NAMESPACE): Remove, use __gnu_cxx::hash_map and
	std::equal_to.

	* configure.ac (libtool_VERSION): To 6:8:0.
	* configure: Regenerate.
	* config/abi/pre/gnu.ver: Revert to exporting __gnu_debug symbols.
	(GLIBCXX_3.4.8): New.
	* testsuite/testsuite_abi.cc: Add GLIBCXX_3.4.8 to known versions.

From-SVN: r111356
This commit is contained in:
Benjamin Kosnik 2006-02-22 00:57:24 +00:00 committed by Benjamin Kosnik
parent 03ba64bb82
commit 45f388bb44
39 changed files with 531 additions and 532 deletions

View File

@ -1,3 +1,56 @@
2006-02-21 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/c++config: Simplify debug namespaces.
* include/ext/hash_set: Specialize insert_iterator after norm,
debug containers have been (optionally) declared. Use nested
namespaces.
* include/ext/hash_map: Same.
* include/debug/hash_map.h (insert): Add specialization for value
pointer types.
* include/debug/hash_set.h (insert): Same.
* include/debug/hash_multimap.h: Change __gnu_debug_def to __debug.
* include/debug/set.h: Same.
* include/debug/bitset: Same.
* include/debug/multiset.h: Same.
* include/debug/hash_multiset.h: Same.
* include/debug/vector: Same.
* include/debug/map.h: Same.
* include/debug/deque: Same.
* include/debug/list: Same.
* include/debug/multimap.h. Same.
* include/debug/macros.h: Use __gnu_debug.
* include/debug/debug.h: Same.
* include/debug/formatter.h: Same.
* include/debug/safe_sequence.h: Same.
* include/debug/functions.h: Same.
* include/debug/safe_base.h: Same.
* include/debug/safe_iterator.h: Same.
* include/debug/safe_iterator.tcc: Same.
(_M_invalidate): Adjust compare order.
* include/debug/string: Change std::__gnu_debug to __gnu_debug.
* include/ext/hashtable.h: Formatting fixes.
* include/bits/stl_map.h: Formatting fixes.
* src/compatibility.cc: Adjust compatibility symbols for old debug
mode model.
* src/debug_list.cc: Tweak.
* src/debug.cc: Adjust namespaces.
* docs/html/debug_mode.html: Adjust namespace names.
* testsuite/25_algorithms/heap/heap.cc: Restore _GLIBCXX_DEBUG
macro guards, as count values differ when in debug mode.
* testsuite/23_containers/vector/26412.cc: Move to...
* testsuite/23_containers/vector/26412-1.cc: ... here.
* testsuite/23_containers/vector/26412-2.cc: Add.
* include/ext/pb_assoc/detail/standard_policies.hpp
(PB_ASSOC_HASH_NAMESPACE): Remove, use __gnu_cxx::hash_map and
std::equal_to.
* configure.ac (libtool_VERSION): To 6:8:0.
* configure: Regenerate.
* config/abi/pre/gnu.ver: Revert to exporting __gnu_debug symbols.
(GLIBCXX_3.4.8): New.
* testsuite/testsuite_abi.cc: Add GLIBCXX_3.4.8 to known versions.
2006-02-21 Paolo Carlini <pcarlini@suse.de>
* include/tr1/hashtable: Trivial formatting fixes.

View File

@ -119,7 +119,10 @@ GLIBCXX_3.4 {
std::__num_base::_S_atoms_out;
std::__moneypunct_cache*;
std::__numpunct_cache*;
std::__timepunct_cache*
std::__timepunct_cache*;
__gnu_debug::_Safe_iterator_base*;
__gnu_debug::_Safe_sequence_base*;
__gnu_debug::_Error_formatter*
};
# Names not in an 'extern' block are mangled names.
@ -378,26 +381,12 @@ GLIBCXX_3.4 {
_ZN9__gnu_cxx12__atomic_add*;
_ZN9__gnu_cxx18__exchange_and_add*;
# __gnu_debug
_ZN10__gnu_norm15_List_node_base4hookEPS0_;
_ZN10__gnu_norm15_List_node_base4swapERS0_S1_;
# debug mode
_ZN10__gnu_norm15_List_node_base4hook*;
_ZN10__gnu_norm15_List_node_base4swap*;
_ZN10__gnu_norm15_List_node_base6unhookEv;
_ZN10__gnu_norm15_List_node_base7reverseEv;
_ZN10__gnu_norm15_List_node_base8transferEPS0_S1_;
_ZN11__gnu_debug19_Safe_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb;
_ZN11__gnu_debug19_Safe_iterator_base9_M_detachEv;
_ZNK11__gnu_debug19_Safe_iterator_base11_M_singularEv;
_ZNK11__gnu_debug19_Safe_iterator_base14_M_can_compareERKS0_;
_ZN11__gnu_debug19_Safe_sequence_base13_M_detach_allEv;
_ZN11__gnu_debug19_Safe_sequence_base18_M_detach_singularEv;
_ZN11__gnu_debug19_Safe_sequence_base22_M_revalidate_singularEv;
_ZN11__gnu_debug19_Safe_sequence_base7_M_swapERS0_;
_ZNK11__gnu_debug16_Error_formatter8_M_errorEv;
_ZNK11__gnu_debug16_Error_formatter10_M_messageENS_13_Debug_msg_idE;
_ZNK11__gnu_debug16_Error_formatter10_Parameter14_M_print_fieldEPKS0_PKc;
_ZNK11__gnu_debug16_Error_formatter10_Parameter20_M_print_descriptionEPKS0_;
_ZNK11__gnu_debug16_Error_formatter13_M_print_wordEPKc;
_ZNK11__gnu_debug16_Error_formatter15_M_print_stringEPKc;
_ZN10__gnu_norm15_List_node_base8transfer*;
# operator new(size_t)
_Znw[jm];
@ -648,25 +637,15 @@ GLIBCXX_3.4.7 {
_ZNSt6locale5_Impl16_M_install_cacheEPKNS_5facetE[jm];
_ZNSt10__gnu_norm15_List_node_base4hookEPS0_;
_ZNSt10__gnu_norm15_List_node_base4swapERS0_S1_;
_ZNSt10__gnu_norm15_List_node_base6unhookEv;
_ZNSt10__gnu_norm15_List_node_base7reverseEv;
_ZNSt10__gnu_norm15_List_node_base8transferEPS0_S1_;
_ZNKSt11__gnu_debug16_Error_formatter8_M_errorEv;
_ZNKSt11__gnu_debug16_Error_formatter10_M_messageENS_13_Debug_msg_idE;
_ZNKSt11__gnu_debug16_Error_formatter10_Parameter14_M_print_fieldEPKS0_PKc;
_ZNKSt11__gnu_debug16_Error_formatter10_Parameter20_M_print_descriptionEPKS0_;
_ZNKSt11__gnu_debug16_Error_formatter13_M_print_wordEPKc;
_ZNKSt11__gnu_debug16_Error_formatter15_M_print_stringEPKc;
_ZNKSt11__gnu_debug19_Safe_iterator_base11_M_singularEv;
_ZNKSt11__gnu_debug19_Safe_iterator_base14_M_can_compareERKS0_;
_ZNSt11__gnu_debug19_Safe_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb;
_ZNSt11__gnu_debug19_Safe_iterator_base9_M_detachEv;
_ZNSt11__gnu_debug19_Safe_sequence_base13_M_detach_allEv;
_ZNSt11__gnu_debug19_Safe_sequence_base18_M_detach_singularEv;
_ZNSt11__gnu_debug19_Safe_sequence_base22_M_revalidate_singularEv;
_ZNSt11__gnu_debug19_Safe_sequence_base7_M_swapERS0_;
} GLIBCXX_3.4.6;
GLIBCXX_3.4.8 {
_ZNSt6__norm15_List_node_base4hook*;
_ZNSt6__norm15_List_node_base4swap*;
_ZNSt6__norm15_List_node_base6unhookEv;
_ZNSt6__norm15_List_node_base7reverseEv;
_ZNSt6__norm15_List_node_base8transfer*;
_ZNSo9_M_insertI[^g]*;
_ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertI[^g]*;
@ -674,8 +653,8 @@ GLIBCXX_3.4.7 {
_ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractI[^g]*;
_ZSt21__copy_streambufs_eofI[cw]St11char_traitsI[cw]EEiPSt15basic_streambuf*;
} GLIBCXX_3.4.7;
} GLIBCXX_3.4.6;
# Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.3 {

View File

@ -1378,7 +1378,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=6:7:0
libtool_VERSION=6:8:0
# Find the rest of the source tree framework.

View File

@ -12,7 +12,7 @@ AC_CONFIG_HEADER(config.h)
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=6:7:0
libtool_VERSION=6:8:0
AC_SUBST(libtool_VERSION)
# Find the rest of the source tree framework.

View File

@ -348,19 +348,19 @@ namespace std
</pre>
<p>In debug mode we include the release-mode container (which is now
defined in in the namespace <code>__gnu_norm</code>) and also the
defined in in the namespace <code>__norm</code>) and also the
debug-mode container. The debug-mode container is defined within the
namespace <code>__gnu_debug</code>, which is associated with namespace
<code>std</code> via a "strong using" directive. This method allows
the debug- and release-mode versions of the same component to coexist
at compile-time and link-time without causing an unreasonable
namespace <code>__debug</code>, which is associated with namespace
<code>std</code> via the GNU namespace association extension. This
method allows the debug and release versions of the same component to
coexist at compile-time and link-time without causing an unreasonable
maintenance burden, while minimizing confusion. Again, this boils down
to C++ code as follows:</p>
<pre>
namespace std
{
namespace __gnu_norm
namespace __norm
{
template&lt;typename _Tp, typename _Alloc = allocator&lt;_Tp&gt; &gt;
class list
@ -369,18 +369,18 @@ namespace std
};
} // namespace __gnu_norm
namespace __gnu_debug
namespace __debug
{
template&lt;typename _Tp, typename _Alloc = allocator&lt;_Tp&gt; &gt;
class list
: public __gnu_norm::list&lt;_Tp, _Alloc&gt;,
: public __norm::list&lt;_Tp, _Alloc&gt;,
public __gnu_debug::_Safe_sequence&lt;list&lt;_Tp, _Alloc&gt; &gt;
{
// ...
};
} // namespace __gnu_norm
} // namespace __norm
using namespace __gnu_debug __attribute__ ((strong));
using namespace __debug __attribute__ ((strong));
}
</pre>

View File

@ -40,14 +40,14 @@
// The current version of the C++ library in compressed ISO date format.
#define __GLIBCXX__
// Macros for various namespace association schemes and modes.
// Macros for controlling various namespace association schemes and modes.
#ifdef _GLIBCXX_DEBUG
# define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1
#endif
#define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
// Macros for namespaces.
// Macros for namespace scope.
// _GLIBCXX_BEGIN_NAMESPACE
// _GLIBCXX_END_NAMESPACE
// _GLIBCXX_BEGIN_NESTED_NAMESPACE
@ -84,12 +84,6 @@ namespace __gnu_cxx
using namespace _6 __attribute__ ((strong));
}
namespace __gnu_ext
{
namespace _6 { }
using namespace _6 __attribute__ ((strong));
}
namespace std
{
namespace tr1
@ -104,19 +98,20 @@ namespace std
#if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
namespace std
{
namespace __gnu_norm { }
#if 1
namespace __gnu_debug_def { }
namespace __gnu_debug { using namespace __gnu_debug_def; }
using namespace __gnu_debug_def __attribute__ ((strong));
#else
namespace __gnu_debug { namespace detail { } }
using namespace __gnu_debug __attribute__ ((strong));
#endif
namespace __norm { }
namespace __debug { }
using namespace __debug __attribute__ ((strong));
}
# define _GLIBCXX_STD __gnu_norm
namespace __gnu_cxx
{
namespace __norm { }
namespace __debug { }
using namespace __debug __attribute__ ((strong));
}
# define _GLIBCXX_STD __norm
# define _GLIBCXX_EXT __norm
# define _GLIBCXX_EXTERN_TEMPLATE 0
# if __NO_INLINE__ && !__GXX_WEAK__
# warning debug mode without inlining may fail due to lack of weak symbols
@ -124,8 +119,10 @@ namespace std
#else
#if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
# define _GLIBCXX_STD _6
# define _GLIBCXX_EXT _6
#else
# define _GLIBCXX_STD std
# define _GLIBCXX_EXT __gnu_cxx
#endif
#endif
@ -148,6 +145,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#endif
_GLIBCXX_END_NAMESPACE
// Allow use of "export template." This is currently not a feature
// that g++ supports.
// #define _GLIBCXX_EXPORT_TEMPLATE 1

View File

@ -205,9 +205,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
: _M_t(__comp, __a)
{ _M_t._M_insert_unique(__first, __last); }
// FIXME There is no dtor declared, but we should have something generated
// by Doxygen. I don't know what tags to add to this paragraph to make
// that happen:
// FIXME There is no dtor declared, but we should have something
// generated by Doxygen. I don't know what tags to add to this
// paragraph to make that happen:
/**
* The dtor only erases the elements, and note that if the elements
* themselves are pointers, the pointed-to memory is not touched in any
@ -253,8 +253,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
{ return _M_t.begin(); }
/**
* Returns a read/write iterator that points one past the last pair in
* the %map. Iteration is done in ascending order according to the keys.
* Returns a read/write iterator that points one past the last
* pair in the %map. Iteration is done in ascending order
* according to the keys.
*/
iterator
end()
@ -329,10 +330,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
* @param k The key for which data should be retrieved.
* @return A reference to the data of the (key,data) %pair.
*
* Allows for easy lookup with the subscript ( @c [] ) operator. Returns
* data associated with the key specified in subscript. If the key does
* not exist, a pair with that key is created using default values, which
* is then returned.
* Allows for easy lookup with the subscript ( @c [] )
* operator. Returns data associated with the key specified in
* subscript. If the key does not exist, a pair with that key
* is created using default values, which is then returned.
*
* Lookup requires logarithmic time.
*/
@ -379,11 +380,13 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
// modifiers
/**
* @brief Attempts to insert a std::pair into the %map.
* @param x Pair to be inserted (see std::make_pair for easy creation of
* pairs).
* @return A pair, of which the first element is an iterator that points
* to the possibly inserted pair, and the second is a bool that
* is true if the pair was actually inserted.
* @param x Pair to be inserted (see std::make_pair for easy creation
* of pairs).
* @return A pair, of which the first element is an iterator that
* points to the possibly inserted pair, and the second is
* a bool that is true if the pair was actually inserted.
*
* This function attempts to insert a (key, value) %pair into the %map.
* A %map relies on unique keys and thus a %pair is only inserted if its
@ -399,18 +402,21 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
* @brief Attempts to insert a std::pair into the %map.
* @param position An iterator that serves as a hint as to where the
* pair should be inserted.
* @param x Pair to be inserted (see std::make_pair for easy creation of
* pairs).
* @param x Pair to be inserted (see std::make_pair for easy creation
* of pairs).
* @return An iterator that points to the element with key of @a x (may
* or may not be the %pair passed in).
*
* This function is not concerned about whether the insertion took place,
* and thus does not return a boolean like the single-argument
* insert() does. Note that the first parameter is only a hint and can
* potentially improve the performance of the insertion process. A bad
* hint would cause no gains in efficiency.
* This function is not concerned about whether the insertion
* took place, and thus does not return a boolean like the
* single-argument insert() does. Note that the first
* parameter is only a hint and can potentially improve the
* performance of the insertion process. A bad hint would
* cause no gains in efficiency.
*
* See http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4
* See
* http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4
* for more on "hinting".
*
* Insertion requires logarithmic time (if the hint is not taken).
@ -420,7 +426,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
{ return _M_t._M_insert_unique(position, __x); }
/**
* @brief A template function that attemps to insert a range of elements.
* @brief Template function that attemps to insert a range of elements.
* @param first Iterator pointing to the start of the range to be
* inserted.
* @param last Iterator pointing to the end of the range.
@ -436,10 +442,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
* @brief Erases an element from a %map.
* @param position An iterator pointing to the element to be erased.
*
* This function erases an element, pointed to by the given iterator,
* from a %map. Note that this function only erases the element, and
* that if the element is itself a pointer, the pointed-to memory is not
* touched in any way. Managing the pointer is the user's responsibilty.
* This function erases an element, pointed to by the given
* iterator, from a %map. Note that this function only erases
* the element, and that if the element is itself a pointer,
* the pointed-to memory is not touched in any way. Managing
* the pointer is the user's responsibilty.
*/
void
erase(iterator __position)
@ -479,22 +486,22 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
* @brief Swaps data with another %map.
* @param x A %map of the same element and allocator types.
*
* This exchanges the elements between two maps in constant time.
* (It is only swapping a pointer, an integer, and an instance of
* the @c Compare type (which itself is often stateless and empty), so it
* should be quite fast.)
* Note that the global std::swap() function is specialized such that
* std::swap(m1,m2) will feed to this function.
* This exchanges the elements between two maps in constant
* time. (It is only swapping a pointer, an integer, and an
* instance of the @c Compare type (which itself is often
* stateless and empty), so it should be quite fast.) Note
* that the global std::swap() function is specialized such
* that std::swap(m1,m2) will feed to this function.
*/
void
swap(map& __x)
{ _M_t.swap(__x._M_t); }
/**
* Erases all elements in a %map. Note that this function only erases
* the elements, and that if the elements themselves are pointers, the
* pointed-to memory is not touched in any way. Managing the pointer is
* the user's responsibilty.
* Erases all elements in a %map. Note that this function only
* erases the elements, and that if the elements themselves are
* pointers, the pointed-to memory is not touched in any way.
* Managing the pointer is the user's responsibilty.
*/
void
clear()

View File

@ -37,7 +37,7 @@
namespace std
{
namespace __gnu_debug_def
namespace __debug
{
template<size_t _Nb>
class bitset
@ -318,7 +318,7 @@ namespace __gnu_debug_def
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const bitset<_Nb>& __x)
{ return __os << __x._M_base(); }
} // namespace __gnu_debug_def
} // namespace __debug
} // namespace std
#endif

View File

@ -28,37 +28,52 @@
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _GLIBCXX_DEBUG_DEBUG_H
#define _GLIBCXX_DEBUG_DEBUG_H 1
#ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H
#define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1
/** Macros used by the implementation outside of debug wrappers to
* verify certain properties. The __glibcxx_requires_xxx macros are
* merely wrappers around the __glibcxx_check_xxx wrappers when we
* are compiling with debug mode, but disappear when we are in
* release mode so that there is no checking performed in, e.g., the
* standard library algorithms.
/** Macros and namespaces used by the implementation outside of debug
* wrappers to verify certain properties. The __glibcxx_requires_xxx
* macros are merely wrappers around the __glibcxx_check_xxx wrappers
* when we are compiling with debug mode, but disappear when we are
* in release mode so that there is no checking performed in, e.g.,
* the standard library algorithms.
*/
// Debug mode namespaces.
namespace std
{
namespace __gnu_debug_def { }
namespace __gnu_debug { using namespace __gnu_debug_def; }
namespace debug = __gnu_debug;
namespace __debug { }
}
namespace __gnu_cxx
{
namespace __gnu_debug { };
namespace debug = __gnu_debug;
namespace __debug { };
}
namespace __gnu_debug
{
using namespace std::debug;
using namespace __gnu_cxx::debug;
using namespace std::__debug;
using namespace __gnu_cxx::__debug;
}
#ifdef _GLIBCXX_DEBUG
#ifndef _GLIBCXX_DEBUG
# define _GLIBCXX_DEBUG_ASSERT(_Condition)
# define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
# define __glibcxx_requires_cond(_Cond,_Msg)
# define __glibcxx_requires_valid_range(_First,_Last)
# define __glibcxx_requires_sorted(_First,_Last)
# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred)
# define __glibcxx_requires_partitioned(_First,_Last,_Value)
# define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred)
# define __glibcxx_requires_heap(_First,_Last)
# define __glibcxx_requires_heap_pred(_First,_Last,_Pred)
# define __glibcxx_requires_nonempty()
# define __glibcxx_requires_string(_String)
# define __glibcxx_requires_string_len(_String,_Len)
# define __glibcxx_requires_subscript(_N)
#else
# include <cstdlib>
# include <cstdio>
@ -66,73 +81,59 @@ namespace __gnu_debug
namespace std
{
namespace __gnu_debug
{
// Avoid the use of assert, because we're trying to keep the <cassert>
// include out of the mix.
inline void
__replacement_assert(const char* __file, int __line, const char* __function,
const char* __condition)
{
std::printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
__function, __condition);
std::abort();
}
} // namespace __gnu_debug
namespace __debug
{
// Avoid the use of assert, because we're trying to keep the <cassert>
// include out of the mix.
inline void
__replacement_assert(const char* __file, int __line,
const char* __function, const char* __condition)
{
printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
__function, __condition);
abort();
}
} // namespace __debug
} // namespace std
#define _GLIBCXX_DEBUG_ASSERT(_Condition) \
do { \
if (! (_Condition)) \
std::__gnu_debug::__replacement_assert(__FILE__, __LINE__, \
__PRETTY_FUNCTION__, \
#_Condition); \
#define _GLIBCXX_DEBUG_ASSERT(_Condition) \
do \
{ \
if (! (_Condition)) \
std::__debug::__replacement_assert(__FILE__, __LINE__, \
__PRETTY_FUNCTION__, #_Condition); \
} while (false)
# ifdef _GLIBCXX_DEBUG_PEDANTIC
# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition)
# else
# define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
# endif
# define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg)
# define __glibcxx_requires_valid_range(_First,_Last) \
__glibcxx_check_valid_range(_First,_Last)
# define __glibcxx_requires_sorted(_First,_Last) \
__glibcxx_check_sorted(_First,_Last)
# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \
__glibcxx_check_sorted_pred(_First,_Last,_Pred)
# define __glibcxx_requires_partitioned(_First,_Last,_Value) \
__glibcxx_check_partitioned(_First,_Last,_Value)
# define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred) \
__glibcxx_check_partitioned_pred(_First,_Last,_Value,_Pred)
# define __glibcxx_requires_heap(_First,_Last) \
__glibcxx_check_heap(_First,_Last)
# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \
__glibcxx_check_heap_pred(_First,_Last,_Pred)
# define __glibcxx_requires_nonempty() __glibcxx_check_nonempty()
# define __glibcxx_requires_string(_String) __glibcxx_check_string(_String)
# define __glibcxx_requires_string_len(_String,_Len) \
__glibcxx_check_string_len(_String,_Len)
# define __glibcxx_requires_subscript(_N) __glibcxx_check_subscript(_N)
# include <debug/functions.h>
# include <debug/formatter.h>
#ifdef _GLIBCXX_DEBUG_PEDANTIC
# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition)
#else
# define _GLIBCXX_DEBUG_ASSERT(_Condition)
# define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
# define __glibcxx_requires_cond(_Cond,_Msg)
# define __glibcxx_requires_valid_range(_First,_Last)
# define __glibcxx_requires_sorted(_First,_Last)
# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred)
# define __glibcxx_requires_partitioned(_First,_Last,_Value)
# define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred)
# define __glibcxx_requires_heap(_First,_Last)
# define __glibcxx_requires_heap_pred(_First,_Last,_Pred)
# define __glibcxx_requires_nonempty()
# define __glibcxx_requires_string(_String)
# define __glibcxx_requires_string_len(_String,_Len)
# define __glibcxx_requires_subscript(_N)
# define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
#endif
# define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg)
# define __glibcxx_requires_valid_range(_First,_Last) \
__glibcxx_check_valid_range(_First,_Last)
# define __glibcxx_requires_sorted(_First,_Last) \
__glibcxx_check_sorted(_First,_Last)
# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \
__glibcxx_check_sorted_pred(_First,_Last,_Pred)
# define __glibcxx_requires_partitioned(_First,_Last,_Value) \
__glibcxx_check_partitioned(_First,_Last,_Value)
# define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred) \
__glibcxx_check_partitioned_pred(_First,_Last,_Value,_Pred)
# define __glibcxx_requires_heap(_First,_Last) \
__glibcxx_check_heap(_First,_Last)
# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \
__glibcxx_check_heap_pred(_First,_Last,_Pred)
# define __glibcxx_requires_nonempty() __glibcxx_check_nonempty()
# define __glibcxx_requires_string(_String) __glibcxx_check_string(_String)
# define __glibcxx_requires_string_len(_String,_Len) \
__glibcxx_check_string_len(_String,_Len)
# define __glibcxx_requires_subscript(_N) __glibcxx_check_subscript(_N)
# include <debug/functions.h>
# include <debug/formatter.h>
#endif
#endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H

View File

@ -37,7 +37,7 @@
namespace std
{
namespace __gnu_debug_def
namespace __debug
{
template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
class deque
@ -383,7 +383,7 @@ namespace __gnu_debug_def
inline void
swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
} // namespace __gnu_debug_def
} // namespace __debug
} // namespace std
#endif

View File

@ -1,6 +1,6 @@
// Debug-mode error formatting implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -33,10 +33,10 @@
#include <typeinfo>
#include <debug/debug.h>
namespace std
{
namespace __gnu_debug
{
using std::type_info;
/** Determine if the two types are the same. */
template<typename _Type1, typename _Type2>
struct __is_same
@ -386,6 +386,5 @@ namespace __gnu_debug
{ return _Error_formatter(__file, __line); }
};
} // namespace __gnu_debug
} // namespace std
#endif

View File

@ -1,6 +1,6 @@
// Debugging support implementation -*- C++ -*-
// Copyright (C) 2003, 2005
// Copyright (C) 2003, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -36,8 +36,6 @@
#include <bits/stl_iterator_base_types.h> // for iterator_traits, categories
#include <bits/cpp_type_traits.h> // for __is_integer
namespace std
{
namespace __gnu_debug
{
template<typename _Iterator, typename _Sequence>
@ -287,6 +285,5 @@ namespace __gnu_debug
return __first == __last;
}
} // namespace __gnu_debug
} // namespace std
#endif

View File

@ -36,18 +36,18 @@
namespace __gnu_cxx
{
namespace __gnu_debug
namespace __debug
{
template<typename _Value, typename _Tp,
typename _HashFcn = __gnu_cxx::hash<_Value>,
typename _EqualKey = std::equal_to<_Value>,
typename _Alloc = std::allocator<_Value> >
class hash_map
: public __gnu_cxx::hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>,
: public _GLIBCXX_EXT::hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>,
public __gnu_debug::_Safe_sequence<hash_map<_Value, _Tp, _HashFcn,
_EqualKey, _Alloc> >
{
typedef __gnu_cxx::hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>
typedef _GLIBCXX_EXT::hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>
_Base;
typedef __gnu_debug::_Safe_sequence<hash_map> _Safe_base;
@ -141,7 +141,14 @@ namespace __gnu_debug
return std::make_pair(iterator(__res.first, this), __res.second);
}
template <typename _InputIterator>
void
insert(const value_type* __first, const value_type* __last)
{
__glibcxx_check_valid_range(__first, __last);
_Base::insert(__first, __last);
}
template<typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
{
@ -267,7 +274,7 @@ namespace __gnu_debug
swap(hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x,
hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __y)
{ __x.swap(__y); }
} // namespace __gnu_debug
} // namespace __debug
} // namespace __gnu_cxx
#endif

View File

@ -36,18 +36,18 @@
namespace __gnu_cxx
{
namespace __gnu_debug
namespace __debug
{
template<typename _Value, typename _Tp,
typename _HashFcn = __gnu_cxx::hash<_Value>,
typename _EqualKey = std::equal_to<_Value>,
typename _Alloc = std::allocator<_Value> >
class hash_multimap
: public __gnu_cxx::hash_multimap<_Value,_Tp,_HashFcn, _EqualKey,_Alloc>,
: public _GLIBCXX_EXT::hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>,
public __gnu_debug::_Safe_sequence<hash_multimap<_Value, _Tp, _HashFcn,
_EqualKey, _Alloc> >
{
typedef __gnu_cxx::hash_multimap<_Value,_Tp,_HashFcn, _EqualKey,_Alloc>
typedef _GLIBCXX_EXT::hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>
_Base;
typedef __gnu_debug::_Safe_sequence<hash_multimap> _Safe_base;
@ -258,7 +258,7 @@ namespace __gnu_debug
swap(hash_multimap<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x,
hash_multimap<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __y)
{ __x.swap(__y); }
} // namespace __gnu_debug
} // namespace __debug
} // namespace __gnu_cxx
#endif

View File

@ -36,18 +36,18 @@
namespace __gnu_cxx
{
namespace __gnu_debug
namespace __debug
{
template<typename _Value,
typename _HashFcn = __gnu_cxx::hash<_Value>,
typename _EqualKey = std::equal_to<_Value>,
typename _Alloc = std::allocator<_Value> >
class hash_multiset
: public __gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>,
: public _GLIBCXX_EXT::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>,
public __gnu_debug::_Safe_sequence<hash_multiset<_Value, _HashFcn,
_EqualKey, _Alloc> >
{
typedef __gnu_cxx:: hash_multiset<_Value,_HashFcn, _EqualKey,_Alloc>
typedef _GLIBCXX_EXT:: hash_multiset<_Value,_HashFcn, _EqualKey,_Alloc>
_Base;
typedef __gnu_debug::_Safe_sequence<hash_multiset> _Safe_base;
@ -233,7 +233,7 @@ template<typename _Value, typename _HashFcn, typename _EqualKey, typename _Alloc
swap(hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>& __x,
hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>& __y)
{ __x.swap(__y); }
} // namespace __gnu_debug
} // namespace __debug
} // namespace __gnu_cxx
#endif

View File

@ -36,18 +36,18 @@
namespace __gnu_cxx
{
namespace __gnu_debug
namespace __debug
{
template<typename _Value,
typename _HashFcn = __gnu_cxx::hash<_Value>,
typename _EqualKey = std::equal_to<_Value>,
typename _Alloc = std::allocator<_Value> >
class hash_set
: public __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc>,
: public _GLIBCXX_EXT::hash_set<_Value, _HashFcn, _EqualKey,_Alloc>,
public __gnu_debug::_Safe_sequence<hash_set<_Value, _HashFcn, _EqualKey,
_Alloc> >
{
typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Base;
typedef _GLIBCXX_EXT::hash_set<_Value, _HashFcn, _EqualKey,_Alloc> _Base;
typedef __gnu_debug::_Safe_sequence<hash_set> _Safe_base;
public:
@ -131,7 +131,14 @@ namespace __gnu_debug
return std::make_pair(iterator(__res.first, this), __res.second);
}
template <typename _InputIterator>
void
insert(const value_type* __first, const value_type* __last)
{
__glibcxx_check_valid_range(__first, __last);
_Base::insert(__first, __last);
}
template<typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
{
@ -242,7 +249,7 @@ namespace __gnu_debug
swap(hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __x,
hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __y)
{ __x.swap(__y); }
} // namespace __gnu_debug
} // namespace __debug
} // namespace __gnu_cxx
#endif

View File

@ -38,7 +38,7 @@
namespace std
{
namespace __gnu_debug_def
namespace __debug
{
template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
class list
@ -502,7 +502,7 @@ namespace __gnu_debug_def
inline void
swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
} // namespace __gnu_debug_def
} // namespace __debug
} // namespace std
#endif

View File

@ -1,6 +1,6 @@
// Debugging support implementation -*- C++ -*-
// Copyright (C) 2003, 2005
// Copyright (C) 2003, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -41,16 +41,17 @@
*
*/
#define _GLIBCXX_DEBUG_VERIFY(_Condition,_ErrorMessage) \
do { \
do \
{ \
if (! (_Condition)) \
std::__gnu_debug::_Error_formatter::_M_at(__FILE__, __LINE__) \
__gnu_debug::_Error_formatter::_M_at(__FILE__, __LINE__) \
._ErrorMessage._M_error(); \
} while (false)
// Verify that [_First, _Last) forms a valid iterator range.
#define __glibcxx_check_valid_range(_First,_Last) \
_GLIBCXX_DEBUG_VERIFY(std::__gnu_debug::__valid_range(_First, _Last), \
_M_message(std::__gnu_debug::__msg_valid_range) \
_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last), \
_M_message(__gnu_debug::__msg_valid_range) \
._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last))
@ -63,11 +64,11 @@ _GLIBCXX_DEBUG_VERIFY(std::__gnu_debug::__valid_range(_First, _Last), \
*/
#define __glibcxx_check_insert(_Position) \
_GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(), \
_M_message(std::__gnu_debug::__msg_insert_singular) \
_M_message(__gnu_debug::__msg_insert_singular) \
._M_sequence(*this, "this") \
._M_iterator(_Position, #_Position)); \
_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
_M_message(std::__gnu_debug::__msg_insert_different) \
_M_message(__gnu_debug::__msg_insert_different) \
._M_sequence(*this, "this") \
._M_iterator(_Position, #_Position))
@ -87,11 +88,11 @@ _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
#define __glibcxx_check_insert_range(_Position,_First,_Last) \
__glibcxx_check_valid_range(_First,_Last); \
_GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(), \
_M_message(std::__gnu_debug::__msg_insert_singular) \
_M_message(__gnu_debug::__msg_insert_singular) \
._M_sequence(*this, "this") \
._M_iterator(_Position, #_Position)); \
_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
_M_message(std::__gnu_debug::__msg_insert_different) \
_M_message(__gnu_debug::__msg_insert_different) \
._M_sequence(*this, "this") \
._M_iterator(_Position, #_Position))
@ -101,11 +102,11 @@ _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
*/
#define __glibcxx_check_erase(_Position) \
_GLIBCXX_DEBUG_VERIFY(_Position._M_dereferenceable(), \
_M_message(std::__gnu_debug::__msg_erase_bad) \
_M_message(__gnu_debug::__msg_erase_bad) \
._M_sequence(*this, "this") \
._M_iterator(_Position, #_Position)); \
_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
_M_message(std::__gnu_debug::__msg_erase_different) \
_M_message(__gnu_debug::__msg_erase_different) \
._M_sequence(*this, "this") \
._M_iterator(_Position, #_Position))
@ -116,7 +117,7 @@ _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
#define __glibcxx_check_erase_range(_First,_Last) \
__glibcxx_check_valid_range(_First,_Last); \
_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \
_M_message(std::__gnu_debug::__msg_erase_different) \
_M_message(__gnu_debug::__msg_erase_different) \
._M_sequence(*this, "this") \
._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last))
@ -124,7 +125,7 @@ _GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \
// Verify that the subscript _N is less than the container's size.
#define __glibcxx_check_subscript(_N) \
_GLIBCXX_DEBUG_VERIFY(_N < this->size(), \
_M_message(std::__gnu_debug::__msg_subscript_oob) \
_M_message(__gnu_debug::__msg_subscript_oob) \
._M_sequence(*this, "this") \
._M_integer(_N, #_N) \
._M_integer(this->size(), "size"))
@ -132,7 +133,7 @@ _GLIBCXX_DEBUG_VERIFY(_N < this->size(), \
// Verify that the container is nonempty
#define __glibcxx_check_nonempty() \
_GLIBCXX_DEBUG_VERIFY(! this->empty(), \
_M_message(std::__gnu_debug::__msg_empty) \
_M_message(__gnu_debug::__msg_empty) \
._M_sequence(*this, "this"))
// Verify that the < operator for elements in the sequence is a
@ -150,8 +151,8 @@ _GLIBCXX_DEBUG_ASSERT(_First == _Last || !_Pred(*_First, *_First))
#define __glibcxx_check_sorted(_First,_Last) \
__glibcxx_check_valid_range(_First,_Last); \
__glibcxx_check_strict_weak_ordering(_First,_Last); \
_GLIBCXX_DEBUG_VERIFY(std::__gnu_debug::__check_sorted(_First, _Last), \
_M_message(std::__gnu_debug::__msg_unsorted) \
_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted(_First, _Last), \
_M_message(__gnu_debug::__msg_unsorted) \
._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last))
@ -160,8 +161,8 @@ _GLIBCXX_DEBUG_VERIFY(std::__gnu_debug::__check_sorted(_First, _Last), \
#define __glibcxx_check_sorted_pred(_First,_Last,_Pred) \
__glibcxx_check_valid_range(_First,_Last); \
__glibcxx_check_strict_weak_ordering_pred(_First,_Last,_Pred); \
_GLIBCXX_DEBUG_VERIFY(std::__gnu_debug::__check_sorted(_First, _Last, _Pred), \
_M_message(std::__gnu_debug::__msg_unsorted_pred) \
_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted(_First, _Last, _Pred), \
_M_message(__gnu_debug::__msg_unsorted_pred) \
._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last) \
._M_string(#_Pred))
@ -170,9 +171,9 @@ _GLIBCXX_DEBUG_VERIFY(std::__gnu_debug::__check_sorted(_First, _Last, _Pred), \
w.r.t. the value _Value. */
#define __glibcxx_check_partitioned(_First,_Last,_Value) \
__glibcxx_check_valid_range(_First,_Last); \
_GLIBCXX_DEBUG_VERIFY(std::__gnu_debug::__check_partitioned(_First, _Last, \
_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned(_First, _Last, \
_Value), \
_M_message(std::__gnu_debug::__msg_unpartitioned) \
_M_message(__gnu_debug::__msg_unpartitioned) \
._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last) \
._M_string(#_Value))
@ -181,9 +182,9 @@ _GLIBCXX_DEBUG_VERIFY(std::__gnu_debug::__check_partitioned(_First, _Last, \
w.r.t. the value _Value and predicate _Pred. */
#define __glibcxx_check_partitioned_pred(_First,_Last,_Value,_Pred) \
__glibcxx_check_valid_range(_First,_Last); \
_GLIBCXX_DEBUG_VERIFY(std::__gnu_debug::__check_partitioned(_First, _Last, \
_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned(_First, _Last, \
_Value, _Pred), \
_M_message(std::__gnu_debug::__msg_unpartitioned_pred) \
_M_message(__gnu_debug::__msg_unpartitioned_pred) \
._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last) \
._M_string(#_Pred) \
@ -192,8 +193,8 @@ _GLIBCXX_DEBUG_VERIFY(std::__gnu_debug::__check_partitioned(_First, _Last, \
// Verify that the iterator range [_First, _Last) is a heap
#define __glibcxx_check_heap(_First,_Last) \
__glibcxx_check_valid_range(_First,_Last); \
_GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last), \
_M_message(std::__gnu_debug::__msg_not_heap) \
_GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last), \
_M_message(__gnu_debug::__msg_not_heap) \
._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last))
@ -202,7 +203,7 @@ _GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last), \
#define __glibcxx_check_heap_pred(_First,_Last,_Pred) \
__glibcxx_check_valid_range(_First,_Last); \
_GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last, _Pred), \
_M_message(std::__gnu_debug::__msg_not_heap_pred) \
_M_message(__gnu_debug::__msg_not_heap_pred) \
._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last) \
._M_string(#_Pred))

View File

@ -37,7 +37,7 @@
namespace std
{
namespace __gnu_debug_def
namespace __debug
{
template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
@ -324,7 +324,7 @@ namespace __gnu_debug_def
swap(map<_Key,_Tp,_Compare,_Allocator>& __lhs,
map<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ __lhs.swap(__rhs); }
} // namespace __gnu_debug_def
} // namespace __debug
} // namespace std
#endif

View File

@ -37,7 +37,7 @@
namespace std
{
namespace __gnu_debug_def
namespace __debug
{
template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
@ -311,7 +311,7 @@ namespace __gnu_debug_def
swap(multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ __lhs.swap(__rhs); }
} // namespace __gnu_debug_def
} // namespace __debug
} // namespace std
#endif

View File

@ -37,7 +37,7 @@
namespace std
{
namespace __gnu_debug_def
namespace __debug
{
template<typename _Key, typename _Compare = std::less<_Key>,
typename _Allocator = std::allocator<_Key> >
@ -317,7 +317,7 @@ namespace __gnu_debug_def
swap(multiset<_Key,_Compare,_Allocator>& __x,
multiset<_Key,_Compare,_Allocator>& __y)
{ return __x.swap(__y); }
} // namespace __gnu_debug_def
} // namespace __debug
} // namespace std
#endif

View File

@ -1,6 +1,6 @@
// Safe sequence/iterator base implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005
// Copyright (C) 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -31,8 +31,6 @@
#ifndef _GLIBCXX_DEBUG_SAFE_BASE_H
#define _GLIBCXX_DEBUG_SAFE_BASE_H 1
namespace std
{
namespace __gnu_debug
{
class _Safe_sequence_base;
@ -205,6 +203,5 @@ namespace __gnu_debug
{ if (++_M_version == 0) _M_version = 1; }
};
} // namespace __gnu_debug
} // namespace std
#endif

View File

@ -1,6 +1,6 @@
// Safe iterator implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005
// Copyright (C) 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -39,8 +39,6 @@
#include <bits/stl_pair.h>
#include <bits/cpp_type_traits.h>
namespace std
{
namespace __gnu_debug
{
/** Iterators that derive from _Safe_iterator_base but that aren't
@ -88,7 +86,7 @@ namespace __gnu_debug
return __is_same<const_iterator, _Safe_iterator>::value;
}
typedef iterator_traits<_Iterator> _Traits;
typedef std::iterator_traits<_Iterator> _Traits;
public:
typedef _Iterator _Base_iterator;
@ -360,16 +358,16 @@ namespace __gnu_debug
* precision.
*/
template<typename _Iterator1, typename _Iterator2>
static pair<difference_type, _Distance_precision>
static std::pair<difference_type, _Distance_precision>
_M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs)
{
typedef typename iterator_traits<_Iterator1>::iterator_category
typedef typename std::iterator_traits<_Iterator1>::iterator_category
_Category;
return _M_get_distance(__lhs, __rhs, _Category());
}
template<typename _Iterator1, typename _Iterator2>
static pair<difference_type, _Distance_precision>
static std::pair<difference_type, _Distance_precision>
_M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs,
std::random_access_iterator_tag)
{
@ -377,7 +375,7 @@ namespace __gnu_debug
}
template<typename _Iterator1, typename _Iterator2>
static pair<difference_type, _Distance_precision>
static std::pair<difference_type, _Distance_precision>
_M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs,
std::forward_iterator_tag)
{
@ -628,7 +626,6 @@ namespace __gnu_debug
const _Safe_iterator<_Iterator, _Sequence>& __i)
{ return __i + __n; }
} // namespace __gnu_debug
} // namespace std
#ifndef _GLIBCXX_EXPORT_TEMPLATE
# include <debug/safe_iterator.tcc>

View File

@ -1,6 +1,6 @@
// Debugging iterator implementation (out of line) -*- C++ -*-
// Copyright (C) 2003, 2004, 2005
// Copyright (C) 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -36,8 +36,6 @@
#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC
#define _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC 1
namespace std
{
namespace __gnu_debug
{
template<typename _Iterator, typename _Sequence>
@ -55,7 +53,7 @@ namespace __gnu_debug
{
const_iterator __begin =
static_cast<const _Sequence*>(_M_sequence)->begin();
pair<difference_type, _Distance_precision> __dist =
std::pair<difference_type, _Distance_precision> __dist =
this->_M_get_distance(__begin, *this);
bool __ok = (__dist.second == __dp_exact && __dist.first >= -__n
|| __dist.second != __dp_exact && __dist.first > 0);
@ -65,7 +63,7 @@ namespace __gnu_debug
{
const_iterator __end =
static_cast<const _Sequence*>(_M_sequence)->end();
pair<difference_type, _Distance_precision> __dist =
std::pair<difference_type, _Distance_precision> __dist =
this->_M_get_distance(*this, __end);
bool __ok = (__dist.second == __dp_exact && __dist.first >= __n
|| __dist.second != __dp_exact && __dist.first > 0);
@ -84,7 +82,7 @@ namespace __gnu_debug
/* Determine if we can order the iterators without the help of
the container */
pair<difference_type, _Distance_precision> __dist =
std::pair<difference_type, _Distance_precision> __dist =
this->_M_get_distance(*this, __rhs);
switch (__dist.second) {
case __dp_equality:
@ -118,26 +116,25 @@ namespace __gnu_debug
if (!this->_M_singular())
{
for (_Safe_iterator_base* iter = _M_sequence->_M_iterators; iter; )
for (_Safe_iterator_base* iter = _M_sequence->_M_iterators; iter;)
{
iterator* __victim = static_cast<iterator*>(iter);
iter = iter->_M_next;
if (this->base() == __victim->base())
__victim->_M_version = 0;
}
for (_Safe_iterator_base* iter2 = _M_sequence->_M_const_iterators;
iter2; /* increment in loop */)
for (_Safe_iterator_base* iter = _M_sequence->_M_const_iterators;
iter;)
{
const_iterator* __victim = static_cast<const_iterator*>(iter2);
iter2 = iter2->_M_next;
if (this->base() == __victim->base())
const_iterator* __victim = static_cast<const_iterator*>(iter);
iter = iter->_M_next;
if (__victim->base() == this->base())
__victim->_M_version = 0;
}
_M_version = 0;
}
}
} // namespace __gnu_debug
} // namespace std
#endif

View File

@ -1,6 +1,6 @@
// Safe sequence implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005
// Copyright (C) 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -36,8 +36,6 @@
#include <debug/functions.h>
#include <debug/safe_base.h>
namespace std
{
namespace __gnu_debug
{
template<typename _Iterator, typename _Sequence>
@ -180,6 +178,5 @@ namespace __gnu_debug
}
}
} // namespace __gnu_debug
} // namespace std
#endif

View File

@ -37,7 +37,7 @@
namespace std
{
namespace __gnu_debug_def
namespace __debug
{
template<typename _Key, typename _Compare = std::less<_Key>,
typename _Allocator = std::allocator<_Key> >
@ -322,7 +322,7 @@ namespace __gnu_debug_def
swap(set<_Key,_Compare,_Allocator>& __x,
set<_Key,_Compare,_Allocator>& __y)
{ return __x.swap(__y); }
} // namespace __gnu_debug_def
} // namespace __debug
} // namespace std
#endif

View File

@ -1,6 +1,6 @@
// Debugging string implementation -*- C++ -*-
// Copyright (C) 2003, 2005
// Copyright (C) 2003, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -35,8 +35,6 @@
#include <debug/safe_sequence.h>
#include <debug/safe_iterator.h>
namespace std
{
namespace __gnu_debug
{
template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
@ -664,7 +662,8 @@ namespace __gnu_debug
{ return _Base::find_first_of(__c, __pos); }
size_type
find_last_of(const basic_string& __str, size_type __pos = _Base::npos) const
find_last_of(const basic_string& __str,
size_type __pos = _Base::npos) const
{ return _Base::find_last_of(__str, __pos); }
size_type
@ -1016,6 +1015,5 @@ namespace __gnu_debug
#endif
} // namespace __gnu_debug
} // namespace std
#endif

View File

@ -38,7 +38,7 @@
namespace std
{
namespace __gnu_debug_def
namespace __debug
{
template<typename _Tp,
typename _Allocator = std::allocator<_Tp> >
@ -413,7 +413,7 @@ namespace __gnu_debug_def
inline void
swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
} // namespace __gnu_debug_def
} // namespace __debug
} // namespace std
#endif

View File

@ -1,6 +1,6 @@
// Hashing map implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -61,10 +61,11 @@
#ifndef _HASH_MAP
#define _HASH_MAP 1
#include <bits/c++config.h>
#include <ext/hashtable.h>
#include <bits/concept_check.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_GLIBCXX_BEGIN_NESTED_NAMESPACE(__gnu_cxx, _GLIBCXX_EXT)
using std::equal_to;
using std::allocator;
@ -73,7 +74,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// Forward declaration of equality operator; needed for friend
// declaration.
template<class _Key, class _Tp, class _HashFcn = hash<_Key>,
template<class _Key, class _Tp, class _HashFn = hash<_Key>,
class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> >
class hash_map;
@ -87,12 +88,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
* @ingroup SGIextensions
* @doctodo
*/
template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
class _Alloc>
template<class _Key, class _Tp, class _HashFn, class _EqualKey, class _Alloc>
class hash_map
{
private:
typedef hashtable<pair<const _Key, _Tp>,_Key, _HashFcn,
typedef hashtable<pair<const _Key, _Tp>,_Key, _HashFn,
_Select1st<pair<const _Key, _Tp> >,
_EqualKey, _Alloc> _Ht;
@ -145,23 +145,23 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template <class _InputIterator>
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>
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>
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>
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())
@ -185,7 +185,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
swap(hash_map& __hs)
{ _M_ht.swap(__hs._M_ht); }
template <class _K1, class _T1, class _HF, class _EqK, class _Al>
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>&);
@ -211,7 +211,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
insert(const value_type& __obj)
{ return _M_ht.insert_unique(__obj); }
template <class _InputIterator>
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f, __l); }
@ -277,33 +277,32 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{ return _M_ht.elems_in_bucket(__n); }
};
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
template<class _Key, class _Tp, class _HashFn, 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)
operator==(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ return __hm1._M_ht == __hm2._M_ht; }
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
template<class _Key, class _Tp, class _HashFn, 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)
operator!=(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ return !(__hm1 == __hm2); }
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
inline void
swap(hash_map<_Key, _Tp, _HashFcn, _EqlKey, _Alloc>& __hm1,
hash_map<_Key, _Tp, _HashFcn, _EqlKey, _Alloc>& __hm2)
swap(hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ __hm1.swap(__hm2); }
// Forward declaration of equality operator; needed for friend declaration.
template <class _Key, class _Tp,
class _HashFcn = hash<_Key>,
template<class _Key, class _Tp,
class _HashFn = hash<_Key>,
class _EqualKey = equal_to<_Key>,
class _Alloc = allocator<_Tp> >
class hash_multimap;
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
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);
@ -313,18 +312,18 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
* @ingroup SGIextensions
* @doctodo
*/
template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
template<class _Key, class _Tp, class _HashFn, class _EqualKey,
class _Alloc>
class hash_multimap
{
// concept requirements
__glibcxx_class_requires(_Key, _SGIAssignableConcept)
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
__glibcxx_class_requires3(_HashFcn, size_t, _Key, _UnaryFunctionConcept)
__glibcxx_class_requires3(_HashFn, size_t, _Key, _UnaryFunctionConcept)
__glibcxx_class_requires3(_EqualKey, _Key, _Key, _BinaryPredicateConcept)
private:
typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFcn,
typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFn,
_Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc>
_Ht;
@ -377,23 +376,23 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template <class _InputIterator>
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>
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>
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>
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())
@ -417,7 +416,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
swap(hash_multimap& __hs)
{ _M_ht.swap(__hs._M_ht); }
template <class _K1, class _T1, class _HF, class _EqK, class _Al>
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>&);
@ -443,7 +442,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); }
template <class _InputIterator>
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); }
@ -506,32 +505,36 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{ return _M_ht.elems_in_bucket(__n); }
};
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
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; }
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
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>
template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
inline void
swap(hash_multimap<_Key, _Tp, _HashFcn, _EqlKey, _Alloc>& __hm1,
hash_multimap<_Key, _Tp, _HashFcn, _EqlKey, _Alloc>& __hm2)
swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ __hm1.swap(__hm2); }
_GLIBCXX_END_NAMESPACE
_GLIBCXX_END_NESTED_NAMESPACE
#ifdef _GLIBCXX_DEBUG
# include <debug/hash_map>
#endif
_GLIBCXX_BEGIN_NAMESPACE(std)
// Specialization of insert_iterator so that it will work for hash_map
// and hash_multimap.
template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn,
template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn,
_EqKey, _Alloc> >
{
protected:
@ -572,7 +575,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return *this; }
};
template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_multimap<_Key, _Tp, _HashFn,
_EqKey, _Alloc> >
{
@ -618,8 +621,4 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE
#ifdef _GLIBCXX_DEBUG
# include <debug/hash_map>
#endif
#endif

View File

@ -1,6 +1,6 @@
// Hashing set implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -61,10 +61,11 @@
#ifndef _HASH_SET
#define _HASH_SET 1
#include <bits/c++config.h>
#include <ext/hashtable.h>
#include <bits/concept_check.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_GLIBCXX_BEGIN_NESTED_NAMESPACE(__gnu_cxx, _GLIBCXX_EXT)
using std::equal_to;
using std::allocator;
@ -73,12 +74,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// Forward declaration of equality operator; needed for friend
// declaration.
template <class _Value, class _HashFcn = hash<_Value>,
template<class _Value, class _HashFcn = hash<_Value>,
class _EqualKey = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class hash_set;
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
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);
@ -88,7 +89,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
* @ingroup SGIextensions
* @doctodo
*/
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class hash_set
{
// concept requirements
@ -146,23 +147,23 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template <class _InputIterator>
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>
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>
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>
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())
@ -186,7 +187,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
swap(hash_set& __hs)
{ _M_ht.swap(__hs._M_ht); }
template <class _Val, class _HF, class _EqK, class _Al>
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>&);
@ -207,7 +208,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return pair<iterator,bool>(__p.first, __p.second);
}
template <class _InputIterator>
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f, __l); }
@ -248,7 +249,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
clear()
{ _M_ht.clear(); }
public:
public:
void
resize(size_type __hint)
{ _M_ht.resize(__hint); }
@ -266,31 +267,31 @@ public:
{ return _M_ht.elems_in_bucket(__n); }
};
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
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; }
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
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>
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); }
template <class _Value,
template<class _Value,
class _HashFcn = hash<_Value>,
class _EqualKey = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class hash_multiset;
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
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);
@ -301,7 +302,7 @@ public:
* @ingroup SGIextensions
* @doctodo
*/
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class hash_multiset
{
// concept requirements
@ -359,23 +360,23 @@ public:
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template <class _InputIterator>
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>
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>
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>
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())
@ -399,7 +400,7 @@ public:
swap(hash_multiset& hs)
{ _M_ht.swap(hs._M_ht); }
template <class _Val, class _HF, class _EqK, class _Al>
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>&);
@ -412,12 +413,12 @@ public:
end() const
{ return _M_ht.end(); }
public:
public:
iterator
insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); }
template <class _InputIterator>
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); }
@ -472,32 +473,35 @@ public:
{ return _M_ht.elems_in_bucket(__n); }
};
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
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; }
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
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>
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); }
_GLIBCXX_END_NAMESPACE
_GLIBCXX_END_NESTED_NAMESPACE
#ifdef _GLIBCXX_DEBUG
# include <debug/hash_set>
#endif
_GLIBCXX_BEGIN_NAMESPACE(std)
// Specialization of insert_iterator so that it will work for hash_set
// and hash_multiset.
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_set<_Value, _HashFcn,
_EqualKey, _Alloc> >
{
@ -540,7 +544,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return *this; }
};
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_multiset<_Value, _HashFcn,
_EqualKey, _Alloc> >
{
@ -585,8 +589,4 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE
#ifdef _GLIBCXX_DEBUG
# include <debug/hash_set>
#endif
#endif

View File

@ -1,6 +1,7 @@
// Hashtable implementation used by containers -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -83,27 +84,27 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
using std::pair;
using std::__iterator_category;
template <class _Val>
template<class _Val>
struct _Hashtable_node
{
_Hashtable_node* _M_next;
_Val _M_val;
};
template <class _Val, class _Key, class _HashFcn, class _ExtractKey,
class _EqualKey, class _Alloc = std::allocator<_Val> >
template<class _Val, class _Key, class _HashFcn, class _ExtractKey,
class _EqualKey, class _Alloc = std::allocator<_Val> >
class hashtable;
template <class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
template<class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
struct _Hashtable_iterator;
template <class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
template<class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
struct _Hashtable_const_iterator;
template <class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
template<class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
struct _Hashtable_iterator
{
typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>
@ -126,9 +127,9 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_Hashtable* _M_ht;
_Hashtable_iterator(_Node* __n, _Hashtable* __tab)
: _M_cur(__n), _M_ht(__tab) {}
: _M_cur(__n), _M_ht(__tab) { }
_Hashtable_iterator() {}
_Hashtable_iterator() { }
reference
operator*() const
@ -153,8 +154,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{ return _M_cur != __it._M_cur; }
};
template <class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
template<class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
struct _Hashtable_const_iterator
{
typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>
@ -178,12 +179,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
const _Hashtable* _M_ht;
_Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab)
: _M_cur(__n), _M_ht(__tab) {}
: _M_cur(__n), _M_ht(__tab) { }
_Hashtable_const_iterator() {}
_Hashtable_const_iterator() { }
_Hashtable_const_iterator(const iterator& __it)
: _M_cur(__it._M_cur), _M_ht(__it._M_ht) {}
: _M_cur(__it._M_cur), _M_ht(__it._M_ht) { }
reference
operator*() const
@ -230,14 +231,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return pos == __last ? *(__last - 1) : *pos;
}
// Forward declaration of operator==.
template <class _Val, class _Key, class _HF, class _Ex,
class _Eq, class _All>
// Forward declaration of operator==.
template<class _Val, class _Key, class _HF, class _Ex,
class _Eq, class _All>
class hashtable;
template <class _Val, class _Key, class _HF, class _Ex,
class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex,
class _Eq, class _All>
bool
operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2);
@ -249,10 +249,9 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// allocator type are identical. This is because, for hashtables,
// this extra storage is negligible. Additionally, a base class
// wouldn't serve any other purposes; it wouldn't, for example,
// simplify the exception-handling code.
template <class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
// simplify the exception-handling code.
template<class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
class hashtable
{
public:
@ -408,7 +407,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
end() const
{ return const_iterator(0, this); }
template <class _Vl, class _Ky, class _HF, class _Ex, class _Eq,
template<class _Vl, class _Ky, class _HF, class _Ex, class _Eq,
class _Al>
friend bool
operator==(const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&,
@ -427,7 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
elems_in_bucket(size_type __bucket) const
{
size_type __result = 0;
for (_Node* __cur = _M_buckets[__bucket]; __cur; __cur = __cur->_M_next)
for (_Node* __n = _M_buckets[__bucket]; __n; __n = __n->_M_next)
__result += 1;
return __result;
}
@ -452,17 +451,17 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
iterator
insert_equal_noresize(const value_type& __obj);
template <class _InputIterator>
template<class _InputIterator>
void
insert_unique(_InputIterator __f, _InputIterator __l)
{ insert_unique(__f, __l, __iterator_category(__f)); }
template <class _InputIterator>
template<class _InputIterator>
void
insert_equal(_InputIterator __f, _InputIterator __l)
{ insert_equal(__f, __l, __iterator_category(__f)); }
template <class _InputIterator>
template<class _InputIterator>
void
insert_unique(_InputIterator __f, _InputIterator __l,
input_iterator_tag)
@ -471,7 +470,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
insert_unique(*__f);
}
template <class _InputIterator>
template<class _InputIterator>
void
insert_equal(_InputIterator __f, _InputIterator __l,
input_iterator_tag)
@ -480,7 +479,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
insert_equal(*__f);
}
template <class _ForwardIterator>
template<class _ForwardIterator>
void
insert_unique(_ForwardIterator __f, _ForwardIterator __l,
forward_iterator_tag)
@ -491,7 +490,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
insert_unique_noresize(*__f);
}
template <class _ForwardIterator>
template<class _ForwardIterator>
void
insert_equal(_ForwardIterator __f, _ForwardIterator __l,
forward_iterator_tag)
@ -513,7 +512,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
for (__first = _M_buckets[__n];
__first && !_M_equals(_M_get_key(__first->_M_val), __key);
__first = __first->_M_next)
{}
{ }
return iterator(__first, this);
}
@ -525,7 +524,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
for (__first = _M_buckets[__n];
__first && !_M_equals(_M_get_key(__first->_M_val), __key);
__first = __first->_M_next)
{}
{ }
return const_iterator(__first, this);
}
@ -633,7 +632,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_M_copy_from(const hashtable& __ht);
};
template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All>
_Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>&
_Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
@ -650,7 +649,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return *this;
}
template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All>
inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>
_Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
@ -661,7 +660,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return __tmp;
}
template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All>
_Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>&
_Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
@ -678,7 +677,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return *this;
}
template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All>
inline _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>
_Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
@ -689,7 +688,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return __tmp;
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
bool
operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2)
@ -706,7 +705,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// Check same length of lists
for (; __cur1 && __cur2;
__cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next)
{}
{ }
if (__cur1 || __cur2)
return false;
// Now check one's elements are in the other
@ -730,20 +729,20 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return true;
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
inline bool
operator!=(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2)
{ return !(__ht1 == __ht2); }
template <class _Val, class _Key, class _HF, class _Extract, class _EqKey,
template<class _Val, class _Key, class _HF, class _Extract, class _EqKey,
class _All>
inline void
swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2)
{ __ht1.swap(__ht2); }
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator, bool>
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
insert_unique_noresize(const value_type& __obj)
@ -762,7 +761,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return pair<iterator, bool>(iterator(__tmp, this), true);
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
insert_equal_noresize(const value_type& __obj)
@ -787,7 +786,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return iterator(__tmp, this);
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
find_or_insert(const value_type& __obj)
@ -808,7 +807,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return __tmp->_M_val;
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator,
typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator>
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
@ -834,7 +833,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return _Pii(end(), end());
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator,
typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator>
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
@ -863,7 +862,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return _Pii(end(), end());
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::size_type
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
erase(const key_type& __key)
@ -903,7 +902,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return __erased;
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
erase(const iterator& __it)
{
@ -941,7 +940,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
}
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
erase(iterator __first, iterator __last)
@ -966,7 +965,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
}
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
inline void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
erase(const_iterator __first, const_iterator __last)
@ -977,14 +976,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
const_cast<hashtable*>(__last._M_ht)));
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
inline void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
erase(const const_iterator& __it)
{ erase(iterator(const_cast<_Node*>(__it._M_cur),
const_cast<hashtable*>(__it._M_ht))); }
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
resize(size_type __num_elements_hint)
@ -1031,7 +1030,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
}
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
_M_erase_bucket(const size_type __n, _Node* __first, _Node* __last)
@ -1056,7 +1055,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
}
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
_M_erase_bucket(const size_type __n, _Node* __last)
@ -1072,7 +1071,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
}
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
clear()
@ -1091,7 +1090,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_M_num_elements = 0;
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
_M_copy_from(const hashtable& __ht)

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
// Copyright (C) 2005 Free Software Foundation, Inc.
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -66,19 +66,16 @@ namespace pb_assoc
#ifdef __GNUC__
#define PB_ASSOC_HASH_NAMESPACE \
__gnu_cxx
template<typename Key>
struct def_hash_fn
{
typedef PB_ASSOC_HASH_NAMESPACE::hash<Key> type;
typedef __gnu_cxx::hash<Key> type;
};
template<typename Key>
struct def_eq_fn
{
typedef PB_ASSOC_HASH_NAMESPACE::equal_to<Key> type;
typedef std::equal_to<Key> type;
};
#elif defined(_MSC_VER)
@ -155,10 +152,6 @@ namespace pb_assoc
typedef pb_assoc::move_to_front_lu_policy<> type;
};
#ifdef __GNUC__
#undef PB_ASSOC_HASH_NAMESPACE
#endif // #ifdef __GNUC__
template<class Comb_Probe_Fn>
struct def_probe_fn
{

View File

@ -44,7 +44,6 @@
#define ignore ignoreXX
#define eq eqXX
#define _List_node_base _List_node_baseXX
#define __gnu_debug __gnu_debugXX
#endif
#include <string>
@ -368,30 +367,15 @@ _GLIBCXX_END_NAMESPACE
#include <bits/compatibility.h>
#undef _GLIBCXX_APPLY_SYMVER
/* gcc-3.4.0
_ZN10__gnu_norm15_List_node_base4hookEPS0_;
_ZN10__gnu_norm15_List_node_base4swapERS0_S1_;
_ZN10__gnu_norm15_List_node_base6unhookEv;
_ZN10__gnu_norm15_List_node_base7reverseEv;
_ZN10__gnu_norm15_List_node_base8transferEPS0_S1_;
_ZN11__gnu_debug19_Safe_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb;
_ZN11__gnu_debug19_Safe_iterator_base9_M_detachEv;
_ZNK11__gnu_debug19_Safe_iterator_base11_M_singularEv;
_ZNK11__gnu_debug19_Safe_iterator_base14_M_can_compareERKS0_;
_ZN11__gnu_debug19_Safe_sequence_base13_M_detach_allEv;
_ZN11__gnu_debug19_Safe_sequence_base18_M_detach_singularEv;
_ZN11__gnu_debug19_Safe_sequence_base22_M_revalidate_singularEv;
_ZN11__gnu_debug19_Safe_sequence_base7_M_swapERS0_;
_ZNK11__gnu_debug16_Error_formatter8_M_errorEv;
_ZNK11__gnu_debug16_Error_formatter10_M_messageENS_13_Debug_msg_idE;
_ZNK11__gnu_debug16_Error_formatter10_Parameter14_M_print_fieldEPKS0_PKc;
_ZNK11__gnu_debug16_Error_formatter10_Parameter20_M_print_descriptionEPKS0_;
_ZNK11__gnu_debug16_Error_formatter13_M_print_wordEPKc;
_ZNK11__gnu_debug16_Error_formatter15_M_print_stringEPKc;
*/
#include "debug_list.cc"
#include "debug.cc"
#include "list.cc"
_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX4hookEPS_, \
_ZN10__gnu_norm15_List_node_base4hookEPS0_, \
GLIBCXX_3.4)
@ -411,62 +395,7 @@ GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX8transferEPS_S0_, \
_ZN10__gnu_norm15_List_node_base8transferEPS0_S1_, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNSt13__gnu_debugXX19_Safe_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb, \
_ZN11__gnu_debug19_Safe_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNSt13__gnu_debugXX19_Safe_iterator_base9_M_detachEv, \
_ZN11__gnu_debug19_Safe_iterator_base9_M_detachEv, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNKSt13__gnu_debugXX19_Safe_iterator_base11_M_singularEv,\
_ZNK11__gnu_debug19_Safe_iterator_base11_M_singularEv, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNKSt13__gnu_debugXX19_Safe_iterator_base14_M_can_compareERKS0_, \
_ZNK11__gnu_debug19_Safe_iterator_base14_M_can_compareERKS0_, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNSt13__gnu_debugXX19_Safe_sequence_base13_M_detach_allEv, \
_ZN11__gnu_debug19_Safe_sequence_base13_M_detach_allEv, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNSt13__gnu_debugXX19_Safe_sequence_base18_M_detach_singularEv, \
_ZN11__gnu_debug19_Safe_sequence_base18_M_detach_singularEv, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNSt13__gnu_debugXX19_Safe_sequence_base22_M_revalidate_singularEv, \
_ZN11__gnu_debug19_Safe_sequence_base22_M_revalidate_singularEv, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNSt13__gnu_debugXX19_Safe_sequence_base7_M_swapERS0_, \
_ZN11__gnu_debug19_Safe_sequence_base7_M_swapERS0_, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNKSt13__gnu_debugXX16_Error_formatter8_M_errorEv, \
_ZNK11__gnu_debug16_Error_formatter8_M_errorEv, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNKSt13__gnu_debugXX16_Error_formatter10_M_messageENS_13_Debug_msg_idE, \
_ZNK11__gnu_debug16_Error_formatter10_M_messageENS_13_Debug_msg_idE, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNKSt13__gnu_debugXX16_Error_formatter10_Parameter14_M_print_fieldEPKS0_PKc, \
_ZNK11__gnu_debug16_Error_formatter10_Parameter14_M_print_fieldEPKS0_PKc, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNKSt13__gnu_debugXX16_Error_formatter10_Parameter20_M_print_descriptionEPKS0_, \
_ZNK11__gnu_debug16_Error_formatter10_Parameter20_M_print_descriptionEPKS0_, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNKSt13__gnu_debugXX16_Error_formatter13_M_print_wordEPKc, \
_ZNK11__gnu_debug16_Error_formatter13_M_print_wordEPKc, \
GLIBCXX_3.4)
_GLIBCXX_ASM_SYMVER(_ZNKSt13__gnu_debugXX16_Error_formatter15_M_print_stringEPKc, \
_ZNK11__gnu_debug16_Error_formatter15_M_print_stringEPKc, \
GLIBCXX_3.4)
#undef _List_node_base
// gcc-4.1.0
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT

View File

@ -1,6 +1,6 @@
// Debugging mode support code -*- C++ -*-
// Copyright (C) 2003, 2004, 2005
// Copyright (C) 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -44,8 +44,6 @@ namespace __gnu_internal
static __glibcxx_mutex_define_initialized(iterator_base_mutex);
} // namespace __gnu_internal
namespace std
{
namespace __gnu_debug
{
const char* _S_debug_messages[] =
@ -670,4 +668,3 @@ namespace __gnu_debug
_Error_formatter::_M_format_word(char*, int, const char*,
const char*) const;
} // namespace __gnu_debug
} // namespace std

View File

@ -29,6 +29,5 @@
#define _GLIBCXX_DEBUG
#include <bits/c++config.h>
#include "list.cc"

View File

@ -0,0 +1,35 @@
// { dg-do compile }
// -*- C++ -*-
// Copyright (C) 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#define debug 0
#include <debug/vector>
// libstdc++26412

View File

@ -1,4 +1,5 @@
// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -21,8 +22,6 @@
#include <algorithm>
#include <testsuite_hooks.h>
bool test __attribute__((unused)) = true;
const int A[] = {1, 11, 12, 3, 10, 6, 17, 4, 8, 2, 5, 13, 9, 15, 14, 16, 7};
const int B[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
const int C[] = {17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
@ -34,28 +33,30 @@ const int N = sizeof(A) / sizeof(int);
class Gt
{
public:
static int count() { return itsCount; }
static void reset() { itsCount = 0; }
static int count() { return _M_count; }
static void reset() { _M_count = 0; }
bool
operator()(const int& x, const int& y)
{
++itsCount;
++_M_count;
return x > y;
}
private:
static int itsCount;
static int _M_count;
};
int Gt::itsCount = 0;
int Gt::_M_count = 0;
// Exercise all of the heap functions for operator<. The
// intermediate results between push_heap and pop_heap and
// make_heap and sort_heap are not checked (they could be).
// Exercise all of the heap functions for operator<. The intermediate
// results between push_heap and pop_heap and make_heap and sort_heap
// are not checked (they could be).
void
test01()
{
bool test __attribute__((unused)) = true;
// sort array s1 using push_heap/pop_heap
int s1[N];
std::copy(A, A + N, s1);
@ -84,8 +85,11 @@ test01()
void
test02()
{
bool test __attribute__((unused)) = true;
Gt gt;
// const int logN = static_cast<int>(std::log(static_cast<double>(N)) + 0.5);
//const int logN = static_cast<int>(std::log(static_cast<double>(N)) + 0.5);
const int logN = 3;
int s1[N];
@ -95,14 +99,18 @@ test02()
for (int i = 2; i <= N; ++i)
{
std::push_heap(s1, s1 + i, gt);
#ifndef _GLIBCXX_DEBUG
VERIFY(gt.count() <= logN);
#endif
gt.reset();
}
for (int i = N; i >= 2; --i)
{
std::pop_heap(s1, s1 + i, gt);
#ifndef _GLIBCXX_DEBUG
VERIFY(gt.count() <= 2 * logN);
#endif
gt.reset();
}
@ -114,11 +122,15 @@ test02()
VERIFY(std::equal(s2, s2 + N, A));
std::make_heap(s2, s2 + N, gt);
#ifndef _GLIBCXX_DEBUG
VERIFY(gt.count() <= 3 * N);
#endif
gt.reset();
std::sort_heap(s2, s2 + N, gt);
#ifndef _GLIBCXX_DEBUG
VERIFY(gt.count() <= N * logN);
#endif
VERIFY(std::equal(s2, s2 + N, C));
}

View File

@ -186,6 +186,7 @@ check_version(symbol& test, bool added)
known_versions.push_back("GLIBCXX_3.4.5");
known_versions.push_back("GLIBCXX_3.4.6");
known_versions.push_back("GLIBCXX_3.4.7");
known_versions.push_back("GLIBCXX_3.4.8");
known_versions.push_back("GLIBCXX_LDBL_3.4");
known_versions.push_back("GLIBCXX_LDBL_3.4.7");
known_versions.push_back("CXXABI_1.3");