From b4a784aa9a0bcb65c77d7cf0bd65e4da26425a4c Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Sat, 9 Apr 2005 06:13:35 +0000 Subject: Merge to tag apple-local-merge-20050406. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/apple-local-200502-branch@97889 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 509 ++++++ libstdc++-v3/acconfig.h | 2 +- libstdc++-v3/acinclude.m4 | 2 +- libstdc++-v3/config.h.in | 2 +- libstdc++-v3/config/cpu/cris/atomicity.h | 10 +- libstdc++-v3/config/cpu/s390/atomicity.h | 3 +- libstdc++-v3/config/linker-map.gnu | 6 + libstdc++-v3/configure | 2 +- libstdc++-v3/docs/doxygen/user.cfg.in | 10 +- libstdc++-v3/docs/html/ext/howto.html | 6 + libstdc++-v3/docs/html/faq/index.html | 3 + libstdc++-v3/include/Makefile.am | 15 +- libstdc++-v3/include/Makefile.in | 15 +- libstdc++-v3/include/bits/basic_string.tcc | 6 +- libstdc++-v3/include/bits/c++config | 2 +- libstdc++-v3/include/bits/stl_algobase.h | 9 +- libstdc++-v3/include/std/std_complex.h | 36 +- libstdc++-v3/include/std/std_fstream.h | 12 + libstdc++-v3/include/tr1/functional | 1103 ++++++++++++- libstdc++-v3/include/tr1/tuple | 1654 +++----------------- libstdc++-v3/include/tr1/tuple_iterate.h | 26 +- libstdc++-v3/include/tr1/type_traits | 429 ++--- libstdc++-v3/include/tr1/type_traits_fwd.h | 13 + libstdc++-v3/include/tr1/utility | 9 + libstdc++-v3/libsupc++/eh_alloc.cc | 6 + libstdc++-v3/libsupc++/eh_catch.cc | 23 +- libstdc++-v3/libsupc++/eh_throw.cc | 5 +- libstdc++-v3/libsupc++/unwind-cxx.h | 1 + libstdc++-v3/scripts/check_performance | 38 +- .../21_strings/basic_string/find/char/3.cc | 4 +- .../21_strings/basic_string/find/wchar_t/3.cc | 4 +- .../22_locale/collate/compare/wchar_t/2.cc | 1 + .../collate/compare/wchar_t/wrapped_env.cc | 1 + .../collate/compare/wchar_t/wrapped_locale.cc | 1 + .../testsuite/22_locale/collate/hash/wchar_t/2.cc | 1 + .../22_locale/collate/hash/wchar_t/wrapped_env.cc | 1 + .../collate/hash/wchar_t/wrapped_locale.cc | 1 + .../22_locale/collate/transform/wchar_t/2.cc | 1 + .../collate/transform/wchar_t/wrapped_env.cc | 1 + .../collate/transform/wchar_t/wrapped_locale.cc | 1 + .../testsuite/23_containers/set/modifiers/16728.cc | 3 +- .../testsuite/27_io/basic_ifstream/open/char/1.cc | 9 +- .../testsuite/27_io/basic_ofstream/open/char/1.cc | 9 +- .../basic_ostream/inserters_other/wchar_t/2.cc | 4 +- libstdc++-v3/testsuite/testsuite_abi.cc | 1 + libstdc++-v3/testsuite/testsuite_tr1.h | 94 +- libstdc++-v3/testsuite/thread/pthread1.cc | 2 +- libstdc++-v3/testsuite/thread/pthread2.cc | 2 +- libstdc++-v3/testsuite/thread/pthread3.cc | 2 +- libstdc++-v3/testsuite/thread/pthread4.cc | 2 +- libstdc++-v3/testsuite/thread/pthread5.cc | 2 +- libstdc++-v3/testsuite/thread/pthread6.cc | 2 +- libstdc++-v3/testsuite/thread/pthread7-rope.cc | 2 +- .../is_function/is_function.cc | 1 + 54 files changed, 2309 insertions(+), 1800 deletions(-) (limited to 'libstdc++-v3') diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0d5155bc367..0e948f11e30 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,512 @@ +2005-04-06 Ulrich Weigand + + * config/cpu/s390/atomicity.h (__exchange_and_add): Add "memory" + clobber to inline assembly statement. + +2005-04-05 Jonathan Wakely + + * include/tr1/memory, include/tr1/boost_shared_ptr.h: Use mutex + to make _Sp_counted_base::add_ref_lock() thread-safe. Check whether + to destroy resources by testing for equality, not inequality. Add + empty critical sections to solve memory visibility issues. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/cons/auto_ptr_neg.cc: Use dg-excess-errors instead of + explicitly listing line numbers which need to be kept in sync. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/assign/auto_ptr_neg.cc: Same. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/assign/auto_ptr_rvalue_neg.cc: Same. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/cons/weak_ptr_expired.cc: Make XFAIL for consistency when + -fno-exceptions. + * testsuite/tr1/2_general_utilities/memory/ + enable_shared_from_this/not_shared.cc: Add explanatory comments. + * testsuite/tr1/2_general_utilities/memory/ + enable_shared_from_this/not_shared2.cc: Same. + * testsuite/tr1/2_general_utilities/memory/ + enable_shared_from_this/not_shared3.cc: Same. + +2005-04-02 Douglas Gregor + + * include/tr1/tuple_iterate.h (tuple_element): Use new macro + _GLIBCXX_T_NUM_ARGS_PLUS_1 because _T is a macro on Darwin. + * include/tr1/repeat.h (_GLIBCXX_T_NUM_ARGS_PLUS_1): Define for + each iteration. + * scripts/gen_includers.h: Define _GLIBCXX_T_NUM_ARGS_PLUS_1 for + each iteration. + +2005-04-01 Douglas Gregor + + * include/tr1/functional (_Maybe_wrap_member_pointer): Wrap up + member pointers in _Mem_fn but let other function objects pass + through unchanged. + * include/tr1/functional_iterator (bind): Reduce number of bind() + overloads to two to eliminate ambiguities. Use + _Maybe_wrap_member_pointer to handle member pointers gracefully. + +2005-03-31 Chris Jefferson + + * include/tr1/tuple: Support iteration via tuple_iterate.h. + * include/tr1/tuple_iterate.h: Iteration file for tuple. + +2005-03-31 Douglas Gregor + + * include/Makefile.am (tr1_headers): Add bind and mu repetition + headers and reference_wrapper<> forwarding header. + * include/Makefile.in: Regenerate. + * include/tr1/bind_iterate.h: Implementation of function call + operators for the function object returned from tr1::bind(). + * include/tr1/bind_repeat.h: Bind-specific repetition header, + akin to include/tr1/repeat.h. + * include/tr1/functional (_Mem_fn): Bug fix: declare result member + template for use with result_of. + (is_bind_expression): New. + (is_placeholder): New. + (_Placeholder): New. Placeholder type for bind. + (_Mu): New. Implementation detail of bind. + (_Bind, _Bind_result): New. Function objects returned by bind. + (_GLIBCXX_JOIN): New. Required to create bind placeholders. + * include/tr1/functional_iterate.h (_Bind, _Bind_result, bind): + New. Implementation of tr1::bind. + * include/tr1/mu_iterate.h (_Mu): result template and operator() + for the _Mu helper to bind. + * include/tr1/ref_fwd.h (reference_wrapper): Forward declaration + used by tuple header. + (ref): Ditto. + (cref): Ditto. + * include/tr1/repeat.h: Add bind-specific repetition macros. + * include/tr1/tuple: Use reference_wrapper forwarding header for + initial definitions, then include at the end, to + make the circular dependencies work. + (tie): Support zero-argument tie() function. + * testsuite/tr1/3_function_objects/bind/all_bound.cc: New test of + bind() functionality with parameters bound. + * testsuite/tr1/3_function_objects/bind/nested.cc: New test of + nested bind() expressions. + * testsuite/tr1/3_function_objects/bind/placeholders.cc: New test + of bind() placeholders. + * testsuite/tr1/3_function_objects/bind/ref.cc: New test of bind() + with arguments bound via reference_wrapper<>. + * scripts/gen_includers.pl: Generate the repetitive part of + include/tr1/repeat.h. + * scripts/gen_bind_includers.pl: Generate the repetitive part of + include/tr1/bind_repeat.h. + +2005-03-24 Benjamin Kosnik + + * include/tr1/memory: Forward to... + * include/tr1/boost_shared_ptr.h: ...here. Add Boost Software License. + * include/Makefile.am (tr1_headers): Add boost_shared_ptr.h. + * include/Makefile.in: Regenerate. + * testsuite/tr1/2_general_utilities/memory/shared_ptr/cons/ + auto_ptr_neg.cc: Adjust line numbers. + +2005-03-22 Chris Jefferson + + PR libstdc++/20577 + * include/bits/stl_algobase.h (iter_swap): Only delegate iter_swap + to swap when the iterator's reference_type is a reference to its + value_type. + * testsuite/25_algorithms/iter_swap/20577.cc: New. + +2005-03-21 Paolo Carlini + + PR libstdc++/20352 + * include/std/std_complex.h (pow(const complex<_Tp>&, + const _Tp&)): On non-c99 platforms, don't try to compute + log of complex zero. + +2005-03-17 Benjamin Kosnik + + * testsuite/testsuite_abi.cc: Add CXXABI_1.3.1. + +2005-03-08 Paolo Carlini + + * include/tr1/type_traits (is_polymorphic): Don't forget + the virtual destructor, thus avoiding warnings. + * testsuite/testsuite_tr1.h (class AbstractClass, + class PolymorphicClass): Likewise. + +2005-03-08 Paolo Carlini + + * include/std/std_complex.h (pow(const complex<_Tp>&, + const complex<_Tp>&)): Dispatch to either __complex_pow(__x.__rep(), + __y.__rep()) or __complex_pow(__x, __y) depending on the macro + _GLIBCXX_USE_C99_COMPLEX. + +2005-03-08 Paolo Carlini + + * include/std/std_fstream.h (basic_fstream<>::open, + basic_ifstream<>::open, basic_ofstream<>::open): Implement the + resolution of DR 409 [Ready], call clear() on success. + * docs/html/ext/howto.html: Add an entry for DR 409. + * docs/html/faq/index.html (4_4): Clarify the new behavior. + * testsuite/27_io/basic_ifstream/open/char/1.cc: Adjust. + * testsuite/27_io/basic_ofstream/open/char/1.cc: Likewise. + +2005-03-06 Paolo Carlini + + * include/tr1/type_traits: Add is_base_of. + * testsuite/tr1/4_metaprogramming/relationships_between_types/ + is_base_of/is_base_of.cc: New. + * testsuite/tr1/4_metaprogramming/relationships_between_types/ + is_base_of/typedefs.cc: Likewise. + +2005-03-05 Joseph S. Myers + + * testsuite/22_locale/collate/compare/wchar_t/2.cc, + testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc, + testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc, + testsuite/22_locale/collate/hash/wchar_t/2.cc, + testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc, + testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc, + testsuite/22_locale/collate/transform/wchar_t/2.cc, + testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc, + testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc: + XFAIL on *-*-hpux11.23. + +2005-03-04 Paolo Carlini + + * include/tr1/type_traits: Implement is_polymorphic. + (is_empty): Minor tweaks. + * testsuite/testsuite_tr1.h: Add test types. + * testsuite/tr1/4_metaprogramming/type_properties/ + is_polymorphic/is_polymorphic.cc: New. + * testsuite/tr1/4_metaprogramming/type_properties/ + is_polymorphic/typedefs.cc: Likewise. + * testsuite/tr1/4_metaprogramming/composite_type_traits/ + is_union_or_class/is_union_or_class.cc: Add tests. + +2005-03-03 Benjamin Kosnik + + * include/tr1/functional: Convert relative path. + + * docs/doxygen/user.cfg.in: Add tr1 includes. + +2005-03-02 Jonathan Wakely + Benjamin Kosnik + + * testsuite/tr1/2_general_utilities/memory/shared_ptr/ + cons/auto_ptr_neg.cc: Correct line numbers. + +2005-03-02 Jonathan Wakely + + * include/tr1/memory: Replace checked_deleter with (unchecked) + _Sp_deleter as GCC warns about delete on incomplete types anyway. + +2005-03-02 Jonathan Wakely + + * include/tr1/memory: Add missing "inline" to __throw_bad_weak_ptr. + +2005-03-02 Douglas Gregor + + * include/tr1/functional (_Has_result_type): Cleanup. + (_Result_of_impl): Handle member data pointers correctly. + (reference_wrapper): Support invocation. + Move repetition code into new file include/tr1/repeat.h. + * include/tr1/functional_iterate.h (reference_wrapper): Support + invocation. Cleanup long lines. + * include/tr1/ref_wrap_iterate.h (reference_wrapper): Declare + invocation operators. + * include/tr1/repeat.h: Code repetition header. + * include/Makefile.am: Add ref_wrap_iterate.h, repeat.h. + * include/Makefile.in: Add ref_wrap_iterate.h, repeat.h. + * testsuite/tr1/3_function_objects/reference_wrapper/invoke.cc: + New test of reference_wrapper invocation. + * testsuite/tr1/3_function_objects/reference_wrapper/typedefs.cc: + New test of reference_wrapper typedefs and base classes. + * testsuite/tr1/3_function_objects/result_of.cc: Trivial cleanup + (e-mail address). + +2005-03-02 Douglas Gregor + + * include/tr1/function (result_of): New class template. + * include/tr1/functional/iterator.h: Implementation of TR1 + result_of. + * testsuite/tr1/3_function_objects/result_of.cc: New test + +2005-03-01 Hans-Peter Nilsson + + PR target/19065 + * config/cpu/cris/atomicity.h (__exchange_and_add): In asm, use + 'Q' constraint, not 'm'. + +2005-02-25 Paolo Carlini + + * include/tr1/type_traits: Add the trivial is_union and is_class; + add the __is_union_or_class extension. + (is_enum, is_empty): Use the latter. + * include/tr1/type_traits_fwd.h: Add __is_union_or_class. + * testsuite/testsuite_tr1.h: Add UnionType; trivial formatting + fixes. + * testsuite/tr1/4_metaprogramming/composite_type_traits/ + is_union_or_class/is_union_or_class.cc: New. + * testsuite/tr1/4_metaprogramming/composite_type_traits/ + is_union_or_class/typedefs.cc: Likewise. + +2005-02-24 Benjamin Kosnik + + * testsuite/tr1/6_containers/unordered/instantiate/hash.cc: Guard + wchar_t use with _GLIBCXX_USE_WCHAR_T. + +2005-02-24 Benjamin Kosnik + + * include/std/std_complex.h: _GLIBCXX_USE_C99_COMPLEX_MATH to + _GLIBCXX_USE_C99_COMPLEX. + * acinclude.m4: Same. + * acconfig.h: Same. + * configure: Regenerate. + * config.h.in: Same. + +2005-02-24 Paolo Carlini + + * include/tr1/functional (mem_fn): Avoid _T, badname on + Darwin. + +2005-02-23 Douglas Gregor + + * include/tr1/functional (function): New class template. + (mem_fn): New function template. + Implementations of TR1 function and mem_fn facilities. + * include/tr1/functional_iterate.h: Implementations of TR1 + function and mem_fn facilities. + * testsuite/tr1/3_function_objects/function/1.cc: New + test of std::tr1::function. + * testsuite/tr1/3_function_objects/function/2.cc: New + test of std::tr1::function. + * testsuite/tr1/3_function_objects/function/3.cc: New + test of std::tr1::function. + * testsuite/tr1/3_function_objects/function/4.cc: New + test of std::tr1::function. + * testsuite/tr1/3_function_objects/function/5.cc: New + test of std::tr1::function. + * testsuite/tr1/3_function_objects/function/6.cc: New + test of std::tr1::function. + * testsuite/tr1/3_function_objects/function/7.cc: New + test of std::tr1::function. + * testsuite/tr1/3_function_objects/function/8.cc: New + test of std::tr1::function. + * testsuite/tr1/3_function_objects/function/9.cc: New + test of std::tr1::function. + * testsuite/tr1/3_function_objects/mem_fn.cc: New test of + std::tr1::mem_fn. + +2005-02-23 Paolo Carlini + + * include/tr1/type_traits: Implement is_convertible. + * testsuite/tr1/4_metaprogramming/relationships_between_types/ + is_convertible/is_convertible.cc: New. + * testsuite/tr1/4_metaprogramming/relationships_between_types/ + is_convertible/typedefs.cc: Likewise. + * testsuite/testsuite_tr1.h: Add class DerivedType. + + * include/tr1/type_traits (is_function): Don't mistake references + to function types for function types. + * testsuite/tr1/4_metaprogramming/primary_type_categories/ + is_function/is_function.cc: Add testcase. + +2005-02-22 Benjamin Kosnik + + * scripts/check_performance: Tweaks. + + * testsuite/27_io/basic_ostream/inserters_other/wchar_t/2.cc: Name + output file with extension that clean rules can find. + +2005-02-22 Richard Henderson + + PR libstdc++/20091 + * libsupc++/eh_catch.cc (__cxa_begin_catch): Don't special case + decrement of uncaughtExceptions for rethrow. + +2005-02-22 Paolo Carlini + + * include/tr1/functional: Fix License to GPL with exception. + * include/tr1/hashtable: Likewise. + * include/tr1/tuple: Likewise. + * include/tr1/type_traits: Likewise. + * include/tr1/type_traits_fwd.h: Likewise. + * include/tr1/unordered_map: Likewise. + * include/tr1/unordered_set: Likewise. + * include/tr1/utility: Likewise. + +2005-02-22 Paolo Carlini + + * testsuite/tr1/2_general_utilities/memory/shared_ptr/assign/ + auto_ptr_neg.cc: Add missing dg-do compile directive. + * testsuite/tr1/2_general_utilities/memory/shared_ptr/assign/ + auto_ptr_rvalue_neg.cc: Likewise. + * testsuite/tr1/2_general_utilities/memory/shared_ptr/assign/ + shared_ptr_neg.cc: Likewise. + * testsuite/tr1/2_general_utilities/memory/shared_ptr/cons/ + auto_ptr_neg.cc: Likewise. + * testsuite/tr1/2_general_utilities/memory/shared_ptr/modifiers/ + reset_neg.cc: Likewise. + * testsuite/tr1/2_general_utilities/memory/shared_ptr/modifiers/ + swap_neg.cc: Likewise. + +2005-02-22 Jonathan Wakely + + * include/Makefile.am, include/Makefile.in: Fix accidental extra + change from previous commit. + +2005-02-21 Jonathan Wakely + + * include/tr1/memory: New file. + * include/Makefile.am, include/Makefile.in: Add new TR1 header. + * testsuite/tr1/2_general_utilities/memory/ + enable_shared_from_this/not_shared.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + enable_shared_from_this/not_shared2.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + enable_shared_from_this/not_shared3.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + enable_shared_from_this/shared.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + enable_shared_from_this/still_shared.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/assign/assign.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/assign/auto_ptr.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/assign/auto_ptr_neg.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/assign/auto_ptr_rvalue_neg.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/assign/shared_ptr.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/assign/shared_ptr_neg.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/comparison/cmp.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/cons/auto_ptr.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/cons/auto_ptr_neg.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/cons/copy.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/cons/default.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/cons/pointer.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/cons/weak_ptr.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/cons/weak_ptr_expired.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/dest/dest.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/misc/io.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/misc/swap.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/modifiers/reset.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/modifiers/reset_neg.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/modifiers/swap.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/modifiers/swap_neg.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/observers/bool_conv.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/observers/get.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/observers/unique.cc: New test. + * testsuite/tr1/2_general_utilities/memory/ + shared_ptr/observers/use_count.cc: New test. + +2005-02-21 Paolo Carlini + + * include/tr1/type_traits (is_member_function_pointer): + Remove ugly workaround for c++/19076. + +2005-02-21 Paolo Carlini + + * include/bits/basic_string.tcc (_Rep::_M_destroy): Don't + check for this == &_S_empty_rep, it's always false, here. + +2005-02-19 Matt Austern + + * include/tr1/functional (tr1_hashtable_define_trivial_hash): Make + hash::operator() a const member function for T a fundamental type + * include/tr1/hashtable (extract1st::operator()): Declare const. + (hash_code_base): Declare all member functions const + (hashtable::find): fix call to this->bucket_count() + (hashtable::count): Likewise. + (hashtable::equal_range): m_incr_bucket applies to iterator, not node. + * testsuite/tr1/6_containers/unordered/find/set1.cc: New test. + * testsuite/tr1/6_containers/unordered/find/map1.cc: New test. + * testsuite/tr1/6_containers/unordered/find/multimap1.cc: New test. + * testsuite/tr1/6_containers/unordered/find/multiset1.cc: New test. + +2005-02-19 Hans-Peter Nilsson + + PR libstdc++/20071 + * include/tr1/functional (hash): Wrap in #ifdef + _GLIBCXX_USE_WCHAR_T. + +2005-02-18 Richard Henderson + + PR libstdc++/10606 + * config/linker-map.gnu (CXXABI_1.3.1): Add __cxa_get_exception_ptr. + * libsupc++/eh_alloc.cc (__cxa_allocate_exception): Increment + uncaughtExceptions here instead of ... + * libsupc++/eh_throw.cc (__cxa_throw) ... here. + (__cxa_rethrow): Increment uncaughtExceptions here instead of ... + * libsupc++/eh_catch.cc (__cxa_end_catch): ... here. + (__cxa_get_exception_ptr): New. + * libsupc++/unwind-cxx.h (__cxa_get_exception_ptr): Declare. + +2005-02-18 Matt Austern + + * testsuite/tr1/6_containers/unordered/insert/array_syntax.cc: Fix + test case to use assignment instead of == + * testsuite/tr1/6_containers/unordered/insert/map_range.cc: New test. + * testsuite/tr1/6_containers/unordered/insert/multimap_range.cc: New test. + * testsuite/tr1/6_containers/unordered/insert/multiset_range.cc: New test. + * testsuite/tr1/6_containers/unordered/insert/set_range.cc: New test. + +2005-02-18 Eric Botcazou + + * testsuite/thread/pthread1.cc: Do not invoke pthread_setconcurrency + on Solaris 2.6 and below. + * testsuite/thread/pthread2.cc: Likewise. + * testsuite/thread/pthread3.cc: Likewise. + * testsuite/thread/pthread4.cc: Likewise. + * testsuite/thread/pthread5.cc: Likewise. + * testsuite/thread/pthread6.cc: Likewise. + * testsuite/thread/pthread7-rope.cc: Likewise. + +2005-02-17 Matt Austern + + * include/tr1/functional (hash): New function object. + * include/tr1/hashtable: New file. + * include/tr1/unordered_set: New file. + * include/tr1/unordered_map: New file. + * include/Makefile.am: Add three new TR1 headers. + * include/Makefile.in: Likewise. + * testsuite/tr1/6_containers/unordered/insert/array_syntax.cc: New test. + * testsuite/tr1/6_containers/unordered/insert/map_single.cc: New test. + * testsuite/tr1/6_containers/unordered/insert/multimap_single.cc: New test. + * testsuite/tr1/6_containers/unordered/insert/multiset_single.cc: New test. + * testsuite/tr1/6_containers/unordered/insert/set_single.cc: New test. + * testsuite/tr1/6_containers/unordered/instantiate/hash.cc: New test. + * testsuite/tr1/6_containers/unordered/instantiate/map.cc: New test. + * testsuite/tr1/6_containers/unordered/instantiate/multimap.cc: New test. + * testsuite/tr1/6_containers/unordered/instantiate/multiset.cc: New test. + * testsuite/tr1/6_containers/unordered/instantiate/set.cc: New test. + +2005-02-16 Paolo Carlini + + * testsuite/23_containers/set/modifiers/16728.cc: + Remove redundant include . + +2005-02-16 Paolo Carlini + + PR libstdc++/19829 + * testsuite/21_strings/basic_string/find/char/3.cc: Fix the test + at line #66 to not access str_lit01 beyond its end. + * testsuite/21_strings/basic_string/find/wchar_t/3.cc: Likewise. + 2005-02-15 Paolo Carlini Jon Grimm diff --git a/libstdc++-v3/acconfig.h b/libstdc++-v3/acconfig.h index f1b821630ba..51d588430a3 100644 --- a/libstdc++-v3/acconfig.h +++ b/libstdc++-v3/acconfig.h @@ -20,7 +20,7 @@ #undef _GLIBCXX_USE_C99_MATH // Define if C99 complex math functions should be used in std::complex. -#undef _GLIBCXX_USE_C99_COMPLEX_MATH +#undef _GLIBCXX_USE_C99_COMPLEX // Define if code specialized for wchar_t should be used. #undef _GLIBCXX_USE_WCHAR_T diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index f18b7d90b53..4ef88ad4d55 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -983,7 +983,7 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ AC_MSG_RESULT($ac_c99_complex) if test x"$ac_c99_complex" = x"yes"; then - AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_MATH) + AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX) fi # Check for the existence in of vscanf, et. al. diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index fdcc07cb2a2..76d32d1630f 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -21,7 +21,7 @@ #undef _GLIBCXX_USE_C99_MATH // Define if C99 complex math functions should be used in std::complex. -#undef _GLIBCXX_USE_C99_COMPLEX_MATH +#undef _GLIBCXX_USE_C99_COMPLEX // Define if code specialized for wchar_t should be used. #undef _GLIBCXX_USE_WCHAR_T diff --git a/libstdc++-v3/config/cpu/cris/atomicity.h b/libstdc++-v3/config/cpu/cris/atomicity.h index 3162f6ada3b..38ae0de330c 100644 --- a/libstdc++-v3/config/cpu/cris/atomicity.h +++ b/libstdc++-v3/config/cpu/cris/atomicity.h @@ -1,6 +1,6 @@ // Low-level functions for atomic operations: CRIS version -*- C++ -*- -// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 2001, 2003, 2004, 2005 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 @@ -47,8 +47,8 @@ namespace __gnu_cxx " move.d %2,[%3] \n" " bwf 0b \n" " clearf \n" - : "=&r" (__result), "=m" (*__mem), "=&r" (__tmp) - : "r" (__mem), "g" (__val), "m" (*__mem) + : "=&r" (__result), "=Q" (*__mem), "=&r" (__tmp) + : "r" (__mem), "g" (__val), "Q" (*__mem) /* The memory clobber must stay, regardless of current uses of this function. */ : "memory"); @@ -60,8 +60,8 @@ namespace __gnu_cxx " add.d %0,%2 \n" " move.d %2,[%3] \n" " move $r9,$ccr \n" - : "=&r" (__result), "=m" (*__mem), "=&r" (__tmp) - : "r" (__mem), "g" (__val), "m" (*__mem) + : "=&r" (__result), "=Q" (*__mem), "=&r" (__tmp) + : "r" (__mem), "g" (__val), "Q" (*__mem) : "r9", /* The memory clobber must stay, regardless of current uses of this function. */ diff --git a/libstdc++-v3/config/cpu/s390/atomicity.h b/libstdc++-v3/config/cpu/s390/atomicity.h index b979e3abd33..cf903b321f4 100644 --- a/libstdc++-v3/config/cpu/s390/atomicity.h +++ b/libstdc++-v3/config/cpu/s390/atomicity.h @@ -43,7 +43,8 @@ namespace __gnu_cxx " cs %0,%1,0(%3)\n" " jl 0b" : "=&d" (__old_val), "=&d" (__new_val), "=m" (*__mem) - : "a" (__mem), "d" (__val), "m" (*__mem) : "cc"); + : "a" (__mem), "d" (__val), "m" (*__mem) + : "cc", "memory"); return __old_val; } diff --git a/libstdc++-v3/config/linker-map.gnu b/libstdc++-v3/config/linker-map.gnu index df3c674f96f..d7d291485b6 100644 --- a/libstdc++-v3/config/linker-map.gnu +++ b/libstdc++-v3/config/linker-map.gnu @@ -410,3 +410,9 @@ CXXABI_1.3 { local: *; }; + +CXXABI_1.3.1 { + + __cxa_get_exception_ptr; + +} CXXABI_1.3; diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 648514f3727..7ddfc53208d 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -8642,7 +8642,7 @@ echo "${ECHO_T}$ac_c99_complex" >&6 if test x"$ac_c99_complex" = x"yes"; then cat >>confdefs.h <<\_ACEOF -#define _GLIBCXX_USE_C99_COMPLEX_MATH 1 +#define _GLIBCXX_USE_C99_COMPLEX 1 _ACEOF fi diff --git a/libstdc++-v3/docs/doxygen/user.cfg.in b/libstdc++-v3/docs/doxygen/user.cfg.in index 4e149d7b8be..dc4595b21ae 100644 --- a/libstdc++-v3/docs/doxygen/user.cfg.in +++ b/libstdc++-v3/docs/doxygen/user.cfg.in @@ -73,6 +73,7 @@ INPUT = @srcdir@/docs/doxygen/doxygroups.cc \ include/@host_alias@/bits \ include/bits \ include/ext \ + include/tr1 \ @srcdir@/libsupc++/exception \ @srcdir@/libsupc++/new \ @srcdir@/libsupc++/typeinfo \ @@ -113,7 +114,14 @@ INPUT = @srcdir@/docs/doxygen/doxygroups.cc \ include/ext/rope \ include/ext/slist \ include/tr1/array \ - include/tr1/tuple + include/tr1/functional \ + include/tr1/hashtable \ + include/tr1/memory \ + include/tr1/tuple \ + include/tr1/type_traits \ + include/tr1/unordered_map \ + include/tr1/unordered_set \ + include/tr1/utility FILE_PATTERNS = *.h \ *.tcc RECURSIVE = NO diff --git a/libstdc++-v3/docs/html/ext/howto.html b/libstdc++-v3/docs/html/ext/howto.html index fff775e165a..72317f83c5d 100644 --- a/libstdc++-v3/docs/html/ext/howto.html +++ b/libstdc++-v3/docs/html/ext/howto.html @@ -503,6 +503,12 @@
Replace "new" with "::new".
+
409: + Closing an fstream should clear the error state +
+
Have open clear the error flags. +
+
434: bitset::to_string() hard to use
diff --git a/libstdc++-v3/docs/html/faq/index.html b/libstdc++-v3/docs/html/faq/index.html index abd6ff3d13f..a0315981b1c 100644 --- a/libstdc++-v3/docs/html/faq/index.html +++ b/libstdc++-v3/docs/html/faq/index.html @@ -721,6 +721,9 @@ which is no longer available, thanks deja...--> DR #22 is to leave the flags unchanged. You must insert a call to fs.clear() between the calls to close() and open(), and then everything will work like we all expect it to work. + Update: for GCC 4.0 we implemented the resolution + of DR #409 and open() now calls + clear() on success!

rel_ops Another is the rel_ops namespace and the template diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 3fa1dd65e77..2b811888c40 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -228,11 +228,24 @@ tr1_srcdir = ${glibcxx_srcdir}/include/tr1 tr1_builddir = ./tr1 tr1_headers = \ ${tr1_srcdir}/array \ + ${tr1_srcdir}/bind_repeat.h \ + ${tr1_srcdir}/bind_iterate.h \ + ${tr1_srcdir}/boost_shared_ptr.h \ + ${tr1_srcdir}/mu_iterate.h \ ${tr1_srcdir}/functional \ + ${tr1_srcdir}/functional_iterate.h \ + ${tr1_srcdir}/memory \ + ${tr1_srcdir}/ref_fwd.h \ + ${tr1_srcdir}/ref_wrap_iterate.h \ + ${tr1_srcdir}/repeat.h \ ${tr1_srcdir}/tuple \ + ${tr1_srcdir}/tuple_iterate.h \ ${tr1_srcdir}/utility \ ${tr1_srcdir}/type_traits \ - ${tr1_srcdir}/type_traits_fwd.h + ${tr1_srcdir}/type_traits_fwd.h \ + ${tr1_srcdir}/hashtable \ + ${tr1_srcdir}/unordered_set \ + ${tr1_srcdir}/unordered_map # This is the common subset of files that all three "C" header models use. diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index d56d35aab7f..82d9065de90 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -444,11 +444,24 @@ tr1_srcdir = ${glibcxx_srcdir}/include/tr1 tr1_builddir = ./tr1 tr1_headers = \ ${tr1_srcdir}/array \ + ${tr1_srcdir}/bind_repeat.h \ + ${tr1_srcdir}/bind_iterate.h \ + ${tr1_srcdir}/boost_shared_ptr.h \ + ${tr1_srcdir}/mu_iterate.h \ ${tr1_srcdir}/functional \ + ${tr1_srcdir}/functional_iterate.h \ + ${tr1_srcdir}/memory \ + ${tr1_srcdir}/ref_fwd.h \ + ${tr1_srcdir}/ref_wrap_iterate.h \ + ${tr1_srcdir}/repeat.h \ ${tr1_srcdir}/tuple \ + ${tr1_srcdir}/tuple_iterate.h \ ${tr1_srcdir}/utility \ ${tr1_srcdir}/type_traits \ - ${tr1_srcdir}/type_traits_fwd.h + ${tr1_srcdir}/type_traits_fwd.h \ + ${tr1_srcdir}/hashtable \ + ${tr1_srcdir}/unordered_set \ + ${tr1_srcdir}/unordered_map # This is the common subset of files that all three "C" header models use. diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc index 3bdce0f090a..41db0dff438 100644 --- a/libstdc++-v3/include/bits/basic_string.tcc +++ b/libstdc++-v3/include/bits/basic_string.tcc @@ -1,6 +1,6 @@ // Components for manipulating sequences of characters -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -425,10 +425,6 @@ namespace std basic_string<_CharT, _Traits, _Alloc>::_Rep:: _M_destroy(const _Alloc& __a) throw () { -#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING - if (this == &_S_empty_rep()) - return; -#endif const size_type __size = sizeof(_Rep_base) + (this->_M_capacity + 1) * sizeof(_CharT); _Raw_bytes_alloc(__a).deallocate(reinterpret_cast(this), __size); diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 132c3b68eaa..3a7c7d318bb 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -35,7 +35,7 @@ #include // The current version of the C++ library in compressed ISO date format. -#define __GLIBCXX__ 20050216 +#define __GLIBCXX__ 20050407 // Allow use of "export template." This is currently not a feature // that g++ supports. diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index a67d2a9a320..426fcba0298 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -155,7 +155,14 @@ namespace std _ValueType2>) __glibcxx_function_requires(_ConvertibleConcept<_ValueType2, _ValueType1>) - std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value>:: + + typedef typename iterator_traits<_ForwardIterator1>::reference + _ReferenceType1; + typedef typename iterator_traits<_ForwardIterator2>::reference + _ReferenceType2; + std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value && + __are_same<_ValueType1 &, _ReferenceType1>::__value && + __are_same<_ValueType2 &, _ReferenceType2>::__value>:: iter_swap(__a, __b); } diff --git a/libstdc++-v3/include/std/std_complex.h b/libstdc++-v3/include/std/std_complex.h index 1a5c6a0a259..6c1e0033730 100644 --- a/libstdc++-v3/include/std/std_complex.h +++ b/libstdc++-v3/include/std/std_complex.h @@ -561,7 +561,7 @@ namespace std return __s * sqrt(__x * __x + __y * __y); } -#if _GLIBCXX_USE_C99_COMPLEX_MATH +#if _GLIBCXX_USE_C99_COMPLEX inline float __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); } @@ -588,7 +588,7 @@ namespace std __complex_arg(const complex<_Tp>& __z) { return atan2(__z.imag(), __z.real()); } -#if _GLIBCXX_USE_C99_COMPLEX_MATH +#if _GLIBCXX_USE_C99_COMPLEX inline float __complex_arg(__complex__ float __z) { return __builtin_cargf(__z); } @@ -666,7 +666,7 @@ namespace std return complex<_Tp>(cos(__x) * cosh(__y), -sin(__x) * sinh(__y)); } -#if _GLIBCXX_USE_C99_COMPLEX_MATH +#if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_cos(__complex__ float __z) { return __builtin_ccosf(__z); } @@ -696,7 +696,7 @@ namespace std return complex<_Tp>(cosh(__x) * cos(__y), sinh(__x) * sin(__y)); } -#if _GLIBCXX_USE_C99_COMPLEX_MATH +#if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_cosh(__complex__ float __z) { return __builtin_ccoshf(__z); } @@ -722,7 +722,7 @@ namespace std __complex_exp(const complex<_Tp>& __z) { return std::polar(exp(__z.real()), __z.imag()); } -#if _GLIBCXX_USE_C99_COMPLEX_MATH +#if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_exp(__complex__ float __z) { return __builtin_cexpf(__z); } @@ -782,7 +782,7 @@ namespace std return complex<_Tp>(sin(__x) * cosh(__y), cos(__x) * sinh(__y)); } -#if _GLIBCXX_USE_C99_COMPLEX_MATH +#if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_sin(__complex__ float __z) { return __builtin_csinf(__z); } @@ -812,7 +812,7 @@ namespace std return complex<_Tp>(sinh(__x) * cos(__y), cosh(__x) * sin(__y)); } -#if _GLIBCXX_USE_C99_COMPLEX_MATH +#if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_sinh(__complex__ float __z) { return __builtin_csinhf(__z); } @@ -856,7 +856,7 @@ namespace std } } -#if _GLIBCXX_USE_C99_COMPLEX_MATH +#if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_sqrt(__complex__ float __z) { return __builtin_csqrtf(__z); } @@ -883,7 +883,7 @@ namespace std __complex_tan(const complex<_Tp>& __z) { return std::sin(__z) / std::cos(__z); } -#if _GLIBCXX_USE_C99_COMPLEX_MATH +#if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_tan(__complex__ float __z) { return __builtin_ctanf(__z); } @@ -911,7 +911,7 @@ namespace std __complex_tanh(const complex<_Tp>& __z) { return std::sinh(__z) / std::cosh(__z); } -#if _GLIBCXX_USE_C99_COMPLEX_MATH +#if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_tanh(__complex__ float __z) { return __builtin_ctanhf(__z); } @@ -944,6 +944,10 @@ namespace std complex<_Tp> pow(const complex<_Tp>& __x, const _Tp& __y) { +#ifndef _GLIBCXX_USE_C99_COMPLEX + if (__x == _Tp()) + return _Tp(); +#endif if (__x.imag() == _Tp() && __x.real() > _Tp()) return pow(__x.real(), __y); @@ -956,7 +960,7 @@ namespace std __complex_pow(const complex<_Tp>& __x, const complex<_Tp>& __y) { return __x == _Tp() ? _Tp() : std::exp(__y * std::log(__x)); } -#if _GLIBCXX_USE_C99_COMPLEX_MATH +#if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_pow(__complex__ float __x, __complex__ float __y) { return __builtin_cpowf(__x, __y); } @@ -966,14 +970,20 @@ namespace std { return __builtin_cpow(__x, __y); } inline __complex__ long double - __complex_pow(__complex__ long double& __x, __complex__ long double& __y) + __complex_pow(const __complex__ long double& __x, + const __complex__ long double& __y) { return __builtin_cpowl(__x, __y); } -#endif + template + inline complex<_Tp> + pow(const complex<_Tp>& __x, const complex<_Tp>& __y) + { return __complex_pow(__x.__rep(), __y.__rep()); } +#else template inline complex<_Tp> pow(const complex<_Tp>& __x, const complex<_Tp>& __y) { return __complex_pow(__x, __y); } +#endif template inline complex<_Tp> diff --git a/libstdc++-v3/include/std/std_fstream.h b/libstdc++-v3/include/std/std_fstream.h index 6993042eb60..c7a934be9f0 100644 --- a/libstdc++-v3/include/std/std_fstream.h +++ b/libstdc++-v3/include/std/std_fstream.h @@ -497,6 +497,10 @@ namespace std { if (!_M_filebuf.open(__s, __mode | ios_base::in)) this->setstate(ios_base::failbit); + else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 409. Closing an fstream should clear error state + this->clear(); } /** @@ -625,6 +629,10 @@ namespace std { if (!_M_filebuf.open(__s, __mode | ios_base::out)) this->setstate(ios_base::failbit); + else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 409. Closing an fstream should clear error state + this->clear(); } /** @@ -751,6 +759,10 @@ namespace std { if (!_M_filebuf.open(__s, __mode)) this->setstate(ios_base::failbit); + else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 409. Closing an fstream should clear error state + this->clear(); } /** diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional index 1e897e2b3c7..abe92e3bf23 100644 --- a/libstdc++-v3/include/tr1/functional +++ b/libstdc++-v3/include/tr1/functional @@ -1,6 +1,6 @@ // TR1 functional header -*- C++ -*- -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005 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 @@ -18,53 +18,363 @@ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. -/** @file - * This is a TR1 C++ Library header. +// 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. + +/** @file + * This is a TR1 C++ Library header. */ #ifndef _TR1_FUNCTIONAL #define _TR1_FUNCTIONAL 1 #include "../functional" +#include +#include +#include +#include // for std::tr1::hash +#include // for std::abort +#include namespace std { namespace tr1 { + template + class _Mem_fn; + + /** + * @if maint + * Actual implementation of _Has_result_type, which uses SFINAE to + * determine if the type _Tp has a publicly-accessible member type + * result_type. + * @endif + */ + template + class _Has_result_type_helper : __sfinae_types + { + template + struct _Wrap_type + { }; + + template + static __one __test(_Wrap_type*); + + template + static __two __test(...); + + public: + static const bool value = sizeof(__test<_Tp>(0)) == 1; + }; + + template + struct _Has_result_type + : integral_constant< + bool, + _Has_result_type_helper::type>::value> + { }; + + /** + * @if maint + * If we have found a result_type, extract it. + * @endif + */ + template + struct _Maybe_get_result_type + { }; + + template + struct _Maybe_get_result_type + { + typedef typename _Functor::result_type result_type; + }; + + /** + * @if maint + * Base class for any function object that has a weak result type, as + * defined in 3.3/3 of TR1. + * @endif + */ + template + struct _Weak_result_type_impl + : _Maybe_get_result_type<_Has_result_type<_Functor>::value, _Functor> + { + }; + + /** + * @if maint + * Strip top-level cv-qualifiers from the function object and let + * _Weak_result_type_impl perform the real work. + * @endif + */ + template + struct _Weak_result_type + : _Weak_result_type_impl::type> + { + }; + + template + class result_of; + + /** + * @if maint + * Actual implementation of result_of. When _Has_result_type is + * true, gets its result from _Weak_result_type. Otherwise, uses + * the function object's member template result to extract the + * result type. + * @endif + */ + template + struct _Result_of_impl; + + // Handle member data pointers using _Mem_fn's logic + template + struct _Result_of_impl + { + typedef typename _Mem_fn<_Res _Class::*> + ::template _Result_type<_T1>::type type; + }; + + /** + * @if maint + * Determines if the type _Tp derives from unary_function. + * @endif + */ + template + struct _Derives_from_unary_function : __sfinae_types + { + private: + template + static __one __test(const volatile unary_function<_T1, _Res>*); + + // It's tempting to change "..." to const volatile void*, but + // that fails when _Tp is a function type. + static __two __test(...); + + public: + static const bool value = sizeof(__test((_Tp*)0)) == 1; + }; + + /** + * @if maint + * Determines if the type _Tp derives from binary_function. + * @endif + */ + template + struct _Derives_from_binary_function : __sfinae_types + { + private: + template + static __one __test(const volatile binary_function<_T1, _T2, _Res>*); + + // It's tempting to change "..." to const volatile void*, but + // that fails when _Tp is a function type. + static __two __test(...); + + public: + static const bool value = sizeof(__test((_Tp*)0)) == 1; + }; + + /** + * @if maint + * Turns a function type into a function pointer type + * @endif + */ + template::value> + struct _Function_to_function_pointer + { + typedef _Tp type; + }; + + template + struct _Function_to_function_pointer<_Tp, true> + { + typedef _Tp* type; + }; + + /** + * @if maint + * Knowing which of unary_function and binary_function _Tp derives + * from, derives from the same and ensures that reference_wrapper + * will have a weak result type. See cases below. + * @endif + */ + template + struct _Reference_wrapper_base_impl; + + // Not a unary_function or binary_function, so try a weak result type + template + struct _Reference_wrapper_base_impl + : _Weak_result_type<_Tp> + { }; + + // unary_function but not binary_function + template + struct _Reference_wrapper_base_impl + : unary_function + { }; + + // binary_function but not unary_function + template + struct _Reference_wrapper_base_impl + : binary_function + { }; + + // both unary_function and binary_function. import result_type to + // avoid conflicts. + template + struct _Reference_wrapper_base_impl + : unary_function, + binary_function + { + typedef typename _Tp::result_type result_type; + }; + + /** + * @if maint + * Derives from unary_function or binary_function when it + * can. Specializations handle all of the easy cases. The primary + * template determines what to do with a class type, which may + * derive from both unary_function and binary_function. + * @endif + */ + template + struct _Reference_wrapper_base + : _Reference_wrapper_base_impl< + _Derives_from_unary_function<_Tp>::value, + _Derives_from_binary_function<_Tp>::value, + _Tp> + { }; + + // - a function type (unary) + template + struct _Reference_wrapper_base<_Res(_T1)> + : unary_function<_T1, _Res> + { }; + + // - a function type (binary) + template + struct _Reference_wrapper_base<_Res(_T1, _T2)> + : binary_function<_T1, _T2, _Res> + { }; + + // - a function pointer type (unary) + template + struct _Reference_wrapper_base<_Res(*)(_T1)> + : unary_function<_T1, _Res> + { }; + + // - a function pointer type (binary) + template + struct _Reference_wrapper_base<_Res(*)(_T1, _T2)> + : binary_function<_T1, _T2, _Res> + { }; + + // - a pointer to member function type (unary, no qualifiers) + template + struct _Reference_wrapper_base<_Res (_T1::*)()> + : unary_function<_T1*, _Res> + { }; + + // - a pointer to member function type (binary, no qualifiers) + template + struct _Reference_wrapper_base<_Res (_T1::*)(_T2)> + : binary_function<_T1*, _T2, _Res> + { }; + + // - a pointer to member function type (unary, const) + template + struct _Reference_wrapper_base<_Res (_T1::*)() const> + : unary_function + { }; + + // - a pointer to member function type (binary, const) + template + struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const> + : binary_function + { }; + + // - a pointer to member function type (unary, volatile) + template + struct _Reference_wrapper_base<_Res (_T1::*)() volatile> + : unary_function + { }; + + // - a pointer to member function type (binary, volatile) + template + struct _Reference_wrapper_base<_Res (_T1::*)(_T2) volatile> + : binary_function + { }; + + // - a pointer to member function type (unary, const volatile) + template + struct _Reference_wrapper_base<_Res (_T1::*)() const volatile> + : unary_function + { }; + + // - a pointer to member function type (binary, const volatile) + template + struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const volatile> + : binary_function + { }; + template class reference_wrapper + : public _Reference_wrapper_base::type> { + // If _Tp is a function type, we can't form result_of<_Tp(...)>, + // so turn it into a function pointer type. + typedef typename _Function_to_function_pointer<_Tp>::type + _M_func_type; + _Tp* _M_data; public: typedef _Tp type; explicit reference_wrapper(_Tp& __indata): _M_data(&__indata) { } - + reference_wrapper(const reference_wrapper<_Tp>& __inref): _M_data(__inref._M_data) { } - reference_wrapper& + reference_wrapper& operator=(const reference_wrapper<_Tp>& __inref) { - _M_data = __inref._M_data; - return *this; + _M_data = __inref._M_data; + return *this; } - + operator _Tp&() const { return this->get(); } - + _Tp& get() const { return *_M_data; } + +#define _GLIBCXX_REPEAT_HEADER +#include +#undef _GLIBCXX_REPEAT_HEADER }; - + + // Denotes a reference should be taken to a variable. template reference_wrapper<_Tp> ref(_Tp& __t) { return reference_wrapper<_Tp>(__t); } - + // Denotes a const reference should be taken to a variable. template reference_wrapper @@ -78,8 +388,777 @@ namespace tr1 template reference_wrapper cref(reference_wrapper<_Tp> __t) { return cref(__t.get()); } + + template + struct _Mem_fn_const_or_non + { + typedef const _Tp& type; + }; + + template + struct _Mem_fn_const_or_non<_Tp, false> + { + typedef _Tp& type; + }; + + template + class _Mem_fn<_Res _Class::*> + { + // This bit of genius is due to Peter Dimov, improved slightly by + // Douglas Gregor. + template + _Res& + _M_call(_Tp& __object, _Class *) const + { return __object.*__pm; } + + template + _Res& + _M_call(_Tp& __object, _Up * const *) const + { return (*__object).*__pm; } + + template + const _Res& + _M_call(_Tp& __object, const _Up * const *) const + { return (*__object).*__pm; } + + template + const _Res& + _M_call(_Tp& __object, const _Class *) const + { return __object.*__pm; } + + template + const _Res& + _M_call(_Tp& __ptr, const volatile void*) const + { return (*__ptr).*__pm; } + + template static _Tp& __get_ref(); + + template + static __sfinae_types::__one __check_const(_Tp&, _Class*); + template + static __sfinae_types::__one __check_const(_Tp&, _Up * const *); + template + static __sfinae_types::__two __check_const(_Tp&, const _Up * const *); + template + static __sfinae_types::__two __check_const(_Tp&, const _Class*); + template + static __sfinae_types::__two __check_const(_Tp&, const volatile void*); + + public: + template + struct _Result_type + : _Mem_fn_const_or_non< + _Res, + (sizeof(__sfinae_types::__two) + == sizeof(__check_const<_Tp>(__get_ref<_Tp>(), (_Tp*)0)))> + { }; + + template + struct result; + + template + struct result<_CVMem(_Tp)> + : public _Result_type<_Tp> { }; + + template + struct result<_CVMem(_Tp&)> + : public _Result_type<_Tp> { }; + + explicit _Mem_fn(_Res _Class::*__pm) : __pm(__pm) { } + + // Handle objects + _Res& operator()(_Class& __object) const + { return __object.*__pm; } + + const _Res& operator()(const _Class& __object) const + { return __object.*__pm; } + + // Handle pointers + _Res& operator()(_Class* __object) const + { return __object->*__pm; } + + const _Res& + operator()(const _Class* __object) const + { return __object->*__pm; } + + // Handle smart pointers and derived + template + typename _Result_type<_Tp>::type + operator()(_Tp& __unknown) const + { return _M_call(__unknown, &__unknown); } + + private: + _Res _Class::*__pm; + }; + + /** + * @brief Returns a function object that forwards to the member + * pointer @a pm. + */ + template + inline _Mem_fn<_Tp _Class::*> + mem_fn(_Tp _Class::* __pm) + { + return _Mem_fn<_Tp _Class::*>(__pm); + } + + /** + * @brief Determines if the given type _Tp is a function object + * should be treated as a subexpression when evaluating calls to + * function objects returned by bind(). [TR1 3.6.1] + */ + template + struct is_bind_expression + { + static const bool value = false; + }; + + /** + * @brief Determines if the given type _Tp is a placeholder in a + * bind() expression and, if so, which placeholder it is. [TR1 3.6.2] + */ + template + struct is_placeholder + { + static const int value = 0; + }; + + /** + * @if maint + * The type of placeholder objects defined by libstdc++. + * @endif + */ + template struct _Placeholder { }; + + /** + * @if maint + * Partial specialization of is_placeholder that provides the placeholder + * number for the placeholder objects defined by libstdc++. + * @endif + */ + template + struct is_placeholder<_Placeholder<_Num> > + { + static const int value = _Num; + }; + + /** + * @if maint + * Maps an argument to bind() into an actual argument to the bound + * function object [TR1 3.6.3/5]. Only the first parameter should + * be specified: the rest are used to determine among the various + * implementations. Note that, although this class is a function + * object, isn't not entirely normal because it takes only two + * parameters regardless of the number of parameters passed to the + * bind expression. The first parameter is the bound argument and + * the second parameter is a tuple containing references to the + * rest of the arguments. + * @endif + */ + template::value, + bool _IsPlaceholder = (is_placeholder<_Arg>::value > 0)> + class _Mu; + + /** + * @if maint + * If the argument is reference_wrapper<_Tp>, returns the + * underlying reference. [TR1 3.6.3/5 bullet 1] + * @endif + */ + template + class _Mu, false, false> + { + public: + typedef _Tp& result_type; + + /* Note: This won't actually work for const volatile + * reference_wrappers, because reference_wrapper::get() is const + * but not volatile-qualified. This might be a defect in the TR. + */ + template + result_type + operator()(_CVRef& __arg, const _Tuple&) const volatile + { return __arg.get(); } + }; + + /** + * @if maint + * If the argument is a bind expression, we invoke the underlying + * function object with the same cv-qualifiers as we are given and + * pass along all of our arguments (unwrapped). [TR1 3.6.3/5 bullet 2] + * @endif + */ + template + class _Mu<_Arg, true, false> + { + public: + template class result; + +#define _GLIBCXX_REPEAT_HEADER +# include +#undef _GLIBCXX_REPEAT_HEADER + }; + + /** + * @if maint + * If the argument is a placeholder for the Nth argument, returns + * a reference to the Nth argument to the bind function object. + * [TR1 3.6.3/5 bullet 3] + * @endif + */ + template + class _Mu<_Arg, false, true> + { + public: + template class result; + + template + class result<_CVMu(_CVArg, _Tuple)> + { + // Add a reference, if it hasn't already been done for us. + // This allows us to be a little bit sloppy in constructing + // the tuple that we pass to result_of<...>. + typedef typename tuple_element<(is_placeholder<_Arg>::value - 1), + _Tuple>::type __base_type; + + public: + typedef typename add_reference<__base_type>::type type; + }; + + template + typename result<_Mu(_Arg, _Tuple)>::type + operator()(const volatile _Arg&, const _Tuple& __tuple) const volatile + { + return ::std::tr1::get<(is_placeholder<_Arg>::value - 1)>(__tuple); + } + }; + + /** + * @if maint + * If the argument is just a value, returns a reference to that + * value. The cv-qualifiers on the reference are the same as the + * cv-qualifiers on the _Mu object. [TR1 3.6.3/5 bullet 4] + * @endif + */ + template + class _Mu<_Arg, false, false> + { + public: + template struct result; + + template + struct result<_CVMu(_CVArg, _Tuple)> + { + typedef typename add_reference<_CVArg>::type type; + }; + + // Pick up the cv-qualifiers of the argument + template + _CVArg& operator()(_CVArg& __arg, const _Tuple&) const volatile + { return __arg; } + }; + + /** + * @if maint + * Maps member pointers into instances of _Mem_fn but leaves all + * other function objects untouched. Used by tr1::bind(). The + * primary template handles the non--member-pointer case. + * @endif + */ + template + struct _Maybe_wrap_member_pointer + { + typedef _Tp type; + static const _Tp& __do_wrap(const _Tp& __x) { return __x; } + }; + + /** + * @if maint + * Maps member pointers into instances of _Mem_fn but leaves all + * other function objects untouched. Used by tr1::bind(). This + * partial specialization handles the member pointer case. + * @endif + */ + template + struct _Maybe_wrap_member_pointer<_Tp _Class::*> + { + typedef _Mem_fn<_Tp _Class::*> type; + static type __do_wrap(_Tp _Class::* __pm) { return type(__pm); } + }; + + /** + * @if maint + * Type of the function object returned from bind(). + * @endif + */ + template + struct _Bind; + + /** + * @if maint + * Type of the function object returned from bind(). + * @endif + */ + template + struct _Bind_result; + + /** + * @if maint + * Class template _Bind is always a bind expression. + * @endif + */ + template + struct is_bind_expression<_Bind<_Signature> > + { + static const bool value = true; + }; + + /** + * @if maint + * Class template _Bind_result is always a bind expression. + * @endif + */ + template + struct is_bind_expression<_Bind_result<_Result, _Signature> > + { + static const bool value = true; + }; + + /** + * @brief Exception class thrown when class template function's + * operator() is called with an empty target. + * + */ + class bad_function_call : public std::exception { }; + + /** + * @if maint + * The integral constant expression 0 can be converted into a + * pointer to this type. It is used by the function template to + * accept NULL pointers. + * @endif + */ + struct _M_clear_type; + + /** + * @if maint + * Trait identifying "location-invariant" types, meaning that the + * address of the object (or any of its members) will not escape. + * Also implies a trivial copy constructor and assignment operator. + * @endif + */ + template + struct __is_location_invariant + : integral_constant::value + || is_member_pointer<_Tp>::value)> + { + }; + + class _Undefined_class; + + union _Nocopy_types + { + void* _M_object; + const void* _M_const_object; + void (*_M_function_pointer)(); + void (_Undefined_class::*_M_member_pointer)(); + }; + + union _Any_data { + void* _M_access() { return &_M_pod_data[0]; } + const void* _M_access() const { return &_M_pod_data[0]; } + + template _Tp& _M_access() + { return *static_cast<_Tp*>(_M_access()); } + + template const _Tp& _M_access() const + { return *static_cast(_M_access()); } + + _Nocopy_types _M_unused; + char _M_pod_data[sizeof(_Nocopy_types)]; + }; + + enum _Manager_operation + { + __get_type_info, + __get_functor_ptr, + __clone_functor, + __destroy_functor + }; + + /* Simple type wrapper that helps avoid annoying const problems + when casting between void pointers and pointers-to-pointers. */ + template + struct _Simple_type_wrapper + { + _Simple_type_wrapper(_Tp __value) : __value(__value) { } + + _Tp __value; + }; + + template + struct __is_location_invariant<_Simple_type_wrapper<_Tp> > + : __is_location_invariant<_Tp> + { + }; + + // Converts a reference to a function object into a callable + // function object. + template + inline _Functor& __callable_functor(_Functor& __f) { return __f; } + + template + inline _Mem_fn<_Member _Class::*> + __callable_functor(_Member _Class::* &__p) + { return mem_fn(__p); } + + template + inline _Mem_fn<_Member _Class::*> + __callable_functor(_Member _Class::* const &__p) + { return mem_fn(__p); } + + template + class _Function_handler; + + template + class function; + + + /** + * @if maint + * Base class of all polymorphic function object wrappers. + * @endif + */ + class _Function_base + { + public: + static const std::size_t _M_max_size = sizeof(_Nocopy_types); + static const std::size_t _M_max_align = __alignof__(_Nocopy_types); + + template + class _Base_manager + { + protected: + static const bool __stored_locally = + (__is_location_invariant<_Functor>::value + && sizeof(_Functor) <= _M_max_size + && __alignof__(_Functor) <= _M_max_align + && (_M_max_align % __alignof__(_Functor) == 0)); + typedef integral_constant _Local_storage; + + // Retrieve a pointer to the function object + static _Functor* _M_get_pointer(const _Any_data& __source) + { + const _Functor* __ptr = + __stored_locally? &__source._M_access<_Functor>() + /* have stored a pointer */ : __source._M_access<_Functor*>(); + return const_cast<_Functor*>(__ptr); + } + + // Clone a location-invariant function object that fits within + // an _Any_data structure. + static void + _M_clone(_Any_data& __dest, const _Any_data& __source, true_type) + { + new (__dest._M_access()) _Functor(__source._M_access<_Functor>()); + } + + // Clone a function object that is not location-invariant or + // that cannot fit into an _Any_data structure. + static void + _M_clone(_Any_data& __dest, const _Any_data& __source, false_type) + { + __dest._M_access<_Functor*>() = + new _Functor(*__source._M_access<_Functor*>()); + } + + // Destroying a location-invariant object may still require + // destruction. + static void + _M_destroy(_Any_data& __victim, true_type) + { + __victim._M_access<_Functor>().~_Functor(); + } + + // Destroying an object located on the heap. + static void + _M_destroy(_Any_data& __victim, false_type) + { + delete __victim._M_access<_Functor*>(); + } + + public: + static bool + _M_manager(_Any_data& __dest, const _Any_data& __source, + _Manager_operation __op) + { + switch (__op) { + case __get_type_info: + __dest._M_access() = &typeid(_Functor); + break; + + case __get_functor_ptr: + __dest._M_access<_Functor*>() = _M_get_pointer(__source); + break; + + case __clone_functor: + _M_clone(__dest, __source, _Local_storage()); + break; + + case __destroy_functor: + _M_destroy(__dest, _Local_storage()); + break; + } + return false; + } + + static void + _M_init_functor(_Any_data& __functor, const _Functor& __f) + { + _M_init_functor(__functor, __f, _Local_storage()); + } + + template + static bool + _M_not_empty_function(const function<_Signature>& __f) + { + return __f; + } + + template + static bool + _M_not_empty_function(const _Tp*& __fp) + { + return __fp; + } + + template + static bool + _M_not_empty_function(_Tp _Class::* const& __mp) + { + return __mp; + } + + template + static bool + _M_not_empty_function(const _Tp&) + { + return true; + } + + private: + static void + _M_init_functor(_Any_data& __functor, const _Functor& __f, true_type) + { + new (__functor._M_access()) _Functor(__f); + } + + static void + _M_init_functor(_Any_data& __functor, const _Functor& __f, false_type) + { + __functor._M_access<_Functor*>() = new _Functor(__f); + } + }; + + template + class _Ref_manager : public _Base_manager<_Functor*> + { + typedef _Function_base::_Base_manager<_Functor*> _Base; + + public: + static bool + _M_manager(_Any_data& __dest, const _Any_data& __source, + _Manager_operation __op) + { + switch (__op) { + case __get_type_info: + __dest._M_access() = &typeid(_Functor); + break; + + case __get_functor_ptr: + __dest._M_access<_Functor*>() = *_Base::_M_get_pointer(__source); + return is_const<_Functor>::value; + break; + + default: + _Base::_M_manager(__dest, __source, __op); + } + return false; + } + + static void + _M_init_functor(_Any_data& __functor, reference_wrapper<_Functor> __f) + { + // TBD: Use address_of function instead + _Base::_M_init_functor(__functor, &__f.get()); + } + }; + + _Function_base() : _M_manager(0) { } + + ~_Function_base() + { + if (_M_manager) + { + _M_manager(_M_functor, _M_functor, __destroy_functor); + } + } + + + bool _M_empty() const { return !_M_manager; } + + typedef bool (*_Manager_type)(_Any_data&, const _Any_data&, + _Manager_operation); + + _Any_data _M_functor; + _Manager_type _M_manager; + }; + + // [3.7.2.7] null pointer comparisons + + /** + * @brief Compares a polymorphic function object wrapper against 0 + * (the NULL pointer). + * @returns @c true if the wrapper has no target, @c false otherwise + * + * This function will not throw an exception. + */ + template + inline bool + operator==(const function<_Signature>& __f, _M_clear_type*) + { + return !__f; + } + + /** + * @overload + */ + template + inline bool + operator==(_M_clear_type*, const function<_Signature>& __f) + { + return !__f; + } + + /** + * @brief Compares a polymorphic function object wrapper against 0 + * (the NULL pointer). + * @returns @c false if the wrapper has no target, @c true otherwise + * + * This function will not throw an exception. + */ + template + inline bool + operator!=(const function<_Signature>& __f, _M_clear_type*) + { + return __f; + } + + /** + * @overload + */ + template + inline bool + operator!=(_M_clear_type*, const function<_Signature>& __f) + { + return __f; + } + + // [3.7.2.8] specialized algorithms + + /** + * @brief Swap the targets of two polymorphic function object wrappers. + * + * This function will not throw an exception. + */ + template + inline void + swap(function<_Signature>& __x, function<_Signature>& __y) + { + __x.swap(__y); + } + +#define _GLIBCXX_JOIN(X,Y) _GLIBCXX_JOIN2( X , Y ) +#define _GLIBCXX_JOIN2(X,Y) _GLIBCXX_JOIN3(X,Y) +#define _GLIBCXX_JOIN3(X,Y) X##Y +#define _GLIBCXX_REPEAT_HEADER +#include +#undef _GLIBCXX_REPEAT_HEADER +#undef _GLIBCXX_JOIN3 +#undef _GLIBCXX_JOIN2 +#undef _GLIBCXX_JOIN + +// Definition of default hash function std::tr1::hash<>. The types for +// which std::tr1::hash is defined is in clause 6.3.3. of the PDTR. + + template struct hash; + + #define tr1_hashtable_define_trivial_hash(T) \ + template <> struct hash { \ + std::size_t operator()(T val) const { return static_cast(val); } \ + } \ + + tr1_hashtable_define_trivial_hash(bool); + tr1_hashtable_define_trivial_hash(char); + tr1_hashtable_define_trivial_hash(signed char); + tr1_hashtable_define_trivial_hash(unsigned char); + tr1_hashtable_define_trivial_hash(wchar_t); + tr1_hashtable_define_trivial_hash(short); + tr1_hashtable_define_trivial_hash(int); + tr1_hashtable_define_trivial_hash(long); + tr1_hashtable_define_trivial_hash(unsigned short); + tr1_hashtable_define_trivial_hash(unsigned int); + tr1_hashtable_define_trivial_hash(unsigned long); + + tr1_hashtable_define_trivial_hash(float); + tr1_hashtable_define_trivial_hash(double); + tr1_hashtable_define_trivial_hash(long double); + + #undef tr1_hashtable_define_trivial_hash + + template + struct hash { + std::size_t operator()(T* p) const { + return reinterpret_cast(p); + } + }; + + // ??? We can probably find a better hash function than this (i.e. one + // that vectorizes better and that produces a more uniform distribution). + + // XXX String hash probably shouldn't be an inline member function, + // since it's nontrivial. Once we have the framework for TR1 .cc + // files, this should go in one. + + template <> + struct hash + { + std::size_t operator()(const std::string& s) const + { + std::size_t result = 0; + for (std::string::const_iterator i = s.begin(); i != s.end(); ++i) + result = (result * 131) + *i; + return result; + } + }; + +#ifdef _GLIBCXX_USE_WCHAR_T + template <> + struct hash + { + std::size_t operator()(const std::wstring& s) const + { + std::size_t result = 0; + for (std::wstring::const_iterator i = s.begin(); i != s.end(); ++i) + result = (result * 131) + *i; + return result; + } + }; +#endif + } } #endif - diff --git a/libstdc++-v3/include/tr1/tuple b/libstdc++-v3/include/tr1/tuple index 928c75f88cf..89bccc3d495 100644 --- a/libstdc++-v3/include/tr1/tuple +++ b/libstdc++-v3/include/tr1/tuple @@ -1,6 +1,6 @@ // class template tuple -*- C++ -*- -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005 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 @@ -18,1432 +18,258 @@ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. -/** @file - * This is a TR1 C++ Library header. - */ +// 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. -// Chris Jefferson +/** @file +* This is a TR1 C++ Library header. +*/ -// This header is automatically generated: see maketuple.c for details. +// Chris Jefferson #ifndef _TUPLE #define _TUPLE 1 #include -#include +#include namespace std { namespace tr1 { - // An implementation specific class which is used in the tuple class - // when the tuple is not maximum possible size. - struct _NullClass { }; - - template - class tuple; - - /// Gives the type of the ith element of a given tuple type. - template - struct tuple_element; - - template - struct tuple_element<0, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> > - { typedef _Tp0 type; }; - - template - struct tuple_element<1, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> > - { typedef _Tp1 type; }; - - template - struct tuple_element<2, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> > - { typedef _Tp2 type; }; - - template - struct tuple_element<3, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> > - { typedef _Tp3 type; }; - - template - struct tuple_element<4, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> > - { typedef _Tp4 type; }; - - template - struct tuple_element<5, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> > - { typedef _Tp5 type; }; - - template - struct tuple_element<6, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> > - { typedef _Tp6 type; }; - - template - struct tuple_element<7, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> > - { typedef _Tp7 type; }; - - template - struct tuple_element<8, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> > - { typedef _Tp8 type; }; - - /// @brief class tuple_element - template - struct tuple_element<9, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> > - { typedef _Tp9 type; }; - - /// Finds the size of a given tuple type. - template - struct tuple_size; - - template<> - struct tuple_size > - { static const int value = 0; }; - - template< typename _Tp0> - struct tuple_size > - { static const int value = 1; }; - - template - struct tuple_size > - { static const int value = 2; }; - - template - struct tuple_size > - { static const int value = 3; }; - - template - struct tuple_size > - { static const int value = 4; }; - - template - struct tuple_size > - { static const int value = 5; }; - - template - struct tuple_size > - { static const int value = 6; }; - - template - struct tuple_size > - { static const int value = 7; }; - - template - struct tuple_size > - { static const int value = 8; }; - - template - struct tuple_size > - { static const int value = 9; }; - - /// @brief class tuple_size - template - struct tuple_size > - { static const int value = 10; }; - - // Adds a const reference to a non-reference type. - template - struct __add_c_ref - { typedef const _Tp& type; }; - - template - struct __add_c_ref<_Tp&> - { typedef _Tp& type; }; - - // Adds a reference to a non-reference type. - template - struct __add_ref - { typedef _Tp& type; }; - - template - struct __add_ref<_Tp&> - { typedef _Tp& type; }; - - // The empty tuple. - template<> - class tuple<_NullClass, _NullClass, _NullClass, _NullClass, _NullClass, - _NullClass, _NullClass, _NullClass, _NullClass, _NullClass> - { - public: - tuple() - { } - - tuple(const tuple& __in) - { } - - tuple& operator=(const tuple& __in) - { return *this; } - }; - - template< typename _Tp0> - class tuple< _Tp0, _NullClass, _NullClass, _NullClass, _NullClass, - _NullClass, _NullClass, _NullClass, _NullClass, _NullClass> - { - _Tp0 _M_t0; - - public: - tuple() - { } - - explicit tuple( typename __add_c_ref<_Tp0>::type __in0): - _M_t0(__in0) - { } - - tuple(const tuple& __in): - _M_t0(__in._M_t0) - { } - - template< typename _Up0> - tuple(const tuple< _Up0>& __in): - _M_t0(__in._M_t0) - { } - - tuple& - operator=(const tuple& __in) - { - _M_t0=__in._M_t0; - return *this; - } - - template< typename _Up0> - tuple& - operator=(const tuple< _Up0>& __in) - { - _M_t0=__in._M_t0; - return *this; - } - - template - friend class __get_helper; - template - friend class tuple; - }; - - template - class tuple<_Tp0, _Tp1, _NullClass, _NullClass, _NullClass, _NullClass, - _NullClass, _NullClass, _NullClass, _NullClass> - { - _Tp0 _M_t0; - _Tp1 _M_t1; - - public: - tuple() - { } - - explicit tuple(typename __add_c_ref<_Tp0>::type __in0, - typename __add_c_ref<_Tp1>::type __in1): - _M_t0(__in0), _M_t1(__in1) - { } - - tuple(const tuple& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1) - { } - - template - tuple(const tuple<_Up0, _Up1>& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1) - { } - - template - tuple(const std::pair<_Up1, _Up2>& __u): - _M_t0(__u.first), _M_t1(__u.second) - { } - - tuple& - operator=(const tuple& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - return *this; - } - - template - tuple& - operator=(const tuple<_Up0, _Up1>& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - return *this; - } - - template - friend class __get_helper; - template - friend class tuple; - }; - - template - class tuple<_Tp0, _Tp1, _Tp2, _NullClass, _NullClass, _NullClass, - _NullClass, _NullClass, _NullClass, _NullClass> - { - _Tp0 _M_t0; - _Tp1 _M_t1; - _Tp2 _M_t2; - - public: - tuple() - { } - - explicit tuple(typename __add_c_ref<_Tp0>::type __in0, - typename __add_c_ref<_Tp1>::type __in1, - typename __add_c_ref<_Tp2>::type __in2): - _M_t0(__in0), _M_t1(__in1), _M_t2(__in2) - { } - - tuple(const tuple& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2) - { } - - template - tuple(const tuple<_Up0, _Up1, _Up2>& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2) - { } - - tuple& - operator=(const tuple& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - return *this; - } - - template - tuple& - operator=(const tuple<_Up0, _Up1, _Up2>& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - return *this; - } - - template - friend class __get_helper; - template - friend class tuple; - }; - - template - class tuple<_Tp0, _Tp1, _Tp2, _Tp3, _NullClass, _NullClass, _NullClass, - _NullClass, _NullClass, _NullClass> - { - _Tp0 _M_t0; - _Tp1 _M_t1; - _Tp2 _M_t2; - _Tp3 _M_t3; - - public: - tuple() - { } - - explicit tuple(typename __add_c_ref<_Tp0>::type __in0, - typename __add_c_ref<_Tp1>::type __in1, - typename __add_c_ref<_Tp2>::type __in2, - typename __add_c_ref<_Tp3>::type __in3): - _M_t0(__in0), _M_t1(__in1), _M_t2(__in2), _M_t3(__in3) - { } - - tuple(const tuple& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3) - { } - - template - tuple(const tuple<_Up0, _Up1, _Up2, _Up3>& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3) - { } - - tuple& - operator=(const tuple& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - return *this; - } - - template - tuple& - operator=(const tuple<_Up0, _Up1, _Up2, _Up3>& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - return *this; - } - - template - friend class __get_helper; - template - friend class tuple; - }; - - template - class tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _NullClass, _NullClass, - _NullClass, _NullClass, _NullClass> - { - _Tp0 _M_t0; - _Tp1 _M_t1; - _Tp2 _M_t2; - _Tp3 _M_t3; - _Tp4 _M_t4; - - public: - tuple() - { } - - explicit tuple(typename __add_c_ref<_Tp0>::type __in0, - typename __add_c_ref<_Tp1>::type __in1, - typename __add_c_ref<_Tp2>::type __in2, - typename __add_c_ref<_Tp3>::type __in3, - typename __add_c_ref<_Tp4>::type __in4): - _M_t0(__in0), _M_t1(__in1), _M_t2(__in2), _M_t3(__in3), _M_t4(__in4) - { } - - tuple(const tuple& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4) - { } - - template - tuple(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4>& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4) - { } - - tuple& - operator=(const tuple& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - return *this; - } - - template - tuple& - operator=(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4>& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - return *this; - } - - template - friend class __get_helper; - template - friend class tuple; - }; - - template - class tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _NullClass, _NullClass, - _NullClass, _NullClass> - { - _Tp0 _M_t0; - _Tp1 _M_t1; - _Tp2 _M_t2; - _Tp3 _M_t3; - _Tp4 _M_t4; - _Tp5 _M_t5; - - public: - tuple() - { } - - explicit tuple(typename __add_c_ref<_Tp0>::type __in0, - typename __add_c_ref<_Tp1>::type __in1, - typename __add_c_ref<_Tp2>::type __in2, - typename __add_c_ref<_Tp3>::type __in3, - typename __add_c_ref<_Tp4>::type __in4, - typename __add_c_ref<_Tp5>::type __in5): - _M_t0(__in0), _M_t1(__in1), _M_t2(__in2), _M_t3(__in3), _M_t4(__in4), - _M_t5(__in5) - { } - - tuple(const tuple& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4), _M_t5(__in._M_t5) - { } - - template - tuple(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5>& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4), _M_t5(__in._M_t5) - { } - - tuple& - operator=(const tuple& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - _M_t5=__in._M_t5; - return *this; - } - - template - tuple& - operator=(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5>& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - _M_t5=__in._M_t5; - return *this; - } - - template - friend class __get_helper; - template - friend class tuple; - }; - - template - class tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _NullClass, - _NullClass, _NullClass> - { - _Tp0 _M_t0; - _Tp1 _M_t1; - _Tp2 _M_t2; - _Tp3 _M_t3; - _Tp4 _M_t4; - _Tp5 _M_t5; - _Tp6 _M_t6; - - public: - tuple() - { } - - explicit tuple(typename __add_c_ref<_Tp0>::type __in0, - typename __add_c_ref<_Tp1>::type __in1, - typename __add_c_ref<_Tp2>::type __in2, - typename __add_c_ref<_Tp3>::type __in3, - typename __add_c_ref<_Tp4>::type __in4, - typename __add_c_ref<_Tp5>::type __in5, - typename __add_c_ref<_Tp6>::type __in6): - _M_t0(__in0), _M_t1(__in1), _M_t2(__in2), _M_t3(__in3), _M_t4(__in4), - _M_t5(__in5), _M_t6(__in6) - { } - - tuple(const tuple& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4), _M_t5(__in._M_t5), - _M_t6(__in._M_t6) - { } - - template - tuple(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6>& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4), _M_t5(__in._M_t5), - _M_t6(__in._M_t6) - { } - - tuple& - operator=(const tuple& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - _M_t5=__in._M_t5; - _M_t6=__in._M_t6; - return *this; - } - - template - tuple& - operator=(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, - _Up6>& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - _M_t5=__in._M_t5; - _M_t6=__in._M_t6; - return *this; - } - - template - friend class __get_helper; - template - friend class tuple; - }; - - template - class tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _NullClass, - _NullClass> - { - _Tp0 _M_t0; - _Tp1 _M_t1; - _Tp2 _M_t2; - _Tp3 _M_t3; - _Tp4 _M_t4; - _Tp5 _M_t5; - _Tp6 _M_t6; - _Tp7 _M_t7; - - public: - tuple() - { } - - explicit tuple(typename __add_c_ref<_Tp0>::type __in0, - typename __add_c_ref<_Tp1>::type __in1, - typename __add_c_ref<_Tp2>::type __in2, - typename __add_c_ref<_Tp3>::type __in3, - typename __add_c_ref<_Tp4>::type __in4, - typename __add_c_ref<_Tp5>::type __in5, - typename __add_c_ref<_Tp6>::type __in6, - typename __add_c_ref<_Tp7>::type __in7): - _M_t0(__in0), _M_t1(__in1), _M_t2(__in2), _M_t3(__in3), _M_t4(__in4), - _M_t5(__in5), _M_t6(__in6), _M_t7(__in7) - { } - - tuple(const tuple& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4), _M_t5(__in._M_t5), - _M_t6(__in._M_t6), _M_t7(__in._M_t7) - { } - - template - tuple(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, - _Up7>& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4), _M_t5(__in._M_t5), - _M_t6(__in._M_t6), _M_t7(__in._M_t7) - { } - - tuple& - operator=(const tuple& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - _M_t5=__in._M_t5; - _M_t6=__in._M_t6; - _M_t7=__in._M_t7; - return *this; - } - - template - tuple& - operator=(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, - _Up7>& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - _M_t5=__in._M_t5; - _M_t6=__in._M_t6; - _M_t7=__in._M_t7; - return *this; - } - - template - friend class __get_helper; - template - friend class tuple; - }; - - template - class tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, - _NullClass> - { - _Tp0 _M_t0; - _Tp1 _M_t1; - _Tp2 _M_t2; - _Tp3 _M_t3; - _Tp4 _M_t4; - _Tp5 _M_t5; - _Tp6 _M_t6; - _Tp7 _M_t7; - _Tp8 _M_t8; - - public: - tuple() - { } - - explicit tuple(typename __add_c_ref<_Tp0>::type __in0, - typename __add_c_ref<_Tp1>::type __in1, - typename __add_c_ref<_Tp2>::type __in2, - typename __add_c_ref<_Tp3>::type __in3, - typename __add_c_ref<_Tp4>::type __in4, - typename __add_c_ref<_Tp5>::type __in5, - typename __add_c_ref<_Tp6>::type __in6, - typename __add_c_ref<_Tp7>::type __in7, - typename __add_c_ref<_Tp8>::type __in8): - _M_t0(__in0), _M_t1(__in1), _M_t2(__in2), _M_t3(__in3), _M_t4(__in4), - _M_t5(__in5), _M_t6(__in6), _M_t7(__in7), _M_t8(__in8) - { } - - tuple(const tuple& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4), _M_t5(__in._M_t5), - _M_t6(__in._M_t6), _M_t7(__in._M_t7), _M_t8(__in._M_t8) - { } - - template - tuple(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, - _Up8>& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4), _M_t5(__in._M_t5), - _M_t6(__in._M_t6), _M_t7(__in._M_t7), _M_t8(__in._M_t8) - { } - - tuple& - operator=(const tuple& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - _M_t5=__in._M_t5; - _M_t6=__in._M_t6; - _M_t7=__in._M_t7; - _M_t8=__in._M_t8; - return *this; - } - - template - tuple& - operator=(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, - _Up8>& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - _M_t5=__in._M_t5; - _M_t6=__in._M_t6; - _M_t7=__in._M_t7; - _M_t8=__in._M_t8; - return *this; - } - - template - friend class __get_helper; - template - friend class tuple; - }; - - /// @brief Template class tuple - template - class tuple - { - _Tp0 _M_t0; - _Tp1 _M_t1; - _Tp2 _M_t2; - _Tp3 _M_t3; - _Tp4 _M_t4; - _Tp5 _M_t5; - _Tp6 _M_t6; - _Tp7 _M_t7; - _Tp8 _M_t8; - _Tp9 _M_t9; - - public: - tuple() - { } - - explicit tuple(typename __add_c_ref<_Tp0>::type __in0, - typename __add_c_ref<_Tp1>::type __in1, - typename __add_c_ref<_Tp2>::type __in2, - typename __add_c_ref<_Tp3>::type __in3, - typename __add_c_ref<_Tp4>::type __in4, - typename __add_c_ref<_Tp5>::type __in5, - typename __add_c_ref<_Tp6>::type __in6, - typename __add_c_ref<_Tp7>::type __in7, - typename __add_c_ref<_Tp8>::type __in8, - typename __add_c_ref<_Tp9>::type __in9): - _M_t0(__in0), _M_t1(__in1), _M_t2(__in2), _M_t3(__in3), _M_t4(__in4), - _M_t5(__in5), _M_t6(__in6), _M_t7(__in7), _M_t8(__in8), _M_t9(__in9) - { } - - tuple(const tuple& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4), _M_t5(__in._M_t5), - _M_t6(__in._M_t6), _M_t7(__in._M_t7), _M_t8(__in._M_t8), - _M_t9(__in._M_t9) - { } - - template - tuple(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, _Up8, - _Up9>& __in): - _M_t0(__in._M_t0), _M_t1(__in._M_t1), _M_t2(__in._M_t2), - _M_t3(__in._M_t3), _M_t4(__in._M_t4), _M_t5(__in._M_t5), - _M_t6(__in._M_t6), _M_t7(__in._M_t7), _M_t8(__in._M_t8), - _M_t9(__in._M_t9) - { } - - tuple& - operator=(const tuple& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - _M_t5=__in._M_t5; - _M_t6=__in._M_t6; - _M_t7=__in._M_t7; - _M_t8=__in._M_t8; - _M_t9=__in._M_t9; - return *this; - } - - template - tuple& - operator=(const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, - _Up8, _Up9>& __in) - { - _M_t0=__in._M_t0; - _M_t1=__in._M_t1; - _M_t2=__in._M_t2; - _M_t3=__in._M_t3; - _M_t4=__in._M_t4; - _M_t5=__in._M_t5; - _M_t6=__in._M_t6; - _M_t7=__in._M_t7; - _M_t8=__in._M_t8; - _M_t9=__in._M_t9; - return *this; - } - - template - friend class __get_helper; - template - friend class tuple; - }; - - // Class used in the implementation of get - template - struct __get_helper; - - template - struct __get_helper<0, _Tp> - { - static typename __add_ref::type>::type - get_value(_Tp& __in) - { return __in._M_t0; } - - static typename __add_c_ref::type>::type - get_value(const _Tp& __in) - { return __in._M_t0; } - }; - - template - struct __get_helper<1, _Tp> - { - static typename __add_ref::type>::type - get_value(_Tp& __in) - { return __in._M_t1; } - - static typename __add_c_ref::type>::type - get_value(const _Tp& __in) - { return __in._M_t1; } - }; - - template - struct __get_helper<2, _Tp> - { - static typename __add_ref::type>::type - get_value(_Tp& __in) - { return __in._M_t2; } - - static typename __add_c_ref::type>::type - get_value(const _Tp& __in) - { return __in._M_t2; } - }; - - template - struct __get_helper<3, _Tp> - { - static typename __add_ref::type>::type - get_value(_Tp& __in) - { return __in._M_t3; } - - static typename __add_c_ref::type>::type - get_value(const _Tp& __in) - { return __in._M_t3; } - }; - - template - struct __get_helper<4, _Tp> - { - static typename __add_ref::type>::type - get_value(_Tp& __in) - { return __in._M_t4; } - - static typename __add_c_ref::type>::type - get_value(const _Tp& __in) - { return __in._M_t4; } - }; - - template - struct __get_helper<5, _Tp> - { - static typename __add_ref::type>::type - get_value(_Tp& __in) - { return __in._M_t5; } - - static typename __add_c_ref::type>::type - get_value(const _Tp& __in) - { return __in._M_t5; } - }; - - template - struct __get_helper<6, _Tp> - { - static typename __add_ref::type>::type - get_value(_Tp& __in) - { return __in._M_t6; } - - static typename __add_c_ref::type>::type - get_value(const _Tp& __in) - { return __in._M_t6; } - }; - - template - struct __get_helper<7, _Tp> - { - static typename __add_ref::type>::type - get_value(_Tp& __in) - { return __in._M_t7; } - - static typename __add_c_ref::type>::type - get_value(const _Tp& __in) - { return __in._M_t7; } - }; - - template - struct __get_helper<8, _Tp> - { - static typename __add_ref::type>::type - get_value(_Tp& __in) - { return __in._M_t8; } - - static typename __add_c_ref::type>::type - get_value(const _Tp& __in) - { return __in._M_t8; } - }; - - template - struct __get_helper<9, _Tp> - { - static typename __add_ref::type>::type - get_value(_Tp& __in) - { return __in._M_t9; } - - static typename __add_c_ref::type>::type - get_value(const _Tp& __in) - { return __in._M_t9; } - }; - - // Returns a reference to the ith element of a tuple. - // Any const or non-const ref elements are returned with their original type. - template - typename __add_ref >::type>::type - get(tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, - _Tp9>& __t) - { - return __get_helper<__i, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> >::get_value(__t); - } - - // Returns a const reference to the ith element of a tuple. - // Any const or non-const ref elements are returned with their original type. - template - typename __add_c_ref >::type>::type - get(const tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, - _Tp9>& __t) - { - return __get_helper<__i, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9> >::get_value(__t); - } - - // This class helps construct the various comparison operations on tuples - template - struct __tuple_compare; - - template - struct __tuple_compare<0, __i, __j, _Tp, _Up> - { - static bool __eq(const _Tp& __t, const _Up& __u) - { - return get<__i>(__t) == get<__i>(__u) && - __tuple_compare<0, __i+1, __j, _Tp, _Up>::__eq(__t, __u); - } - static bool __less(const _Tp& __t, const _Up& __u) - { - return (get<__i>(__t) < get<__i>(__u)) || !(get<__i>(__u) < get<__i>(__t)) && - __tuple_compare<0, __i+1, __j, _Tp, _Up>::__less(__t, __u); - } - }; - - template - struct __tuple_compare<0, __i, __i, _Tp, _Up> - { - static bool __eq(const _Tp&, const _Up&) - { return true; } - static bool __less(const _Tp&, const _Up&) - { return false; } - }; - - template - bool - operator==(const tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, _Tp9>& __t, - const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, _Up8, _Up9>& __u) - { - typedef tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, - _Tp9> _Tp; - typedef tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, _Up8, - _Up9> _Up; - return __tuple_compare::value - - tuple_size<_Tp>::value, 0, - tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u); - } - - template - bool - operator<(const tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, _Tp9>& __t, - const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, _Up8, _Up9>& __u) - { - typedef tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, - _Tp9> _Tp; - typedef tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, _Up8, - _Up9> _Up; - return __tuple_compare::value - - tuple_size<_Tp>::value, 0, - tuple_size<_Tp>::value, _Tp, _Up>::__less(__t, __u); - } - - template - bool - operator!=(const tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, _Tp9>& __t, - const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, _Up8, _Up9>& __u) - { - return !(__t == __u); - } - template - bool - operator>(const tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, _Tp9>& __t, - const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, _Up8, _Up9>& __u) - { - return __u < __t; - } - template - bool - operator<=(const tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, _Tp9>& __t, - const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, _Up8, _Up9>& __u) - { - return !(__u < __t); - } - template - bool - operator>=(const tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, _Tp9>& __t, - const tuple<_Up0, _Up1, _Up2, _Up3, _Up4, _Up5, _Up6, _Up7, _Up8, _Up9>& __u) - { - return !(__t < __u); - } - - // Helper which adds a reference to a type when given a reference_wrapper - template - struct __strip_reference_wrapper - { - typedef _Tp __type; - }; - - template - struct __strip_reference_wrapper > - { - typedef _Tp& __type; - }; - - template - struct __strip_reference_wrapper > - { - typedef _Tp& __type; - }; - - template - struct __stripped_tuple_type - { - typedef tuple::__type, - typename __strip_reference_wrapper<_Tp1>::__type, - typename __strip_reference_wrapper<_Tp2>::__type, - typename __strip_reference_wrapper<_Tp3>::__type, - typename __strip_reference_wrapper<_Tp4>::__type, - typename __strip_reference_wrapper<_Tp5>::__type, - typename __strip_reference_wrapper<_Tp6>::__type, - typename __strip_reference_wrapper<_Tp7>::__type, - typename __strip_reference_wrapper<_Tp8>::__type, - typename __strip_reference_wrapper<_Tp9>::__type> __type; - }; - - tuple<> - make_tuple() - { return tuple<>(); } - - template< typename _Tp0> - typename __stripped_tuple_type< _Tp0>::__type - make_tuple( _Tp0 __t0) - { - return typename __stripped_tuple_type< _Tp0>:: - __type( __t0); - } - - template - typename __stripped_tuple_type<_Tp0, _Tp1>::__type - make_tuple(_Tp0 __t0, _Tp1 __t1) - { - return typename __stripped_tuple_type<_Tp0, _Tp1>:: - __type(__t0, __t1); - } - - template - typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2>::__type - make_tuple(_Tp0 __t0, _Tp1 __t1, _Tp2 __t2) - { - return typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2>:: - __type(__t0, __t1, __t2); - } - - template - typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3>::__type - make_tuple(_Tp0 __t0, _Tp1 __t1, _Tp2 __t2, _Tp3 __t3) - { - return typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3>:: - __type(__t0, __t1, __t2, __t3); - } - - template - typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4>::__type - make_tuple(_Tp0 __t0, _Tp1 __t1, _Tp2 __t2, _Tp3 __t3, _Tp4 __t4) - { - return typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4>:: - __type(__t0, __t1, __t2, __t3, __t4); - } - - template - typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, - _Tp5>::__type - make_tuple(_Tp0 __t0, _Tp1 __t1, _Tp2 __t2, _Tp3 __t3, _Tp4 __t4, - _Tp5 __t5) - { - return typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, - _Tp5>:: - __type(__t0, __t1, __t2, __t3, __t4, __t5); - } - - template - typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, - _Tp6>::__type - make_tuple(_Tp0 __t0, _Tp1 __t1, _Tp2 __t2, _Tp3 __t3, _Tp4 __t4, - _Tp5 __t5, _Tp6 __t6) - { - return typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, - _Tp5, _Tp6>:: - __type(__t0, __t1, __t2, __t3, __t4, __t5, __t6); - } - - template - typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7>::__type - make_tuple(_Tp0 __t0, _Tp1 __t1, _Tp2 __t2, _Tp3 __t3, _Tp4 __t4, - _Tp5 __t5, _Tp6 __t6, _Tp7 __t7) - { - return typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, - _Tp5, _Tp6, _Tp7>:: - __type(__t0, __t1, __t2, __t3, __t4, __t5, __t6, __t7); - } - - template - typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8>::__type - make_tuple(_Tp0 __t0, _Tp1 __t1, _Tp2 __t2, _Tp3 __t3, _Tp4 __t4, - _Tp5 __t5, _Tp6 __t6, _Tp7 __t7, _Tp8 __t8) - { - return typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, - _Tp5, _Tp6, _Tp7, _Tp8>:: - __type(__t0, __t1, __t2, __t3, __t4, __t5, __t6, __t7, __t8); - } - - template - typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, - _Tp7, _Tp8, _Tp9>::__type - make_tuple(_Tp0 __t0, _Tp1 __t1, _Tp2 __t2, _Tp3 __t3, _Tp4 __t4, - _Tp5 __t5, _Tp6 __t6, _Tp7 __t7, _Tp8 __t8, _Tp9 __t9) - { - return typename __stripped_tuple_type<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, - _Tp5, _Tp6, _Tp7, _Tp8, _Tp9>:: - __type(__t0, __t1, __t2, __t3, __t4, __t5, __t6, __t7, __t8, __t9); - } - - // A class (and instance) which can be used in 'tie' when an element - // of a tuple is not required - struct swallow_assign - { - template - swallow_assign& - operator=(const T&) - { return *this; } - }; - - // TODO: Put this in some kind of shared file. - namespace - { - swallow_assign ignore; - }; - - - // Forms a tuple of references to a list of variables. - template< typename _Tp0> - tuple< _Tp0&> - tie( _Tp0& __t0) - { - return make_tuple( ref(__t0)); - }; - - template - tuple<_Tp0&, _Tp1&> - tie(_Tp0& __t0, _Tp1& __t1) - { - return make_tuple(ref(__t0), ref(__t1)); - }; - - template - tuple<_Tp0&, _Tp1&, _Tp2&> - tie(_Tp0& __t0, _Tp1& __t1, _Tp2& __t2) - { - return make_tuple(ref(__t0), ref(__t1), ref(__t2)); - }; - - template - tuple<_Tp0&, _Tp1&, _Tp2&, _Tp3&> - tie(_Tp0& __t0, _Tp1& __t1, _Tp2& __t2, _Tp3& __t3) - { - return make_tuple(ref(__t0), ref(__t1), ref(__t2), ref(__t3)); - }; - - template - tuple<_Tp0&, _Tp1&, _Tp2&, _Tp3&, _Tp4&> - tie(_Tp0& __t0, _Tp1& __t1, _Tp2& __t2, _Tp3& __t3, _Tp4& __t4) - { - return make_tuple(ref(__t0), ref(__t1), ref(__t2), ref(__t3), - ref(__t4)); - }; - - template - tuple<_Tp0&, _Tp1&, _Tp2&, _Tp3&, _Tp4&, _Tp5&> - tie(_Tp0& __t0, _Tp1& __t1, _Tp2& __t2, _Tp3& __t3, _Tp4& __t4, - _Tp5& __t5) - { - return make_tuple(ref(__t0), ref(__t1), ref(__t2), ref(__t3), ref(__t4), - ref(__t5)); - }; - - template - tuple<_Tp0&, _Tp1&, _Tp2&, _Tp3&, _Tp4&, _Tp5&, _Tp6&> - tie(_Tp0& __t0, _Tp1& __t1, _Tp2& __t2, _Tp3& __t3, _Tp4& __t4, _Tp5& __t5, - _Tp6& __t6) - { - return make_tuple(ref(__t0), ref(__t1), ref(__t2), ref(__t3), ref(__t4), - ref(__t5), ref(__t6)); - }; - - template - tuple<_Tp0&, _Tp1&, _Tp2&, _Tp3&, _Tp4&, _Tp5&, _Tp6&, _Tp7&> - tie(_Tp0& __t0, _Tp1& __t1, _Tp2& __t2, _Tp3& __t3, _Tp4& __t4, _Tp5& __t5, - _Tp6& __t6, _Tp7& __t7) - { - return make_tuple(ref(__t0), ref(__t1), ref(__t2), ref(__t3), ref(__t4), - ref(__t5), ref(__t6), ref(__t7)); - }; - - template - tuple<_Tp0&, _Tp1&, _Tp2&, _Tp3&, _Tp4&, _Tp5&, _Tp6&, _Tp7&, _Tp8&> - tie(_Tp0& __t0, _Tp1& __t1, _Tp2& __t2, _Tp3& __t3, _Tp4& __t4, _Tp5& __t5, - _Tp6& __t6, _Tp7& __t7, _Tp8& __t8) - { - return make_tuple(ref(__t0), ref(__t1), ref(__t2), ref(__t3), ref(__t4), - ref(__t5), ref(__t6), ref(__t7), ref(__t8)); - }; - - template - tuple<_Tp0&, _Tp1&, _Tp2&, _Tp3&, _Tp4&, _Tp5&, _Tp6&, _Tp7&, _Tp8&, - _Tp9&> - tie(_Tp0& __t0, _Tp1& __t1, _Tp2& __t2, _Tp3& __t3, _Tp4& __t4, _Tp5& __t5, - _Tp6& __t6, _Tp7& __t7, _Tp8& __t8, _Tp9& __t9) - { - return make_tuple(ref(__t0), ref(__t1), ref(__t2), ref(__t3), ref(__t4), - ref(__t5), ref(__t6), ref(__t7), ref(__t8), - ref(__t9)); - }; - + // An implementation specific class which is used in the tuple class + // when the tuple is not maximum possible size. + struct _NullClass { }; + + template + class tuple; + + /// Gives the type of the ith element of a given tuple type. + template + struct tuple_element; + + /// Finds the size of a given tuple type. + template + struct tuple_size; + + // Adds a const reference to a non-reference type. + template + struct __add_c_ref + { typedef const _Tp& type; }; + + template + struct __add_c_ref<_Tp&> + { typedef _Tp& type; }; + + // Adds a reference to a non-reference type. + template + struct __add_ref + { typedef _Tp& type; }; + + template + struct __add_ref<_Tp&> + { typedef _Tp& type; }; + + // Class used in the implementation of get + template + struct __get_helper; + + // Returns a const reference to the ith element of a tuple. + // Any const or non-const ref elements are returned with their original type. + template + typename __add_ref >::type>::type + get(tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, + _Tp9>& __t) + { + return __get_helper<__i, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, + _Tp7, _Tp8, _Tp9> >::get_value(__t); + } + + template + typename __add_c_ref >::type>::type + get(const tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, _Tp7, _Tp8, + _Tp9>& __t) + { + return __get_helper<__i, tuple<_Tp0, _Tp1, _Tp2, _Tp3, _Tp4, _Tp5, _Tp6, + _Tp7, _Tp8, _Tp9> >::get_value(__t); + } + + // This class helps construct the various comparison operations on tuples + template + struct __tuple_compare; + + template + struct __tuple_compare<0, __i, __j, _Tp, _Up> + { + static bool __eq(const _Tp& __t, const _Up& __u) + { + return get<__i>(__t) == get<__i>(__u) && + __tuple_compare<0, __i+1, __j, _Tp, _Up>::__eq(__t, __u); + } + static bool __less(const _Tp& __t, const _Up& __u) + { + return (get<__i>(__t) < get<__i>(__u)) || !(get<__i>(__u) < get<__i>(__t)) && + __tuple_compare<0, __i+1, __j, _Tp, _Up>::__less(__t, __u); + } + }; + + template + struct __tuple_compare<0, __i, __i, _Tp, _Up> + { + static bool __eq(const _Tp&, const _Up&) + { return true; } + static bool __less(const _Tp&, const _Up&) + { return false; } + }; + + template + bool + operator==(const tuple<_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10>& __t, + const tuple<_U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9, _U10>& __u) + { + typedef tuple<_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10> _Tp; + typedef tuple<_U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8,_U9, _U10> _Up; + return __tuple_compare::value - tuple_size<_Tp>::value, 0, + tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u); + } + + template + bool + operator<(const tuple<_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10>& __t, + const tuple<_U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9, _U10>& __u) + { + typedef tuple<_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10> _Tp; + typedef tuple<_U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8,_U9, _U10> _Up; + return __tuple_compare::value - tuple_size<_Tp>::value, 0, + tuple_size<_Tp>::value, _Tp, _Up>::__less(__t, __u); + } + + template + bool + operator!=(const tuple<_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10>& __t, + const tuple<_U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9, _U10>& __u) + { return !(__t == __u); } + + template + bool + operator>(const tuple<_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10>& __t, + const tuple<_U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9, _U10>& __u) + { return __u < __t; } + + template + bool + operator<=(const tuple<_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10>& __t, + const tuple<_U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9, _U10>& __u) + { return !(__u < __t); } + + template + bool + operator>=(const tuple<_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10>& __t, + const tuple<_U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9, _U10>& __u) + { return !(__t < __u); } + + // Helper which adds a reference to a type when given a reference_wrapper + template + struct __strip_reference_wrapper + { + typedef _Tp __type; + }; + + template + struct __strip_reference_wrapper > + { + typedef _Tp& __type; + }; + + template + struct __strip_reference_wrapper > + { + typedef _Tp& __type; + }; + + template + struct __stripped_tuple_type + { + typedef tuple::__type, + typename __strip_reference_wrapper<_Tp1>::__type, + typename __strip_reference_wrapper<_Tp2>::__type, + typename __strip_reference_wrapper<_Tp3>::__type, + typename __strip_reference_wrapper<_Tp4>::__type, + typename __strip_reference_wrapper<_Tp5>::__type, + typename __strip_reference_wrapper<_Tp6>::__type, + typename __strip_reference_wrapper<_Tp7>::__type, + typename __strip_reference_wrapper<_Tp8>::__type, + typename __strip_reference_wrapper<_Tp9>::__type> __type; + }; + + // A class (and instance) which can be used in 'tie' when an element + // of a tuple is not required + struct swallow_assign + { + template + swallow_assign& + operator=(const T&) + { return *this; } + }; + + // TODO: Put this in some kind of shared file. + namespace + { + swallow_assign ignore; + }; + +#define _GLIBCXX_CAT(x,y) _GLIBCXX_CAT2(x,y) +#define _GLIBCXX_CAT2(x,y) x##y +#define _SHORT_REPEAT +#define _GLIBCXX_REPEAT_HEADER +#include +#undef _GLIBCXX_REPEAT_HEADER +#undef _SHORT_REPEAT } } -#endif +#include +#endif diff --git a/libstdc++-v3/include/tr1/tuple_iterate.h b/libstdc++-v3/include/tr1/tuple_iterate.h index 23cb01fc923..1d3756dc90c 100644 --- a/libstdc++-v3/include/tr1/tuple_iterate.h +++ b/libstdc++-v3/include/tr1/tuple_iterate.h @@ -49,7 +49,7 @@ template<_GLIBCXX_TEMPLATE_PARAMS> _GLIBCXX_BIND_MEMBERS public: - tuple() + tuple() { } #if _GLIBCXX_NUM_ARGS == 2 @@ -75,8 +75,8 @@ template tuple& operator=(const tuple<_GLIBCXX_TEMPLATE_ARGS_U>& __in) { - _GLIBCXX_TUPLE_ASSIGN - return *this; + _GLIBCXX_TUPLE_ASSIGN + return *this; } tuple(const tuple& __in) : @@ -94,7 +94,7 @@ template operator=(const tuple& __in) { _GLIBCXX_TUPLE_ASSIGN - return *this; + return *this; } template @@ -110,23 +110,23 @@ template template struct __get_helper<_GLIBCXX_NUM_ARGS, _Tp> { - static typename __add_ref::type>::type + static typename __add_ref::type>::type get_value(_Tp& __in) { return __in._GLIBCXX_CAT(_M_arg,_GLIBCXX_NUM_ARGS_PLUS_1); } static typename __add_c_ref::type>::type + _Tp>::type>::type get_value(const _Tp& __in) { return __in._GLIBCXX_CAT(_M_arg,_GLIBCXX_NUM_ARGS_PLUS_1); } }; -/// @brief class tuple_element -template - struct tuple_element<_GLIBCXX_NUM_ARGS, tuple<_T1, _T2, _T3, _T4, - _T5, _T6, _T7, _T8, _T9, + struct tuple_element<_GLIBCXX_NUM_ARGS, tuple<_T1, _T2, _T3, _T4, + _T5, _T6, _T7, _T8, _T9, _T10> > { typedef _GLIBCXX_T_NUM_ARGS_PLUS_1 type; }; @@ -145,7 +145,7 @@ tie() template<_GLIBCXX_TEMPLATE_PARAMS> typename __stripped_tuple_type<_GLIBCXX_TEMPLATE_ARGS>::__type make_tuple(_GLIBCXX_PARAMS) - { + { return typename __stripped_tuple_type<_GLIBCXX_TEMPLATE_ARGS>:: __type(_GLIBCXX_ARGS); } diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits index 12609dd41b4..55f585f9f4b 100644 --- a/libstdc++-v3/include/tr1/type_traits +++ b/libstdc++-v3/include/tr1/type_traits @@ -18,6 +18,15 @@ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + /** @file * This is a TR1 C++ Library header. */ @@ -33,7 +42,7 @@ namespace std { namespace tr1 { - // For use in is_enum, is_abstract and elsewhere. + // For use in __conv_helper, is_abstract and elsewhere. struct __sfinae_types { typedef char __one; @@ -151,262 +160,31 @@ namespace tr1 _DEFINE_SPEC(2, is_member_object_pointer, _Tp _Cp::*, !is_function<_Tp>::value) - // Due to c++/19076, for the time being we cannot use the correct, neat - // implementation :-( - // - // template - // struct is_member_function_pointer - // : public false_type { }; - // _DEFINE_SPEC(2, is_member_function_pointer, _Tp _Cp::*, - // is_function<_Tp>::value) - // - // Temporary workaround for member functions with up to 15 arguments: template - struct __is_mfp_helper - { static const bool __value = false; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) ()> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9, _A10)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9, _A10, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9, _A10, _A11)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9, _A10, _A11, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9, _A10, _A11, _A12)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9, _A10, _A11, _A12, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9, _A10, _A11, _A12, - _A13)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9, _A10, _A11, _A12, - _A13, ...)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9, _A10, _A11, _A12, - _A13, _A14)> - { static const bool __value = true; }; - - template - struct __is_mfp_helper<_Rt (_Cp::*) (_A0, _A1, _A2, _A3, _A4, _A5, _A6, - _A7, _A8, _A9, _A10, _A11, _A12, - _A13, _A14, ...)> - { static const bool __value = true; }; + struct is_member_function_pointer + : public false_type { }; + _DEFINE_SPEC(2, is_member_function_pointer, _Tp _Cp::*, + is_function<_Tp>::value) template - struct is_member_function_pointer - : public integral_constant::type>::__value)> + struct is_enum + : public integral_constant::value + || is_array<_Tp>::value + || is_pointer<_Tp>::value + || is_reference<_Tp>::value + || is_member_pointer<_Tp>::value + || is_function<_Tp>::value + || __is_union_or_class<_Tp>::value)> { }; - template::value - || is_array<_Tp>::value - || is_pointer<_Tp>::value - || is_reference<_Tp>::value - || is_member_pointer<_Tp>::value - || is_function<_Tp>::value)> - struct __is_enum_helper - : public __sfinae_types - { - private: - static __one __test(bool); - static __one __test(char); - static __one __test(signed char); - static __one __test(unsigned char); -#ifdef _GLIBCXX_USE_WCHAR_T - static __one __test(wchar_t); -#endif - static __one __test(short); - static __one __test(unsigned short); - static __one __test(int); - static __one __test(unsigned int); - static __one __test(long); - static __one __test(unsigned long); - static __one __test(long long); - static __one __test(unsigned long long); - static __two __test(...); - - struct __convert - { operator _Tp() const; }; - - public: - static const bool __value = sizeof(__test(__convert())) == 1; - }; - - template - struct __is_enum_helper<_Tp, true> - { static const bool __value = false; }; + template + struct is_union { }; - template - struct is_enum - : public integral_constant::__value> { }; + template + struct is_class { }; - template::value> + template::value + || is_reference<_Tp>::value)> struct __is_function_helper { static const bool __value = (__conv_helper::value || is_member_function_pointer<_Tp>::value)> { }; + + template + struct __is_union_or_class_helper + : public __sfinae_types + { + private: + template + static __one __test(int _Up::*); + template + static __two __test(...); + + public: + static const bool __value = sizeof(__test<_Tp>(0)) == 1; + }; + + // Extension. + template + struct __is_union_or_class + : public integral_constant::__value> + { }; /// @brief type properties [4.5.3]. template @@ -486,26 +284,21 @@ namespace tr1 remove_all_extents<_Tp>::type>::value)> { }; - template - struct __is_empty_helper_1 - { }; - - template - struct __is_empty_helper_2 - : public _Tp { }; - - // Unfortunately, without compiler support we cannot tell union from - // class types, and is_empty doesn't work at all with the former. - template::value - || is_array<_Tp>::value - || is_pointer<_Tp>::value - || is_reference<_Tp>::value - || is_member_pointer<_Tp>::value - || is_enum<_Tp>::value - || is_function<_Tp>::value)> + // N.B. Without compiler support we cannot tell union from class types, + // and is_empty and is_polymorphic don't work at all with the former. + template::value> struct __is_empty_helper - { static const bool __value = (sizeof(__is_empty_helper_1<_Tp>) - == sizeof(__is_empty_helper_2<_Tp>)); }; + { + private: + template + struct __first { }; + template + struct __second + : public _Up { }; + + public: + static const bool __value = sizeof(__first<_Tp>) == sizeof(__second<_Tp>); + }; template struct __is_empty_helper<_Tp, true> @@ -516,6 +309,34 @@ namespace tr1 : public integral_constant::__value> { }; + template::value> + struct __is_polymorphic_helper + { + private: + template + struct __first + : public _Up { }; + template + struct __second + : public _Up + { + virtual void __dummy(); + virtual ~__second(); + }; + + public: + static const bool __value = sizeof(__first<_Tp>) == sizeof(__second<_Tp>); + }; + + template + struct __is_polymorphic_helper<_Tp, true> + { static const bool __value = false; }; + + template + struct is_polymorphic + : public integral_constant::__value> + { }; + // Exploit the resolution DR core/337. template::value> struct __is_abstract_helper @@ -638,6 +459,76 @@ namespace tr1 struct is_same<_Tp, _Tp> : public true_type { }; + // See Daveed Vandevoorde explanation in http://tinyurl.com/502f. + // Also see Rani Sharoni in http://tinyurl.com/6jvyq. + template::value + || !__is_union_or_class<_Derived>::value + || is_same<_Base, _Derived>::value)> + struct __is_base_of_helper + : public __sfinae_types + { + private: + typedef typename remove_cv<_Base>::type _NoCv_Base; + typedef typename remove_cv<_Derived>::type _NoCv_Derived; + + template + static __one __test(_NoCv_Derived&, _Up); + static __two __test(_NoCv_Base&, int); + + struct _Conv + { + operator _NoCv_Derived&(); + operator _NoCv_Base&() const; + }; + + public: + static const bool __value = sizeof(__test(_Conv(), 0)) == 1; + }; + + template + struct __is_base_of_helper<_Base, _Derived, true> + { static const bool __value = is_same<_Base, _Derived>::value; }; + + template + struct is_base_of + : public integral_constant::__value> + { }; + + template + struct __is_int_or_cref + { + typedef typename remove_reference<_Tp>::type __rr_Tp; + static const bool __value = (is_integral<_Tp>::value + || (is_integral<__rr_Tp>::value + && is_const<__rr_Tp>::value + && !is_volatile<__rr_Tp>::value)); + }; + + template::value || is_array<_To>::value + // This special case is here only to avoid warnings. + || (is_floating_point::type>::value + && __is_int_or_cref<_To>::__value))> + struct __is_convertible_helper + { + // "An imaginary lvalue of type From...". + static const bool __value = (__conv_helper::type, _To>::__value); + }; + + template + struct __is_convertible_helper<_From, _To, true> + { static const bool __value = __is_int_or_cref<_To>::__value; }; + + template + struct is_convertible + : public integral_constant::__value> + { }; + /// @brief const-volatile modifications [4.7.1]. template struct remove_const diff --git a/libstdc++-v3/include/tr1/type_traits_fwd.h b/libstdc++-v3/include/tr1/type_traits_fwd.h index 46beade5819..2d25d9b4c14 100644 --- a/libstdc++-v3/include/tr1/type_traits_fwd.h +++ b/libstdc++-v3/include/tr1/type_traits_fwd.h @@ -18,6 +18,15 @@ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + /** @file type_traits_fwd.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. @@ -94,6 +103,10 @@ namespace tr1 template struct is_member_pointer; + + // Extension. + template + struct __is_union_or_class; /// @brief type properties [4.5.3]. template diff --git a/libstdc++-v3/include/tr1/utility b/libstdc++-v3/include/tr1/utility index 6a74dfaf4d8..645edb6592f 100644 --- a/libstdc++-v3/include/tr1/utility +++ b/libstdc++-v3/include/tr1/utility @@ -18,6 +18,15 @@ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + /** @file * This is a TR1 C++ Library header. */ diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc index 64a36f9e95a..e43b0790c43 100644 --- a/libstdc++-v3/libsupc++/eh_alloc.cc +++ b/libstdc++-v3/libsupc++/eh_alloc.cc @@ -155,6 +155,12 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) throw() std::terminate (); } + // We have an uncaught exception as soon as we allocate memory. This + // yields uncaught_exception() true during the copy-constructor that + // initializes the exception object. See Issue 475. + __cxa_eh_globals *globals = __cxa_get_globals (); + globals->uncaughtExceptions += 1; + memset (ret, 0, sizeof (__cxa_exception)); return (void *)((char *)ret + sizeof (__cxa_exception)); diff --git a/libstdc++-v3/libsupc++/eh_catch.cc b/libstdc++-v3/libsupc++/eh_catch.cc index bdcbd7e085c..ba4b7d75f48 100644 --- a/libstdc++-v3/libsupc++/eh_catch.cc +++ b/libstdc++-v3/libsupc++/eh_catch.cc @@ -33,6 +33,15 @@ using namespace __cxxabiv1; +extern "C" void * +__cxxabiv1::__cxa_get_exception_ptr(void *exc_obj_in) throw() +{ + _Unwind_Exception *exceptionObject + = reinterpret_cast <_Unwind_Exception *>(exc_obj_in); + __cxa_exception *header = __get_exception_header_from_ue (exceptionObject); + + return header->adjustedPtr; +} extern "C" void * __cxxabiv1::__cxa_begin_catch (void *exc_obj_in) throw() @@ -61,15 +70,14 @@ __cxxabiv1::__cxa_begin_catch (void *exc_obj_in) throw() } int count = header->handlerCount; + // Count is less than zero if this exception was rethrown from an + // immediately enclosing region. if (count < 0) - // This exception was rethrown from an immediately enclosing region. count = -count + 1; else - { - count += 1; - globals->uncaughtExceptions -= 1; - } + count += 1; header->handlerCount = count; + globals->uncaughtExceptions -= 1; if (header != prev) { @@ -107,10 +115,7 @@ __cxxabiv1::__cxa_end_catch () // This exception was rethrown. Decrement the (inverted) catch // count and remove it from the chain when it reaches zero. if (++count == 0) - { - globals->uncaughtExceptions += 1; - globals->caughtExceptions = header->nextException; - } + globals->caughtExceptions = header->nextException; } else if (--count == 0) { diff --git a/libstdc++-v3/libsupc++/eh_throw.cc b/libstdc++-v3/libsupc++/eh_throw.cc index b02efdad6dc..0807c5e1df7 100644 --- a/libstdc++-v3/libsupc++/eh_throw.cc +++ b/libstdc++-v3/libsupc++/eh_throw.cc @@ -66,9 +66,6 @@ __cxxabiv1::__cxa_throw (void *obj, std::type_info *tinfo, header->unwindHeader.exception_class = __gxx_exception_class; header->unwindHeader.exception_cleanup = __gxx_exception_cleanup; - __cxa_eh_globals *globals = __cxa_get_globals (); - globals->uncaughtExceptions += 1; - #ifdef _GLIBCXX_SJLJ_EXCEPTIONS _Unwind_SjLj_RaiseException (&header->unwindHeader); #else @@ -86,6 +83,8 @@ __cxxabiv1::__cxa_rethrow () __cxa_eh_globals *globals = __cxa_get_globals (); __cxa_exception *header = globals->caughtExceptions; + globals->uncaughtExceptions += 1; + // Watch for luser rethrowing with no active exception. if (header) { diff --git a/libstdc++-v3/libsupc++/unwind-cxx.h b/libstdc++-v3/libsupc++/unwind-cxx.h index 67ea5cc2110..e79dd83628e 100644 --- a/libstdc++-v3/libsupc++/unwind-cxx.h +++ b/libstdc++-v3/libsupc++/unwind-cxx.h @@ -107,6 +107,7 @@ extern "C" void __cxa_throw (void *thrown_exception, __attribute__((noreturn)); // Used to implement exception handlers. +extern "C" void *__cxa_get_exception_ptr (void *) throw(); extern "C" void *__cxa_begin_catch (void *) throw(); extern "C" void __cxa_end_catch (); extern "C" void __cxa_rethrow () __attribute__((noreturn)); diff --git a/libstdc++-v3/scripts/check_performance b/libstdc++-v3/scripts/check_performance index b395fcb14e0..f5d2351d837 100755 --- a/libstdc++-v3/scripts/check_performance +++ b/libstdc++-v3/scripts/check_performance @@ -32,42 +32,50 @@ SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc \ -Wl,--rpath -Wl,$BUILD_DIR/src/.libs" ST_FLAG="-static" LINK=$SH_FLAG -CXX="$COMPILER $INCLUDES $PCH_FLAGS $FLAGS -DNOTHREAD $LINK" -CXX_THREAD="$COMPILER $INCLUDES $PCH_FLAGS $FLAGS $THREAD_FLAG $LINK" - - +CXX="$COMPILER $INCLUDES $PCH_FLAGS $FLAGS $LINK" TESTS_FILE="testsuite_files_performance" for NAME in `cat $TESTS_FILE` do RUN=true + + # TEST_S == single thread + # TEST_B == do both single and multi-thread + # TEST_T == multi-thread for CYCLE in `sed -n 's,.*\(TEST_[SB][0-9]*\)$,\1,p' $SRC_DIR/testsuite/$NAME` do RUN=false echo $NAME $CYCLE FILE_NAME="`basename $NAME`" - EXE_NAME="`echo $FILE_NAME-$CYCLE | sed 's/cc$/exe/'`" - $CXX -D$CYCLE $SRC_DIR/testsuite/$NAME -o $EXE_NAME - ./$EXE_NAME - echo "" + FILE_NAME="`echo $FILE_NAME | sed 's/.cc//g'`" + EXE_NAME="`echo $FILE_NAME-$CYCLE.exe`" + $CXX -DNOTHREAD -D$CYCLE $SRC_DIR/testsuite/$NAME -o $EXE_NAME + if [ -f $EXE_NAME ]; then + ./$EXE_NAME + fi done + for CYCLE in `sed -n 's,.*\(TEST_[TB][0-9]*\)$,\1,p' $SRC_DIR/testsuite/$NAME` do RUN=false - echo $NAME $CYCLE THREAD + echo $NAME $CYCLE thread FILE_NAME="`basename $NAME`" - EXE_NAME="`echo $FILE_NAME-$CYCLE | sed 's/cc$/exe/'`" - $CXX_THREAD -D$CYCLE $SRC_DIR/testsuite/$NAME -o $EXE_NAME - ./$EXE_NAME - echo "" + FILE_NAME="`echo $FILE_NAME | sed 's/.cc//g'`" + EXE_NAME="`echo $FILE_NAME-$CYCLE.exe`" + $CXX $THREAD_FLAG -D$CYCLE $SRC_DIR/testsuite/$NAME -o $EXE_NAME + if [ -f $EXE_NAME ]; then + ./$EXE_NAME + fi done + if $RUN; then echo $NAME FILE_NAME="`basename $NAME`" EXE_NAME="`echo $FILE_NAME | sed 's/cc$/exe/'`" $CXX $SRC_DIR/testsuite/$NAME -o $EXE_NAME - ./$EXE_NAME - echo "" + if [ -f $EXE_NAME ]; then + ./$EXE_NAME + fi fi done diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/find/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/find/char/3.cc index 24b73333744..b8643e08c3f 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/find/char/3.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/find/char/3.cc @@ -1,6 +1,6 @@ // 2003-05-04 Paolo Carlini -// Copyright (C) 2003 Free Software Foundation, Inc. +// Copyright (C) 2003, 2005 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 @@ -63,7 +63,7 @@ bool test03(void) // size_type find_first_not_of(const char* s, size_type pos, size_type n) const; csz01 = str01.find_first_not_of(str_lit01, 0, 0); VERIFY( csz01 == 0 ); - csz01 = str01.find_first_not_of(str_lit01, 0, 10); + csz01 = str01.find_first_not_of(str_lit01, 0, 8); VERIFY( csz01 == 8 ); csz01 = str01.find_first_not_of(str_lit01, 10, 0); VERIFY( csz01 == 10 ); diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/3.cc index 6964e013f30..dd27c438063 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/3.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/3.cc @@ -1,6 +1,6 @@ // 2003-05-04 Paolo Carlini -// Copyright (C) 2003 Free Software Foundation, Inc. +// Copyright (C) 2003, 2005 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 @@ -63,7 +63,7 @@ bool test03(void) // size_type find_first_not_of(const char* s, size_type pos, size_type n) const; csz01 = str01.find_first_not_of(str_lit01, 0, 0); VERIFY( csz01 == 0 ); - csz01 = str01.find_first_not_of(str_lit01, 0, 10); + csz01 = str01.find_first_not_of(str_lit01, 0, 8); VERIFY( csz01 == 8 ); csz01 = str01.find_first_not_of(str_lit01, 10, 0); VERIFY( csz01 == 10 ); diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/2.cc index 28c96055aef..c4a95b6cd81 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/2.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/2.cc @@ -19,6 +19,7 @@ // USA. // { dg-do run } +// { dg-xfail-if "" { "*-*-hpux11.23" } { "*" } { "" } } */ // { dg-options "-finput-charset=ISO8859-1" } // { dg-require-iconv "ISO8859-1" } diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc index 7c2cbca5e63..6819fa5411a 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc @@ -21,6 +21,7 @@ // 22.2.4.1.1 collate members // { dg-do run } +// { dg-xfail-if "" { "*-*-hpux11.23" } { "*" } { "" } } */ // { dg-options "-finput-charset=ISO8859-1" } // { dg-require-iconv "ISO8859-1" } diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc index 055abe4e2c0..f7c1cc06f1e 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc @@ -21,6 +21,7 @@ // 22.2.4.1.1 collate members // { dg-do run } +// { dg-xfail-if "" { "*-*-hpux11.23" } { "*" } { "" } } */ // { dg-options "-finput-charset=ISO8859-1" } // { dg-require-iconv "ISO8859-1" } diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/2.cc index 766ec03f89a..4fac2729585 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/2.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/2.cc @@ -21,6 +21,7 @@ // 22.2.4.1.1 collate members // { dg-do run } +// { dg-xfail-if "" { "*-*-hpux11.23" } { "*" } { "" } } */ // { dg-options "-finput-charset=ISO8859-1" } // { dg-require-iconv "ISO8859-1" } diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc index 7c2cbca5e63..6819fa5411a 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc @@ -21,6 +21,7 @@ // 22.2.4.1.1 collate members // { dg-do run } +// { dg-xfail-if "" { "*-*-hpux11.23" } { "*" } { "" } } */ // { dg-options "-finput-charset=ISO8859-1" } // { dg-require-iconv "ISO8859-1" } diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc index 055abe4e2c0..f7c1cc06f1e 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc @@ -21,6 +21,7 @@ // 22.2.4.1.1 collate members // { dg-do run } +// { dg-xfail-if "" { "*-*-hpux11.23" } { "*" } { "" } } */ // { dg-options "-finput-charset=ISO8859-1" } // { dg-require-iconv "ISO8859-1" } diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/2.cc index 0373c35b1c9..a52899b7625 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/2.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/2.cc @@ -21,6 +21,7 @@ // 22.2.4.1.1 collate members // { dg-do run } +// { dg-xfail-if "" { "*-*-hpux11.23" } { "*" } { "" } } */ // { dg-options "-finput-charset=ISO8859-1" } // { dg-require-iconv "ISO8859-1" } diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc index 8a0a5570c16..c3286289cc5 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc @@ -21,6 +21,7 @@ // 22.2.4.1.1 collate members // { dg-do run } +// { dg-xfail-if "" { "*-*-hpux11.23" } { "*" } { "" } } */ // { dg-options "-finput-charset=ISO8859-1" } // { dg-require-iconv "ISO8859-1" } diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc index bcfc10f0aff..b8bb537555a 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc @@ -21,6 +21,7 @@ // 22.2.4.1.1 collate members // { dg-do run } +// { dg-xfail-if "" { "*-*-hpux11.23" } { "*" } { "" } } */ // { dg-options "-finput-charset=ISO8859-1" } // { dg-require-iconv "ISO8859-1" } diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc index 69487473f3d..79486191766 100644 --- a/libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc +++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005 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,7 +33,6 @@ #include #include -#include using namespace std; diff --git a/libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/1.cc index dcb89a6dfa2..cbc4c7ac109 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/1.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. +// Copyright (C) 2000, 2001, 2003, 2005 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 @@ -40,9 +40,10 @@ void test01() ifs1.open(name_01); VERIFY( ifs1.is_open() ); - // fail bit still true - VERIFY( !(ifs1) ); - VERIFY( ifs1.rdstate() == std::ios_base::failbit ); + + // As per the resolution of DR 409. + VERIFY( (ifs1) ); + VERIFY( ifs1.rdstate() == std::ios_base::goodbit ); ifs1.close(); } diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/1.cc index 5bb02d4eb3c..64b9e342c38 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/1.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. +// Copyright (C) 2000, 2001, 2003, 2005 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 @@ -41,9 +41,10 @@ void test01() ofs1.open(name_02); VERIFY( ofs1.is_open() ); - // fail bit still true - VERIFY( !(ofs1) ); - VERIFY( ofs1.rdstate() == std::ios_base::failbit ); + + // As per the resolution of DR 409. + VERIFY( (ofs1) ); + VERIFY( ofs1.rdstate() == std::ios_base::goodbit ); ofs1.close(); } diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/2.cc index 626d45c9f35..978ae203cd8 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/2.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/2.cc @@ -33,8 +33,8 @@ test03(void) typedef wios::pos_type pos_type; - const char* TEST_IN = "wostream_inserter_other_in"; - const char* TEST_OUT = "wostream_inserter_other_out"; + const char* TEST_IN = "wostream_inserter_other_in.txt"; + const char* TEST_OUT = "wostream_inserter_other_out.txt"; pos_type i_read, i_wrote, rs, ws; double tf_size = BUFSIZ * 2.5; ofstream testfile(TEST_IN); diff --git a/libstdc++-v3/testsuite/testsuite_abi.cc b/libstdc++-v3/testsuite/testsuite_abi.cc index 1120c7d3399..4b9534fb339 100644 --- a/libstdc++-v3/testsuite/testsuite_abi.cc +++ b/libstdc++-v3/testsuite/testsuite_abi.cc @@ -169,6 +169,7 @@ check_version(const symbol& test, bool added) known_versions.push_back("CXXABI_1.2"); known_versions.push_back("CXXABI_1.2.1"); known_versions.push_back("CXXABI_1.3"); + known_versions.push_back("CXXABI_1.3.1"); } compat_list::iterator begin = known_versions.begin(); compat_list::iterator end = known_versions.end(); diff --git a/libstdc++-v3/testsuite/testsuite_tr1.h b/libstdc++-v3/testsuite/testsuite_tr1.h index 74a187666fd..ea6affb37c1 100644 --- a/libstdc++-v3/testsuite/testsuite_tr1.h +++ b/libstdc++-v3/testsuite/testsuite_tr1.h @@ -32,10 +32,10 @@ #define _GLIBCXX_TESTSUITE_TR1_H namespace __gnu_test -{ +{ // For tr1/type_traits. template class Category, - typename Type> + typename Type> bool test_category(bool value) { @@ -52,7 +52,7 @@ namespace __gnu_test } template class Property, - typename Type> + typename Type> bool test_property(typename Property::value_type value) { @@ -63,7 +63,7 @@ namespace __gnu_test } template class Property, - typename Type> + typename Type> bool test_copy_property(bool value) { @@ -80,7 +80,7 @@ namespace __gnu_test } template class Property, - typename Type> + typename Type> bool test_assign_property(bool value) { @@ -97,7 +97,7 @@ namespace __gnu_test } template class Relationship, - typename Type1, typename Type2> + typename Type1, typename Type2> bool test_relationship(bool value) { @@ -113,14 +113,90 @@ namespace __gnu_test typedef volatile ClassType vClassType; typedef const volatile ClassType cvClassType; + class DerivedType : public ClassType { }; + enum EnumType { }; struct ConvType { operator int() const; }; class AbstractClass - { virtual void rotate(int) = 0; }; - -}; // namespace __gnu_test + { + virtual void rotate(int) = 0; + virtual ~AbstractClass(); + }; + + class PolymorphicClass + { + virtual void rotate(int); + virtual ~PolymorphicClass(); + }; + + class DerivedPolymorphic : public PolymorphicClass { }; + + union UnionType { }; + + + int truncate_float(float x) { return (int)x; } + long truncate_double(double x) { return (long)x; } + + struct do_truncate_float_t + { + do_truncate_float_t() + { + ++live_objects; + } + + do_truncate_float_t(const do_truncate_float_t&) + { + ++live_objects; + } + + ~do_truncate_float_t() + { + --live_objects; + } + + int operator()(float x) { return (int)x; } + + static int live_objects; + }; + + int do_truncate_float_t::live_objects = 0; + + struct do_truncate_double_t + { + do_truncate_double_t() + { + ++live_objects; + } + + do_truncate_double_t(const do_truncate_double_t&) + { + ++live_objects; + } + + ~do_truncate_double_t() + { + --live_objects; + } + + long operator()(double x) { return (long)x; } + + static int live_objects; + }; + + int do_truncate_double_t::live_objects = 0; + + struct X + { + int bar; + + int foo() { return 1; } + int foo_c() const { return 2; } + int foo_v() volatile { return 3; } + int foo_cv() const volatile { return 4; } + }; +} // namespace __gnu_test #endif // _GLIBCXX_TESTSUITE_TR1_H diff --git a/libstdc++-v3/testsuite/thread/pthread1.cc b/libstdc++-v3/testsuite/thread/pthread1.cc index 26d198a755e..f83e20595af 100644 --- a/libstdc++-v3/testsuite/thread/pthread1.cc +++ b/libstdc++-v3/testsuite/thread/pthread1.cc @@ -111,7 +111,7 @@ main () task_queue* tq[thread_pairs]; -#if defined(__sun) && defined(__svr4__) +#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500 pthread_setconcurrency (thread_pairs * 2); #endif diff --git a/libstdc++-v3/testsuite/thread/pthread2.cc b/libstdc++-v3/testsuite/thread/pthread2.cc index 7a0efd067a2..84485165cd2 100644 --- a/libstdc++-v3/testsuite/thread/pthread2.cc +++ b/libstdc++-v3/testsuite/thread/pthread2.cc @@ -48,7 +48,7 @@ main() { pthread_t tid[max_thread_count]; -#if defined(__sun) && defined(__svr4__) +#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500 pthread_setconcurrency (max_thread_count); #endif diff --git a/libstdc++-v3/testsuite/thread/pthread3.cc b/libstdc++-v3/testsuite/thread/pthread3.cc index 4696fb76cdc..23f4e04e180 100644 --- a/libstdc++-v3/testsuite/thread/pthread3.cc +++ b/libstdc++-v3/testsuite/thread/pthread3.cc @@ -45,7 +45,7 @@ main() { pthread_t tid[max_thread_count]; -#if defined(__sun) && defined(__svr4__) +#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500 pthread_setconcurrency (max_thread_count); #endif diff --git a/libstdc++-v3/testsuite/thread/pthread4.cc b/libstdc++-v3/testsuite/thread/pthread4.cc index a9ec9b84e38..b58445fb68e 100644 --- a/libstdc++-v3/testsuite/thread/pthread4.cc +++ b/libstdc++-v3/testsuite/thread/pthread4.cc @@ -98,7 +98,7 @@ template class __gnu_cxx::__mt_alloc >; int main (void) { -#if defined(__sun) && defined(__svr4__) +#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500 pthread_setconcurrency (2); #endif diff --git a/libstdc++-v3/testsuite/thread/pthread5.cc b/libstdc++-v3/testsuite/thread/pthread5.cc index 93f03a22761..30086d4584d 100644 --- a/libstdc++-v3/testsuite/thread/pthread5.cc +++ b/libstdc++-v3/testsuite/thread/pthread5.cc @@ -100,7 +100,7 @@ main () int ids[NTHREADS]; void* status; -#if defined(__sun) && defined(__svr4__) +#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500 pthread_setconcurrency (NTHREADS); #endif diff --git a/libstdc++-v3/testsuite/thread/pthread6.cc b/libstdc++-v3/testsuite/thread/pthread6.cc index ba8c341c3f8..44b2b897146 100644 --- a/libstdc++-v3/testsuite/thread/pthread6.cc +++ b/libstdc++-v3/testsuite/thread/pthread6.cc @@ -80,7 +80,7 @@ main (void) { pthread_t tid[max_thread_count]; -#if defined(__sun) && defined(__svr4__) +#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500 pthread_setconcurrency (max_thread_count); #endif diff --git a/libstdc++-v3/testsuite/thread/pthread7-rope.cc b/libstdc++-v3/testsuite/thread/pthread7-rope.cc index 307973c202d..3f5a338d086 100644 --- a/libstdc++-v3/testsuite/thread/pthread7-rope.cc +++ b/libstdc++-v3/testsuite/thread/pthread7-rope.cc @@ -68,7 +68,7 @@ main() pthread_t tid[max_thread_count]; -#if defined(__sun) && defined(__svr4__) +#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500 pthread_setconcurrency (max_thread_count); #endif diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_function/is_function.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_function/is_function.cc index 4bbda75280b..1c8d64dca4d 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_function/is_function.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_function/is_function.cc @@ -41,6 +41,7 @@ void test01() VERIFY( (test_category(false)) ); VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); // Sanity check. VERIFY( (test_category(false)) ); -- cgit v1.2.3