summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-05 22:25:29 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-05 22:25:29 +0000
commit7deddfded2d013c07a639873a4c90bfed40fd03e (patch)
tree3df2a52207fec5bec55c28303aa57a8bd9b4e620 /libstdc++-v3
parentc79b54af83c8031caac515081fb7c56a127b90e3 (diff)
downloadgcc-7deddfded2d013c07a639873a4c90bfed40fd03e.tar.gz
2010-11-05 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 166377 2010-11-05 Basile Starynkevitch <basile@starynkevitch.net> MELT branch merged with trunk rev 166377 * gcc/Makefile.in (MELT_RAW_CFLAGS): removed LIBELFINC git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@166380 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog503
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver11
-rw-r--r--libstdc++-v3/configure.host7
-rw-r--r--libstdc++-v3/doc/doxygen/user.cfg.in3
-rw-r--r--libstdc++-v3/doc/xml/manual/using.xml4
-rw-r--r--libstdc++-v3/include/Makefile.am44
-rw-r--r--libstdc++-v3/include/Makefile.in43
-rw-r--r--libstdc++-v3/include/bits/allocator.h2
-rw-r--r--libstdc++-v3/include/bits/atomic_0.h520
-rw-r--r--libstdc++-v3/include/bits/atomic_2.h548
-rw-r--r--libstdc++-v3/include/bits/atomic_base.h364
-rw-r--r--libstdc++-v3/include/bits/atomicfwd_c.h174
-rw-r--r--libstdc++-v3/include/bits/atomicfwd_cxx.h117
-rw-r--r--libstdc++-v3/include/bits/c++config149
-rw-r--r--libstdc++-v3/include/bits/char_traits.h70
-rw-r--r--libstdc++-v3/include/bits/hashtable.h295
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h25
-rw-r--r--libstdc++-v3/include/bits/ios_base.h59
-rw-r--r--libstdc++-v3/include/bits/random.h156
-rw-r--r--libstdc++-v3/include/bits/random.tcc56
-rw-r--r--libstdc++-v3/include/bits/regex.h27
-rw-r--r--libstdc++-v3/include/bits/regex_compiler.h7
-rw-r--r--libstdc++-v3/include/bits/regex_constants.h6
-rw-r--r--libstdc++-v3/include/bits/regex_cursor.h7
-rw-r--r--libstdc++-v3/include/bits/regex_error.h6
-rw-r--r--libstdc++-v3/include/bits/regex_grep_matcher.h8
-rw-r--r--libstdc++-v3/include/bits/regex_grep_matcher.tcc7
-rw-r--r--libstdc++-v3/include/bits/regex_nfa.h7
-rw-r--r--libstdc++-v3/include/bits/regex_nfa.tcc6
-rw-r--r--libstdc++-v3/include/bits/shared_ptr_base.h196
-rw-r--r--libstdc++-v3/include/bits/stl_function.h12
-rw-r--r--libstdc++-v3/include/bits/stl_iterator.h2
-rw-r--r--libstdc++-v3/include/bits/stl_pair.h7
-rw-r--r--libstdc++-v3/include/bits/stream_iterator.h4
-rw-r--r--libstdc++-v3/include/bits/streambuf_iterator.h4
-rw-r--r--libstdc++-v3/include/bits/unique_ptr.h153
-rw-r--r--libstdc++-v3/include/c_compatibility/fenv.h58
-rw-r--r--libstdc++-v3/include/c_compatibility/inttypes.h48
-rw-r--r--libstdc++-v3/include/c_compatibility/stdatomic.h37
-rw-r--r--libstdc++-v3/include/c_compatibility/stdint.h59
-rw-r--r--libstdc++-v3/include/c_global/cctype31
-rw-r--r--libstdc++-v3/include/c_global/cfenv60
-rw-r--r--libstdc++-v3/include/c_global/cinttypes51
-rw-r--r--libstdc++-v3/include/c_global/cmath824
-rw-r--r--libstdc++-v3/include/c_global/cstdint64
-rw-r--r--libstdc++-v3/include/c_global/cstdio19
-rw-r--r--libstdc++-v3/include/c_global/cstdlib47
-rw-r--r--libstdc++-v3/include/c_global/cwchar44
-rw-r--r--libstdc++-v3/include/c_global/cwctype33
-rw-r--r--libstdc++-v3/include/debug/unordered_map36
-rw-r--r--libstdc++-v3/include/debug/unordered_set24
-rw-r--r--libstdc++-v3/include/ext/numeric_traits.h4
-rw-r--r--libstdc++-v3/include/profile/unordered_map51
-rw-r--r--libstdc++-v3/include/profile/unordered_set40
-rw-r--r--libstdc++-v3/include/std/array244
-rw-r--r--libstdc++-v3/include/std/atomic760
-rw-r--r--libstdc++-v3/include/std/bitset104
-rw-r--r--libstdc++-v3/include/std/chrono676
-rw-r--r--libstdc++-v3/include/std/complex520
-rw-r--r--libstdc++-v3/include/std/condition_variable6
-rw-r--r--libstdc++-v3/include/std/functional7
-rw-r--r--libstdc++-v3/include/std/future43
-rw-r--r--libstdc++-v3/include/std/limits1991
-rw-r--r--libstdc++-v3/include/std/memory16
-rw-r--r--libstdc++-v3/include/std/mutex27
-rw-r--r--libstdc++-v3/include/std/ratio46
-rw-r--r--libstdc++-v3/include/std/thread6
-rw-r--r--libstdc++-v3/include/std/tuple19
-rw-r--r--libstdc++-v3/include/std/type_traits482
-rw-r--r--libstdc++-v3/include/std/typeindex7
-rw-r--r--libstdc++-v3/include/std/utility87
-rw-r--r--libstdc++-v3/include/tr1/array230
-rw-r--r--libstdc++-v3/include/tr1/cctype24
-rw-r--r--libstdc++-v3/include/tr1/cfenv56
-rw-r--r--libstdc++-v3/include/tr1/cinttypes47
-rw-r--r--libstdc++-v3/include/tr1/cmath981
-rw-r--r--libstdc++-v3/include/tr1/complex342
-rw-r--r--libstdc++-v3/include/tr1/cstdint62
-rw-r--r--libstdc++-v3/include/tr1/cstdio31
-rw-r--r--libstdc++-v3/include/tr1/cstdlib50
-rw-r--r--libstdc++-v3/include/tr1/cwchar45
-rw-r--r--libstdc++-v3/include/tr1/cwctype30
-rw-r--r--libstdc++-v3/include/tr1/memory20
-rw-r--r--libstdc++-v3/include/tr1/regex2692
-rw-r--r--libstdc++-v3/include/tr1/shared_ptr.h199
-rw-r--r--libstdc++-v3/include/tr1/type_traits497
-rw-r--r--libstdc++-v3/include/tr1/utility85
-rw-r--r--libstdc++-v3/include/tr1_impl/array291
-rw-r--r--libstdc++-v3/include/tr1_impl/boost_sp_counted_base.h254
-rw-r--r--libstdc++-v3/include/tr1_impl/cctype43
-rw-r--r--libstdc++-v3/include/tr1_impl/cfenv70
-rw-r--r--libstdc++-v3/include/tr1_impl/cinttypes64
-rw-r--r--libstdc++-v3/include/tr1_impl/cmath996
-rw-r--r--libstdc++-v3/include/tr1_impl/complex370
-rw-r--r--libstdc++-v3/include/tr1_impl/cstdint75
-rw-r--r--libstdc++-v3/include/tr1_impl/cstdio44
-rw-r--r--libstdc++-v3/include/tr1_impl/cstdlib65
-rw-r--r--libstdc++-v3/include/tr1_impl/cwchar58
-rw-r--r--libstdc++-v3/include/tr1_impl/cwctype43
-rw-r--r--libstdc++-v3/include/tr1_impl/regex2710
-rw-r--r--libstdc++-v3/include/tr1_impl/type_traits502
-rw-r--r--libstdc++-v3/include/tr1_impl/utility120
-rw-r--r--libstdc++-v3/libsupc++/initializer_list20
-rw-r--r--libstdc++-v3/python/libstdcxx/v6/printers.py5
-rw-r--r--libstdc++-v3/src/atomic.cc79
-rw-r--r--libstdc++-v3/src/chrono.cc7
-rw-r--r--libstdc++-v3/src/condition_variable.cc7
-rw-r--r--libstdc++-v3/src/future.cc10
-rw-r--r--libstdc++-v3/src/limits.cc4
-rw-r--r--libstdc++-v3/src/mutex.cc33
-rw-r--r--libstdc++-v3/src/thread.cc7
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc3
-rw-r--r--libstdc++-v3/testsuite/18_support/initializer_list/constexpr.cc (renamed from libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c)14
-rw-r--r--libstdc++-v3/testsuite/18_support/initializer_list/requirements/constexpr_functions.cc57
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits/cons/default.cc (renamed from libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c)14
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits/cons/default_c++0x.cc28
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_data.cc98
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_functions.cc70
-rw-r--r--libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/default_delete/cons/constexpr.cc29
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/cons/constexpr.cc33
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/constexpr_functions.cc64
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/duration_cast/constexpr.cc37
-rw-r--r--libstdc++-v3/testsuite/20_util/enable_shared_from_this/cons/constexpr.cc (renamed from libstdc++-v3/testsuite/29_atomics/atomic_flag/clear/1.c)25
-rw-r--r--libstdc++-v3/testsuite/20_util/hash/chi2_quality.cc10
-rw-r--r--libstdc++-v3/testsuite/20_util/hash/quality.cc30
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/pair/cons/constexpr.cc (renamed from libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c)19
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/requirements/constexpr_data.cc60
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/constexpr.cc33
-rw-r--r--libstdc++-v3/testsuite/20_util/time_point/cons/constexpr.cc37
-rw-r--r--libstdc++-v3/testsuite/20_util/time_point/requirements/constexpr_functions.cc59
-rw-r--r--libstdc++-v3/testsuite/20_util/time_point_cast/constexpr.cc39
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/cons/constexpr.cc29
-rw-r--r--libstdc++-v3/testsuite/20_util/unique_ptr/cons/constexpr.cc32
-rw-r--r--libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/20_util/weak_ptr/cons/constexpr.cc32
-rw-r--r--libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc74
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_functions.cc54
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc37
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/requirements/constexpr_functions.cc55
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax.cc21
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax_move.cc59
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-1.cc76
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-2.cc79
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-1.cc80
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-2.cc80
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_single_move.cc71
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/insert/set_single_move.cc69
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc29
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc29
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr.cc37
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/requirements/constexpr_functions.cc57
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_data.cc59
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_functions.cc59
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/constexpr_functions.cc62
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc59
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc55
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_data.cc79
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_functions.cc55
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_data.cc60
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_functions.cc62
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_data.cc59
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_functions.cc55
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc28
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc (renamed from libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c)14
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc28
-rw-r--r--libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc66
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc71
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/cons/constexpr.cc32
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_address/cons/constexpr.cc29
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc2
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/constexpr.cc31
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc85
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc3
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc94
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c114
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c77
-rw-r--r--libstdc++-v3/testsuite/30_threads/call_once/constexpr.cc31
-rw-r--r--libstdc++-v3/testsuite/30_threads/mutex/cons/constexpr.cc31
-rw-r--r--libstdc++-v3/testsuite/30_threads/once_flag/cons/constexpr.cc31
-rw-r--r--libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc2
-rw-r--r--libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc4
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_abi.cc1
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_common_types.h71
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_rvalref.h56
203 files changed, 15290 insertions, 9552 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 14e0b9f2f92..8ea46f0847d 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,506 @@
+2010-11-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/46303
+ * testsuite/30_threads/call_once/constexpr.cc: Add missing dg-require
+ directives.
+ * testsuite/30_threads/mutex/cons/constexpr.cc: Likewise.
+ * testsuite/30_threads/once_flag/cons/constexpr.cc: Likewise.
+
+2010-11-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/ratio (ratio_add, ratio_subtract, ratio_multiply,
+ ratio_divide): Declare the data members constexpr.
+ * testsuite/20_util/ratio/requirements/constexpr_data.cc: Extend.
+
+2010-11-03 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/std/tuple (tuple): Make default constructors constexpr.
+ * testsuite/20_util/tuple/cons/constexpr.cc: Add.
+
+ * testsuite/18_support/initializer_list/requirements/
+ constexpr_functions.cc: Add.
+ * testsuite/18_support/initializer_list/constexpr.cc: Add.
+
+2010-11-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/limits (__glibcxx_digits10, __glibcxx_max_digits10):
+ Use 643L instead of 643 to avoid overflows on 16-bit machines.
+ * include/ext/numeric_traits.h (__glibcxx_max_digits10): Likewise.
+
+2010-11-02 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/std/chrono: Use typedefs.
+ * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust
+ line numbers.
+ * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
+ * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
+ * testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
+
+2010-11-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/c_global/cmath (fpclassify, isfinite, isinf, isnan,
+ isnormal, signbit, isgreater, isgreaterequal, isless, islessequal,
+ islessgreater, isunordered): Remove spurious duplicate definition
+ added in the last commit.
+
+ * include/tr1/cmath: Remove tr1_impl leftover macro.
+
+2010-11-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/tr1_impl/cinttypes: Remove, move contents to C++0x
+ and TR1 headers.
+ * include/tr1_impl/cstdlib: Likewise.
+ * include/tr1_impl/cstdio: Likewise.
+ * include/tr1_impl/cctype: Likewise.
+ * include/tr1_impl/boost_sp_counted_base.h: Likewise.
+ * include/tr1_impl/cmath: Likewise.
+ * include/tr1_impl/cfenv: Likewise.
+ * include/tr1_impl/utility: Likewise.
+ * include/tr1_impl/complex: Likewise.
+ * include/tr1_impl/cwchar: Likewise.
+ * include/tr1_impl/type_traits: Likewise.
+ * include/tr1_impl/cstdint: Likewise.
+ * include/tr1_impl/regex: Likewise.
+ * include/tr1_impl/array: Likewise.
+ * include/tr1_impl/cwctype: Likewise.
+ * include/Makefile.am: Adjust.
+ * include/Makefile.in: Regenerate.
+ * src/condition_variable.cc: Adjust; consistently use
+ _GLIBCXX_BEGIN_NAMESPACE and _GLIBCXX_END_NAMESPACE.
+ * src/mutex.cc: Likewise.
+ * src/future.cc: Likewise.
+ * src/atomic.cc: Likewise.
+ * src/chrono.cc: Likewise.
+ * src/thread.cc: Likewise.
+ * include/std/tuple: Likewise.
+ * include/std/utility: Likewise.
+ * include/std/thread: Likewise.: Likewise.
+ * include/std/type_traits: Likewise.
+ * include/std/memory: Likewise.
+ * include/std/future: Likewise.
+ * include/std/ratio: Likewise.
+ * include/std/chrono: Likewise.
+ * include/std/condition_variable: Likewise.
+ * include/std/mutex: Likewise.
+ * include/std/functional: Likewise.
+ * include/std/complex: Likewise.
+ * include/std/typeindex: Likewise.
+ * include/std/array: Likewise.
+ * include/bits/regex_compiler.h: Likewise.
+ * include/bits/regex_grep_matcher.tcc: Likewise.
+ * include/bits/regex_grep_matcher.h: Likewise.
+ * include/bits/regex_constants.h: Likewise.
+ * include/bits/regex_cursor.h: Likewise.
+ * include/bits/regex_nfa.tcc: Likewise.
+ * include/bits/shared_ptr_base.h: Likewise.
+ * include/bits/regex_nfa.h: Likewise.
+ * include/bits/random.tcc: Likewise.
+ * include/bits/regex.h: Likewise.
+ * include/bits/random.h: Likewise.
+ * include/bits/regex_error.h: Likewise.
+ * include/c_global/cinttypes: Likewise.
+ * include/c_global/cstdlib: Likewise.
+ * include/c_global/cstdio: Likewise.
+ * include/c_global/cctype: Likewise.
+ * include/c_global/cmath: Likewise.
+ * include/c_global/cfenv: Likewise.
+ * include/c_global/cwchar: Likewise.
+ * include/c_global/cstdint: Likewise.
+ * include/c_global/cwctype: Likewise.
+ * include/tr1/shared_ptr.h: Likewise.
+ * include/tr1/cinttypes: Likewise.
+ * include/tr1/cstdio: Likewise.
+ * include/tr1/cfenv: Likewise.
+ * include/tr1/utility: Likewise.
+ * include/tr1/cwchar: Likewise.
+ * include/tr1/type_traits: Likewise.
+ * include/tr1/memory: Likewise.
+ * include/tr1/cstdint: Likewise.
+ * include/tr1/regex: Likewise.
+ * include/tr1/cwctype: Likewise.
+ * include/tr1/cstdlib: Likewise.
+ * include/tr1/cctype: Likewise.
+ * include/tr1/cmath: Likewise.
+ * include/tr1/complex: Likewise.
+ * include/tr1/array: Likewise.
+ * include/c_compatibility/fenv.h: Likewise.
+ * include/c_compatibility/stdint.h: Likewise.
+ * include/c_compatibility/inttypes.h: Likewise.
+ * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc: Adjust
+ dg-error line numbers.
+ * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
+ * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
+ * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
+ * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise.
+ * testsuite/20_util/make_unsigned/requirements/
+ typedefs_neg.cc: Likewise.
+ * testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
+ * testsuite/20_util/shared_ptr/cons/43820.cc: Likewise.
+ * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise.
+
+2010-11-02 Paolo Carlini <paolo.carlini@oracle.com
+
+ * testsuite/28_regex/05_constants/syntax_option_type.cc: Avoid
+ -Wall warnings.
+ * testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc:
+ Likewise.
+ * testsuite/18_support/numeric_limits/requirements/
+ constexpr_functions.cc: Likewise.
+ * testsuite/18_support/numeric_limits/requirements/
+ constexpr_data.cc: Likewise.
+ * testsuite/21_strings/char_traits/requirements/
+ constexpr_functions.cc: Likewise.
+ * testsuite/26_numerics/random/independent_bits_engine/requirements/
+ constexpr_functions.cc: Likewise.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/
+ requirements/constexpr_functions.cc: Likewise.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/
+ requirements/constexpr_data.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/requirements/
+ constexpr_functions.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/requirements/
+ constexpr_data.cc: Likewise.
+ * testsuite/26_numerics/random/mersenne_twister_engine/
+ requirements/constexpr_functions.cc: Likewise.
+ * testsuite/26_numerics/random/mersenne_twister_engine/
+ requirements/constexpr_data.cc: Likewise.
+ * testsuite/26_numerics/random/linear_congruential_engine/
+ requirements/constexpr_functions.cc: Likewise.
+ * testsuite/26_numerics/random/linear_congruential_engine/
+ requirements/constexpr_data.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/
+ requirements/constexpr_functions.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/
+ requirements/constexpr_data.cc: Likewise.
+ * testsuite/26_numerics/complex/requirements/
+ constexpr_functions.cc: Likewise.
+ * testsuite/23_containers/bitset/requirements/
+ constexpr_functions.cc: Likewise.
+ * testsuite/23_containers/array/requirements/
+ constexpr_functions.cc: Likewise.
+ * testsuite/util/testsuite_common_types.h: Likewise.
+ * testsuite/20_util/duration/requirements/
+ constexpr_functions.cc: Likewise.
+ * testsuite/20_util/duration_cast/constexpr.cc: Likewise.
+ * testsuite/20_util/time_point/requirements/
+ constexpr_functions.cc: Likewise.
+ * testsuite/20_util/ratio/requirements/constexpr_data.cc: Likewise.
+
+ * testsuite/tr1/4_metaprogramming/integral_constant/
+ requirements/constexpr_data.cc: Remove.
+
+2010-11-02 Jason Merrill <jason@redhat.com>
+
+ * include/bits/atomic_0.h (_ATOMIC_CMPEXCHNG_): Use C-style cast.
+
+2010-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR target/45693
+ * configure.host (osf*): Set os_include_dir to os/generic.
+ Add -lpthread to OPT_LDFLAGS.
+
+2010-11-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/bitset (_Base_bitset<>_Base_bitset(unsigned long long)):
+ Convert __val to _WordT.
+
+2010-11-01 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/std/chrono: Extend constexpr application.
+ * testsuite/util/testsuite_common_types.h
+ (constexpr_default_constructible, constexpr_single_value_constructible)
+ : Add comments about implied constraints.
+ * testsuite/20_util/duration/cons/constexpr.cc: Activate all tests.
+ * testsuite/20_util/time_point/cons/constexpr.cc: Same.
+ * testsuite/20_util/time_point/requirements/constexpr_functions.cc:
+ Same.
+ * testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust line
+ numbers.
+ * testsuite/20_util/time_point_cast/constexpr.cc: New.
+
+ * include/std/bitset: Use __SIZEOF_* macros to re-create original
+ logic instead of slipshod application of
+ std::numeric_limits<T>::max() macros.
+ * testsuite/util/testsuite_common_types.h
+ (constexpr_default_constructible): Modify.
+
+ * include/std/chrono: Tested constexpr.
+ * testsuite/20_util/duration_cast/constexpr.cc: New.
+ * testsuite/20_util/time_point/cons/constexpr.cc: New.
+
+ * testsuite/20_util/duration/cons/constexpr.cc: Add single_value tests.
+ * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust
+ line numbers.
+ * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
+ * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
+ * testsuite/20_util/time_point/cons/constexpr.cc: Add single_value
+ tests.
+ * testsuite/20_util/time_point/requirements/constexpr_functions.cc: Add.
+
+ * testsuite/util/testsuite_common_types.h: Adjust init.
+
+ * include/std/chrono (duration): Remove defaulted constructor,
+ replace with mem-init list.
+ * testsuite/20_util/duration/cons/constexpr.cc: Add single value.
+ * testsuite/20_util/duration/requirements/constexpr_functions.cc:
+ Add non-static member functions.
+
+ * testsuite/20_util/default_delete/cons/constexpr.cc: New, xfail.
+ * testsuite/20_util/enable_shared_from_this/cons/constexpr.cc: Same.
+ * testsuite/20_util/shared_ptr/cons/constexpr.cc: Same.
+ * testsuite/20_util/time_point/requirements/constexpr_functions.cc:
+ Same.
+ * testsuite/20_util/unique_ptr/cons/constexpr.cc: Same.
+ * testsuite/20_util/weak_ptr/cons/constexpr.cc: Same.
+
+ * include/std/bitset: Add constexpr as per N3126 draft.
+ * testsuite/23_containers/bitset/cons/constexpr.cc: New.
+ * testsuite/23_containers/bitset/requirements/constexpr_functions.cc:
+ New.
+
+ * testsuite/util/testsuite_common_types.h: Reset condition.
+
+ * include/bits/random.h: Remove misleading comments.
+ * include/bits/regex.h: Add constexpr.
+ * testsuite/28_regex/05_constants/syntax_option_type.cc: Add tests.
+ * testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc: New.
+
+ PR libstdc++/46134
+ * include/std/chrono: Use default constructor.
+ * testsuite/util/testsuite_common_types.h
+ (constexpr_default_constructible): Adjust condition.
+
+ PR libstdc++/46133
+ * include/std/complex: Adjust complex specialization default
+ constructors for constexpr.
+ * testsuite/26_numerics/complex/cons/constexpr.cc: Enable tests.
+
+ * include/bits/random.h: Adjust for constexpr as per N3126 draft.
+ * testsuite/26_numerics/random/discard_block_engine/requirements/
+ constexpr_data.cc: New.
+ * testsuite/26_numerics/random/discard_block_engine/requirements/
+ constexpr_functions.cc: New.
+ * testsuite/26_numerics/random/independent_bits_engine/requirements/
+ constexpr_functions.cc: New.
+ * testsuite/26_numerics/random/linear_congruential_engine/requirements/
+ constexpr_data.cc: New.
+ * testsuite/26_numerics/random/linear_congruential_engine/requirements/
+ constexpr_functions.cc: New.
+ * testsuite/26_numerics/random/mersenne_twister_engine/requirements/
+ constexpr_data.cc: New.
+ * testsuite/26_numerics/random/mersenne_twister_engine/requirements/
+ constexpr_functions.cc: New.
+ * testsuite/26_numerics/random/shuffle_order_engine/requirements/
+ constexpr_data.cc: New.
+ * testsuite/26_numerics/random/shuffle_order_engine/requirements/
+ constexpr_functions.cc: New.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
+ constexpr_data.cc: New.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
+ constexpr_functions.cc: New.
+
+ * include/bits/stream_iterator.h: Add constexpr as per N3126 draft.
+ * include/bits/streambuf_iterator.h: Same.
+ * include/std/complex: Same.
+ * testsuite/24_iterators/istream_iterator/cons/constexpr.cc: New.
+ * testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc: New.
+ * testsuite/26_numerics/complex/cons/constexpr.cc: New.
+ * testsuite/26_numerics/complex/requirements/constexpr_functions.cc:
+ New.
+
+ * include/bits/char_traits.h: Add constexpr as per N3126 draft.
+ * testsuite/21_strings/char_traits/requirements/constexpr_functions.cc:
+ New.
+
+ * include/tr1_impl/array: Add constexpr as per N3126 draft.
+ * testsuite/23_containers/array/requirements/
+ constexpr_functions.cc: New.
+
+ * include/bits/shared_ptr.h: Revert changes.
+ * include/bits/unique_ptr.h: Same.
+
+ * include/std/chrono: Adjust.
+ * include/tr1_impl/type_traits: Same.
+
+ * testsuite/util/testsuite_common_types.h: Add test functors.
+ * testsuite/20_util/duration/cons/constexpr.cc: New.
+ * testsuite/20_util/duration/requirements/constexpr_functions.cc: Same.
+ * testsuite/20_util/pair/cons/constexpr.cc: Same.
+ * testsuite/20_util/ratio/requirements/constexpr_data.cc: Same.
+ * testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc: Same.
+ * testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc: Same.
+ * testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc: Same.
+ * testsuite/30_threads/call_once/constexpr.cc: Same.
+ * testsuite/30_threads/mutex/cons/constexpr.cc: Same.
+ * testsuite/30_threads/once_flag/cons/constexpr.cc: Same.
+ * testsuite/tr1/4_metaprogramming/integral_constant/requirements/
+ constexpr_data.cc: Same.
+
+ * testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust line numbers.
+ * testsuite/29_atomics/atomic/cons/copy_neg.cc: Same.
+ * testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Same.
+ * testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Same.
+ * testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: Same.
+
+ * include/bits/allocator.h: Add constexpr as per N3126 draft.
+ * include/bits/ios_base.h: Same.
+ * include/bits/shared_ptr.h: Same.
+ * include/bits/unique_ptr.h: Same.
+ * include/bits/stl_iterator.h: Same.
+ * include/bits/stl_pair.h: Same.
+ * include/std/tuple: Same.
+ * include/tr1_impl/type_traits: Same.
+ * include/std/chrono: Same.
+ * include/std/ratio: Same.
+ * include/std/mutex: Same.
+ * src/mutex.cc: Same.
+ * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust.
+ * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
+ * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
+ * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
+ * testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
+ * testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
+
+ * doc/doxygen/user.cfg.in: Replace _GLIBCXX_USE_CONSTEXPR,
+ _GLIBCXX_CONSTEXPR for doxygen generation.
+
+ * src/limits.cc: Undef.
+ * testsuite/29_atomics/atomic/cons/constexpr.cc: Adjust.
+ * testsuite/29_atomics/atomic_address/cons/constexpr.cc: Same.
+ * testsuite/29_atomics/atomic_integral/cons/constexpr.cc: Same.
+ * testsuite/29_atomics/atomic_integral/operators/bitwise_neg.c: Same.
+ * testsuite/18_support/numeric_limits/constexpr.cc: To...
+ * testsuite/18_support/numeric_limits/requirements/
+ constexpr_data.cc, constexpr_functions.cc: ...this
+
+ * testsuite/util/testsuite_common_types.h
+ (constexpr_single_value_constructible): Add.
+ * testsuite/29_atomics/atomic/cons/constexpr.cc: Adjust name.
+ * testsuite/29_atomics/atomic_integral/cons/constexpr.cc: Same.
+ * testsuite/29_atomics/atomic_address/cons/constexpr.cc: New.
+ * testsuite/18_support/numeric_limits/constexpr.cc: New.
+
+ * testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust line numbers.
+ * testsuite/29_atomics/atomic/cons/constexpr.cc: Same.
+ * testsuite/29_atomics/atomic/cons/copy_neg.cc: Same.
+ * testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Same.
+ * testsuite/29_atomics/atomic_integral/cons/constexpr.cc: Same.
+ * testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Same.
+ * testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: Same.
+ * testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc: Same.
+ * testsuite/29_atomics/atomic_integral/operators/increment_neg.cc: Same.
+
+ * include/bits/c++config (_GLIBCXX_CONSTEXPR): Add.
+ (_GLIBCXX_USE_CONSTEXPR): Add.
+ * include/std/limits: Use it.
+ * src/limits.cc: Adjust.
+ * testsuite/ext/profile/mutex_extensions.cc: Change line number.
+
+ * include/bits/atomic_0.h: Rework for N3126 draft, add constexpr.
+ * include/bits/atomic_2.h: Same.
+ * include/bits/atomic_base.h: Same.
+ * include/std/atomic: Same.
+ * src/atomic.cc: Same.
+ * include/bits/atomicfwd_c.h: Remove.
+ * include/bits/atomicfwd_cxx.h: Remove.
+ * include/c_compatibility/stdatomic.h: Remove.
+ * include/Makefile.am: Remove atomicfwd_c.h, atomicfwd_cxx.h,
+ stdatomic.h.
+ * include/Makefile.in: Regenerate.
+ * doc/xml/manual/using.xml: Update list of header files for changes.
+ * testsuite/util/testsuite_common_types.h
+ (constexpr_constructible): Add.
+ * testsuite/29_atomics/atomic/cons/constexpr.cc: New.
+ * testsuite/29_atomics/atomic_integral/cons/constexpr.cc: New.
+ * testsuite/17_intro/headers/c++200x/stdc++.cc: Modify.
+ * testsuite/29_atomics/atomic/cons/assign_neg.cc: Same.
+ * testsuite/29_atomics/atomic_address/cons/assign_neg.cc: Same.
+ * testsuite/29_atomics/atomic_flag/cons/1.cc: Same.
+ * testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Same.
+ * testsuite/29_atomics/headers/atomic/macros.cc: Same.
+ * testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Same.
+ * testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc: Same.
+ * testsuite/29_atomics/atomic_flag/test_and_set/implicit.c: Remove.
+ * testsuite/29_atomics/atomic_flag/test_and_set/explicit.c: Same.
+ * testsuite/29_atomics/atomic_flag/clear/1.c: Same.
+ * testsuite/29_atomics/headers/stdatomic.h/debug_mode.c: Same.
+ * testsuite/29_atomics/headers/stdatomic.h/functions.c: Same.
+ * testsuite/29_atomics/headers/stdatomic.h/macros.c: Same.
+ * testsuite/29_atomics/headers/stdatomic.h/types.c: Same.
+
+ * testsuite/util/testsuite_abi.cc: Add GLIBCXX_3.4.16.
+
+2010-11-01 Jason Merrill <jason@redhat.com>
+
+ * libsupc++/initializer_list: Decorate with constexpr.
+
+2010-11-01 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/45999
+ * python/libstdcxx/v6/printers.py (StdVectorPrinter): Replace
+ conditional expression with backward-compatible if-else.
+
+2010-11-01 Jie Zhang <jie@codesourcery.com>
+
+ * config/abi/pre/gnu.ver: Export __emutls_v._ZSt11__once_call
+ and __emutls_v._ZSt15__once_callable.
+
+2010-10-31 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/23_containers/bitset/cons/dr1325-2.cc: Fix typo.
+ * testsuite/20_util/hash/quality.cc: Avoid -Wall warnings.
+ * testsuite/20_util/hash/chi2_quality.cc: Likewise.
+
+2010-10-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/stl_function.h (_Select1st<>::operator()): Add
+ templatized overloads.
+ * include/bits/hashtable_policy.h (_Select1st): Remove; revert
+ everything to std::_Select1st.
+ * include/bits/unordered_map.h: Likewise.
+
+2010-10-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/44436 (partial)
+ * include/bits/hashtable.h (_Hashtable<>::insert(value_type&&),
+ insert(_Pair&&), insert(const_iterator, value_type&&),
+ insert(const_iterator, _Pair&&)): Add.
+ (_M_allocate_node, _M_insert, _M_insert_bucket): Templatize.
+ * include/bits/hashtable_policy.h (__detail::_Select1st): Add; use
+ it throughout.
+ (_Map_base<>::operator[](_Key&&)): Add.
+ * include/bits/unordered_map.h: Use __detail::_Select1st throughout.
+ * include/debug/unordered_map: Update.
+ * include/debug/unordered_set: Likewise.
+ * include/profile/unordered_map: Likewise.
+ * include/profile/unordered_set: Likewise.
+ * testsuite/util/testsuite_rvalref.h (struct hash<rvalstruct>): Add;
+ minor tweaks throughout, use deleted special members.
+ * testsuite/23_containers/unordered_map/insert/map_single_move-1.cc:
+ New.
+ * testsuite/23_containers/unordered_map/insert/map_single_move-2.cc:
+ Likewise.
+ * testsuite/23_containers/unordered_map/insert/array_syntax_move.cc:
+ Likewise.
+ * testsuite/23_containers/unordered_multimap/insert/
+ multimap_single_move-1.cc: Likewise.
+ * testsuite/23_containers/unordered_multimap/insert/
+ multimap_single_move-2.cc: Likewise.
+ * testsuite/23_containers/unordered_set/insert/set_single_move.cc:
+ Likewise.
+ * testsuite/23_containers/unordered_multiset/insert/
+ multiset_single_move.cc: Likewise.
+
+ * testsuite/23_containers/unordered_map/insert/array_syntax.cc:
+ Minor cosmetic changes.
+
+2010-10-27 Jason Merrill <jason@redhat.com>
+
+ * include/std/type_traits (is_literal_type): New.
+ * testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
+ * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust.
+ * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Adjust.
+
2010-10-26 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/lib/libstdc++.exp ([check_v3_target_normal_mode]): Add.
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 4981ca90740..eec63a016da 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1187,8 +1187,19 @@ GLIBCXX_3.4.15 {
# basic_filebuf::_M_get_ext_pos
_ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE14_M_get_ext_pos*;
+ # targets using emutls
+ __emutls_v._ZSt11__once_call;
+ __emutls_v._ZSt15__once_callable;
+
} GLIBCXX_3.4.14;
+GLIBCXX_3.4.16 {
+
+ # std::future_category is now a function
+ _ZSt15future_categoryv;
+
+} GLIBCXX_3.4.15;
+
# Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.3 {
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index 30b28dcd9f6..73cf2162cbc 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -261,6 +261,13 @@ case "${host_os}" in
netbsd*)
os_include_dir="os/bsd/netbsd"
;;
+ osf*)
+ os_include_dir="os/generic"
+ # libstdc++.so relies on emutls on Tru64 UNIX, which only works with the
+ # real functions implemented in libpthread.so, not with the dummies in
+ # libgcc, so always pass -lpthread.
+ OPT_LDFLAGS="${OPT_LDFLAGS} -lpthread"
+ ;;
qnx6.[12]*)
os_include_dir="os/qnx/qnx6.1"
c_model=c
diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in
index c9e86a51884..8550aa54bf1 100644
--- a/libstdc++-v3/doc/doxygen/user.cfg.in
+++ b/libstdc++-v3/doc/doxygen/user.cfg.in
@@ -599,6 +599,7 @@ INPUT = @srcdir@/doc/doxygen/doxygroups.cc \
include/complex \
include/condition_variable \
include/deque \
+ include/forward_list \
include/fstream \
include/functional \
include/future \
@@ -1539,6 +1540,8 @@ PREDEFINED = __cplusplus \
_GLIBCXX_END_NESTED_NAMESPACE=} \
"_GLIBCXX_TEMPLATE_ARGS=... " \
_GLIBCXX_DEPRECATED \
+ _GLIBCXX_CONSTEXPR=constexpr \
+ _GLIBCXX_USE_CONSTEXPR=constexpr \
_GLIBCXX_USE_WCHAR_T \
_GLIBCXX_USE_LONG_LONG \
_GLIBCXX_USE_C99_STDINT_TR1 \
diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml
index e3400a678c1..6e3123e11b1 100644
--- a/libstdc++-v3/doc/xml/manual/using.xml
+++ b/libstdc++-v3/doc/xml/manual/using.xml
@@ -354,10 +354,6 @@ mode, i.e. <literal>-std=c++0x</literal> or <literal>-std=gnu++0x</literal>.
<entry><filename class="headerfile">cwchar</filename></entry>
<entry><filename class="headerfile">cwctype</filename></entry>
</row>
-<row>
-<entry><filename class="headerfile">stdatomic.h</filename></entry>
-</row>
-
</tbody>
</tgroup>
</table>
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 8093425c06b..3fb1876fb47 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -1,4 +1,4 @@
-#o# Makefile for the include subdirectory of the GNU C++ Standard library.
+## Makefile for the include subdirectory of the GNU C++ Standard library.
##
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
## Free Software Foundation, Inc.
@@ -80,8 +80,6 @@ bits_headers = \
${bits_srcdir}/algorithmfwd.h \
${bits_srcdir}/allocator.h \
${bits_srcdir}/atomic_base.h \
- ${bits_srcdir}/atomicfwd_c.h \
- ${bits_srcdir}/atomicfwd_cxx.h \
${bits_srcdir}/atomic_0.h \
${bits_srcdir}/atomic_2.h \
${bits_srcdir}/basic_ios.h \
@@ -612,26 +610,6 @@ tr1_headers = \
${tr1_srcdir}/wchar.h \
${tr1_srcdir}/wctype.h
-
-tr1_impl_srcdir = ${glibcxx_srcdir}/include/tr1_impl
-tr1_impl_builddir = ./tr1_impl
-tr1_impl_headers = \
- ${tr1_impl_srcdir}/array \
- ${tr1_impl_srcdir}/boost_sp_counted_base.h \
- ${tr1_impl_srcdir}/cctype \
- ${tr1_impl_srcdir}/cfenv \
- ${tr1_impl_srcdir}/cinttypes \
- ${tr1_impl_srcdir}/cmath \
- ${tr1_impl_srcdir}/complex \
- ${tr1_impl_srcdir}/cstdint \
- ${tr1_impl_srcdir}/cstdio \
- ${tr1_impl_srcdir}/cstdlib \
- ${tr1_impl_srcdir}/cwchar \
- ${tr1_impl_srcdir}/cwctype \
- ${tr1_impl_srcdir}/regex \
- ${tr1_impl_srcdir}/type_traits \
- ${tr1_impl_srcdir}/utility
-
decimal_srcdir = ${glibcxx_srcdir}/include/decimal
decimal_builddir = ./decimal
decimal_headers = \
@@ -679,8 +657,7 @@ if GLIBCXX_C_HEADERS_C_GLOBAL
c_compatibility_headers = \
${c_compatibility_srcdir}/complex.h \
${c_compatibility_srcdir}/fenv.h \
- ${c_compatibility_srcdir}/tgmath.h \
- ${c_compatibility_srcdir}/stdatomic.h
+ ${c_compatibility_srcdir}/tgmath.h
endif
if GLIBCXX_C_HEADERS_C
@@ -911,9 +888,9 @@ endif
# CLEANFILES and all-local are kept up-to-date.
allstamped = \
stamp-std stamp-bits stamp-c_base stamp-c_compatibility \
- stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-tr1-impl \
- stamp-decimal stamp-debug stamp-parallel stamp-profile \
- stamp-profile-impl stamp-host
+ stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-decimal \
+ stamp-debug stamp-parallel stamp-profile stamp-profile-impl \
+ stamp-host
# List of all files that are created by explicit building, editing, or
# catenation.
@@ -1022,11 +999,6 @@ stamp-tr1: ${tr1_headers}
@-cd ${tr1_builddir} && $(LN_S) $? . 2>/dev/null
@$(STAMP) stamp-tr1
-stamp-tr1-impl: ${tr1_impl_headers}
- @-mkdir -p ${tr1_impl_builddir}
- @-cd ${tr1_impl_builddir} && $(LN_S) $? . 2>/dev/null
- @$(STAMP) stamp-tr1-impl
-
stamp-decimal: ${decimal_headers}
@-mkdir -p ${decimal_builddir}
@-cd ${decimal_builddir} && $(LN_S) $? . 2>/dev/null
@@ -1257,9 +1229,6 @@ install-headers:
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_builddir}
for file in ${tr1_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done
- $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}
- for file in ${tr1_impl_headers}; do \
- $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}; done
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${decimal_builddir}
for file in ${decimal_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${decimal_builddir}; done
@@ -1306,11 +1275,10 @@ clean-local:
# developer tries to create them via make in the include build
# directory. (This is more of an example of how this kind of rule can
# be made.)
-.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(tr1_impl_headers)
+.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers)
$(decimal_headers) $(ext_headers)
$(std_headers): ; @:
$(c_base_headers): ; @:
$(tr1_headers): ; @:
-$(tr1_impl_headers): ; @:
$(decimal_headers): ; @:
$(ext_headers): ; @:
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 256bac6e437..82cdd922049 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -14,8 +14,6 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
-
-#o# Makefile for the include subdirectory of the GNU C++ Standard library.
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@@ -322,8 +320,6 @@ bits_headers = \
${bits_srcdir}/algorithmfwd.h \
${bits_srcdir}/allocator.h \
${bits_srcdir}/atomic_base.h \
- ${bits_srcdir}/atomicfwd_c.h \
- ${bits_srcdir}/atomicfwd_cxx.h \
${bits_srcdir}/atomic_0.h \
${bits_srcdir}/atomic_2.h \
${bits_srcdir}/basic_ios.h \
@@ -852,25 +848,6 @@ tr1_headers = \
${tr1_srcdir}/wchar.h \
${tr1_srcdir}/wctype.h
-tr1_impl_srcdir = ${glibcxx_srcdir}/include/tr1_impl
-tr1_impl_builddir = ./tr1_impl
-tr1_impl_headers = \
- ${tr1_impl_srcdir}/array \
- ${tr1_impl_srcdir}/boost_sp_counted_base.h \
- ${tr1_impl_srcdir}/cctype \
- ${tr1_impl_srcdir}/cfenv \
- ${tr1_impl_srcdir}/cinttypes \
- ${tr1_impl_srcdir}/cmath \
- ${tr1_impl_srcdir}/complex \
- ${tr1_impl_srcdir}/cstdint \
- ${tr1_impl_srcdir}/cstdio \
- ${tr1_impl_srcdir}/cstdlib \
- ${tr1_impl_srcdir}/cwchar \
- ${tr1_impl_srcdir}/cwctype \
- ${tr1_impl_srcdir}/regex \
- ${tr1_impl_srcdir}/type_traits \
- ${tr1_impl_srcdir}/utility
-
decimal_srcdir = ${glibcxx_srcdir}/include/decimal
decimal_builddir = ./decimal
decimal_headers = \
@@ -914,8 +891,7 @@ c_compatibility_builddir = .
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@c_compatibility_headers = \
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/complex.h \
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/fenv.h \
-@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/tgmath.h \
-@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/stdatomic.h
+@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/tgmath.h
@GLIBCXX_C_HEADERS_C_STD_TRUE@c_compatibility_headers =
@GLIBCXX_C_HEADERS_C_TRUE@c_compatibility_headers = \
@@ -1138,9 +1114,9 @@ PCHFLAGS = -x c++-header -nostdinc++ $(CXXFLAGS)
# CLEANFILES and all-local are kept up-to-date.
allstamped = \
stamp-std stamp-bits stamp-c_base stamp-c_compatibility \
- stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-tr1-impl \
- stamp-decimal stamp-debug stamp-parallel stamp-profile \
- stamp-profile-impl stamp-host
+ stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-decimal \
+ stamp-debug stamp-parallel stamp-profile stamp-profile-impl \
+ stamp-host
# List of all files that are created by explicit building, editing, or
@@ -1411,11 +1387,6 @@ stamp-tr1: ${tr1_headers}
@-cd ${tr1_builddir} && $(LN_S) $? . 2>/dev/null
@$(STAMP) stamp-tr1
-stamp-tr1-impl: ${tr1_impl_headers}
- @-mkdir -p ${tr1_impl_builddir}
- @-cd ${tr1_impl_builddir} && $(LN_S) $? . 2>/dev/null
- @$(STAMP) stamp-tr1-impl
-
stamp-decimal: ${decimal_headers}
@-mkdir -p ${decimal_builddir}
@-cd ${decimal_builddir} && $(LN_S) $? . 2>/dev/null
@@ -1634,9 +1605,6 @@ install-headers:
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_builddir}
for file in ${tr1_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done
- $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}
- for file in ${tr1_impl_headers}; do \
- $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}; done
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${decimal_builddir}
for file in ${decimal_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${decimal_builddir}; done
@@ -1680,12 +1648,11 @@ clean-local:
# developer tries to create them via make in the include build
# directory. (This is more of an example of how this kind of rule can
# be made.)
-.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(tr1_impl_headers)
+.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers)
$(decimal_headers) $(ext_headers)
$(std_headers): ; @:
$(c_base_headers): ; @:
$(tr1_headers): ; @:
-$(tr1_impl_headers): ; @:
$(decimal_headers): ; @:
$(ext_headers): ; @:
diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h
index e73ab7ea5cd..70327acd25b 100644
--- a/libstdc++-v3/include/bits/allocator.h
+++ b/libstdc++-v3/include/bits/allocator.h
@@ -208,7 +208,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
/// [allocator.tag]
struct allocator_arg_t { };
- static const allocator_arg_t allocator_arg = allocator_arg_t();
+ constexpr allocator_arg_t allocator_arg = allocator_arg_t();
_GLIBCXX_HAS_NESTED_TYPE(allocator_type)
diff --git a/libstdc++-v3/include/bits/atomic_0.h b/libstdc++-v3/include/bits/atomic_0.h
index a39de4a7926..8daf4160bad 100644
--- a/libstdc++-v3/include/bits/atomic_0.h
+++ b/libstdc++-v3/include/bits/atomic_0.h
@@ -1,6 +1,6 @@
// -*- C++ -*- header.
-// Copyright (C) 2008, 2009
+// Copyright (C) 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,24 +33,42 @@
#pragma GCC system_header
-// _GLIBCXX_BEGIN_NAMESPACE(std)
+_GLIBCXX_BEGIN_NAMESPACE(std)
- // 0 == __atomic0 == Never lock-free
+// 0 == __atomic0 == Never lock-free
namespace __atomic0
{
- struct atomic_flag;
+ _GLIBCXX_BEGIN_EXTERN_C
+
+ void
+ atomic_flag_clear_explicit(__atomic_flag_base*, memory_order)
+ _GLIBCXX_NOTHROW;
+
+ void
+ __atomic_flag_wait_explicit(__atomic_flag_base*, memory_order)
+ _GLIBCXX_NOTHROW;
+
+ _GLIBCXX_CONST __atomic_flag_base*
+ __atomic_flag_for_address(const volatile void* __z) _GLIBCXX_NOTHROW;
+
+ _GLIBCXX_END_EXTERN_C
+
+ // Implementation specific defines.
+#define _ATOMIC_MEMBER_ _M_i
// Implementation specific defines.
#define _ATOMIC_LOAD_(__a, __x) \
- ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
+ __i_type* __p = &_ATOMIC_MEMBER_; \
__atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
- __typeof__ _ATOMIC_MEMBER_ __r = *__p; \
+ __i_type __r = *__p; \
atomic_flag_clear_explicit(__g, __x); \
__r; })
#define _ATOMIC_STORE_(__a, __m, __x) \
- ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
+ __i_type* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \
__atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
@@ -59,34 +77,42 @@ namespace __atomic0
__v; })
#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \
- ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
+ __i_type* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \
__atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
- __typeof__ _ATOMIC_MEMBER_ __r = *__p; \
+ __i_type __r = *__p; \
*__p __o __v; \
atomic_flag_clear_explicit(__g, __x); \
__r; })
#define _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x) \
- ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
+ __i_type* __p = &_ATOMIC_MEMBER_; \
__typeof__(__e) __q = (__e); \
__typeof__(__m) __v = (__m); \
bool __r; \
__atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
- __typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \
- if (__t__ == *__q) { *__p = __v; __r = true; } \
- else { *__q = __t__; __r = false; } \
+ __i_type __t = *__p; \
+ if (*__q == __t) \
+ { \
+ *__p = (__i_type)__v; \
+ __r = true; \
+ } \
+ else { *__q = __t; __r = false; } \
atomic_flag_clear_explicit(__g, __x); \
__r; })
+
/// atomic_flag
struct atomic_flag : public __atomic_flag_base
{
atomic_flag() = default;
~atomic_flag() = default;
atomic_flag(const atomic_flag&) = delete;
+ atomic_flag& operator=(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) volatile = delete;
// Conversion to ATOMIC_FLAG_INIT.
@@ -95,11 +121,18 @@ namespace __atomic0
bool
test_and_set(memory_order __m = memory_order_seq_cst);
+ bool
+ test_and_set(memory_order __m = memory_order_seq_cst) volatile;
+
void
clear(memory_order __m = memory_order_seq_cst);
+
+ void
+ clear(memory_order __m = memory_order_seq_cst) volatile;
};
- /// 29.4.2, address types
+
+ /// atomic_address
struct atomic_address
{
private:
@@ -109,13 +142,16 @@ namespace __atomic0
atomic_address() = default;
~atomic_address() = default;
atomic_address(const atomic_address&) = delete;
+ atomic_address& operator=(const atomic_address&) = delete;
atomic_address& operator=(const atomic_address&) volatile = delete;
- atomic_address(void* __v) { _M_i = __v; }
+ constexpr atomic_address(void* __v): _M_i (__v) { }
+
+ bool
+ is_lock_free() const { return false; }
bool
- is_lock_free() const
- { return false; }
+ is_lock_free() const volatile { return false; }
void
store(void* __v, memory_order __m = memory_order_seq_cst)
@@ -126,6 +162,15 @@ namespace __atomic0
_ATOMIC_STORE_(this, __v, __m);
}
+ void
+ store(void* __v, memory_order __m = memory_order_seq_cst) volatile
+ {
+ __glibcxx_assert(__m != memory_order_acquire);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+ __glibcxx_assert(__m != memory_order_consume);
+ _ATOMIC_STORE_(this, __v, __m);
+ }
+
void*
load(memory_order __m = memory_order_seq_cst) const
{
@@ -135,9 +180,21 @@ namespace __atomic0
}
void*
+ load(memory_order __m = memory_order_seq_cst) const volatile
+ {
+ __glibcxx_assert(__m != memory_order_release);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+ return _ATOMIC_LOAD_(this, __m);
+ }
+
+ void*
exchange(void* __v, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, =, __v, __m); }
+ void*
+ exchange(void* __v, memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, =, __v, __m); }
+
bool
compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2)
@@ -149,6 +206,16 @@ namespace __atomic0
}
bool
+ compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
+ memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
+ }
+
+ bool
compare_exchange_weak(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst)
{
@@ -157,6 +224,50 @@ namespace __atomic0
}
bool
+ compare_exchange_weak(void*& __v1, void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_weak(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_weak(const void*& __v1, const void* __v2,
+ memory_order __m1, memory_order __m2)
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
+ }
+
+ bool
+ compare_exchange_weak(const void*& __v1, const void* __v2,
+ memory_order __m1, memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
+ }
+
+ bool
+ compare_exchange_weak(const void*& __v1, const void* __v2,
+ memory_order __m = memory_order_seq_cst)
+ {
+ return compare_exchange_weak(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_weak(const void*& __v1, const void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_weak(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2)
{
@@ -167,8 +278,62 @@ namespace __atomic0
}
bool
+ compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
+ memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
+ }
+
+ bool
compare_exchange_strong(void*& __v1, void* __v2,
- memory_order __m = memory_order_seq_cst)
+ memory_order __m = memory_order_seq_cst)
+ {
+ return compare_exchange_strong(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(void*& __v1, void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_strong(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(const void*& __v1, const void* __v2,
+ memory_order __m1, memory_order __m2)
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
+ }
+
+ bool
+ compare_exchange_strong(const void*& __v1, const void* __v2,
+ memory_order __m1, memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
+ }
+
+ bool
+ compare_exchange_strong(const void*& __v1, const void* __v2,
+ memory_order __m = memory_order_seq_cst)
+ {
+ return compare_exchange_strong(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(const void*& __v1, const void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m));
@@ -187,6 +352,18 @@ namespace __atomic0
}
void*
+ fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+ {
+ void* volatile* __p = &(_M_i);
+ __atomic_flag_base* __g = __atomic_flag_for_address(__p);
+ __atomic_flag_wait_explicit(__g, __m);
+ void* __r = *__p;
+ *__p = (void*)((char*)(*__p) + __d);
+ atomic_flag_clear_explicit(__g, __m);
+ return __r;
+ }
+
+ void*
fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
{
void** __p = &(_M_i);
@@ -198,9 +375,25 @@ namespace __atomic0
return __r;
}
+ void*
+ fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+ {
+ void* volatile* __p = &(_M_i);
+ __atomic_flag_base* __g = __atomic_flag_for_address(__p);
+ __atomic_flag_wait_explicit(__g, __m);
+ void* __r = *__p;
+ *__p = (void*)((char*)(*__p) - __d);
+ atomic_flag_clear_explicit(__g, __m);
+ return __r;
+ }
+
operator void*() const
{ return load(); }
+ operator void*() const volatile
+ { return load(); }
+
+ // XXX
void*
operator=(void* __v)
{
@@ -209,16 +402,32 @@ namespace __atomic0
}
void*
+ operator=(void* __v) volatile
+ {
+ store(__v);
+ return __v;
+ }
+
+ void*
operator+=(ptrdiff_t __d)
{ return fetch_add(__d) + __d; }
void*
+ operator+=(ptrdiff_t __d) volatile
+ { return fetch_add(__d) + __d; }
+
+ void*
operator-=(ptrdiff_t __d)
{ return fetch_sub(__d) - __d; }
+
+ void*
+ operator-=(ptrdiff_t __d) volatile
+ { return fetch_sub(__d) - __d; }
};
- // 29.3.1 atomic integral types
+ /// Base class for atomic integrals.
+ //
// For each of the integral types, define atomic_[integral type] struct
//
// atomic_bool bool
@@ -244,71 +453,131 @@ namespace __atomic0
struct __atomic_base
{
private:
- typedef _ITp __integral_type;
+ typedef _ITp __int_type;
- __integral_type _M_i;
+ __int_type _M_i;
public:
__atomic_base() = default;
~__atomic_base() = default;
__atomic_base(const __atomic_base&) = delete;
+ __atomic_base& operator=(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) volatile = delete;
- // Requires __integral_type convertible to _M_base._M_i.
- __atomic_base(__integral_type __i) { _M_i = __i; }
+ // Requires __int_type convertible to _M_base._M_i.
+ constexpr __atomic_base(__int_type __i): _M_i (__i) { }
- operator __integral_type() const
+ operator __int_type() const
{ return load(); }
- __integral_type
- operator=(__integral_type __i)
+ operator __int_type() const volatile
+ { return load(); }
+
+ __int_type
+ operator=(__int_type __i)
{
store(__i);
return __i;
}
- __integral_type
+ __int_type
+ operator=(__int_type __i) volatile
+ {
+ store(__i);
+ return __i;
+ }
+
+ __int_type
operator++(int)
{ return fetch_add(1); }
- __integral_type
+ __int_type
+ operator++(int) volatile
+ { return fetch_add(1); }
+
+ __int_type
operator--(int)
{ return fetch_sub(1); }
- __integral_type
+ __int_type
+ operator--(int) volatile
+ { return fetch_sub(1); }
+
+ __int_type
operator++()
{ return fetch_add(1) + 1; }
- __integral_type
+ __int_type
+ operator++() volatile
+ { return fetch_add(1) + 1; }
+
+ __int_type
operator--()
{ return fetch_sub(1) - 1; }
- __integral_type
- operator+=(__integral_type __i)
+ __int_type
+ operator--() volatile
+ { return fetch_sub(1) - 1; }
+
+ __int_type
+ operator+=(__int_type __i)
{ return fetch_add(__i) + __i; }
- __integral_type
- operator-=(__integral_type __i)
+ __int_type
+ operator+=(__int_type __i) volatile
+ { return fetch_add(__i) + __i; }
+
+ __int_type
+ operator-=(__int_type __i)
{ return fetch_sub(__i) - __i; }
- __integral_type
- operator&=(__integral_type __i)
+ __int_type
+ operator-=(__int_type __i) volatile
+ { return fetch_sub(__i) - __i; }
+
+ __int_type
+ operator&=(__int_type __i)
+ { return fetch_and(__i) & __i; }
+
+ __int_type
+ operator&=(__int_type __i) volatile
{ return fetch_and(__i) & __i; }
- __integral_type
- operator|=(__integral_type __i)
+ __int_type
+ operator|=(__int_type __i)
{ return fetch_or(__i) | __i; }
- __integral_type
- operator^=(__integral_type __i)
+ __int_type
+ operator|=(__int_type __i) volatile
+ { return fetch_or(__i) | __i; }
+
+ __int_type
+ operator^=(__int_type __i)
+ { return fetch_xor(__i) ^ __i; }
+
+ __int_type
+ operator^=(__int_type __i) volatile
{ return fetch_xor(__i) ^ __i; }
bool
is_lock_free() const
{ return false; }
+ bool
+ is_lock_free() const volatile
+ { return false; }
+
+ void
+ store(__int_type __i, memory_order __m = memory_order_seq_cst)
+ {
+ __glibcxx_assert(__m != memory_order_acquire);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+ __glibcxx_assert(__m != memory_order_consume);
+ _ATOMIC_STORE_(this, __i, __m);
+ }
+
void
- store(__integral_type __i, memory_order __m = memory_order_seq_cst)
+ store(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
{
__glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel);
@@ -316,7 +585,7 @@ namespace __atomic0
_ATOMIC_STORE_(this, __i, __m);
}
- __integral_type
+ __int_type
load(memory_order __m = memory_order_seq_cst) const
{
__glibcxx_assert(__m != memory_order_release);
@@ -324,12 +593,24 @@ namespace __atomic0
return _ATOMIC_LOAD_(this, __m);
}
- __integral_type
- exchange(__integral_type __i, memory_order __m = memory_order_seq_cst)
+ __int_type
+ load(memory_order __m = memory_order_seq_cst) const volatile
+ {
+ __glibcxx_assert(__m != memory_order_release);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+ return _ATOMIC_LOAD_(this, __m);
+ }
+
+ __int_type
+ exchange(__int_type __i, memory_order __m = memory_order_seq_cst)
+ { return _ATOMIC_MODIFY_(this, =, __i, __m); }
+
+ __int_type
+ exchange(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, =, __i, __m); }
bool
- compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m1, memory_order __m2)
{
__glibcxx_assert(__m2 != memory_order_release);
@@ -339,7 +620,17 @@ namespace __atomic0
}
bool
- compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
+ memory_order __m1, memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
+ }
+
+ bool
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_weak(__i1, __i2, __m,
@@ -347,7 +638,15 @@ namespace __atomic0
}
bool
- compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_weak(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
memory_order __m1, memory_order __m2)
{
__glibcxx_assert(__m2 != memory_order_release);
@@ -357,94 +656,75 @@ namespace __atomic0
}
bool
- compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
+ memory_order __m1, memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
+ }
+
+ bool
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_strong(__i1, __i2, __m,
__calculate_memory_order(__m));
}
- __integral_type
- fetch_add(__integral_type __i, memory_order __m = memory_order_seq_cst)
- { return _ATOMIC_MODIFY_(this, +=, __i, __m); }
-
- __integral_type
- fetch_sub(__integral_type __i, memory_order __m = memory_order_seq_cst)
- { return _ATOMIC_MODIFY_(this, -=, __i, __m); }
-
- __integral_type
- fetch_and(__integral_type __i, memory_order __m = memory_order_seq_cst)
- { return _ATOMIC_MODIFY_(this, &=, __i, __m); }
-
- __integral_type
- fetch_or(__integral_type __i, memory_order __m = memory_order_seq_cst)
- { return _ATOMIC_MODIFY_(this, |=, __i, __m); }
-
- __integral_type
- fetch_xor(__integral_type __i, memory_order __m = memory_order_seq_cst)
- { return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
- };
-
-
- /// atomic_bool
- // NB: No operators or fetch-operations for this type.
- struct atomic_bool
- {
- private:
- __atomic_base<bool> _M_base;
-
- public:
- atomic_bool() = default;
- ~atomic_bool() = default;
- atomic_bool(const atomic_bool&) = delete;
- atomic_bool& operator=(const atomic_bool&) volatile = delete;
-
- atomic_bool(bool __i) : _M_base(__i) { }
-
- bool
- operator=(bool __i)
- { return _M_base.operator=(__i); }
+ bool
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_strong(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
- operator bool() const
- { return _M_base.load(); }
+ __int_type
+ fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst)
+ { return _ATOMIC_MODIFY_(this, +=, __i, __m); }
- bool
- is_lock_free() const
- { return _M_base.is_lock_free(); }
+ __int_type
+ fetch_add(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, +=, __i, __m); }
- void
- store(bool __i, memory_order __m = memory_order_seq_cst)
- { _M_base.store(__i, __m); }
+ __int_type
+ fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst)
+ { return _ATOMIC_MODIFY_(this, -=, __i, __m); }
- bool
- load(memory_order __m = memory_order_seq_cst) const
- { return _M_base.load(__m); }
+ __int_type
+ fetch_sub(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, -=, __i, __m); }
- bool
- exchange(bool __i, memory_order __m = memory_order_seq_cst)
- { return _M_base.exchange(__i, __m); }
+ __int_type
+ fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst)
+ { return _ATOMIC_MODIFY_(this, &=, __i, __m); }
- bool
- compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
- memory_order __m2)
- { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
+ __int_type
+ fetch_and(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, &=, __i, __m); }
- bool
- compare_exchange_weak(bool& __i1, bool __i2,
- memory_order __m = memory_order_seq_cst)
- { return _M_base.compare_exchange_weak(__i1, __i2, __m); }
+ __int_type
+ fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst)
+ { return _ATOMIC_MODIFY_(this, |=, __i, __m); }
- bool
- compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
- memory_order __m2)
- { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
+ __int_type
+ fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, |=, __i, __m); }
+ __int_type
+ fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst)
+ { return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
- bool
- compare_exchange_strong(bool& __i1, bool __i2,
- memory_order __m = memory_order_seq_cst)
- { return _M_base.compare_exchange_strong(__i1, __i2, __m); }
- };
+ __int_type
+ fetch_xor(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
+ };
#undef _ATOMIC_LOAD_
#undef _ATOMIC_STORE_
@@ -452,6 +732,6 @@ namespace __atomic0
#undef _ATOMIC_CMPEXCHNG_
} // namespace __atomic0
-// _GLIBCXX_END_NAMESPACE
+_GLIBCXX_END_NAMESPACE
#endif
diff --git a/libstdc++-v3/include/bits/atomic_2.h b/libstdc++-v3/include/bits/atomic_2.h
index fa6c0d5b9d6..e4cf24dc94d 100644
--- a/libstdc++-v3/include/bits/atomic_2.h
+++ b/libstdc++-v3/include/bits/atomic_2.h
@@ -1,6 +1,6 @@
// -*- C++ -*- header.
-// Copyright (C) 2008, 2009
+// Copyright (C) 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,7 +33,7 @@
#pragma GCC system_header
-// _GLIBCXX_BEGIN_NAMESPACE(std)
+_GLIBCXX_BEGIN_NAMESPACE(std)
// 2 == __atomic2 == Always lock-free
// Assumed:
@@ -49,6 +49,7 @@ namespace __atomic2
atomic_flag() = default;
~atomic_flag() = default;
atomic_flag(const atomic_flag&) = delete;
+ atomic_flag& operator=(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) volatile = delete;
// Conversion to ATOMIC_FLAG_INIT.
@@ -63,6 +64,15 @@ namespace __atomic2
return __sync_lock_test_and_set(&_M_i, 1);
}
+ bool
+ test_and_set(memory_order __m = memory_order_seq_cst) volatile
+ {
+ // Redundant synchronize if built-in for lock is a full barrier.
+ if (__m != memory_order_acquire && __m != memory_order_acq_rel)
+ __sync_synchronize();
+ return __sync_lock_test_and_set(&_M_i, 1);
+ }
+
void
clear(memory_order __m = memory_order_seq_cst)
{
@@ -74,10 +84,22 @@ namespace __atomic2
if (__m != memory_order_acquire && __m != memory_order_acq_rel)
__sync_synchronize();
}
+
+ void
+ clear(memory_order __m = memory_order_seq_cst) volatile
+ {
+ __glibcxx_assert(__m != memory_order_consume);
+ __glibcxx_assert(__m != memory_order_acquire);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+
+ __sync_lock_release(&_M_i);
+ if (__m != memory_order_acquire && __m != memory_order_acq_rel)
+ __sync_synchronize();
+ }
};
- /// 29.4.2, address types
+ /// atomic_address
struct atomic_address
{
private:
@@ -87,13 +109,16 @@ namespace __atomic2
atomic_address() = default;
~atomic_address() = default;
atomic_address(const atomic_address&) = delete;
+ atomic_address& operator=(const atomic_address&) = delete;
atomic_address& operator=(const atomic_address&) volatile = delete;
- atomic_address(void* __v) { _M_i = __v; }
+ constexpr atomic_address(void* __v): _M_i (__v) { }
bool
- is_lock_free() const
- { return true; }
+ is_lock_free() const { return true; }
+
+ bool
+ is_lock_free() const volatile { return true; }
void
store(void* __v, memory_order __m = memory_order_seq_cst)
@@ -113,6 +138,24 @@ namespace __atomic2
}
}
+ void
+ store(void* __v, memory_order __m = memory_order_seq_cst) volatile
+ {
+ __glibcxx_assert(__m != memory_order_acquire);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+ __glibcxx_assert(__m != memory_order_consume);
+
+ if (__m == memory_order_relaxed)
+ _M_i = __v;
+ else
+ {
+ // write_mem_barrier();
+ _M_i = __v;
+ if (__m == memory_order_seq_cst)
+ __sync_synchronize();
+ }
+ }
+
void*
load(memory_order __m = memory_order_seq_cst) const
{
@@ -126,19 +169,69 @@ namespace __atomic2
}
void*
+ load(memory_order __m = memory_order_seq_cst) const volatile
+ {
+ __glibcxx_assert(__m != memory_order_release);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+
+ __sync_synchronize();
+ void* __ret = _M_i;
+ __sync_synchronize();
+ return __ret;
+ }
+
+ void*
exchange(void* __v, memory_order __m = memory_order_seq_cst)
{
// XXX built-in assumes memory_order_acquire.
return __sync_lock_test_and_set(&_M_i, __v);
}
+ void*
+ exchange(void* __v, memory_order __m = memory_order_seq_cst) volatile
+ {
+ // XXX built-in assumes memory_order_acquire.
+ return __sync_lock_test_and_set(&_M_i, __v);
+ }
+
bool
compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2)
{ return compare_exchange_strong(__v1, __v2, __m1, __m2); }
bool
+ compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
+ memory_order __m2) volatile
+ { return compare_exchange_strong(__v1, __v2, __m1, __m2); }
+
+ bool
+ compare_exchange_weak(void*& __v1, void* __v2,
+ memory_order __m = memory_order_seq_cst)
+ {
+ return compare_exchange_weak(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
compare_exchange_weak(void*& __v1, void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_weak(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_weak(const void*& __v1, const void* __v2,
+ memory_order __m1, memory_order __m2)
+ { return compare_exchange_strong(__v1, __v2, __m1, __m2); }
+
+ bool
+ compare_exchange_weak(const void*& __v1, const void* __v2,
+ memory_order __m1, memory_order __m2) volatile
+ { return compare_exchange_strong(__v1, __v2, __m1, __m2); }
+
+ bool
+ compare_exchange_weak(const void*& __v1, const void* __v2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_weak(__v1, __v2, __m,
@@ -146,6 +239,14 @@ namespace __atomic2
}
bool
+ compare_exchange_weak(const void*& __v1, const void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_weak(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2)
{
@@ -162,8 +263,80 @@ namespace __atomic2
}
bool
+ compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
+ memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ void* __v1o = __v1;
+ void* __v1n = __sync_val_compare_and_swap(&_M_i, __v1o, __v2);
+
+ // Assume extra stores (of same value) allowed in true case.
+ __v1 = __v1n;
+ return __v1o == __v1n;
+ }
+
+ bool
compare_exchange_strong(void*& __v1, void* __v2,
- memory_order __m = memory_order_seq_cst)
+ memory_order __m = memory_order_seq_cst)
+ {
+ return compare_exchange_strong(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(void*& __v1, void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_strong(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(const void*& __v1, const void* __v2,
+ memory_order __m1, memory_order __m2)
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ const void* __v1o = __v1;
+ const void* __v1n = __sync_val_compare_and_swap(&_M_i, __v1o, __v2);
+
+ // Assume extra stores (of same value) allowed in true case.
+ __v1 = __v1n;
+ return __v1o == __v1n;
+ }
+
+ bool
+ compare_exchange_strong(const void*& __v1, const void* __v2,
+ memory_order __m1, memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ const void* __v1o = __v1;
+ const void* __v1n = __sync_val_compare_and_swap(&_M_i, __v1o, __v2);
+
+ // Assume extra stores (of same value) allowed in true case.
+ __v1 = __v1n;
+ return __v1o == __v1n;
+ }
+
+ bool
+ compare_exchange_strong(const void*& __v1, const void* __v2,
+ memory_order __m = memory_order_seq_cst)
+ {
+ return compare_exchange_strong(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(const void*& __v1, const void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m));
@@ -174,14 +347,46 @@ namespace __atomic2
{ return __sync_fetch_and_add(&_M_i, __d); }
void*
+ fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_add(&_M_i, __d); }
+
+ void*
fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_sub(&_M_i, __d); }
+ void*
+ fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_sub(&_M_i, __d); }
+
operator void*() const
{ return load(); }
+ operator void*() const volatile
+ { return load(); }
+
void*
- operator=(void* __v)
+#if 0
+ // XXX as specified but won't compile as store takes void*,
+ // invalid conversion from const void* to void*
+ // CD1 had this signature
+ operator=(const void* __v)
+#else
+ operator=(void* __v)
+#endif
+ {
+ store(__v);
+ return __v;
+ }
+
+ void*
+#if 0
+ // XXX as specified but won't compile as store takes void*,
+ // invalid conversion from const void* to void*
+ // CD1 had this signature, but store and this could both be const void*?
+ operator=(const void* __v) volatile
+#else
+ operator=(void* __v) volatile
+#endif
{
store(__v);
return __v;
@@ -192,11 +397,21 @@ namespace __atomic2
{ return __sync_add_and_fetch(&_M_i, __d); }
void*
+ operator+=(ptrdiff_t __d) volatile
+ { return __sync_add_and_fetch(&_M_i, __d); }
+
+ void*
operator-=(ptrdiff_t __d)
{ return __sync_sub_and_fetch(&_M_i, __d); }
+
+ void*
+ operator-=(ptrdiff_t __d) volatile
+ { return __sync_sub_and_fetch(&_M_i, __d); }
};
- // 29.3.1 atomic integral types
+
+ /// Base class for atomic integrals.
+ //
// For each of the integral types, define atomic_[integral type] struct
//
// atomic_bool bool
@@ -214,79 +429,148 @@ namespace __atomic2
// atomic_char16_t char16_t
// atomic_char32_t char32_t
// atomic_wchar_t wchar_t
-
- // Base type.
- // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or 8 bytes,
- // since that is what GCC built-in functions for atomic memory access work on.
+ //
+ // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or
+ // 8 bytes, since that is what GCC built-in functions for atomic
+ // memory access expect.
template<typename _ITp>
struct __atomic_base
{
private:
- typedef _ITp __integral_type;
+ typedef _ITp __int_type;
- __integral_type _M_i;
+ __int_type _M_i;
public:
__atomic_base() = default;
~__atomic_base() = default;
__atomic_base(const __atomic_base&) = delete;
+ __atomic_base& operator=(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) volatile = delete;
- // Requires __integral_type convertible to _M_base._M_i.
- __atomic_base(__integral_type __i) { _M_i = __i; }
+ // Requires __int_type convertible to _M_i.
+ constexpr __atomic_base(__int_type __i): _M_i (__i) { }
- operator __integral_type() const
+ operator __int_type() const
{ return load(); }
- __integral_type
- operator=(__integral_type __i)
+ operator __int_type() const volatile
+ { return load(); }
+
+ __int_type
+ operator=(__int_type __i)
+ {
+ store(__i);
+ return __i;
+ }
+
+ __int_type
+ operator=(__int_type __i) volatile
{
store(__i);
return __i;
}
- __integral_type
+ __int_type
operator++(int)
{ return fetch_add(1); }
- __integral_type
+ __int_type
+ operator++(int) volatile
+ { return fetch_add(1); }
+
+ __int_type
operator--(int)
{ return fetch_sub(1); }
- __integral_type
+ __int_type
+ operator--(int) volatile
+ { return fetch_sub(1); }
+
+ __int_type
operator++()
{ return __sync_add_and_fetch(&_M_i, 1); }
- __integral_type
+ __int_type
+ operator++() volatile
+ { return __sync_add_and_fetch(&_M_i, 1); }
+
+ __int_type
operator--()
{ return __sync_sub_and_fetch(&_M_i, 1); }
- __integral_type
- operator+=(__integral_type __i)
+ __int_type
+ operator--() volatile
+ { return __sync_sub_and_fetch(&_M_i, 1); }
+
+ __int_type
+ operator+=(__int_type __i)
+ { return __sync_add_and_fetch(&_M_i, __i); }
+
+ __int_type
+ operator+=(__int_type __i) volatile
{ return __sync_add_and_fetch(&_M_i, __i); }
- __integral_type
- operator-=(__integral_type __i)
+ __int_type
+ operator-=(__int_type __i)
{ return __sync_sub_and_fetch(&_M_i, __i); }
- __integral_type
- operator&=(__integral_type __i)
+ __int_type
+ operator-=(__int_type __i) volatile
+ { return __sync_sub_and_fetch(&_M_i, __i); }
+
+ __int_type
+ operator&=(__int_type __i)
{ return __sync_and_and_fetch(&_M_i, __i); }
- __integral_type
- operator|=(__integral_type __i)
+ __int_type
+ operator&=(__int_type __i) volatile
+ { return __sync_and_and_fetch(&_M_i, __i); }
+
+ __int_type
+ operator|=(__int_type __i)
+ { return __sync_or_and_fetch(&_M_i, __i); }
+
+ __int_type
+ operator|=(__int_type __i) volatile
{ return __sync_or_and_fetch(&_M_i, __i); }
- __integral_type
- operator^=(__integral_type __i)
+ __int_type
+ operator^=(__int_type __i)
+ { return __sync_xor_and_fetch(&_M_i, __i); }
+
+ __int_type
+ operator^=(__int_type __i) volatile
{ return __sync_xor_and_fetch(&_M_i, __i); }
bool
is_lock_free() const
{ return true; }
+ bool
+ is_lock_free() const volatile
+ { return true; }
+
+ void
+ store(__int_type __i, memory_order __m = memory_order_seq_cst)
+ {
+ __glibcxx_assert(__m != memory_order_acquire);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+ __glibcxx_assert(__m != memory_order_consume);
+
+ if (__m == memory_order_relaxed)
+ _M_i = __i;
+ else
+ {
+ // write_mem_barrier();
+ _M_i = __i;
+ if (__m == memory_order_seq_cst)
+ __sync_synchronize();
+ }
+ }
+
void
- store(__integral_type __i, memory_order __m = memory_order_seq_cst)
+ store(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
{
__glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel);
@@ -303,32 +587,57 @@ namespace __atomic2
}
}
- __integral_type
- load(memory_order __m = memory_order_seq_cst) const
+ __int_type
+ load(memory_order __m = memory_order_seq_cst) const
{
__glibcxx_assert(__m != memory_order_release);
__glibcxx_assert(__m != memory_order_acq_rel);
__sync_synchronize();
- __integral_type __ret = _M_i;
+ __int_type __ret = _M_i;
__sync_synchronize();
return __ret;
}
- __integral_type
- exchange(__integral_type __i, memory_order __m = memory_order_seq_cst)
+ __int_type
+ load(memory_order __m = memory_order_seq_cst) const volatile
+ {
+ __glibcxx_assert(__m != memory_order_release);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+
+ __sync_synchronize();
+ __int_type __ret = _M_i;
+ __sync_synchronize();
+ return __ret;
+ }
+
+ __int_type
+ exchange(__int_type __i, memory_order __m = memory_order_seq_cst)
+ {
+ // XXX built-in assumes memory_order_acquire.
+ return __sync_lock_test_and_set(&_M_i, __i);
+ }
+
+
+ __int_type
+ exchange(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
{
// XXX built-in assumes memory_order_acquire.
return __sync_lock_test_and_set(&_M_i, __i);
}
bool
- compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m1, memory_order __m2)
{ return compare_exchange_strong(__i1, __i2, __m1, __m2); }
bool
- compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
+ memory_order __m1, memory_order __m2) volatile
+ { return compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+ bool
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_weak(__i1, __i2, __m,
@@ -336,15 +645,39 @@ namespace __atomic2
}
bool
- compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
- memory_order __m1, memory_order __m2)
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_weak(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
+ memory_order __m1, memory_order __m2)
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ __int_type __i1o = __i1;
+ __int_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2);
+
+ // Assume extra stores (of same value) allowed in true case.
+ __i1 = __i1n;
+ return __i1o == __i1n;
+ }
+
+ bool
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
+ memory_order __m1, memory_order __m2) volatile
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
- __integral_type __i1o = __i1;
- __integral_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2);
+ __int_type __i1o = __i1;
+ __int_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2);
// Assume extra stores (of same value) allowed in true case.
__i1 = __i1n;
@@ -352,101 +685,68 @@ namespace __atomic2
}
bool
- compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_strong(__i1, __i2, __m,
__calculate_memory_order(__m));
}
- __integral_type
- fetch_add(__integral_type __i,
- memory_order __m = memory_order_seq_cst)
- { return __sync_fetch_and_add(&_M_i, __i); }
-
- __integral_type
- fetch_sub(__integral_type __i,
- memory_order __m = memory_order_seq_cst)
- { return __sync_fetch_and_sub(&_M_i, __i); }
-
- __integral_type
- fetch_and(__integral_type __i,
- memory_order __m = memory_order_seq_cst)
- { return __sync_fetch_and_and(&_M_i, __i); }
-
- __integral_type
- fetch_or(__integral_type __i,
- memory_order __m = memory_order_seq_cst)
- { return __sync_fetch_and_or(&_M_i, __i); }
-
- __integral_type
- fetch_xor(__integral_type __i,
- memory_order __m = memory_order_seq_cst)
- { return __sync_fetch_and_xor(&_M_i, __i); }
- };
-
-
- /// atomic_bool
- // NB: No operators or fetch-operations for this type.
- struct atomic_bool
- {
- private:
- __atomic_base<bool> _M_base;
-
- public:
- atomic_bool() = default;
- ~atomic_bool() = default;
- atomic_bool(const atomic_bool&) = delete;
- atomic_bool& operator=(const atomic_bool&) volatile = delete;
-
- atomic_bool(bool __i) : _M_base(__i) { }
-
- bool
- operator=(bool __i)
- { return _M_base.operator=(__i); }
+ bool
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_strong(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
- operator bool() const
- { return _M_base.load(); }
+ __int_type
+ fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst)
+ { return __sync_fetch_and_add(&_M_i, __i); }
- bool
- is_lock_free() const
- { return _M_base.is_lock_free(); }
+ __int_type
+ fetch_add(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_add(&_M_i, __i); }
- void
- store(bool __i, memory_order __m = memory_order_seq_cst)
- { _M_base.store(__i, __m); }
+ __int_type
+ fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst)
+ { return __sync_fetch_and_sub(&_M_i, __i); }
- bool
- load(memory_order __m = memory_order_seq_cst) const
- { return _M_base.load(__m); }
+ __int_type
+ fetch_sub(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_sub(&_M_i, __i); }
- bool
- exchange(bool __i, memory_order __m = memory_order_seq_cst)
- { return _M_base.exchange(__i, __m); }
+ __int_type
+ fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst)
+ { return __sync_fetch_and_and(&_M_i, __i); }
- bool
- compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
- memory_order __m2)
- { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
+ __int_type
+ fetch_and(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_and(&_M_i, __i); }
- bool
- compare_exchange_weak(bool& __i1, bool __i2,
- memory_order __m = memory_order_seq_cst)
- { return _M_base.compare_exchange_weak(__i1, __i2, __m); }
+ __int_type
+ fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst)
+ { return __sync_fetch_and_or(&_M_i, __i); }
- bool
- compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
- memory_order __m2)
- { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
+ __int_type
+ fetch_or(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_or(&_M_i, __i); }
+ __int_type
+ fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst)
+ { return __sync_fetch_and_xor(&_M_i, __i); }
- bool
- compare_exchange_strong(bool& __i1, bool __i2,
- memory_order __m = memory_order_seq_cst)
- { return _M_base.compare_exchange_strong(__i1, __i2, __m); }
- };
+ __int_type
+ fetch_xor(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_xor(&_M_i, __i); }
+ };
} // namespace __atomic2
-// _GLIBCXX_END_NAMESPACE
+_GLIBCXX_END_NAMESPACE
#endif
diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
index 454699f8175..7c89de22e5d 100644
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -1,6 +1,6 @@
-// -*- C++ -*- compatibility header.
+// -*- C++ -*- header.
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 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
@@ -23,18 +23,21 @@
// <http://www.gnu.org/licenses/>.
/** @file bits/atomic_base.h
- * This is a Standard C++ Library header.
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
*/
-#include <bits/c++config.h>
-#include <stddef.h>
-#include <stdbool.h> // XXX need to define bool w/o stdbool.h in tr1/cstdbool
-
#ifndef _GLIBCXX_ATOMIC_BASE_H
#define _GLIBCXX_ATOMIC_BASE_H 1
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <stddef.h>
+#include <stdbool.h>
+#include <stdint.h>
+
_GLIBCXX_BEGIN_NAMESPACE(std)
-_GLIBCXX_BEGIN_EXTERN_C
/**
* @defgroup atomics Atomics
@@ -54,15 +57,85 @@ _GLIBCXX_BEGIN_EXTERN_C
memory_order_seq_cst
} memory_order;
- // Base for atomic_flag.
- typedef struct __atomic_flag_base
+ inline memory_order
+ __calculate_memory_order(memory_order __m)
+ {
+ const bool __cond1 = __m == memory_order_release;
+ const bool __cond2 = __m == memory_order_acq_rel;
+ memory_order __mo1(__cond1 ? memory_order_relaxed : __m);
+ memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+ return __mo2;
+ }
+
+ /// kill_dependency
+ template<typename _Tp>
+ inline _Tp
+ kill_dependency(_Tp __y)
+ {
+ _Tp ret(__y);
+ return ret;
+ }
+
+ /**
+ * @brief Base type for atomic_flag.
+ *
+ * Base type is POD with data, allowing atomic_flag to derive from
+ * it and meet the standard layout type requirement. In addition to
+ * compatibilty with a C interface, this allows different
+ * implementations of atomic_flag to use the same atomic operation
+ * functions, via a standard conversion to the __atomic_flag_base
+ * argument.
+ */
+ _GLIBCXX_BEGIN_EXTERN_C
+
+ struct __atomic_flag_base
{
bool _M_i;
- } __atomic_flag_base;
+ };
+
+ _GLIBCXX_END_EXTERN_C
#define ATOMIC_FLAG_INIT { false }
- /// 29.2 Lock-free Property
+
+ // Base types for atomics.
+ //
+ // Three nested namespaces for atomic implementation details.
+ //
+ // The nested namespace inlined into std:: is determined by the value
+ // of the _GLIBCXX_ATOMIC_PROPERTY macro and the resulting
+ // ATOMIC_*_LOCK_FREE macros.
+ //
+ // 0 == __atomic0 == Never lock-free
+ // 1 == __atomic1 == Best available, sometimes lock-free
+ // 2 == __atomic2 == Always lock-free
+
+ namespace __atomic0
+ {
+ struct atomic_flag;
+ struct atomic_address;
+
+ template<typename _IntTp>
+ struct __atomic_base;
+ }
+
+ namespace __atomic2
+ {
+ struct atomic_flag;
+ struct atomic_address;
+
+ template<typename _IntTp>
+ struct __atomic_base;
+ }
+
+ namespace __atomic1
+ {
+ using __atomic2::atomic_flag;
+ using __atomic0::atomic_address;
+ using __atomic0::__atomic_base;
+ }
+
+ /// Lock-free Property
#if defined(_GLIBCXX_ATOMIC_BUILTINS_1) && defined(_GLIBCXX_ATOMIC_BUILTINS_2) \
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_ATOMIC_BUILTINS_8)
# define _GLIBCXX_ATOMIC_PROPERTY 2
@@ -75,150 +148,143 @@ _GLIBCXX_BEGIN_EXTERN_C
# define _GLIBCXX_ATOMIC_NAMESPACE __atomic0
#endif
-#define ATOMIC_INTEGRAL_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_CHAR_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_CHAR16_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_CHAR32_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_WCHAR_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_SHORT_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_INT_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_LONG_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_LLONG_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_ADDRESS_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
- // Switch atomic integral base types based on C or C++. In
- // addition, for "C" only provide type-generic macros for atomic
- // operations. (As C++ accomplishes the same thing with sets of
- // overloaded functions.
-#ifdef __cplusplus
inline namespace _GLIBCXX_ATOMIC_NAMESPACE { }
-# include <bits/atomicfwd_cxx.h>
-#else
-# include <bits/atomicfwd_c.h>
-#endif
- // Typedefs for other atomic integral types.
- typedef atomic_schar atomic_int_least8_t;
- typedef atomic_uchar atomic_uint_least8_t;
- typedef atomic_short atomic_int_least16_t;
- typedef atomic_ushort atomic_uint_least16_t;
- typedef atomic_int atomic_int_least32_t;
- typedef atomic_uint atomic_uint_least32_t;
- typedef atomic_llong atomic_int_least64_t;
- typedef atomic_ullong atomic_uint_least64_t;
-
- typedef atomic_schar atomic_int_fast8_t;
- typedef atomic_uchar atomic_uint_fast8_t;
- typedef atomic_short atomic_int_fast16_t;
- typedef atomic_ushort atomic_uint_fast16_t;
- typedef atomic_int atomic_int_fast32_t;
- typedef atomic_uint atomic_uint_fast32_t;
- typedef atomic_llong atomic_int_fast64_t;
- typedef atomic_ullong atomic_uint_fast64_t;
-
- typedef atomic_long atomic_intptr_t;
- typedef atomic_ulong atomic_uintptr_t;
-
- typedef atomic_long atomic_ssize_t;
- typedef atomic_ulong atomic_size_t;
-
- typedef atomic_llong atomic_intmax_t;
- typedef atomic_ullong atomic_uintmax_t;
-
- typedef atomic_long atomic_ptrdiff_t;
-
- // Accessor functions for base atomic_flag type.
- bool
- atomic_flag_test_and_set_explicit(__atomic_flag_base*, memory_order)
- _GLIBCXX_NOTHROW;
-
- inline bool
- atomic_flag_test_and_set(__atomic_flag_base* __a)
- { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
-
- void
- atomic_flag_clear_explicit(__atomic_flag_base*, memory_order)
- _GLIBCXX_NOTHROW;
-
- inline void
- atomic_flag_clear(__atomic_flag_base* __a)
- { atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
-
- void
- __atomic_flag_wait_explicit(__atomic_flag_base*, memory_order)
- _GLIBCXX_NOTHROW;
-
- _GLIBCXX_CONST __atomic_flag_base*
- __atomic_flag_for_address(const void* __z) _GLIBCXX_NOTHROW;
-
- // Implementation specific defines.
-#define _ATOMIC_LOAD_(__a, __x) \
- ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
- atomic_flag* __g = __atomic_flag_for_address(__p); \
- __atomic_flag_wait_explicit(__g, __x); \
- __typeof__ _ATOMIC_MEMBER_ __r = *__p; \
- atomic_flag_clear_explicit(__g, __x); \
- __r; })
-
-#define _ATOMIC_STORE_(__a, __m, __x) \
- ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
- __typeof__(__m) __v = (__m); \
- atomic_flag* __g = __atomic_flag_for_address(__p); \
- __atomic_flag_wait_explicit(__g, __x); \
- *__p = __v; \
- atomic_flag_clear_explicit(__g, __x); \
- __v; })
-
-#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \
- ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
- __typeof__(__m) __v = (__m); \
- atomic_flag* __g = __atomic_flag_for_address(__p); \
- __atomic_flag_wait_explicit(__g, __x); \
- __typeof__ _ATOMIC_MEMBER_ __r = *__p; \
- *__p __o __v; \
- atomic_flag_clear_explicit(__g, __x); \
- __r; })
-
-#define _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x) \
- ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
- __typeof__(__e) __q = (__e); \
- __typeof__(__m) __v = (__m); \
- bool __r; \
- atomic_flag* __g = __atomic_flag_for_address(__p); \
- __atomic_flag_wait_explicit(__g, __x); \
- __typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \
- if (__t__ == *__q) { *__p = __v; __r = true; } \
- else { *__q = __t__; __r = false; } \
- atomic_flag_clear_explicit(__g, __x); \
- __r; })
+
+ /// atomic_char
+ typedef __atomic_base<char> atomic_char;
+
+ /// atomic_schar
+ typedef __atomic_base<signed char> atomic_schar;
+
+ /// atomic_uchar
+ typedef __atomic_base<unsigned char> atomic_uchar;
+
+ /// atomic_short
+ typedef __atomic_base<short> atomic_short;
+
+ /// atomic_ushort
+ typedef __atomic_base<unsigned short> atomic_ushort;
+
+ /// atomic_int
+ typedef __atomic_base<int> atomic_int;
+
+ /// atomic_uint
+ typedef __atomic_base<unsigned int> atomic_uint;
+
+ /// atomic_long
+ typedef __atomic_base<long> atomic_long;
+
+ /// atomic_ulong
+ typedef __atomic_base<unsigned long> atomic_ulong;
+
+ /// atomic_llong
+ typedef __atomic_base<long long> atomic_llong;
+
+ /// atomic_ullong
+ typedef __atomic_base<unsigned long long> atomic_ullong;
+
+ /// atomic_wchar_t
+ typedef __atomic_base<wchar_t> atomic_wchar_t;
+
+ /// atomic_char16_t
+ typedef __atomic_base<char16_t> atomic_char16_t;
+
+ /// atomic_char32_t
+ typedef __atomic_base<char32_t> atomic_char32_t;
+
+ /// atomic_char32_t
+ typedef __atomic_base<char32_t> atomic_char32_t;
+
+
+ /// atomic_int_least8_t
+ typedef __atomic_base<int_least8_t> atomic_int_least8_t;
+
+ /// atomic_uint_least8_t
+ typedef __atomic_base<uint_least8_t> atomic_uint_least8_t;
+
+ /// atomic_int_least16_t
+ typedef __atomic_base<int_least16_t> atomic_int_least16_t;
+
+ /// atomic_uint_least16_t
+ typedef __atomic_base<uint_least16_t> atomic_uint_least16_t;
+
+ /// atomic_int_least32_t
+ typedef __atomic_base<int_least32_t> atomic_int_least32_t;
+
+ /// atomic_uint_least32_t
+ typedef __atomic_base<uint_least32_t> atomic_uint_least32_t;
+
+ /// atomic_int_least64_t
+ typedef __atomic_base<int_least64_t> atomic_int_least64_t;
+
+ /// atomic_uint_least64_t
+ typedef __atomic_base<uint_least64_t> atomic_uint_least64_t;
+
+
+ /// atomic_int_fast8_t
+ typedef __atomic_base<int_fast8_t> atomic_int_fast8_t;
+
+ /// atomic_uint_fast8_t
+ typedef __atomic_base<uint_fast8_t> atomic_uint_fast8_t;
+
+ /// atomic_int_fast16_t
+ typedef __atomic_base<int_fast16_t> atomic_int_fast16_t;
+
+ /// atomic_uint_fast16_t
+ typedef __atomic_base<uint_fast16_t> atomic_uint_fast16_t;
+
+ /// atomic_int_fast32_t
+ typedef __atomic_base<int_fast32_t> atomic_int_fast32_t;
+
+ /// atomic_uint_fast32_t
+ typedef __atomic_base<uint_fast32_t> atomic_uint_fast32_t;
+
+ /// atomic_int_fast64_t
+ typedef __atomic_base<int_fast64_t> atomic_int_fast64_t;
+
+ /// atomic_uint_fast64_t
+ typedef __atomic_base<uint_fast64_t> atomic_uint_fast64_t;
+
+
+ /// atomic_intptr_t
+ typedef __atomic_base<intptr_t> atomic_intptr_t;
+
+ /// atomic_uintptr_t
+ typedef __atomic_base<uintptr_t> atomic_uintptr_t;
+
+ /// atomic_size_t
+ typedef __atomic_base<size_t> atomic_size_t;
+
+ /// atomic_intmax_t
+ typedef __atomic_base<intmax_t> atomic_intmax_t;
+
+ /// atomic_uintmax_t
+ typedef __atomic_base<uintmax_t> atomic_uintmax_t;
+
+ /// atomic_ptrdiff_t
+ typedef __atomic_base<ptrdiff_t> atomic_ptrdiff_t;
+
+
+ struct atomic_bool;
+
+#define ATOMIC_VAR_INIT(_VI) { _VI }
+
+ template<typename _Tp>
+ struct atomic;
// @} group atomics
-_GLIBCXX_END_EXTERN_C
_GLIBCXX_END_NAMESPACE
-// Inject into global namespace.
-#ifdef __cplusplus
-
-#include <atomic>
-
-using std::memory_order;
-using std::memory_order_relaxed;
-using std::memory_order_consume;
-using std::memory_order_acquire;
-using std::memory_order_release;
-using std::memory_order_acq_rel;
-using std::memory_order_seq_cst;
-using std::atomic_flag;
-using std::atomic_bool;
-using std::atomic_char;
-using std::atomic_schar;
-using std::atomic_uchar;
-using std::atomic_short;
-using std::atomic_ushort;
-using std::atomic_int;
-using std::atomic_uint;
-using std::atomic_long;
-using std::atomic_ulong;
-using std::atomic_llong;
-using std::atomic_ullong;
-using std::atomic_wchar_t;
-using std::atomic_char16_t;
-using std::atomic_char32_t;
-using std::atomic_address;
-using std::atomic;
-#endif
-
#endif
diff --git a/libstdc++-v3/include/bits/atomicfwd_c.h b/libstdc++-v3/include/bits/atomicfwd_c.h
deleted file mode 100644
index 08418439345..00000000000
--- a/libstdc++-v3/include/bits/atomicfwd_c.h
+++ /dev/null
@@ -1,174 +0,0 @@
-// -*- C++ -*- header.
-
-// Copyright (C) 2008, 2009
-// Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/atomicfwd_c.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-// "C" only bits.
-
-#define _ATOMIC_MEMBER_ ((__a)->_M_i)
-
- // POD base classes for atomic intgral types.
- struct __atomic_bool_base
- {
- bool _M_i;
- };
-
- struct __atomic_char_base
- {
- char _M_i;
- };
-
- struct __atomic_schar_base
- {
- signed char _M_i;
- };
-
- struct __atomic_uchar_base
- {
- unsigned char _M_i;
- };
-
- struct __atomic_short_base
- {
- short _M_i;
- };
-
- struct __atomic_ushort_base
- {
- unsigned short _M_i;
- };
-
- struct __atomic_int_base
- {
- int _M_i;
- };
-
- struct __atomic_uint_base
- {
- unsigned int _M_i;
- };
-
- struct __atomic_long_base
- {
- long _M_i;
- };
-
- struct __atomic_ulong_base
- {
- unsigned long _M_i;
- };
-
- struct __atomic_llong_base
- {
- long long _M_i;
- };
-
- struct __atomic_ullong_base
- {
- unsigned long long _M_i;
- };
-
- struct __atomic_wchar_t_base
- {
- wchar_t _M_i;
- };
-
- typedef struct __atomic_flag_base atomic_flag;
- typedef struct __atomic_address_base atomic_address;
- typedef struct __atomic_bool_base atomic_bool;
- typedef struct __atomic_char_base atomic_char;
- typedef struct __atomic_schar_base atomic_schar;
- typedef struct __atomic_uchar_base atomic_uchar;
- typedef struct __atomic_short_base atomic_short;
- typedef struct __atomic_ushort_base atomic_ushort;
- typedef struct __atomic_int_base atomic_int;
- typedef struct __atomic_uint_base atomic_uint;
- typedef struct __atomic_long_base atomic_long;
- typedef struct __atomic_ulong_base atomic_ulong;
- typedef struct __atomic_llong_base atomic_llong;
- typedef struct __atomic_ullong_base atomic_ullong;
- typedef struct __atomic_wchar_t_base atomic_wchar_t;
- typedef struct __atomic_short_base atomic_char16_t;
- typedef struct __atomic_int_base atomic_char32_t;
-
-#define atomic_is_lock_free(__a) \
- false
-
-#define atomic_load_explicit(__a, __x) \
- _ATOMIC_LOAD_(__a, __x)
-
-#define atomic_load(__a) \
- atomic_load_explicit(__a, memory_order_seq_cst)
-
-#define atomic_store_explicit(__a, __m, __x) \
- _ATOMIC_STORE_(__a, __m, __x)
-
-#define atomic_store(__a, __m) \
- atomic_store_explicit(__a, __m, memory_order_seq_cst)
-
-#define atomic_exchange_explicit(__a, __m, __x) \
- _ATOMIC_MODIFY_(__a, =, __m, __x)
-
-#define atomic_exchange(__a, __m) \
- atomic_exchange_explicit(__a, __m, memory_order_seq_cst)
-
-#define atomic_compare_exchange_explicit(__a, __e, __m, __x, __y) \
- _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x)
-
-#define atomic_compare_exchange(__a, __e, __m) \
- _ATOMIC_CMPEXCHNG_(__a, __e, __m, memory_order_seq_cst)
-
-#define atomic_fetch_add_explicit(__a, __m, __x) \
- _ATOMIC_MODIFY_(__a, +=, __m, __x)
-
-#define atomic_fetch_add(__a, __m) \
- atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst)
-
-#define atomic_fetch_sub_explicit(__a, __m, __x) \
- _ATOMIC_MODIFY_(__a, -=, __m, __x)
-
-#define atomic_fetch_sub(__a, __m) \
- atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst)
-
-#define atomic_fetch_and_explicit(__a, __m, __x) \
- _ATOMIC_MODIFY_(__a, &=, __m, __x)
-
-#define atomic_fetch_and(__a, __m) \
- atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst)
-
-#define atomic_fetch_or_explicit(__a, __m, __x) \
- _ATOMIC_MODIFY_(__a, |=, __m, __x)
-
-#define atomic_fetch_or(__a, __m) \
- atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst)
-
-#define atomic_fetch_xor_explicit(__a, __m, __x) \
- _ATOMIC_MODIFY_(__a, ^=, __m, __x)
-
-#define atomic_fetch_xor(__a, __m) \
- atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst)
diff --git a/libstdc++-v3/include/bits/atomicfwd_cxx.h b/libstdc++-v3/include/bits/atomicfwd_cxx.h
deleted file mode 100644
index 8ef25e622cc..00000000000
--- a/libstdc++-v3/include/bits/atomicfwd_cxx.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// -*- C++ -*- header.
-
-// Copyright (C) 2008, 2009, 2010
-// Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/atomicfwd_cxx.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-// "C++" only bits.
-
-#define _ATOMIC_MEMBER_ _M_i
-
-_GLIBCXX_END_EXTERN_C
-
- namespace __atomic0
- {
- template<typename _IntTp>
- struct __atomic_base;
-
- struct atomic_flag;
- struct atomic_address;
- struct atomic_bool;
- }
-
- namespace __atomic2
- {
- template<typename _IntTp>
- struct __atomic_base;
-
- struct atomic_flag;
- struct atomic_address;
- struct atomic_bool;
- }
-
- namespace __atomic1
- {
- using __atomic2::atomic_flag;
- using __atomic2::atomic_bool;
- using __atomic0::atomic_address;
- using __atomic0::__atomic_base;
- }
-
- /**
- * @addtogroup atomics
- * @{
- */
-
- /// atomic_char
- typedef __atomic_base<char> atomic_char;
-
- /// atomic_schar
- typedef __atomic_base<signed char> atomic_schar;
-
- /// atomic_uchar
- typedef __atomic_base<unsigned char> atomic_uchar;
-
- /// atomic_short
- typedef __atomic_base<short> atomic_short;
-
- /// atomic_ushort
- typedef __atomic_base<unsigned short> atomic_ushort;
-
- /// atomic_int
- typedef __atomic_base<int> atomic_int;
-
- /// atomic_uint
- typedef __atomic_base<unsigned int> atomic_uint;
-
- /// atomic_long
- typedef __atomic_base<long> atomic_long;
-
- /// atomic_ulong
- typedef __atomic_base<unsigned long> atomic_ulong;
-
- /// atomic_llong
- typedef __atomic_base<long long> atomic_llong;
-
- /// atomic_ullong
- typedef __atomic_base<unsigned long long> atomic_ullong;
-
- /// atomic_wchar_t
- typedef __atomic_base<wchar_t> atomic_wchar_t;
-
- /// atomic_char16_t
- typedef __atomic_base<char16_t> atomic_char16_t;
-
- /// atomic_char32_t
- typedef __atomic_base<char32_t> atomic_char32_t;
-
- template<typename _Tp>
- struct atomic;
-
- // @} group atomics
-
-_GLIBCXX_BEGIN_EXTERN_C
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 19b55bc5b08..1c556eb5b4e 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -34,6 +34,27 @@
// The current version of the C++ library in compressed ISO date format.
#define __GLIBCXX__
+// Macros for various attributes.
+#ifndef _GLIBCXX_PURE
+# define _GLIBCXX_PURE __attribute__ ((__pure__))
+#endif
+
+#ifndef _GLIBCXX_CONST
+# define _GLIBCXX_CONST __attribute__ ((__const__))
+#endif
+
+#ifndef _GLIBCXX_NORETURN
+# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
+#endif
+
+#ifndef _GLIBCXX_NOTHROW
+# ifdef __cplusplus
+# define _GLIBCXX_NOTHROW throw()
+# else
+# define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
+# endif
+#endif
+
// Macros for visibility.
// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
// _GLIBCXX_VISIBILITY_ATTR
@@ -60,33 +81,39 @@
# define _GLIBCXX_DEPRECATED_ATTR
#endif
-// Macros for race detectors.
-// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
-// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
-// atomic (lock-free) synchronization to race detectors:
-// the race detector will infer a happens-before arc from the former to the
-// latter when they share the same argument pointer.
-//
-// The most frequent use case for these macros (and the only case in the
-// current implementation of the library) is atomic reference counting:
-// void _M_remove_reference()
-// {
-// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
-// if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
-// {
-// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
-// _M_destroy(__a);
-// }
-// }
-// The annotations in this example tell the race detector that all memory
-// accesses occurred when the refcount was positive do not race with
-// memory accesses which occurred after the refcount became zero.
+#if __cplusplus
-#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
-# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
+namespace std
+{
+ typedef __SIZE_TYPE__ size_t;
+ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ typedef decltype(nullptr) nullptr_t;
#endif
-#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
-# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
+}
+
+// Macros for C compatibility. In particular, define extern "C"
+// linkage only when using C++.
+# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
+# define _GLIBCXX_END_EXTERN_C }
+
+
+// Macro for constexpr, to support in mixed 03/0x mode.
+#ifndef _GLIBCXX_CONSTEXPR
+# ifdef __GXX_EXPERIMENTAL_CXX0X__
+# define _GLIBCXX_CONSTEXPR constexpr
+# else
+# define _GLIBCXX_CONSTEXPR
+# endif
+#endif
+
+#ifndef _GLIBCXX_USE_CONSTEXPR
+# ifdef __GXX_EXPERIMENTAL_CXX0X__
+# define _GLIBCXX_USE_CONSTEXPR constexpr
+# else
+# define _GLIBCXX_USE_CONSTEXPR const
+# endif
#endif
// Macros for activating various namespace association modes.
@@ -106,7 +133,6 @@
namespace tr1 { }
}
*/
-#if __cplusplus
#ifdef _GLIBCXX_DEBUG
# define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1
@@ -136,6 +162,7 @@
// _GLIBCXX_STD
// _GLIBCXX_STD_D
// _GLIBCXX_STD_P
+// _GLIBCXX_STD_PR
//
// Macros for enclosing namespaces and possibly nested namespaces.
// _GLIBCXX_BEGIN_NAMESPACE
@@ -283,19 +310,42 @@ namespace std
# define _GLIBCXX_END_LDBL_NAMESPACE
#endif
+// Macros for race detectors.
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
+// atomic (lock-free) synchronization to race detectors:
+// the race detector will infer a happens-before arc from the former to the
+// latter when they share the same argument pointer.
+//
+// The most frequent use case for these macros (and the only case in the
+// current implementation of the library) is atomic reference counting:
+// void _M_remove_reference()
+// {
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
+// if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
+// {
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
+// _M_destroy(__a);
+// }
+// }
+// The annotations in this example tell the race detector that all memory
+// accesses occurred when the refcount was positive do not race with
+// memory accesses which occurred after the refcount became zero.
-// Defines for C compatibility. In particular, define extern "C"
-// linkage only when using C++.
-# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
-# define _GLIBCXX_END_EXTERN_C }
+#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
+# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
+#endif
+#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
+# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
+#endif
#else // !__cplusplus
+# define _GLIBCXX_BEGIN_EXTERN_C
+# define _GLIBCXX_END_EXTERN_C
# undef _GLIBCXX_BEGIN_NAMESPACE
# undef _GLIBCXX_END_NAMESPACE
# define _GLIBCXX_BEGIN_NAMESPACE(X)
# define _GLIBCXX_END_NAMESPACE
-# define _GLIBCXX_BEGIN_EXTERN_C
-# define _GLIBCXX_END_EXTERN_C
#endif
// First includes.
@@ -385,39 +435,4 @@ _GLIBCXX_END_NAMESPACE
#undef min
#undef max
-#ifndef _GLIBCXX_PURE
-# define _GLIBCXX_PURE __attribute__ ((__pure__))
-#endif
-
-#ifndef _GLIBCXX_CONST
-# define _GLIBCXX_CONST __attribute__ ((__const__))
-#endif
-
-#ifndef _GLIBCXX_NORETURN
-# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
-#endif
-
-#ifndef _GLIBCXX_NOTHROW
-# ifdef __cplusplus
-# define _GLIBCXX_NOTHROW throw()
-# else
-# define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
-# endif
-#endif
-
-#ifdef __cplusplus
-
-_GLIBCXX_BEGIN_NAMESPACE(std)
-
- typedef __SIZE_TYPE__ size_t;
- typedef __PTRDIFF_TYPE__ ptrdiff_t;
-
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- typedef decltype(nullptr) nullptr_t;
-#endif
-
-_GLIBCXX_END_NAMESPACE
-
-#endif // __cplusplus
-
// End of prewritten config; the discovered settings follow.
diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h
index 786c1c6b380..2c1a5fd6b3c 100644
--- a/libstdc++-v3/include/bits/char_traits.h
+++ b/libstdc++-v3/include/bits/char_traits.h
@@ -92,11 +92,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
@@ -118,23 +118,23 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
static char_type*
assign(char_type* __s, std::size_t __n, char_type __a);
- static char_type
+ static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c)
{ return static_cast<char_type>(__c); }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c)
{ return static_cast<int_type>(__c); }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
eof()
{ return static_cast<int_type>(_GLIBCXX_STDIO_EOF); }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c)
{ return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); }
};
@@ -239,11 +239,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
@@ -271,25 +271,25 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type* __s, size_t __n, char_type __a)
{ return static_cast<char_type*>(__builtin_memset(__s, __a, __n)); }
- static char_type
+ static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c)
{ return static_cast<char_type>(__c); }
// To keep both the byte 0xff and the eof symbol 0xffffffff
// from ending up as 0xffffffff.
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c)
{ return static_cast<int_type>(static_cast<unsigned char>(__c)); }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
eof()
{ return static_cast<int_type>(_GLIBCXX_STDIO_EOF); }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c)
{ return (__c == eof()) ? 0 : __c; }
};
@@ -310,11 +310,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
@@ -342,23 +342,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type* __s, size_t __n, char_type __a)
{ return wmemset(__s, __a, __n); }
- static char_type
+ static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c)
{ return char_type(__c); }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c)
{ return int_type(__c); }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
eof()
{ return static_cast<int_type>(WEOF); }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? 0 : __c; }
};
@@ -386,11 +386,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
@@ -445,23 +445,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return __s;
}
- static char_type
+ static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c)
{ return char_type(__c); }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c)
{ return int_type(__c); }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
eof()
{ return static_cast<int_type>(-1); }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? 0 : __c; }
};
@@ -479,11 +479,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
@@ -538,23 +538,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return __s;
}
- static char_type
+ static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c)
{ return char_type(__c); }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c)
{ return int_type(__c); }
- static bool
+ static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
eof()
{ return static_cast<int_type>(-1); }
- static int_type
+ static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? 0 : __c; }
};
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index dd8c1c22349..343a12267fd 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -178,9 +178,10 @@ namespace std
size_type _M_begin_bucket_index; // First non-empty bucket.
size_type _M_element_count;
_RehashPolicy _M_rehash_policy;
-
- _Node*
- _M_allocate_node(const value_type& __v);
+
+ template<typename... _Args>
+ _Node*
+ _M_allocate_node(_Args&&... __args);
void
_M_deallocate_node(_Node* __n);
@@ -360,11 +361,27 @@ namespace std
std::pair<const_iterator, const_iterator>
equal_range(const key_type& __k) const;
- private: // Find, insert and erase helper functions
- // ??? This dispatching is a workaround for the fact that we don't
- // have partial specialization of member templates; it would be
- // better to just specialize insert on __unique_keys. There may be a
- // cleaner workaround.
+ private:
+ // Find, insert and erase helper functions
+ _Node*
+ _M_find_node(_Node*, const key_type&,
+ typename _Hashtable::_Hash_code_type) const;
+
+ template<typename _Pair>
+ iterator
+ _M_insert_bucket(_Pair&&, size_type,
+ typename _Hashtable::_Hash_code_type);
+
+ template<typename _Pair>
+ std::pair<iterator, bool>
+ _M_insert(_Pair&&, std::true_type);
+
+ template<typename _Pair>
+ iterator
+ _M_insert(_Pair&&, std::false_type);
+
+ public:
+ // Insert and erase
typedef typename std::conditional<__unique_keys,
std::pair<iterator, bool>,
iterator>::type
@@ -376,30 +393,39 @@ namespace std
>::type
_Insert_Conv_Type;
- _Node*
- _M_find_node(_Node*, const key_type&,
- typename _Hashtable::_Hash_code_type) const;
-
- iterator
- _M_insert_bucket(const value_type&, size_type,
- typename _Hashtable::_Hash_code_type);
-
- std::pair<iterator, bool>
- _M_insert(const value_type&, std::true_type);
+ _Insert_Return_Type
+ insert(const value_type& __v)
+ { return _M_insert(__v, std::integral_constant<bool, __unique_keys>()); }
iterator
- _M_insert(const value_type&, std::false_type);
+ insert(const_iterator, const value_type& __v)
+ { return _Insert_Conv_Type()(insert(__v)); }
- public:
- // Insert and erase
_Insert_Return_Type
- insert(const value_type& __v)
- { return _M_insert(__v, std::integral_constant<bool,
- __unique_keys>()); }
+ insert(value_type&& __v)
+ { return _M_insert(std::move(__v),
+ std::integral_constant<bool, __unique_keys>()); }
iterator
- insert(const_iterator, const value_type& __v)
- { return iterator(_Insert_Conv_Type()(this->insert(__v))); }
+ insert(const_iterator, value_type&& __v)
+ { return _Insert_Conv_Type()(insert(std::move(__v))); }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<!__constant_iterators
+ && std::is_convertible<_Pair,
+ value_type>::value>::type>
+ _Insert_Return_Type
+ insert(_Pair&& __v)
+ { return _M_insert(std::forward<_Pair>(__v),
+ std::integral_constant<bool, __unique_keys>()); }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<!__constant_iterators
+ && std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(const_iterator, _Pair&& __v)
+ { return _Insert_Conv_Type()(insert(std::forward<_Pair>(__v))); }
template<typename _InputIterator>
void
@@ -438,26 +464,27 @@ namespace std
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
- typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy,
- __chc, __cit, __uk>::_Node*
- _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
- _M_allocate_node(const value_type& __v)
- {
- _Node* __n = _M_node_allocator.allocate(1);
- __try
- {
- _M_node_allocator.construct(__n, __v);
- __n->_M_next = 0;
- return __n;
- }
- __catch(...)
- {
- _M_node_allocator.deallocate(__n, 1);
- __throw_exception_again;
- }
- }
+ template<typename... _Args>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::_Node*
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_allocate_node(_Args&&... __args)
+ {
+ _Node* __n = _M_node_allocator.allocate(1);
+ __try
+ {
+ _M_node_allocator.construct(__n, std::forward<_Args>(__args)...);
+ __n->_M_next = 0;
+ return __n;
+ }
+ __catch(...)
+ {
+ _M_node_allocator.deallocate(__n, 1);
+ __throw_exception_again;
+ }
+ }
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
@@ -871,111 +898,117 @@ namespace std
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
- typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy,
- __chc, __cit, __uk>::iterator
- _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
- _M_insert_bucket(const value_type& __v, size_type __n,
- typename _Hashtable::_Hash_code_type __code)
- {
- std::pair<bool, std::size_t> __do_rehash
- = _M_rehash_policy._M_need_rehash(_M_bucket_count,
- _M_element_count, 1);
+ template<typename _Pair>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_insert_bucket(_Pair&& __v, size_type __n,
+ typename _Hashtable::_Hash_code_type __code)
+ {
+ std::pair<bool, std::size_t> __do_rehash
+ = _M_rehash_policy._M_need_rehash(_M_bucket_count,
+ _M_element_count, 1);
- // Allocate the new node before doing the rehash so that we don't
- // do a rehash if the allocation throws.
- _Node* __new_node = _M_allocate_node(__v);
+ if (__do_rehash.first)
+ {
+ const key_type& __k = this->_M_extract(__v);
+ __n = this->_M_bucket_index(__k, __code, __do_rehash.second);
+ }
- __try
- {
- if (__do_rehash.first)
- {
- const key_type& __k = this->_M_extract(__v);
- __n = this->_M_bucket_index(__k, __code, __do_rehash.second);
+ // Allocate the new node before doing the rehash so that we don't
+ // do a rehash if the allocation throws.
+ _Node* __new_node = _M_allocate_node(std::forward<_Pair>(__v));
+
+ __try
+ {
+ if (__do_rehash.first)
_M_rehash(__do_rehash.second);
- }
- __new_node->_M_next = _M_buckets[__n];
- this->_M_store_code(__new_node, __code);
- _M_buckets[__n] = __new_node;
- ++_M_element_count;
- if (__n < _M_begin_bucket_index)
- _M_begin_bucket_index = __n;
- return iterator(__new_node, _M_buckets + __n);
- }
- __catch(...)
- {
- _M_deallocate_node(__new_node);
- __throw_exception_again;
- }
- }
+ __new_node->_M_next = _M_buckets[__n];
+ this->_M_store_code(__new_node, __code);
+ _M_buckets[__n] = __new_node;
+ ++_M_element_count;
+ if (__n < _M_begin_bucket_index)
+ _M_begin_bucket_index = __n;
+ return iterator(__new_node, _M_buckets + __n);
+ }
+ __catch(...)
+ {
+ _M_deallocate_node(__new_node);
+ __throw_exception_again;
+ }
+ }
// Insert v if no element with its key is already present.
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
- std::pair<typename _Hashtable<_Key, _Value, _Allocator,
- _ExtractKey, _Equal, _H1,
- _H2, _Hash, _RehashPolicy,
- __chc, __cit, __uk>::iterator, bool>
- _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
- _M_insert(const value_type& __v, std::true_type)
- {
- const key_type& __k = this->_M_extract(__v);
- typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
- size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
-
- if (_Node* __p = _M_find_node(_M_buckets[__n], __k, __code))
- return std::make_pair(iterator(__p, _M_buckets + __n), false);
- return std::make_pair(_M_insert_bucket(__v, __n, __code), true);
- }
+ template<typename _Pair>
+ std::pair<typename _Hashtable<_Key, _Value, _Allocator,
+ _ExtractKey, _Equal, _H1,
+ _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator, bool>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_insert(_Pair&& __v, std::true_type)
+ {
+ const key_type& __k = this->_M_extract(__v);
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+
+ if (_Node* __p = _M_find_node(_M_buckets[__n], __k, __code))
+ return std::make_pair(iterator(__p, _M_buckets + __n), false);
+ return std::make_pair(_M_insert_bucket(std::forward<_Pair>(__v),
+ __n, __code), true);
+ }
// Insert v unconditionally.
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
- typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy,
- __chc, __cit, __uk>::iterator
- _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
- _M_insert(const value_type& __v, std::false_type)
- {
- std::pair<bool, std::size_t> __do_rehash
- = _M_rehash_policy._M_need_rehash(_M_bucket_count,
- _M_element_count, 1);
- if (__do_rehash.first)
- _M_rehash(__do_rehash.second);
+ template<typename _Pair>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_insert(_Pair&& __v, std::false_type)
+ {
+ std::pair<bool, std::size_t> __do_rehash
+ = _M_rehash_policy._M_need_rehash(_M_bucket_count,
+ _M_element_count, 1);
+ if (__do_rehash.first)
+ _M_rehash(__do_rehash.second);
- const key_type& __k = this->_M_extract(__v);
- typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
- size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+ const key_type& __k = this->_M_extract(__v);
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
- // First find the node, avoid leaking new_node if compare throws.
- _Node* __prev = _M_find_node(_M_buckets[__n], __k, __code);
- _Node* __new_node = _M_allocate_node(__v);
+ // First find the node, avoid leaking new_node if compare throws.
+ _Node* __prev = _M_find_node(_M_buckets[__n], __k, __code);
+ _Node* __new_node = _M_allocate_node(std::forward<_Pair>(__v));
- if (__prev)
- {
- __new_node->_M_next = __prev->_M_next;
- __prev->_M_next = __new_node;
- }
- else
- {
- __new_node->_M_next = _M_buckets[__n];
- _M_buckets[__n] = __new_node;
- if (__n < _M_begin_bucket_index)
- _M_begin_bucket_index = __n;
- }
- this->_M_store_code(__new_node, __code);
+ if (__prev)
+ {
+ __new_node->_M_next = __prev->_M_next;
+ __prev->_M_next = __new_node;
+ }
+ else
+ {
+ __new_node->_M_next = _M_buckets[__n];
+ _M_buckets[__n] = __new_node;
+ if (__n < _M_begin_bucket_index)
+ _M_begin_bucket_index = __n;
+ }
+ this->_M_store_code(__new_node, __code);
- ++_M_element_count;
- return iterator(__new_node, _M_buckets + __n);
- }
+ ++_M_element_count;
+ return iterator(__new_node, _M_buckets + __n);
+ }
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index 694d0ffdeb4..d8d2af5d64e 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -497,7 +497,7 @@ namespace __detail
// the form pair<T1, T2> and a key extraction policy that returns the
// first part of the pair, the hashtable gets a mapped_type typedef.
// If it satisfies those criteria and also has unique keys, then it
- // also gets an operator[].
+ // also gets an operator[].
template<typename _Key, typename _Value, typename _Ex, bool __unique,
typename _Hashtable>
struct _Map_base { };
@@ -516,6 +516,9 @@ namespace __detail
mapped_type&
operator[](const _Key& __k);
+ mapped_type&
+ operator[](_Key&& __k);
+
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 761. unordered_map needs an at() member function.
mapped_type&
@@ -548,6 +551,26 @@ namespace __detail
typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
true, _Hashtable>::mapped_type&
_Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
+ operator[](_Key&& __k)
+ {
+ _Hashtable* __h = static_cast<_Hashtable*>(this);
+ typename _Hashtable::_Hash_code_type __code = __h->_M_hash_code(__k);
+ std::size_t __n = __h->_M_bucket_index(__k, __code,
+ __h->_M_bucket_count);
+
+ typename _Hashtable::_Node* __p =
+ __h->_M_find_node(__h->_M_buckets[__n], __k, __code);
+ if (!__p)
+ return __h->_M_insert_bucket(std::make_pair(std::move(__k),
+ mapped_type()),
+ __n, __code)->second;
+ return (__p->_M_v).second;
+ }
+
+ template<typename _Key, typename _Pair, typename _Hashtable>
+ typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
+ true, _Hashtable>::mapped_type&
+ _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
at(const _Key& __k)
{
_Hashtable* __h = static_cast<_Hashtable*>(this);
diff --git a/libstdc++-v3/include/bits/ios_base.h b/libstdc++-v3/include/bits/ios_base.h
index 6749a731065..f161a4d997c 100644
--- a/libstdc++-v3/include/bits/ios_base.h
+++ b/libstdc++-v3/include/bits/ios_base.h
@@ -71,34 +71,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_S_ios_fmtflags_end = 1L << 16
};
- inline _Ios_Fmtflags
+ inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
- inline _Ios_Fmtflags
+ inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
- inline _Ios_Fmtflags
+ inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _Ios_Fmtflags&
+ inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
+ operator~(_Ios_Fmtflags __a)
+ { return _Ios_Fmtflags(~static_cast<int>(__a)); }
+
+ inline const _Ios_Fmtflags&
operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a | __b; }
- inline _Ios_Fmtflags&
+ inline const _Ios_Fmtflags&
operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a & __b; }
- inline _Ios_Fmtflags&
+ inline const _Ios_Fmtflags&
operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a ^ __b; }
- inline _Ios_Fmtflags
- operator~(_Ios_Fmtflags __a)
- { return _Ios_Fmtflags(~static_cast<int>(__a)); }
-
enum _Ios_Openmode
{
@@ -111,34 +111,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_S_ios_openmode_end = 1L << 16
};
- inline _Ios_Openmode
+ inline _GLIBCXX_CONSTEXPR _Ios_Openmode
operator&(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
- inline _Ios_Openmode
+ inline _GLIBCXX_CONSTEXPR _Ios_Openmode
operator|(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
- inline _Ios_Openmode
+ inline _GLIBCXX_CONSTEXPR _Ios_Openmode
operator^(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _Ios_Openmode&
+ inline _GLIBCXX_CONSTEXPR _Ios_Openmode
+ operator~(_Ios_Openmode __a)
+ { return _Ios_Openmode(~static_cast<int>(__a)); }
+
+ inline const _Ios_Openmode&
operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a | __b; }
- inline _Ios_Openmode&
+ inline const _Ios_Openmode&
operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a & __b; }
- inline _Ios_Openmode&
+ inline const _Ios_Openmode&
operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a ^ __b; }
- inline _Ios_Openmode
- operator~(_Ios_Openmode __a)
- { return _Ios_Openmode(~static_cast<int>(__a)); }
-
enum _Ios_Iostate
{
@@ -149,33 +149,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_S_ios_iostate_end = 1L << 16
};
- inline _Ios_Iostate
+ inline _GLIBCXX_CONSTEXPR _Ios_Iostate
operator&(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
- inline _Ios_Iostate
+ inline _GLIBCXX_CONSTEXPR _Ios_Iostate
operator|(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
- inline _Ios_Iostate
+ inline _GLIBCXX_CONSTEXPR _Ios_Iostate
operator^(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _Ios_Iostate&
+ inline _GLIBCXX_CONSTEXPR _Ios_Iostate
+ operator~(_Ios_Iostate __a)
+ { return _Ios_Iostate(~static_cast<int>(__a)); }
+
+ inline const _Ios_Iostate&
operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a | __b; }
- inline _Ios_Iostate&
+ inline const _Ios_Iostate&
operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a & __b; }
- inline _Ios_Iostate&
+ inline const _Ios_Iostate&
operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a ^ __b; }
- inline _Ios_Iostate
- operator~(_Ios_Iostate __a)
- { return _Ios_Iostate(~static_cast<int>(__a)); }
enum _Ios_Seekdir
{
diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
index cfb286a3c97..2fa8e6c35a1 100644
--- a/libstdc++-v3/include/bits/random.h
+++ b/libstdc++-v3/include/bits/random.h
@@ -33,8 +33,8 @@
#include <vector>
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
// [26.4] Random number generation
/**
@@ -169,12 +169,12 @@ namespace std
typedef _UIntType result_type;
/** The multiplier. */
- static const result_type multiplier = __a;
+ static constexpr result_type multiplier = __a;
/** An increment. */
- static const result_type increment = __c;
+ static constexpr result_type increment = __c;
/** The modulus. */
- static const result_type modulus = __m;
- static const result_type default_seed = 1u;
+ static constexpr result_type modulus = __m;
+ static constexpr result_type default_seed = 1u;
/**
* @brief Constructs a %linear_congruential_engine random number
@@ -225,26 +225,20 @@ namespace std
*
* The minimum depends on the @p __c parameter: if it is zero, the
* minimum generated must be > 0, otherwise 0 is allowed.
- *
- * @todo This should be constexpr.
*/
- result_type
- min() const
+ static constexpr result_type
+ min()
{ return __c == 0u ? 1u : 0u; }
/**
* @brief Gets the largest possible value in the output range.
- *
- * @todo This should be constexpr.
*/
- result_type
- max() const
+ static constexpr result_type
+ max()
{ return __m - 1u; }
/**
* @brief Discard a sequence of random numbers.
- *
- * @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
@@ -402,20 +396,20 @@ namespace std
typedef _UIntType result_type;
// parameter values
- static const size_t word_size = __w;
- static const size_t state_size = __n;
- static const size_t shift_size = __m;
- static const size_t mask_bits = __r;
- static const result_type xor_mask = __a;
- static const size_t tempering_u = __u;
- static const result_type tempering_d = __d;
- static const size_t tempering_s = __s;
- static const result_type tempering_b = __b;
- static const size_t tempering_t = __t;
- static const result_type tempering_c = __c;
- static const size_t tempering_l = __l;
- static const result_type initialization_multiplier = __f;
- static const result_type default_seed = 5489u;
+ static constexpr size_t word_size = __w;
+ static constexpr size_t state_size = __n;
+ static constexpr size_t shift_size = __m;
+ static constexpr size_t mask_bits = __r;
+ static constexpr result_type xor_mask = __a;
+ static constexpr size_t tempering_u = __u;
+ static constexpr result_type tempering_d = __d;
+ static constexpr size_t tempering_s = __s;
+ static constexpr result_type tempering_b = __b;
+ static constexpr size_t tempering_t = __t;
+ static constexpr result_type tempering_c = __c;
+ static constexpr size_t tempering_l = __l;
+ static constexpr result_type initialization_multiplier = __f;
+ static constexpr result_type default_seed = 5489u;
// constructors and member function
explicit
@@ -444,26 +438,20 @@ namespace std
/**
* @brief Gets the smallest possible value in the output range.
- *
- * @todo This should be constexpr.
*/
- result_type
- min() const
+ static constexpr result_type
+ min()
{ return 0; };
/**
* @brief Gets the largest possible value in the output range.
- *
- * @todo This should be constexpr.
*/
- result_type
- max() const
+ static constexpr result_type
+ max()
{ return __detail::_Shift<_UIntType, __w>::__value - 1; }
/**
* @brief Discard a sequence of random numbers.
- *
- * @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
@@ -608,10 +596,10 @@ namespace std
typedef _UIntType result_type;
// parameter values
- static const size_t word_size = __w;
- static const size_t short_lag = __s;
- static const size_t long_lag = __r;
- static const result_type default_seed = 19780503u;
+ static constexpr size_t word_size = __w;
+ static constexpr size_t short_lag = __s;
+ static constexpr size_t long_lag = __r;
+ static constexpr result_type default_seed = 19780503u;
/**
* @brief Constructs an explicitly seeded % subtract_with_carry_engine
@@ -660,27 +648,21 @@ namespace std
/**
* @brief Gets the inclusive minimum value of the range of random
* integers returned by this generator.
- *
- * @todo This should be constexpr.
*/
- result_type
- min() const
+ static constexpr result_type
+ min()
{ return 0; }
/**
* @brief Gets the inclusive maximum value of the range of random
* integers returned by this generator.
- *
- * @todo This should be constexpr.
*/
- result_type
- max() const
+ static constexpr result_type
+ max()
{ return __detail::_Shift<_UIntType, __w>::__value - 1; }
/**
* @brief Discard a sequence of random numbers.
- *
- * @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
@@ -794,8 +776,8 @@ namespace std
typedef typename _RandomNumberEngine::result_type result_type;
// parameter values
- static const size_t block_size = __p;
- static const size_t used_block = __r;
+ static constexpr size_t block_size = __p;
+ static constexpr size_t used_block = __r;
/**
* @brief Constructs a default %discard_block_engine engine.
@@ -894,26 +876,20 @@ namespace std
/**
* @brief Gets the minimum value in the generated random number range.
- *
- * @todo This should be constexpr.
*/
- result_type
- min() const
- { return _M_b.min(); }
+ static constexpr result_type
+ min()
+ { return _RandomNumberEngine::min(); }
/**
* @brief Gets the maximum value in the generated random number range.
- *
- * @todo This should be constexpr.
*/
- result_type
- max() const
- { return _M_b.max(); }
+ static constexpr result_type
+ max()
+ { return _RandomNumberEngine::max(); }
/**
* @brief Discard a sequence of random numbers.
- *
- * @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
@@ -1109,26 +1085,20 @@ namespace std
/**
* @brief Gets the minimum value in the generated random number range.
- *
- * @todo This should be constexpr.
*/
- result_type
- min() const
+ static constexpr result_type
+ min()
{ return 0U; }
/**
* @brief Gets the maximum value in the generated random number range.
- *
- * @todo This should be constexpr.
*/
- result_type
- max() const
+ static constexpr result_type
+ max()
{ return __detail::_Shift<_UIntType, __w>::__value - 1; }
/**
* @brief Discard a sequence of random numbers.
- *
- * @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
@@ -1243,7 +1213,7 @@ namespace std
/** The type of the generated random value. */
typedef typename _RandomNumberEngine::result_type result_type;
- static const size_t table_size = __k;
+ static constexpr size_t table_size = __k;
/**
* @brief Constructs a default %shuffle_order_engine engine.
@@ -1345,26 +1315,20 @@ namespace std
/**
* Gets the minimum value in the generated random number range.
- *
- * @todo This should be constexpr.
*/
- result_type
- min() const
- { return _M_b.min(); }
+ static constexpr result_type
+ min()
+ { return _RandomNumberEngine::min(); }
/**
* Gets the maximum value in the generated random number range.
- *
- * @todo This should be constexpr.
*/
- result_type
- max() const
- { return _M_b.max(); }
+ static constexpr result_type
+ max()
+ { return _RandomNumberEngine::max(); }
/**
* Discard a sequence of random numbers.
- *
- * @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
@@ -1617,7 +1581,7 @@ namespace std
*/
/**
- * @addtogroup random_distributions_uniform Uniform
+ * @addtogroup random_distributions_uniform Uniform Distributions
* @ingroup random_distributions
* @{
*/
@@ -1975,7 +1939,7 @@ namespace std
/* @} */ // group random_distributions_uniform
/**
- * @addtogroup random_distributions_normal Normal
+ * @addtogroup random_distributions_normal Normal Distributions
* @ingroup random_distributions
* @{
*/
@@ -3229,7 +3193,7 @@ namespace std
/* @} */ // group random_distributions_normal
/**
- * @addtogroup random_distributions_bernoulli Bernoulli
+ * @addtogroup random_distributions_bernoulli Bernoulli Distributions
* @ingroup random_distributions
* @{
*/
@@ -3960,7 +3924,7 @@ namespace std
/* @} */ // group random_distributions_bernoulli
/**
- * @addtogroup random_distributions_poisson Poisson
+ * @addtogroup random_distributions_poisson Poisson Distributions
* @ingroup random_distributions
* @{
*/
@@ -5412,6 +5376,6 @@ namespace std
/* @} */ // group random_utilities
/* @} */ // group random
-}
+_GLIBCXX_END_NAMESPACE
#endif
diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc
index e3faf481423..323741d25db 100644
--- a/libstdc++-v3/include/bits/random.tcc
+++ b/libstdc++-v3/include/bits/random.tcc
@@ -32,8 +32,8 @@
#include <numeric> // std::accumulate and std::partial_sum
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
/*
* (Further) implementation-space details.
*/
@@ -104,19 +104,19 @@ namespace std
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- const _UIntType
+ constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier;
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- const _UIntType
+ constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::increment;
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- const _UIntType
+ constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::modulus;
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- const _UIntType
+ constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed;
/**
@@ -205,7 +205,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const size_t
+ constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::word_size;
@@ -214,7 +214,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const size_t
+ constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::state_size;
@@ -223,7 +223,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const size_t
+ constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::shift_size;
@@ -232,7 +232,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const size_t
+ constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::mask_bits;
@@ -241,7 +241,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const _UIntType
+ constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::xor_mask;
@@ -250,7 +250,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const size_t
+ constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_u;
@@ -259,7 +259,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const _UIntType
+ constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_d;
@@ -268,7 +268,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const size_t
+ constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_s;
@@ -277,7 +277,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const _UIntType
+ constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_b;
@@ -286,7 +286,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const size_t
+ constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_t;
@@ -295,7 +295,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const _UIntType
+ constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_c;
@@ -304,7 +304,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const size_t
+ constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_l;
@@ -313,7 +313,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const _UIntType
+ constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::
initialization_multiplier;
@@ -323,7 +323,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
- const _UIntType
+ constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::default_seed;
@@ -500,19 +500,19 @@ namespace std
template<typename _UIntType, size_t __w, size_t __s, size_t __r>
- const size_t
+ constexpr size_t
subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
template<typename _UIntType, size_t __w, size_t __s, size_t __r>
- const size_t
+ constexpr size_t
subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
template<typename _UIntType, size_t __w, size_t __s, size_t __r>
- const size_t
+ constexpr size_t
subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
template<typename _UIntType, size_t __w, size_t __s, size_t __r>
- const _UIntType
+ constexpr _UIntType
subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed;
template<typename _UIntType, size_t __w, size_t __s, size_t __r>
@@ -651,11 +651,11 @@ namespace std
template<typename _RandomNumberEngine, size_t __p, size_t __r>
- const size_t
+ constexpr size_t
discard_block_engine<_RandomNumberEngine, __p, __r>::block_size;
template<typename _RandomNumberEngine, size_t __p, size_t __r>
- const size_t
+ constexpr size_t
discard_block_engine<_RandomNumberEngine, __p, __r>::used_block;
template<typename _RandomNumberEngine, size_t __p, size_t __r>
@@ -761,7 +761,7 @@ namespace std
template<typename _RandomNumberEngine, size_t __k>
- const size_t
+ constexpr size_t
shuffle_order_engine<_RandomNumberEngine, __k>::table_size;
template<typename _RandomNumberEngine, size_t __k>
@@ -2818,6 +2818,6 @@ namespace std
}
return __sum / __tmp;
}
-}
+_GLIBCXX_END_NAMESPACE
#endif
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index 64d4407fd72..807bf0dda69 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -28,8 +28,7 @@
* You should not attempt to use it directly.
*/
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @defgroup regex Regular Expressions
@@ -349,28 +348,27 @@ namespace std
/**
* @name Constants
* std [28.8.1](1)
- * @todo These should be constexpr.
*/
//@{
- static const regex_constants::syntax_option_type icase
+ static constexpr regex_constants::syntax_option_type icase
= regex_constants::icase;
- static const regex_constants::syntax_option_type nosubs
+ static constexpr regex_constants::syntax_option_type nosubs
= regex_constants::nosubs;
- static const regex_constants::syntax_option_type optimize
+ static constexpr regex_constants::syntax_option_type optimize
= regex_constants::optimize;
- static const regex_constants::syntax_option_type collate
+ static constexpr regex_constants::syntax_option_type collate
= regex_constants::collate;
- static const regex_constants::syntax_option_type ECMAScript
+ static constexpr regex_constants::syntax_option_type ECMAScript
= regex_constants::ECMAScript;
- static const regex_constants::syntax_option_type basic
+ static constexpr regex_constants::syntax_option_type basic
= regex_constants::basic;
- static const regex_constants::syntax_option_type extended
+ static constexpr regex_constants::syntax_option_type extended
= regex_constants::extended;
- static const regex_constants::syntax_option_type awk
+ static constexpr regex_constants::syntax_option_type awk
= regex_constants::awk;
- static const regex_constants::syntax_option_type grep
+ static constexpr regex_constants::syntax_option_type grep
= regex_constants::grep;
- static const regex_constants::syntax_option_type egrep
+ static constexpr regex_constants::syntax_option_type egrep
= regex_constants::egrep;
//@}
@@ -2423,6 +2421,5 @@ namespace std
#endif
//@} // group regex
-
-}
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h
index b15807aa762..90c96ff93ea 100644
--- a/libstdc++-v3/include/bits/regex_compiler.h
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -28,8 +28,8 @@
* You should not attempt to use it directly.
*/
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
namespace __regex
{
struct _Scanner_base
@@ -1110,6 +1110,7 @@ namespace __regex
__f)._M_nfa())); }
} // namespace __regex
-} // namespace std
+
+_GLIBCXX_END_NAMESPACE
/* vim: set ts=8 sw=2 sts=2: */
diff --git a/libstdc++-v3/include/bits/regex_constants.h b/libstdc++-v3/include/bits/regex_constants.h
index ae462b3234f..15e29532c51 100644
--- a/libstdc++-v3/include/bits/regex_constants.h
+++ b/libstdc++-v3/include/bits/regex_constants.h
@@ -30,8 +30,7 @@
* You should not attempt to use it directly.
*/
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @namespace std::regex_constants
@@ -295,5 +294,6 @@ namespace regex_constants
//@}
} // namespace regex_constants
-} // namespace std
+
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/include/bits/regex_cursor.h b/libstdc++-v3/include/bits/regex_cursor.h
index e8330fb7885..32ea8c97d85 100644
--- a/libstdc++-v3/include/bits/regex_cursor.h
+++ b/libstdc++-v3/include/bits/regex_cursor.h
@@ -28,8 +28,8 @@
* You should not attempt to use it directly.
*/
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
namespace __regex
{
// ABC for pattern matching
@@ -87,6 +87,5 @@ namespace __regex
{ return _SpecializedCursor<_FwdIterT>(__b, __e); }
} // namespace __regex
-} // namespace std
-/* vim: set ts=8 sw=2 sts=2: */
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h
index 283eabfd9fb..91dd59778fc 100644
--- a/libstdc++-v3/include/bits/regex_error.h
+++ b/libstdc++-v3/include/bits/regex_error.h
@@ -30,8 +30,7 @@
* You should not attempt to use it directly.
*/
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
namespace regex_constants
{
@@ -156,5 +155,4 @@ namespace regex_constants
__throw_regex_error(regex_constants::error_type __ecode)
{ throw regex_error(__ecode); }
-} // namespace std
-
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/include/bits/regex_grep_matcher.h b/libstdc++-v3/include/bits/regex_grep_matcher.h
index 33890e4257c..470e6297f39 100644
--- a/libstdc++-v3/include/bits/regex_grep_matcher.h
+++ b/libstdc++-v3/include/bits/regex_grep_matcher.h
@@ -28,9 +28,8 @@
* You should not attempt to use it directly.
*/
+_GLIBCXX_BEGIN_NAMESPACE(std)
-namespace std
-{
template<typename _BiIter>
class sub_match;
@@ -124,8 +123,7 @@ namespace __regex
};
} // namespace __regex
-} // namespace std
-#include <bits/regex_grep_matcher.tcc>
+_GLIBCXX_END_NAMESPACE
-/* vim: set ts=8 sw=2 sts=2: */
+#include <bits/regex_grep_matcher.tcc>
diff --git a/libstdc++-v3/include/bits/regex_grep_matcher.tcc b/libstdc++-v3/include/bits/regex_grep_matcher.tcc
index 6964592ab1d..48e7482b2ed 100644
--- a/libstdc++-v3/include/bits/regex_grep_matcher.tcc
+++ b/libstdc++-v3/include/bits/regex_grep_matcher.tcc
@@ -25,10 +25,10 @@
/**
* @file bits/regex_grep_matcher.tcc
*/
+
#include <regex>
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
namespace
{
@@ -172,6 +172,5 @@ namespace __regex
}
} // namespace __regex
-} // namespace std
-/* vim: set ts=8 sw=2 sts=2: */
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/include/bits/regex_nfa.h b/libstdc++-v3/include/bits/regex_nfa.h
index 2a938915b97..0a412891311 100644
--- a/libstdc++-v3/include/bits/regex_nfa.h
+++ b/libstdc++-v3/include/bits/regex_nfa.h
@@ -28,8 +28,8 @@
* You should not attempt to use it directly.
*/
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
namespace __regex
{
@@ -397,7 +397,8 @@ namespace __regex
};
} // namespace __regex
-} // namespace std
+
+_GLIBCXX_END_NAMESPACE
#include <bits/regex_nfa.tcc>
diff --git a/libstdc++-v3/include/bits/regex_nfa.tcc b/libstdc++-v3/include/bits/regex_nfa.tcc
index 2a1a4d07679..4a5d5ffd120 100644
--- a/libstdc++-v3/include/bits/regex_nfa.tcc
+++ b/libstdc++-v3/include/bits/regex_nfa.tcc
@@ -27,8 +27,8 @@
*/
#include <regex>
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
namespace __regex
{
#ifdef _GLIBCXX_DEBUG
@@ -166,5 +166,5 @@ _M_clone()
{ return 0; }
} // namespace __regex
-} // namespace std
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 183c241e29b..4a30ea4da6a 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -51,6 +51,202 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
+ /**
+ * @brief Exception possibly thrown by @c shared_ptr.
+ * @ingroup exceptions
+ */
+ class bad_weak_ptr : public std::exception
+ {
+ public:
+ virtual char const*
+ what() const throw()
+ { return "std::bad_weak_ptr"; }
+ };
+
+ // Substitute for bad_weak_ptr object in the case of -fno-exceptions.
+ inline void
+ __throw_bad_weak_ptr()
+ {
+#if __EXCEPTIONS
+ throw bad_weak_ptr();
+#else
+ __builtin_abort();
+#endif
+ }
+
+ using __gnu_cxx::_Lock_policy;
+ using __gnu_cxx::__default_lock_policy;
+ using __gnu_cxx::_S_single;
+ using __gnu_cxx::_S_mutex;
+ using __gnu_cxx::_S_atomic;
+
+ // Empty helper class except when the template argument is _S_mutex.
+ template<_Lock_policy _Lp>
+ class _Mutex_base
+ {
+ protected:
+ // The atomic policy uses fully-fenced builtins, single doesn't care.
+ enum { _S_need_barriers = 0 };
+ };
+
+ template<>
+ class _Mutex_base<_S_mutex>
+ : public __gnu_cxx::__mutex
+ {
+ protected:
+ // This policy is used when atomic builtins are not available.
+ // The replacement atomic operations might not have the necessary
+ // memory barriers.
+ enum { _S_need_barriers = 1 };
+ };
+
+ template<_Lock_policy _Lp = __default_lock_policy>
+ class _Sp_counted_base
+ : public _Mutex_base<_Lp>
+ {
+ public:
+ _Sp_counted_base()
+ : _M_use_count(1), _M_weak_count(1) { }
+
+ virtual
+ ~_Sp_counted_base() // nothrow
+ { }
+
+ // Called when _M_use_count drops to zero, to release the resources
+ // managed by *this.
+ virtual void
+ _M_dispose() = 0; // nothrow
+
+ // Called when _M_weak_count drops to zero.
+ virtual void
+ _M_destroy() // nothrow
+ { delete this; }
+
+ virtual void*
+ _M_get_deleter(const std::type_info&) = 0;
+
+ void
+ _M_add_ref_copy()
+ { __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); }
+
+ void
+ _M_add_ref_lock();
+
+ void
+ _M_release() // nothrow
+ {
+ // Be race-detector-friendly. For more info see bits/c++config.
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count);
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
+ {
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
+ _M_dispose();
+ // There must be a memory barrier between dispose() and destroy()
+ // to ensure that the effects of dispose() are observed in the
+ // thread that runs destroy().
+ // See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html
+ if (_Mutex_base<_Lp>::_S_need_barriers)
+ {
+ _GLIBCXX_READ_MEM_BARRIER;
+ _GLIBCXX_WRITE_MEM_BARRIER;
+ }
+
+ // Be race-detector-friendly. For more info see bits/c++config.
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,
+ -1) == 1)
+ {
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
+ _M_destroy();
+ }
+ }
+ }
+
+ void
+ _M_weak_add_ref() // nothrow
+ { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
+
+ void
+ _M_weak_release() // nothrow
+ {
+ // Be race-detector-friendly. For more info see bits/c++config.
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)
+ {
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
+ if (_Mutex_base<_Lp>::_S_need_barriers)
+ {
+ // See _M_release(),
+ // destroy() must observe results of dispose()
+ _GLIBCXX_READ_MEM_BARRIER;
+ _GLIBCXX_WRITE_MEM_BARRIER;
+ }
+ _M_destroy();
+ }
+ }
+
+ long
+ _M_get_use_count() const // nothrow
+ {
+ // No memory barrier is used here so there is no synchronization
+ // with other threads.
+ return const_cast<const volatile _Atomic_word&>(_M_use_count);
+ }
+
+ private:
+ _Sp_counted_base(_Sp_counted_base const&);
+ _Sp_counted_base& operator=(_Sp_counted_base const&);
+
+ _Atomic_word _M_use_count; // #shared
+ _Atomic_word _M_weak_count; // #weak + (#shared != 0)
+ };
+
+ template<>
+ inline void
+ _Sp_counted_base<_S_single>::
+ _M_add_ref_lock()
+ {
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
+ {
+ _M_use_count = 0;
+ __throw_bad_weak_ptr();
+ }
+ }
+
+ template<>
+ inline void
+ _Sp_counted_base<_S_mutex>::
+ _M_add_ref_lock()
+ {
+ __gnu_cxx::__scoped_lock sentry(*this);
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
+ {
+ _M_use_count = 0;
+ __throw_bad_weak_ptr();
+ }
+ }
+
+ template<>
+ inline void
+ _Sp_counted_base<_S_atomic>::
+ _M_add_ref_lock()
+ {
+ // Perform lock-free add-if-not-zero operation.
+ _Atomic_word __count;
+ do
+ {
+ __count = _M_use_count;
+ if (__count == 0)
+ __throw_bad_weak_ptr();
+
+ // Replace the current counter value with the old value + 1, as
+ // long as it's not changed meanwhile.
+ }
+ while (!__sync_bool_compare_and_swap(&_M_use_count, __count,
+ __count + 1));
+ }
+
+
// Forward declarations.
template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
class __shared_ptr;
diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/bits/stl_function.h
index fd9c3589d69..a5f5e255825 100644
--- a/libstdc++-v3/include/bits/stl_function.h
+++ b/libstdc++-v3/include/bits/stl_function.h
@@ -487,6 +487,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const typename _Pair::first_type&
operator()(const _Pair& __x) const
{ return __x.first; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Pair2>
+ typename _Pair2::first_type&
+ operator()(_Pair2& __x) const
+ { return __x.first; }
+
+ template<typename _Pair2>
+ const typename _Pair2::first_type&
+ operator()(const _Pair2& __x) const
+ { return __x.first; }
+#endif
};
template<typename _Pair>
diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h
index 83a390d3d9e..cf543baebd0 100644
--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -709,7 +709,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef typename __traits_type::reference reference;
typedef typename __traits_type::pointer pointer;
- __normal_iterator() : _M_current(_Iterator()) { }
+ _GLIBCXX_CONSTEXPR __normal_iterator() : _M_current(_Iterator()) { }
explicit
__normal_iterator(const _Iterator& __i) : _M_current(__i) { }
diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index f4b339db91a..0e651e7ba76 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -66,10 +66,11 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /// piecewise_construct_t
struct piecewise_construct_t { };
- static const piecewise_construct_t piecewise_construct
- = piecewise_construct_t();
+ /// piecewise_construct
+ constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
// forward declarations
template<typename...>
@@ -93,7 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// 265. std::pair::pair() effects overly restrictive
/** The default constructor creates @c first and @c second using their
* respective default constructors. */
- pair()
+ _GLIBCXX_CONSTEXPR pair()
: first(), second() { }
/** Two objects may be passed to a @c pair constructor to be copied. */
diff --git a/libstdc++-v3/include/bits/stream_iterator.h b/libstdc++-v3/include/bits/stream_iterator.h
index 90f1b552b60..a5675cb1415 100644
--- a/libstdc++-v3/include/bits/stream_iterator.h
+++ b/libstdc++-v3/include/bits/stream_iterator.h
@@ -1,6 +1,6 @@
// Stream iterators
-// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2004, 2005, 2009, 2010 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
@@ -59,7 +59,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
public:
/// Construct end of input stream iterator.
- istream_iterator()
+ _GLIBCXX_CONSTEXPR istream_iterator()
: _M_stream(0), _M_value(), _M_ok(false) {}
/// Construct start of input stream iterator.
diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h b/libstdc++-v3/include/bits/streambuf_iterator.h
index 71c323035a2..3ec1df18092 100644
--- a/libstdc++-v3/include/bits/streambuf_iterator.h
+++ b/libstdc++-v3/include/bits/streambuf_iterator.h
@@ -1,7 +1,7 @@
// Streambuf iterators
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2009
+// 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -93,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
public:
/// Construct end of input stream iterator.
- istreambuf_iterator() throw()
+ _GLIBCXX_CONSTEXPR istreambuf_iterator() throw()
: _M_sbuf(0), _M_c(traits_type::eof()) { }
/// Construct start of input stream iterator.
diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h
index d6adb1459e3..ebbc521873a 100644
--- a/libstdc++-v3/include/bits/unique_ptr.h
+++ b/libstdc++-v3/include/bits/unique_ptr.h
@@ -44,7 +44,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*/
/// Primary template, default_delete.
- template<typename _Tp>
+ template<typename _Tp>
struct default_delete
{
default_delete() { }
@@ -65,7 +65,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 740 - omit specialization for array objects with a compile time length
/// Specialization, default_delete.
- template<typename _Tp>
+ template<typename _Tp>
struct default_delete<_Tp[]>
{
void
@@ -78,11 +78,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
};
/// 20.7.12.2 unique_ptr for single objects.
- template <typename _Tp, typename _Dp = default_delete<_Tp> >
+ template <typename _Tp, typename _Dp = default_delete<_Tp> >
class unique_ptr
{
- typedef std::tuple<_Tp*, _Dp> __tuple_type;
-
// use SFINAE to determine whether _Del::pointer exists
class _Pointer
{
@@ -95,19 +93,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef typename remove_reference<_Dp>::type _Del;
public:
- typedef decltype( __test<_Del>(0) ) type;
+ typedef decltype( __test<_Del>(0)) type;
};
+ typedef std::tuple<_Tp*, _Dp> __tuple_type;
+ __tuple_type _M_t;
+
public:
typedef typename _Pointer::type pointer;
typedef _Tp element_type;
typedef _Dp deleter_type;
+ static_assert(!std::is_pointer<deleter_type>::value,
+ "constructed with null function pointer deleter");
+
// Constructors.
unique_ptr()
: _M_t(pointer(), deleter_type())
- { static_assert(!std::is_pointer<deleter_type>::value,
- "constructed with null function pointer deleter"); }
+ { }
explicit
unique_ptr(pointer __p)
@@ -116,14 +119,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
"constructed with null function pointer deleter"); }
unique_ptr(pointer __p,
- typename std::conditional<std::is_reference<deleter_type>::value,
- deleter_type, const deleter_type&>::type __d)
+ typename std::conditional<std::is_reference<deleter_type>::value,
+ deleter_type, const deleter_type&>::type __d)
: _M_t(__p, __d) { }
unique_ptr(pointer __p,
- typename std::remove_reference<deleter_type>::type&& __d)
+ typename std::remove_reference<deleter_type>::type&& __d)
: _M_t(std::move(__p), std::move(__d))
- { static_assert(!std::is_reference<deleter_type>::value,
+ { static_assert(!std::is_reference<deleter_type>::value,
"rvalue deleter bound to reference"); }
unique_ptr(nullptr_t)
@@ -131,7 +134,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ }
// Move constructors.
- unique_ptr(unique_ptr&& __u)
+ unique_ptr(unique_ptr&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
template<typename _Up, typename _Ep, typename = typename
@@ -143,9 +146,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
&& std::is_same<_Ep, _Dp>::value)
|| (!std::is_reference<_Dp>::value
&& std::is_convertible<_Ep, _Dp>::value))>
- ::type>
- unique_ptr(unique_ptr<_Up, _Ep>&& __u)
- : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
+ ::type>
+ unique_ptr(unique_ptr<_Up, _Ep>&& __u)
+ : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
{ }
#if _GLIBCXX_DEPRECATED
@@ -153,7 +156,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
std::enable_if<std::is_convertible<_Up*, _Tp*>::value
&& std::is_same<_Dp,
default_delete<_Tp>>::value>::type>
- unique_ptr(auto_ptr<_Up>&& __u)
+ unique_ptr(auto_ptr<_Up>&& __u)
: _M_t(__u.release(), deleter_type()) { }
#endif
@@ -163,24 +166,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Assignment.
unique_ptr&
operator=(unique_ptr&& __u)
- {
- reset(__u.release());
- get_deleter() = std::move(__u.get_deleter());
- return *this;
+ {
+ reset(__u.release());
+ get_deleter() = std::move(__u.get_deleter());
+ return *this;
}
template<typename _Up, typename _Ep, typename = typename
- std::enable_if
+ std::enable_if
<std::is_convertible<typename unique_ptr<_Up, _Ep>::pointer,
pointer>::value
- && !std::is_array<_Up>::value>::type>
- unique_ptr&
- operator=(unique_ptr<_Up, _Ep>&& __u)
+ && !std::is_array<_Up>::value>::type>
+ unique_ptr&
+ operator=(unique_ptr<_Up, _Ep>&& __u)
{
- reset(__u.release());
- get_deleter() = std::move(__u.get_deleter());
- return *this;
- }
+ reset(__u.release());
+ get_deleter() = std::move(__u.get_deleter());
+ return *this;
+ }
unique_ptr&
operator=(nullptr_t)
@@ -221,7 +224,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Modifiers.
pointer
- release()
+ release()
{
pointer __p = get();
std::get<0>(_M_t) = pointer();
@@ -247,11 +250,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Disable copy from lvalue.
unique_ptr(const unique_ptr&) = delete;
unique_ptr& operator=(const unique_ptr&) = delete;
-
- private:
- __tuple_type _M_t;
};
-
+
/// 20.7.12.3 unique_ptr for array objects with a runtime length
// [unique.ptr.runtime]
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -259,34 +259,36 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp, typename _Dp>
class unique_ptr<_Tp[], _Dp>
{
- typedef std::tuple<_Tp*, _Dp> __tuple_type;
+ typedef std::tuple<_Tp*, _Dp> __tuple_type;
+ __tuple_type _M_t;
public:
- typedef _Tp* pointer;
- typedef _Tp element_type;
- typedef _Dp deleter_type;
+ typedef _Tp* pointer;
+ typedef _Tp element_type;
+ typedef _Dp deleter_type;
+
+ static_assert(!std::is_pointer<deleter_type>::value,
+ "constructed with null function pointer deleter");
// Constructors.
unique_ptr()
: _M_t(pointer(), deleter_type())
- { static_assert(!std::is_pointer<deleter_type>::value,
- "constructed with null function pointer deleter"); }
+ { }
explicit
unique_ptr(pointer __p)
: _M_t(__p, deleter_type())
- { static_assert(!std::is_pointer<deleter_type>::value,
- "constructed with null function pointer deleter"); }
+ { }
unique_ptr(pointer __p,
- typename std::conditional<std::is_reference<deleter_type>::value,
- deleter_type, const deleter_type&>::type __d)
+ typename std::conditional<std::is_reference<deleter_type>::value,
+ deleter_type, const deleter_type&>::type __d)
: _M_t(__p, __d) { }
unique_ptr(pointer __p,
typename std::remove_reference<deleter_type>::type && __d)
: _M_t(std::move(__p), std::move(__d))
- { static_assert(!std::is_reference<deleter_type>::value,
+ { static_assert(!std::is_reference<deleter_type>::value,
"rvalue deleter bound to reference"); }
/* TODO: use delegating constructor */
@@ -295,11 +297,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ }
// Move constructors.
- unique_ptr(unique_ptr&& __u)
+ unique_ptr(unique_ptr&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
- template<typename _Up, typename _Ep>
- unique_ptr(unique_ptr<_Up, _Ep>&& __u)
+ template<typename _Up, typename _Ep>
+ unique_ptr(unique_ptr<_Up, _Ep>&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
{ }
@@ -311,18 +313,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
operator=(unique_ptr&& __u)
{
reset(__u.release());
- get_deleter() = std::move(__u.get_deleter());
- return *this;
+ get_deleter() = std::move(__u.get_deleter());
+ return *this;
}
- template<typename _Up, typename _Ep>
- unique_ptr&
- operator=(unique_ptr<_Up, _Ep>&& __u)
+ template<typename _Up, typename _Ep>
+ unique_ptr&
+ operator=(unique_ptr<_Up, _Ep>&& __u)
{
- reset(__u.release());
- get_deleter() = std::move(__u.get_deleter());
- return *this;
- }
+ reset(__u.release());
+ get_deleter() = std::move(__u.get_deleter());
+ return *this;
+ }
unique_ptr&
operator=(nullptr_t)
@@ -332,8 +334,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
// Observers.
- typename std::add_lvalue_reference<element_type>::type
- operator[](size_t __i) const
+ typename std::add_lvalue_reference<element_type>::type
+ operator[](size_t __i) const
{
_GLIBCXX_DEBUG_ASSERT(get() != pointer());
return get()[__i];
@@ -343,20 +345,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
get() const
{ return std::get<0>(_M_t); }
- deleter_type&
+ deleter_type&
get_deleter()
{ return std::get<1>(_M_t); }
const deleter_type&
get_deleter() const
- { return std::get<1>(_M_t); }
+ { return std::get<1>(_M_t); }
- explicit operator bool() const
+ explicit operator bool() const
{ return get() == pointer() ? false : true; }
-
+
// Modifiers.
pointer
- release()
+ release()
{
pointer __p = get();
std::get<0>(_M_t) = pointer();
@@ -364,7 +366,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
void
- reset(pointer __p = pointer())
+ reset(pointer __p = pointer())
{
using std::swap;
swap(std::get<0>(_M_t), __p);
@@ -383,7 +385,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// DR 821.
template<typename _Up>
- void reset(_Up) = delete;
+ void reset(_Up) = delete;
void
swap(unique_ptr& __u)
@@ -399,27 +401,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Disable construction from convertible pointer types.
// (N2315 - 20.6.5.3.1)
template<typename _Up>
- unique_ptr(_Up*, typename
+ unique_ptr(_Up*, typename
std::conditional<std::is_reference<deleter_type>::value,
deleter_type, const deleter_type&>::type,
- typename std::enable_if<std::is_convertible<_Up*,
+ typename std::enable_if<std::is_convertible<_Up*,
pointer>::value>::type* = 0) = delete;
template<typename _Up>
- unique_ptr(_Up*, typename std::remove_reference<deleter_type>::type&&,
- typename std::enable_if<std::is_convertible<_Up*,
+ unique_ptr(_Up*, typename std::remove_reference<deleter_type>::type&&,
+ typename std::enable_if<std::is_convertible<_Up*,
pointer>::value>::type* = 0) = delete;
template<typename _Up>
- explicit
- unique_ptr(_Up*, typename std::enable_if<std::is_convertible<_Up*,
+ explicit
+ unique_ptr(_Up*, typename std::enable_if<std::is_convertible<_Up*,
pointer>::value>::type* = 0) = delete;
-
- private:
- __tuple_type _M_t;
};
-
- template<typename _Tp, typename _Dp>
+
+ template<typename _Tp, typename _Dp>
inline void
swap(unique_ptr<_Tp, _Dp>& __x,
unique_ptr<_Tp, _Dp>& __y)
diff --git a/libstdc++-v3/include/c_compatibility/fenv.h b/libstdc++-v3/include/c_compatibility/fenv.h
index 5db6d9d0125..3eb5b207d7a 100644
--- a/libstdc++-v3/include/c_compatibility/fenv.h
+++ b/libstdc++-v3/include/c_compatibility/fenv.h
@@ -37,22 +37,46 @@
#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cfenv>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cfenv>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
-#endif
+
+#if _GLIBCXX_USE_C99_FENV_TR1
+
+#undef feclearexcept
+#undef fegetexceptflag
+#undef feraiseexcept
+#undef fesetexceptflag
+#undef fetestexcept
+#undef fegetround
+#undef fesetround
+#undef fegetenv
+#undef feholdexcept
+#undef fesetenv
+#undef feupdateenv
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // types
+ using ::fenv_t;
+ using ::fexcept_t;
+
+ // functions
+ using ::feclearexcept;
+ using ::fegetexceptflag;
+ using ::feraiseexcept;
+ using ::fesetexceptflag;
+ using ::fetestexcept;
+
+ using ::fegetround;
+ using ::fesetround;
+
+ using ::fegetenv;
+ using ::feholdexcept;
+ using ::fesetenv;
+ using ::feupdateenv;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_C99_FENV_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_FENV_H
diff --git a/libstdc++-v3/include/c_compatibility/inttypes.h b/libstdc++-v3/include/c_compatibility/inttypes.h
index 31fd43169ef..2273dfe652e 100644
--- a/libstdc++-v3/include/c_compatibility/inttypes.h
+++ b/libstdc++-v3/include/c_compatibility/inttypes.h
@@ -48,22 +48,38 @@
# endif
# endif
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cinttypes>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cinttypes>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
+#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // types
+ using ::imaxdiv_t;
+
+ // functions
+ using ::imaxabs;
+
+ // May collide with _Longlong abs(_Longlong), and is not described
+ // anywhere outside the synopsis. Likely, a defect.
+ //
+ // intmax_t abs(intmax_t)
+
+ using ::imaxdiv;
+
+ // Likewise, with lldiv_t div(_Longlong, _Longlong).
+ //
+ // imaxdiv_t div(intmax_t, intmax_t)
+
+ using ::strtoimax;
+ using ::strtoumax;
+
+#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
+ using ::wcstoimax;
+ using ::wcstoumax;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif _GLIBCXX_USE_C99_INTTYPES_TR1
#else
diff --git a/libstdc++-v3/include/c_compatibility/stdatomic.h b/libstdc++-v3/include/c_compatibility/stdatomic.h
deleted file mode 100644
index 1b24b494f11..00000000000
--- a/libstdc++-v3/include/c_compatibility/stdatomic.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*- compatibility header.
-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file stdatomic.h
- * This is a Standard C++ Library header.
- */
-
-#include <bits/atomic_base.h>
-
-#ifndef _GLIBCXX_STDATOMIC_H
-#define _GLIBCXX_STDATOMIC_H 1
-
-#ifdef _GLIBCXX_NAMESPACE_C
-#endif
-
-#endif
diff --git a/libstdc++-v3/include/c_compatibility/stdint.h b/libstdc++-v3/include/c_compatibility/stdint.h
index 78a66d0d1b6..9f3a65bbe46 100644
--- a/libstdc++-v3/include/c_compatibility/stdint.h
+++ b/libstdc++-v3/include/c_compatibility/stdint.h
@@ -56,22 +56,49 @@
# endif
# endif
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cstdint>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cstdint>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::int8_t;
+ using ::int16_t;
+ using ::int32_t;
+ using ::int64_t;
+
+ using ::int_fast8_t;
+ using ::int_fast16_t;
+ using ::int_fast32_t;
+ using ::int_fast64_t;
+
+ using ::int_least8_t;
+ using ::int_least16_t;
+ using ::int_least32_t;
+ using ::int_least64_t;
+
+ using ::intmax_t;
+ using ::intptr_t;
+
+ using ::uint8_t;
+ using ::uint16_t;
+ using ::uint32_t;
+ using ::uint64_t;
+
+ using ::uint_fast8_t;
+ using ::uint_fast16_t;
+ using ::uint_fast32_t;
+ using ::uint_fast64_t;
+
+ using ::uint_least8_t;
+ using ::uint_least16_t;
+ using ::uint_least32_t;
+ using ::uint_least64_t;
+
+ using ::uintmax_t;
+ using ::uintptr_t;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_C99_STDINT_TR1
#else
diff --git a/libstdc++-v3/include/c_global/cctype b/libstdc++-v3/include/c_global/cctype
index 1dfe1720c4f..cab2a5089f6 100644
--- a/libstdc++-v3/include/c_global/cctype
+++ b/libstdc++-v3/include/c_global/cctype
@@ -80,22 +80,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cctype>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cctype>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
-#endif
+
+#ifdef _GLIBCXX_USE_C99_CTYPE_TR1
+
+#undef isblank
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::isblank;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_C99_CTYPE_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif
diff --git a/libstdc++-v3/include/c_global/cfenv b/libstdc++-v3/include/c_global/cfenv
index 4e401411767..9686e8d35ec 100644
--- a/libstdc++-v3/include/c_global/cfenv
+++ b/libstdc++-v3/include/c_global/cfenv
@@ -33,29 +33,53 @@
#ifndef __GXX_EXPERIMENTAL_CXX0X__
# include <bits/c++0x_warning.h>
-#endif
-
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-#endif
+#else
#include <bits/c++config.h>
+
#if _GLIBCXX_HAVE_FENV_H
# include <fenv.h>
#endif
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cfenv>
-#else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cfenv>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-#endif
+#ifdef _GLIBCXX_USE_C99_FENV_TR1
+
+#undef feclearexcept
+#undef fegetexceptflag
+#undef feraiseexcept
+#undef fesetexceptflag
+#undef fetestexcept
+#undef fegetround
+#undef fesetround
+#undef fegetenv
+#undef feholdexcept
+#undef fesetenv
+#undef feupdateenv
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // types
+ using ::fenv_t;
+ using ::fexcept_t;
+
+ // functions
+ using ::feclearexcept;
+ using ::fegetexceptflag;
+ using ::feraiseexcept;
+ using ::fesetexceptflag;
+ using ::fetestexcept;
+
+ using ::fegetround;
+ using ::fesetround;
+
+ using ::fegetenv;
+ using ::feholdexcept;
+ using ::fesetenv;
+ using ::feupdateenv;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_C99_FENV_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_CFENV
diff --git a/libstdc++-v3/include/c_global/cinttypes b/libstdc++-v3/include/c_global/cinttypes
index d8de5ee5c92..0017e75d509 100644
--- a/libstdc++-v3/include/c_global/cinttypes
+++ b/libstdc++-v3/include/c_global/cinttypes
@@ -33,11 +33,7 @@
#ifndef __GXX_EXPERIMENTAL_CXX0X__
# include <bits/c++0x_warning.h>
-#endif
-
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-#endif
+#else
#include <cstdint>
@@ -54,18 +50,39 @@
# endif
#endif
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cinttypes>
-#else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cinttypes>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // types
+ using ::imaxdiv_t;
+
+ // functions
+ using ::imaxabs;
+
+ // May collide with _Longlong abs(_Longlong), and is not described
+ // anywhere outside the synopsis. Likely, a defect.
+ //
+ // intmax_t abs(intmax_t)
+
+ using ::imaxdiv;
+
+ // Likewise, with lldiv_t div(_Longlong, _Longlong).
+ //
+ // imaxdiv_t div(intmax_t, intmax_t)
+
+ using ::strtoimax;
+ using ::strtoumax;
+
+#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
+ using ::wcstoimax;
+ using ::wcstoumax;
#endif
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_C99_INTTYPES_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
#endif // _GLIBCXX_CINTTYPES
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index 3469b3884e8..69d424c2721 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -846,22 +846,812 @@ _GLIBCXX_END_NAMESPACE
#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cmath>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cmath>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
-#endif
+
+#ifdef _GLIBCXX_USE_C99_MATH_TR1
+
+#undef acosh
+#undef acoshf
+#undef acoshl
+#undef asinh
+#undef asinhf
+#undef asinhl
+#undef atanh
+#undef atanhf
+#undef atanhl
+#undef cbrt
+#undef cbrtf
+#undef cbrtl
+#undef copysign
+#undef copysignf
+#undef copysignl
+#undef erf
+#undef erff
+#undef erfl
+#undef erfc
+#undef erfcf
+#undef erfcl
+#undef exp2
+#undef exp2f
+#undef exp2l
+#undef expm1
+#undef expm1f
+#undef expm1l
+#undef fdim
+#undef fdimf
+#undef fdiml
+#undef fma
+#undef fmaf
+#undef fmal
+#undef fmax
+#undef fmaxf
+#undef fmaxl
+#undef fmin
+#undef fminf
+#undef fminl
+#undef hypot
+#undef hypotf
+#undef hypotl
+#undef ilogb
+#undef ilogbf
+#undef ilogbl
+#undef lgamma
+#undef lgammaf
+#undef lgammal
+#undef llrint
+#undef llrintf
+#undef llrintl
+#undef llround
+#undef llroundf
+#undef llroundl
+#undef log1p
+#undef log1pf
+#undef log1pl
+#undef log2
+#undef log2f
+#undef log2l
+#undef logb
+#undef logbf
+#undef logbl
+#undef lrint
+#undef lrintf
+#undef lrintl
+#undef lround
+#undef lroundf
+#undef lroundl
+#undef nan
+#undef nanf
+#undef nanl
+#undef nearbyint
+#undef nearbyintf
+#undef nearbyintl
+#undef nextafter
+#undef nextafterf
+#undef nextafterl
+#undef nexttoward
+#undef nexttowardf
+#undef nexttowardl
+#undef remainder
+#undef remainderf
+#undef remainderl
+#undef remquo
+#undef remquof
+#undef remquol
+#undef rint
+#undef rintf
+#undef rintl
+#undef round
+#undef roundf
+#undef roundl
+#undef scalbln
+#undef scalblnf
+#undef scalblnl
+#undef scalbn
+#undef scalbnf
+#undef scalbnl
+#undef tgamma
+#undef tgammaf
+#undef tgammal
+#undef trunc
+#undef truncf
+#undef truncl
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // types
+ using ::double_t;
+ using ::float_t;
+
+ // functions
+ using ::acosh;
+ using ::acoshf;
+ using ::acoshl;
+
+ using ::asinh;
+ using ::asinhf;
+ using ::asinhl;
+
+ using ::atanh;
+ using ::atanhf;
+ using ::atanhl;
+
+ using ::cbrt;
+ using ::cbrtf;
+ using ::cbrtl;
+
+ using ::copysign;
+ using ::copysignf;
+ using ::copysignl;
+
+ using ::erf;
+ using ::erff;
+ using ::erfl;
+
+ using ::erfc;
+ using ::erfcf;
+ using ::erfcl;
+
+ using ::exp2;
+ using ::exp2f;
+ using ::exp2l;
+
+ using ::expm1;
+ using ::expm1f;
+ using ::expm1l;
+
+ using ::fdim;
+ using ::fdimf;
+ using ::fdiml;
+
+ using ::fma;
+ using ::fmaf;
+ using ::fmal;
+
+ using ::fmax;
+ using ::fmaxf;
+ using ::fmaxl;
+
+ using ::fmin;
+ using ::fminf;
+ using ::fminl;
+
+ using ::hypot;
+ using ::hypotf;
+ using ::hypotl;
+
+ using ::ilogb;
+ using ::ilogbf;
+ using ::ilogbl;
+
+ using ::lgamma;
+ using ::lgammaf;
+ using ::lgammal;
+
+ using ::llrint;
+ using ::llrintf;
+ using ::llrintl;
+
+ using ::llround;
+ using ::llroundf;
+ using ::llroundl;
+
+ using ::log1p;
+ using ::log1pf;
+ using ::log1pl;
+
+ using ::log2;
+ using ::log2f;
+ using ::log2l;
+
+ using ::logb;
+ using ::logbf;
+ using ::logbl;
+
+ using ::lrint;
+ using ::lrintf;
+ using ::lrintl;
+
+ using ::lround;
+ using ::lroundf;
+ using ::lroundl;
+
+ using ::nan;
+ using ::nanf;
+ using ::nanl;
+
+ using ::nearbyint;
+ using ::nearbyintf;
+ using ::nearbyintl;
+
+ using ::nextafter;
+ using ::nextafterf;
+ using ::nextafterl;
+
+ using ::nexttoward;
+ using ::nexttowardf;
+ using ::nexttowardl;
+
+ using ::remainder;
+ using ::remainderf;
+ using ::remainderl;
+
+ using ::remquo;
+ using ::remquof;
+ using ::remquol;
+
+ using ::rint;
+ using ::rintf;
+ using ::rintl;
+
+ using ::round;
+ using ::roundf;
+ using ::roundl;
+
+ using ::scalbln;
+ using ::scalblnf;
+ using ::scalblnl;
+
+ using ::scalbn;
+ using ::scalbnf;
+ using ::scalbnl;
+
+ using ::tgamma;
+ using ::tgammaf;
+ using ::tgammal;
+
+ using ::trunc;
+ using ::truncf;
+ using ::truncl;
+
+ /// Additional overloads.
+ inline float
+ acosh(float __x)
+ { return __builtin_acoshf(__x); }
+
+ inline long double
+ acosh(long double __x)
+ { return __builtin_acoshl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ acosh(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return acosh(__type(__x));
+ }
+
+ inline float
+ asinh(float __x)
+ { return __builtin_asinhf(__x); }
+
+ inline long double
+ asinh(long double __x)
+ { return __builtin_asinhl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ asinh(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return asinh(__type(__x));
+ }
+
+ inline float
+ atanh(float __x)
+ { return __builtin_atanhf(__x); }
+
+ inline long double
+ atanh(long double __x)
+ { return __builtin_atanhl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ atanh(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return atanh(__type(__x));
+ }
+
+ inline float
+ cbrt(float __x)
+ { return __builtin_cbrtf(__x); }
+
+ inline long double
+ cbrt(long double __x)
+ { return __builtin_cbrtl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ cbrt(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return cbrt(__type(__x));
+ }
+
+ inline float
+ copysign(float __x, float __y)
+ { return __builtin_copysignf(__x, __y); }
+
+ inline long double
+ copysign(long double __x, long double __y)
+ { return __builtin_copysignl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ copysign(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return copysign(__type(__x), __type(__y));
+ }
+
+ inline float
+ erf(float __x)
+ { return __builtin_erff(__x); }
+
+ inline long double
+ erf(long double __x)
+ { return __builtin_erfl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ erf(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return erf(__type(__x));
+ }
+
+ inline float
+ erfc(float __x)
+ { return __builtin_erfcf(__x); }
+
+ inline long double
+ erfc(long double __x)
+ { return __builtin_erfcl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ erfc(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return erfc(__type(__x));
+ }
+
+ inline float
+ exp2(float __x)
+ { return __builtin_exp2f(__x); }
+
+ inline long double
+ exp2(long double __x)
+ { return __builtin_exp2l(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ exp2(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return exp2(__type(__x));
+ }
+
+ inline float
+ expm1(float __x)
+ { return __builtin_expm1f(__x); }
+
+ inline long double
+ expm1(long double __x)
+ { return __builtin_expm1l(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ expm1(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return expm1(__type(__x));
+ }
+
+ inline float
+ fdim(float __x, float __y)
+ { return __builtin_fdimf(__x, __y); }
+
+ inline long double
+ fdim(long double __x, long double __y)
+ { return __builtin_fdiml(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ fdim(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return fdim(__type(__x), __type(__y));
+ }
+
+ inline float
+ fma(float __x, float __y, float __z)
+ { return __builtin_fmaf(__x, __y, __z); }
+
+ inline long double
+ fma(long double __x, long double __y, long double __z)
+ { return __builtin_fmal(__x, __y, __z); }
+
+ template<typename _Tp, typename _Up, typename _Vp>
+ inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
+ fma(_Tp __x, _Up __y, _Vp __z)
+ {
+ typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
+ return fma(__type(__x), __type(__y), __type(__z));
+ }
+
+ inline float
+ fmax(float __x, float __y)
+ { return __builtin_fmaxf(__x, __y); }
+
+ inline long double
+ fmax(long double __x, long double __y)
+ { return __builtin_fmaxl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ fmax(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return fmax(__type(__x), __type(__y));
+ }
+
+ inline float
+ fmin(float __x, float __y)
+ { return __builtin_fminf(__x, __y); }
+
+ inline long double
+ fmin(long double __x, long double __y)
+ { return __builtin_fminl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ fmin(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return fmin(__type(__x), __type(__y));
+ }
+
+ inline float
+ hypot(float __x, float __y)
+ { return __builtin_hypotf(__x, __y); }
+
+ inline long double
+ hypot(long double __x, long double __y)
+ { return __builtin_hypotl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ hypot(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return hypot(__type(__x), __type(__y));
+ }
+
+ inline int
+ ilogb(float __x)
+ { return __builtin_ilogbf(__x); }
+
+ inline int
+ ilogb(long double __x)
+ { return __builtin_ilogbl(__x); }
+
+ template<typename _Tp>
+ inline int
+ ilogb(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return ilogb(__type(__x));
+ }
+
+ inline float
+ lgamma(float __x)
+ { return __builtin_lgammaf(__x); }
+
+ inline long double
+ lgamma(long double __x)
+ { return __builtin_lgammal(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ lgamma(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return lgamma(__type(__x));
+ }
+
+ inline long long
+ llrint(float __x)
+ { return __builtin_llrintf(__x); }
+
+ inline long long
+ llrint(long double __x)
+ { return __builtin_llrintl(__x); }
+
+ template<typename _Tp>
+ inline long long
+ llrint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return llrint(__type(__x));
+ }
+
+ inline long long
+ llround(float __x)
+ { return __builtin_llroundf(__x); }
+
+ inline long long
+ llround(long double __x)
+ { return __builtin_llroundl(__x); }
+
+ template<typename _Tp>
+ inline long long
+ llround(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return llround(__type(__x));
+ }
+
+ inline float
+ log1p(float __x)
+ { return __builtin_log1pf(__x); }
+
+ inline long double
+ log1p(long double __x)
+ { return __builtin_log1pl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ log1p(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return log1p(__type(__x));
+ }
+
+ // DR 568.
+ inline float
+ log2(float __x)
+ { return __builtin_log2f(__x); }
+
+ inline long double
+ log2(long double __x)
+ { return __builtin_log2l(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ log2(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return log2(__type(__x));
+ }
+
+ inline float
+ logb(float __x)
+ { return __builtin_logbf(__x); }
+
+ inline long double
+ logb(long double __x)
+ { return __builtin_logbl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ logb(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return logb(__type(__x));
+ }
+
+ inline long
+ lrint(float __x)
+ { return __builtin_lrintf(__x); }
+
+ inline long
+ lrint(long double __x)
+ { return __builtin_lrintl(__x); }
+
+ template<typename _Tp>
+ inline long
+ lrint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return lrint(__type(__x));
+ }
+
+ inline long
+ lround(float __x)
+ { return __builtin_lroundf(__x); }
+
+ inline long
+ lround(long double __x)
+ { return __builtin_lroundl(__x); }
+
+ template<typename _Tp>
+ inline long
+ lround(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return lround(__type(__x));
+ }
+
+ inline float
+ nearbyint(float __x)
+ { return __builtin_nearbyintf(__x); }
+
+ inline long double
+ nearbyint(long double __x)
+ { return __builtin_nearbyintl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ nearbyint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return nearbyint(__type(__x));
+ }
+
+ inline float
+ nextafter(float __x, float __y)
+ { return __builtin_nextafterf(__x, __y); }
+
+ inline long double
+ nextafter(long double __x, long double __y)
+ { return __builtin_nextafterl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ nextafter(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return nextafter(__type(__x), __type(__y));
+ }
+
+ inline float
+ nexttoward(float __x, long double __y)
+ { return __builtin_nexttowardf(__x, __y); }
+
+ inline long double
+ nexttoward(long double __x, long double __y)
+ { return __builtin_nexttowardl(__x, __y); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ nexttoward(_Tp __x, long double __y)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return nexttoward(__type(__x), __y);
+ }
+
+ inline float
+ remainder(float __x, float __y)
+ { return __builtin_remainderf(__x, __y); }
+
+ inline long double
+ remainder(long double __x, long double __y)
+ { return __builtin_remainderl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ remainder(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return remainder(__type(__x), __type(__y));
+ }
+
+ inline float
+ remquo(float __x, float __y, int* __pquo)
+ { return __builtin_remquof(__x, __y, __pquo); }
+
+ inline long double
+ remquo(long double __x, long double __y, int* __pquo)
+ { return __builtin_remquol(__x, __y, __pquo); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ remquo(_Tp __x, _Up __y, int* __pquo)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return remquo(__type(__x), __type(__y), __pquo);
+ }
+
+ inline float
+ rint(float __x)
+ { return __builtin_rintf(__x); }
+
+ inline long double
+ rint(long double __x)
+ { return __builtin_rintl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ rint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return rint(__type(__x));
+ }
+
+ inline float
+ round(float __x)
+ { return __builtin_roundf(__x); }
+
+ inline long double
+ round(long double __x)
+ { return __builtin_roundl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ round(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return round(__type(__x));
+ }
+
+ inline float
+ scalbln(float __x, long __ex)
+ { return __builtin_scalblnf(__x, __ex); }
+
+ inline long double
+ scalbln(long double __x, long __ex)
+ { return __builtin_scalblnl(__x, __ex); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ scalbln(_Tp __x, long __ex)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return scalbln(__type(__x), __ex);
+ }
+
+ inline float
+ scalbn(float __x, int __ex)
+ { return __builtin_scalbnf(__x, __ex); }
+
+ inline long double
+ scalbn(long double __x, int __ex)
+ { return __builtin_scalbnl(__x, __ex); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ scalbn(_Tp __x, int __ex)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return scalbn(__type(__x), __ex);
+ }
+
+ inline float
+ tgamma(float __x)
+ { return __builtin_tgammaf(__x); }
+
+ inline long double
+ tgamma(long double __x)
+ { return __builtin_tgammal(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ tgamma(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return tgamma(__type(__x));
+ }
+
+ inline float
+ trunc(float __x)
+ { return __builtin_truncf(__x); }
+
+ inline long double
+ trunc(long double __x)
+ { return __builtin_truncl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ trunc(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return trunc(__type(__x));
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_C99_MATH_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif
diff --git a/libstdc++-v3/include/c_global/cstdint b/libstdc++-v3/include/c_global/cstdint
index 28e449cff81..45aa7fa84f0 100644
--- a/libstdc++-v3/include/c_global/cstdint
+++ b/libstdc++-v3/include/c_global/cstdint
@@ -33,11 +33,7 @@
#ifndef __GXX_EXPERIMENTAL_CXX0X__
# include <bits/c++0x_warning.h>
-#endif
-
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-#endif
+#else
#include <bits/c++config.h>
@@ -62,18 +58,50 @@
# endif
#endif
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cstdint>
-#else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cstdint>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-#endif
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::int8_t;
+ using ::int16_t;
+ using ::int32_t;
+ using ::int64_t;
+
+ using ::int_fast8_t;
+ using ::int_fast16_t;
+ using ::int_fast32_t;
+ using ::int_fast64_t;
+
+ using ::int_least8_t;
+ using ::int_least16_t;
+ using ::int_least32_t;
+ using ::int_least64_t;
+
+ using ::intmax_t;
+ using ::intptr_t;
+
+ using ::uint8_t;
+ using ::uint16_t;
+ using ::uint32_t;
+ using ::uint64_t;
+
+ using ::uint_fast8_t;
+ using ::uint_fast16_t;
+ using ::uint_fast32_t;
+ using ::uint_fast64_t;
+
+ using ::uint_least8_t;
+ using ::uint_least16_t;
+ using ::uint_least32_t;
+ using ::uint_least64_t;
+
+ using ::uintmax_t;
+ using ::uintptr_t;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_C99_STDINT_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_CSTDINT
diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio
index 9124229248b..c7eb129cc5f 100644
--- a/libstdc++-v3/include/c_global/cstdio
+++ b/libstdc++-v3/include/c_global/cstdio
@@ -185,23 +185,4 @@ _GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_C99
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cstdio>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cstdio>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
-#endif
-
#endif
diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib
index 943f26328f0..31fad41bdd6 100644
--- a/libstdc++-v3/include/c_global/cstdlib
+++ b/libstdc++-v3/include/c_global/cstdlib
@@ -215,27 +215,38 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE
-#endif // _GLIBCXX_USE_C99
-
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cstdlib>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cstdlib>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ // types
+ using std::lldiv_t;
+
+ // functions
+ using std::llabs;
+ using std::lldiv;
#endif
+ using std::atoll;
+ using std::strtoll;
+ using std::strtoull;
+
+ using std::strtof;
+ using std::strtold;
+
+ // overloads
+ using std::abs;
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using std::div;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_USE_C99
+
#endif // !_GLIBCXX_HOSTED
#endif
diff --git a/libstdc++-v3/include/c_global/cwchar b/libstdc++-v3/include/c_global/cwchar
index c2bbde09c51..bbfcb64cb44 100644
--- a/libstdc++-v3/include/c_global/cwchar
+++ b/libstdc++-v3/include/c_global/cwchar
@@ -273,22 +273,34 @@ _GLIBCXX_END_NAMESPACE
#endif //_GLIBCXX_USE_WCHAR_T
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cwchar>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cwchar>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+#if _GLIBCXX_HAVE_WCSTOF
+ using std::wcstof;
+#endif
+#if _GLIBCXX_HAVE_VFWSCANF
+ using std::vfwscanf;
+#endif
+#if _GLIBCXX_HAVE_VSWSCANF
+ using std::vswscanf;
#endif
+#if _GLIBCXX_HAVE_VWSCANF
+ using std::vwscanf;
+#endif
+
+#if _GLIBCXX_USE_C99
+ using std::wcstold;
+ using std::wcstoll;
+ using std::wcstoull;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_WCHAR_T
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif
diff --git a/libstdc++-v3/include/c_global/cwctype b/libstdc++-v3/include/c_global/cwctype
index 2ac1155aa9b..ff196434c82 100644
--- a/libstdc++-v3/include/c_global/cwctype
+++ b/libstdc++-v3/include/c_global/cwctype
@@ -111,22 +111,19 @@ _GLIBCXX_END_NAMESPACE
#endif //_GLIBCXX_USE_WCHAR_T
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/cwctype>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/cwctype>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
-#endif
-#endif
+#ifdef _GLIBCXX_USE_WCHAR_T
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+#if _GLIBCXX_HAVE_ISWBLANK
+ using std::iswblank;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_WCHAR_T
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_CWCTYPE
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
index 2e2f9122ee0..6f37e040a26 100644
--- a/libstdc++-v3/include/debug/unordered_map
+++ b/libstdc++-v3/include/debug/unordered_map
@@ -190,6 +190,28 @@ namespace __debug
return iterator(__res.first, this);
}
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ std::pair<iterator, bool>
+ insert(_Pair&& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(std::forward<_Pair>(__obj));
+ return std::make_pair(iterator(__res.first, this), __res.second);
+ }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(const_iterator, _Pair&& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(std::forward<_Pair>(__obj));
+ return iterator(__res.first, this);
+ }
+
void
insert(std::initializer_list<value_type> __l)
{ _Base::insert(__l); }
@@ -444,6 +466,20 @@ namespace __debug
insert(const_iterator, const value_type& __obj)
{ return iterator(_Base::insert(__obj), this); }
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(_Pair&& __obj)
+ { return iterator(_Base::insert(std::forward<_Pair>(__obj)), this); }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(const_iterator, _Pair&& __obj)
+ { return iterator(_Base::insert(std::forward<_Pair>(__obj)), this); }
+
void
insert(std::initializer_list<value_type> __l)
{ _Base::insert(__l); }
diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
index ea90c675476..1d42905e236 100644
--- a/libstdc++-v3/include/debug/unordered_set
+++ b/libstdc++-v3/include/debug/unordered_set
@@ -190,6 +190,22 @@ namespace __debug
return iterator(__res.first, this);
}
+ std::pair<iterator, bool>
+ insert(value_type&& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(std::move(__obj));
+ return std::make_pair(iterator(__res.first, this), __res.second);
+ }
+
+ iterator
+ insert(const_iterator, value_type&& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(std::move(__obj));
+ return iterator(__res.first, this);
+ }
+
void
insert(std::initializer_list<value_type> __l)
{ _Base::insert(__l); }
@@ -440,6 +456,14 @@ namespace __debug
insert(const_iterator, const value_type& __obj)
{ return iterator(_Base::insert(__obj), this); }
+ iterator
+ insert(value_type&& __obj)
+ { return iterator(_Base::insert(std::move(__obj)), this); }
+
+ iterator
+ insert(const_iterator, value_type&& __obj)
+ { return iterator(_Base::insert(std::move(__obj)), this); }
+
void
insert(std::initializer_list<value_type> __l)
{ _Base::insert(__l); }
diff --git a/libstdc++-v3/include/ext/numeric_traits.h b/libstdc++-v3/include/ext/numeric_traits.h
index 57fcf9c1fb8..ab66a493580 100644
--- a/libstdc++-v3/include/ext/numeric_traits.h
+++ b/libstdc++-v3/include/ext/numeric_traits.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
#define __glibcxx_max_digits10(_Tp) \
(2 + __glibcxx_floating(_Tp, __FLT_MANT_DIG__, __DBL_MANT_DIG__, \
- __LDBL_MANT_DIG__) * 3010 / 10000)
+ __LDBL_MANT_DIG__) * 643L / 2136)
#define __glibcxx_digits10(_Tp) \
__glibcxx_floating(_Tp, __FLT_DIG__, __DBL_DIG__, __LDBL_DIG__)
diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map
index 2dec1f2a268..18563d87508 100644
--- a/libstdc++-v3/include/profile/unordered_map
+++ b/libstdc++-v3/include/profile/unordered_map
@@ -191,6 +191,31 @@ namespace __profile
return __res;
}
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ std::pair<iterator, bool>
+ insert(_Pair&& __obj)
+ {
+ size_type __old_size = _Base::bucket_count();
+ std::pair<iterator, bool> __res
+ = _Base::insert(std::forward<_Pair>(__obj));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(const_iterator __iter, _Pair&& __v)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)
@@ -420,11 +445,35 @@ namespace __profile
insert(const_iterator __iter, const value_type& __v)
{
size_type __old_size = _Base::bucket_count();
- iterator __res =_Base::insert(__iter, __v);
+ iterator __res = _Base::insert(__iter, __v);
_M_profile_resize(__old_size, _Base::bucket_count());
return __res;
}
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(_Pair&& __obj)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(std::forward<_Pair>(__obj));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(const_iterator __iter, _Pair&& __v)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)
diff --git a/libstdc++-v3/include/profile/unordered_set b/libstdc++-v3/include/profile/unordered_set
index 2dade092024..f46cf5c8bdd 100644
--- a/libstdc++-v3/include/profile/unordered_set
+++ b/libstdc++-v3/include/profile/unordered_set
@@ -174,7 +174,7 @@ namespace __profile
std::pair<iterator, bool>
insert(const value_type& __obj)
{
- size_type __old_size = _Base::bucket_count();
+ size_type __old_size = _Base::bucket_count();
std::pair<iterator, bool> __res = _Base::insert(__obj);
_M_profile_resize(__old_size, _Base::bucket_count());
return __res;
@@ -189,6 +189,24 @@ namespace __profile
return __res;
}
+ std::pair<iterator, bool>
+ insert(value_type&& __obj)
+ {
+ size_type __old_size = _Base::bucket_count();
+ std::pair<iterator, bool> __res = _Base::insert(std::move(__obj));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
+ iterator
+ insert(const_iterator __iter, value_type&& __v)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(__iter, std::move(__v));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)
@@ -406,13 +424,31 @@ namespace __profile
iterator
insert(const_iterator __iter, const value_type& __v)
- {
+ {
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__iter, __v);
_M_profile_resize(__old_size, _Base::bucket_count());
return __res;
}
+ iterator
+ insert(value_type&& __obj)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(std::move(__obj));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
+ iterator
+ insert(const_iterator __iter, value_type&& __v)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(__iter, std::move(__v));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array
index 26e762de339..3cad7e8f5ad 100644
--- a/libstdc++-v3/include/std/array
+++ b/libstdc++-v3/include/std/array
@@ -35,26 +35,236 @@
# include <bits/c++0x_warning.h>
#else
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-#endif
-
#include <bits/stl_algobase.h>
#include <bits/range_access.h>
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/array>
-#else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/array>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-#endif
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @brief A standard container for storing a fixed size sequence of elements.
+ *
+ * @ingroup sequences
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#66">reversible container</a>, and a
+ * <a href="tables.html#67">sequence</a>.
+ *
+ * Sets support random access iterators.
+ *
+ * @param Tp Type of element. Required to be a complete type.
+ * @param N Number of elements.
+ */
+ template<typename _Tp, std::size_t _Nm>
+ struct array
+ {
+ typedef _Tp value_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // Support for zero-sized arrays mandatory.
+ value_type _M_instance[_Nm ? _Nm : 1];
+
+ // No explicit construct/copy/destroy for aggregate type.
+
+ // DR 776.
+ void
+ fill(const value_type& __u)
+ { std::fill_n(begin(), size(), __u); }
+
+ void
+ swap(array& __other)
+ { std::swap_ranges(begin(), end(), __other.begin()); }
+
+ // Iterators.
+ iterator
+ begin()
+ { return iterator(std::__addressof(_M_instance[0])); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(std::__addressof(_M_instance[0])); }
+
+ iterator
+ end()
+ { return iterator(std::__addressof(_M_instance[_Nm])); }
+
+ const_iterator
+ end() const
+ { return const_iterator(std::__addressof(_M_instance[_Nm])); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+ const_iterator
+ cbegin() const
+ { return const_iterator(std::__addressof(_M_instance[0])); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(std::__addressof(_M_instance[_Nm])); }
+
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+
+ // Capacity.
+ constexpr size_type
+ size() const { return _Nm; }
+
+ constexpr size_type
+ max_size() const { return _Nm; }
+
+ constexpr bool
+ empty() const { return size() == 0; }
+
+ // Element access.
+ reference
+ operator[](size_type __n)
+ { return _M_instance[__n]; }
+
+ const_reference
+ operator[](size_type __n) const
+ { return _M_instance[__n]; }
+
+ reference
+ at(size_type __n)
+ {
+ if (__n >= _Nm)
+ std::__throw_out_of_range(__N("array::at"));
+ return _M_instance[__n];
+ }
+
+ const_reference
+ at(size_type __n) const
+ {
+ if (__n >= _Nm)
+ std::__throw_out_of_range(__N("array::at"));
+ return _M_instance[__n];
+ }
+
+ reference
+ front()
+ { return *begin(); }
+
+ const_reference
+ front() const
+ { return *begin(); }
+
+ reference
+ back()
+ { return _Nm ? *(end() - 1) : *end(); }
+
+ const_reference
+ back() const
+ { return _Nm ? *(end() - 1) : *end(); }
+
+ _Tp*
+ data()
+ { return std::__addressof(_M_instance[0]); }
+
+ const _Tp*
+ data() const
+ { return std::__addressof(_M_instance[0]); }
+ };
+
+ // Array comparisons.
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return std::equal(__one.begin(), __one.end(), __two.begin()); }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return !(__one == __two); }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
+ {
+ return std::lexicographical_compare(__a.begin(), __a.end(),
+ __b.begin(), __b.end());
+ }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return __two < __one; }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return !(__one > __two); }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return !(__one < __two); }
+
+ // Specialized algorithms [6.2.2.2].
+ template<typename _Tp, std::size_t _Nm>
+ inline void
+ swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
+ { __one.swap(__two); }
+
+ // Tuple interface to class template array [6.2.2.5].
+
+ /// tuple_size
+ template<typename _Tp>
+ class tuple_size;
+
+ /// tuple_element
+ template<std::size_t _Int, typename _Tp>
+ class tuple_element;
+
+ template<typename _Tp, std::size_t _Nm>
+ struct tuple_size<array<_Tp, _Nm> >
+ { static const std::size_t value = _Nm; };
+
+ template<typename _Tp, std::size_t _Nm>
+ const std::size_t
+ tuple_size<array<_Tp, _Nm> >::value;
+
+ template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+ struct tuple_element<_Int, array<_Tp, _Nm> >
+ { typedef _Tp type; };
+
+ template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+ inline _Tp&
+ get(array<_Tp, _Nm>& __arr)
+ { return __arr[_Int]; }
+
+ template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+ inline const _Tp&
+ get(const array<_Tp, _Nm>& __arr)
+ { return __arr[_Int]; }
+
+_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index c94597db6f3..fc4cb86c49d 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -38,8 +38,9 @@
# include <bits/c++0x_warning.h>
#endif
-#include <bits/c++config.h>
#include <bits/atomic_base.h>
+#include <bits/atomic_0.h>
+#include <bits/atomic_2.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
@@ -48,37 +49,103 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @{
*/
- /// kill_dependency
- template<typename _Tp>
- inline _Tp
- kill_dependency(_Tp __y)
- {
- _Tp ret(__y);
- return ret;
- }
-
- inline memory_order
- __calculate_memory_order(memory_order __m)
+ /// atomic_bool
+ // NB: No operators or fetch-operations for this type.
+ struct atomic_bool
{
- const bool __cond1 = __m == memory_order_release;
- const bool __cond2 = __m == memory_order_acq_rel;
- memory_order __mo1(__cond1 ? memory_order_relaxed : __m);
- memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
- return __mo2;
- }
+ private:
+ __atomic_base<bool> _M_base;
+
+ public:
+ atomic_bool() = default;
+ ~atomic_bool() = default;
+ atomic_bool(const atomic_bool&) = delete;
+ atomic_bool& operator=(const atomic_bool&) = delete;
+ atomic_bool& operator=(const atomic_bool&) volatile = delete;
+
+ constexpr atomic_bool(bool __i) : _M_base(__i) { }
+
+ bool
+ operator=(bool __i)
+ { return _M_base.operator=(__i); }
+
+ operator bool() const
+ { return _M_base.load(); }
+
+ operator bool() const volatile
+ { return _M_base.load(); }
+
+ bool
+ is_lock_free() const { return _M_base.is_lock_free(); }
+
+ bool
+ is_lock_free() const volatile { return _M_base.is_lock_free(); }
+
+ void
+ store(bool __i, memory_order __m = memory_order_seq_cst)
+ { _M_base.store(__i, __m); }
+
+ void
+ store(bool __i, memory_order __m = memory_order_seq_cst) volatile
+ { _M_base.store(__i, __m); }
+
+ bool
+ load(memory_order __m = memory_order_seq_cst) const
+ { return _M_base.load(__m); }
+
+ bool
+ load(memory_order __m = memory_order_seq_cst) const volatile
+ { return _M_base.load(__m); }
+
+ bool
+ exchange(bool __i, memory_order __m = memory_order_seq_cst)
+ { return _M_base.exchange(__i, __m); }
+
+ bool
+ exchange(bool __i, memory_order __m = memory_order_seq_cst) volatile
+ { return _M_base.exchange(__i, __m); }
+
+ bool
+ compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
+ memory_order __m2)
+ { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
+
+ bool
+ compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
+ memory_order __m2) volatile
+ { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
+
+ bool
+ compare_exchange_weak(bool& __i1, bool __i2,
+ memory_order __m = memory_order_seq_cst)
+ { return _M_base.compare_exchange_weak(__i1, __i2, __m); }
+
+ bool
+ compare_exchange_weak(bool& __i1, bool __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _M_base.compare_exchange_weak(__i1, __i2, __m); }
+
+ bool
+ compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
+ memory_order __m2)
+ { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+ bool
+ compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
+ memory_order __m2) volatile
+ { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+ bool
+ compare_exchange_strong(bool& __i1, bool __i2,
+ memory_order __m = memory_order_seq_cst)
+ { return _M_base.compare_exchange_strong(__i1, __i2, __m); }
+
+ bool
+ compare_exchange_strong(bool& __i1, bool __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _M_base.compare_exchange_strong(__i1, __i2, __m); }
+ };
- //
- // Three nested namespaces for atomic implementation details.
- //
- // The nested namespace inlined into std:: is determined by the value
- // of the _GLIBCXX_ATOMIC_PROPERTY macro and the resulting
- // ATOMIC_*_LOCK_FREE macros. See file atomic_base.h.
- //
- // 0 == __atomic0 == Never lock-free
- // 1 == __atomic1 == Best available, sometimes lock-free
- // 2 == __atomic2 == Always lock-free
-#include <bits/atomic_0.h>
-#include <bits/atomic_2.h>
/// atomic
/// 29.4.3, Generic atomic type, primary class template.
@@ -92,38 +159,68 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(_Tp __i) : _M_i(__i) { }
+ constexpr atomic(_Tp __i) : _M_i(__i) { }
operator _Tp() const;
+ operator _Tp() const volatile;
+
_Tp
operator=(_Tp __i) { store(__i); return __i; }
+ _Tp
+ operator=(_Tp __i) volatile { store(__i); return __i; }
+
+ bool
+ is_lock_free() const;
+
bool
is_lock_free() const volatile;
void
+ store(_Tp, memory_order = memory_order_seq_cst);
+
+ void
store(_Tp, memory_order = memory_order_seq_cst) volatile;
_Tp
+ load(memory_order = memory_order_seq_cst) const;
+
+ _Tp
load(memory_order = memory_order_seq_cst) const volatile;
_Tp
+ exchange(_Tp __i, memory_order = memory_order_seq_cst);
+
+ _Tp
exchange(_Tp __i, memory_order = memory_order_seq_cst) volatile;
bool
+ compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order);
+
+ bool
compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) volatile;
bool
- compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile;
+ compare_exchange_weak(_Tp&, _Tp, memory_order = memory_order_seq_cst);
bool
compare_exchange_weak(_Tp&, _Tp,
memory_order = memory_order_seq_cst) volatile;
bool
+ compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order);
+
+ bool
+ compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile;
+
+ bool
+ compare_exchange_strong(_Tp&, _Tp, memory_order = memory_order_seq_cst);
+
+ bool
compare_exchange_strong(_Tp&, _Tp,
memory_order = memory_order_seq_cst) volatile;
};
@@ -138,41 +235,70 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(_Tp* __v) : atomic_address(__v) { }
+ constexpr atomic(_Tp* __v) : atomic_address(__v) { }
+
+ void
+ store(_Tp*, memory_order = memory_order_seq_cst);
void
- store(_Tp* __v, memory_order __m = memory_order_seq_cst)
- { atomic_address::store(__v, __m); }
+ store(_Tp*, memory_order = memory_order_seq_cst) volatile;
_Tp*
- load(memory_order __m = memory_order_seq_cst) const
- { return static_cast<_Tp*>(atomic_address::load(__m)); }
+ load(memory_order = memory_order_seq_cst) const;
_Tp*
- exchange(_Tp* __v, memory_order __m = memory_order_seq_cst)
- { return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); }
+ load(memory_order = memory_order_seq_cst) const volatile;
+
+ _Tp*
+ exchange(_Tp*, memory_order = memory_order_seq_cst);
+
+ _Tp*
+ exchange(_Tp*, memory_order = memory_order_seq_cst) volatile;
bool
compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order);
bool
- compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order);
+ compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order) volatile;
bool
compare_exchange_weak(_Tp*&, _Tp*, memory_order = memory_order_seq_cst);
bool
+ compare_exchange_weak(_Tp*&, _Tp*,
+ memory_order = memory_order_seq_cst) volatile;
+
+ bool
+ compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order);
+
+ bool
+ compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order) volatile;
+
+ bool
compare_exchange_strong(_Tp*&, _Tp*, memory_order = memory_order_seq_cst);
+ bool
+ compare_exchange_strong(_Tp*&, _Tp*,
+ memory_order = memory_order_seq_cst) volatile;
+
_Tp*
fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst);
_Tp*
+ fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
+
+ _Tp*
fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst);
+ _Tp*
+ fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
+
operator _Tp*() const
{ return load(); }
+ operator _Tp*() const volatile
+ { return load(); }
+
_Tp*
operator=(_Tp* __v)
{
@@ -181,43 +307,51 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
_Tp*
+ operator=(_Tp* __v) volatile
+ {
+ store(__v);
+ return __v;
+ }
+
+ _Tp*
operator++(int) { return fetch_add(1); }
_Tp*
+ operator++(int) volatile { return fetch_add(1); }
+
+ _Tp*
operator--(int) { return fetch_sub(1); }
_Tp*
+ operator--(int) volatile { return fetch_sub(1); }
+
+ _Tp*
operator++() { return fetch_add(1) + 1; }
_Tp*
+ operator++() volatile { return fetch_add(1) + 1; }
+
+ _Tp*
operator--() { return fetch_sub(1) - 1; }
_Tp*
+ operator--() volatile { return fetch_sub(1) - 1; }
+
+ _Tp*
operator+=(ptrdiff_t __d)
{ return fetch_add(__d) + __d; }
_Tp*
+ operator+=(ptrdiff_t __d) volatile
+ { return fetch_add(__d) + __d; }
+
+ _Tp*
operator-=(ptrdiff_t __d)
{ return fetch_sub(__d) - __d; }
- };
-
-
- /// Explicit specialization for void*
- template<>
- struct atomic<void*> : public atomic_address
- {
- typedef void* __integral_type;
- typedef atomic_address __base_type;
-
- atomic() = default;
- ~atomic() = default;
- atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) volatile = delete;
-
- atomic(__integral_type __i) : __base_type(__i) { }
- using __base_type::operator __integral_type;
- using __base_type::operator=;
+ _Tp*
+ operator-=(ptrdiff_t __d) volatile
+ { return fetch_sub(__d) - __d; }
};
/// Explicit specialization for bool.
@@ -230,9 +364,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -248,9 +383,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -266,9 +402,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -284,9 +421,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -302,9 +440,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -320,9 +459,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -338,9 +478,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -356,9 +497,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -374,9 +516,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -392,9 +535,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -410,9 +554,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -428,9 +573,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -446,9 +592,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -464,9 +611,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
@@ -482,14 +630,36 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
- atomic(__integral_type __i) : __base_type(__i) { }
+ constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
};
+
+ template<typename _Tp>
+ _Tp*
+ atomic<_Tp*>::load(memory_order __m) const
+ { return static_cast<_Tp*>(atomic_address::load(__m)); }
+
+ template<typename _Tp>
+ _Tp*
+ atomic<_Tp*>::load(memory_order __m) const volatile
+ { return static_cast<_Tp*>(atomic_address::load(__m)); }
+
+ template<typename _Tp>
+ _Tp*
+ atomic<_Tp*>::exchange(_Tp* __v, memory_order __m)
+ { return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); }
+
+ template<typename _Tp>
+ _Tp*
+ atomic<_Tp*>::exchange(_Tp* __v, memory_order __m) volatile
+ { return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); }
+
template<typename _Tp>
bool
atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1,
@@ -502,6 +672,33 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp>
bool
+ atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1,
+ memory_order __m2) volatile
+ {
+ void** __vr = reinterpret_cast<void**>(&__r);
+ void* __vv = static_cast<void*>(__v);
+ return atomic_address::compare_exchange_weak(*__vr, __vv, __m1, __m2);
+ }
+
+ template<typename _Tp>
+ bool
+ atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m)
+ {
+ return compare_exchange_weak(__r, __v, __m,
+ __calculate_memory_order(__m));
+ }
+
+ template<typename _Tp>
+ bool
+ atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v,
+ memory_order __m) volatile
+ {
+ return compare_exchange_weak(__r, __v, __m,
+ __calculate_memory_order(__m));
+ }
+
+ template<typename _Tp>
+ bool
atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
memory_order __m1,
memory_order __m2)
@@ -513,17 +710,28 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp>
bool
- atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v,
- memory_order __m)
+ atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
+ memory_order __m1,
+ memory_order __m2) volatile
{
- return compare_exchange_weak(__r, __v, __m,
- __calculate_memory_order(__m));
+ void** __vr = reinterpret_cast<void**>(&__r);
+ void* __vv = static_cast<void*>(__v);
+ return atomic_address::compare_exchange_strong(*__vr, __vv, __m1, __m2);
+ }
+
+ template<typename _Tp>
+ bool
+ atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
+ memory_order __m)
+ {
+ return compare_exchange_strong(__r, __v, __m,
+ __calculate_memory_order(__m));
}
template<typename _Tp>
bool
atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
- memory_order __m)
+ memory_order __m) volatile
{
return compare_exchange_strong(__r, __v, __m,
__calculate_memory_order(__m));
@@ -539,50 +747,141 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp>
_Tp*
+ atomic<_Tp*>::fetch_add(ptrdiff_t __d, memory_order __m) volatile
+ {
+ void* __p = atomic_fetch_add_explicit(this, sizeof(_Tp) * __d, __m);
+ return static_cast<_Tp*>(__p);
+ }
+
+ template<typename _Tp>
+ _Tp*
atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m)
{
void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m);
return static_cast<_Tp*>(__p);
}
- // Convenience function definitions, atomic_flag.
+ template<typename _Tp>
+ _Tp*
+ atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m) volatile
+ {
+ void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m);
+ return static_cast<_Tp*>(__p);
+ }
+
+
+ // Function definitions, atomic_flag operations.
inline bool
atomic_flag_test_and_set_explicit(atomic_flag* __a, memory_order __m)
{ return __a->test_and_set(__m); }
+ inline bool
+ atomic_flag_test_and_set_explicit(volatile atomic_flag* __a,
+ memory_order __m)
+ { return __a->test_and_set(__m); }
+
inline void
atomic_flag_clear_explicit(atomic_flag* __a, memory_order __m)
- { return __a->clear(__m); }
+ { __a->clear(__m); }
+
+ inline void
+ atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __m)
+ { __a->clear(__m); }
+ inline bool
+ atomic_flag_test_and_set(atomic_flag* __a)
+ { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
- // Convenience function definitions, atomic_address.
+ inline bool
+ atomic_flag_test_and_set(volatile atomic_flag* __a)
+ { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
+
+ inline void
+ atomic_flag_clear(atomic_flag* __a)
+ { atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
+
+ inline void
+ atomic_flag_clear(volatile atomic_flag* __a)
+ { atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
+
+
+ // Function definitions, atomic_address operations.
inline bool
atomic_is_lock_free(const atomic_address* __a)
{ return __a->is_lock_free(); }
+ inline bool
+ atomic_is_lock_free(const volatile atomic_address* __a)
+ { return __a->is_lock_free(); }
+
+ inline void
+ atomic_init(atomic_address* __a, void* __v);
+
+ inline void
+ atomic_init(volatile atomic_address* __a, void* __v);
+
+ inline void
+ atomic_store_explicit(atomic_address* __a, void* __v, memory_order __m)
+ { __a->store(__v, __m); }
+
+ inline void
+ atomic_store_explicit(volatile atomic_address* __a, void* __v,
+ memory_order __m)
+ { __a->store(__v, __m); }
+
inline void
atomic_store(atomic_address* __a, void* __v)
{ __a->store(__v); }
inline void
- atomic_store_explicit(atomic_address* __a, void* __v, memory_order __m)
- { __a->store(__v, __m); }
+ atomic_store(volatile atomic_address* __a, void* __v)
+ { __a->store(__v); }
+
+ inline void*
+ atomic_load_explicit(const atomic_address* __a, memory_order __m)
+ { return __a->load(__m); }
+
+ inline void*
+ atomic_load_explicit(const volatile atomic_address* __a, memory_order __m)
+ { return __a->load(__m); }
inline void*
atomic_load(const atomic_address* __a)
{ return __a->load(); }
inline void*
- atomic_load_explicit(const atomic_address* __a, memory_order __m)
- { return __a->load(__m); }
+ atomic_load(const volatile atomic_address* __a)
+ { return __a->load(); }
+
+ inline void*
+ atomic_exchange_explicit(atomic_address* __a, void* __v, memory_order __m)
+ { return __a->exchange(__v, __m); }
+
+ inline void*
+ atomic_exchange_explicit(volatile atomic_address* __a, void* __v,
+ memory_order __m)
+ { return __a->exchange(__v, __m); }
inline void*
atomic_exchange(atomic_address* __a, void* __v)
{ return __a->exchange(__v); }
inline void*
- atomic_exchange_explicit(atomic_address* __a, void* __v, memory_order __m)
- { return __a->exchange(__v, __m); }
+ atomic_exchange(volatile atomic_address* __a, void* __v)
+ { return __a->exchange(__v); }
+
+
+ inline bool
+ atomic_compare_exchange_weak_explicit(atomic_address* __a,
+ void** __v1, void* __v2,
+ memory_order __m1, memory_order __m2)
+ { return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); }
+
+ inline bool
+ atomic_compare_exchange_weak_explicit(volatile atomic_address* __a,
+ void** __v1, void* __v2,
+ memory_order __m1, memory_order __m2)
+ { return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); }
inline bool
atomic_compare_exchange_weak(atomic_address* __a, void** __v1, void* __v2)
@@ -592,72 +891,152 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
inline bool
- atomic_compare_exchange_strong(atomic_address* __a,
- void** __v1, void* __v2)
+ atomic_compare_exchange_weak(volatile atomic_address* __a, void** __v1,
+ void* __v2)
{
- return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst,
+ return __a->compare_exchange_weak(*__v1, __v2, memory_order_seq_cst,
memory_order_seq_cst);
}
inline bool
- atomic_compare_exchange_weak_explicit(atomic_address* __a,
- void** __v1, void* __v2,
- memory_order __m1, memory_order __m2)
- { return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); }
+ atomic_compare_exchange_strong_explicit(atomic_address* __a,
+ void** __v1, void* __v2,
+ memory_order __m1, memory_order __m2)
+ { return __a->compare_exchange_strong(*__v1, __v2, __m1, __m2); }
inline bool
- atomic_compare_exchange_strong_explicit(atomic_address* __a,
+ atomic_compare_exchange_strong_explicit(volatile atomic_address* __a,
void** __v1, void* __v2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_strong(*__v1, __v2, __m1, __m2); }
+ inline bool
+ atomic_compare_exchange_strong(atomic_address* __a, void** __v1, void* __v2)
+ {
+ return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+
+ inline bool
+ atomic_compare_exchange_strong(volatile atomic_address* __a,
+ void** __v1, void* __v2)
+ {
+ return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+
inline void*
atomic_fetch_add_explicit(atomic_address* __a, ptrdiff_t __d,
memory_order __m)
{ return __a->fetch_add(__d, __m); }
inline void*
+ atomic_fetch_add_explicit(volatile atomic_address* __a, ptrdiff_t __d,
+ memory_order __m)
+ { return __a->fetch_add(__d, __m); }
+
+ inline void*
atomic_fetch_add(atomic_address* __a, ptrdiff_t __d)
{ return __a->fetch_add(__d); }
inline void*
+ atomic_fetch_add(volatile atomic_address* __a, ptrdiff_t __d)
+ { return __a->fetch_add(__d); }
+
+ inline void*
atomic_fetch_sub_explicit(atomic_address* __a, ptrdiff_t __d,
memory_order __m)
{ return __a->fetch_sub(__d, __m); }
inline void*
+ atomic_fetch_sub_explicit(volatile atomic_address* __a, ptrdiff_t __d,
+ memory_order __m)
+ { return __a->fetch_sub(__d, __m); }
+
+ inline void*
atomic_fetch_sub(atomic_address* __a, ptrdiff_t __d)
{ return __a->fetch_sub(__d); }
+ inline void*
+ atomic_fetch_sub(volatile atomic_address* __a, ptrdiff_t __d)
+ { return __a->fetch_sub(__d); }
+
- // Convenience function definitions, atomic_bool.
+ // Function definitions, atomic_bool operations.
inline bool
atomic_is_lock_free(const atomic_bool* __a)
{ return __a->is_lock_free(); }
+ inline bool
+ atomic_is_lock_free(const volatile atomic_bool* __a)
+ { return __a->is_lock_free(); }
+
+ inline void
+ atomic_init(atomic_bool* __a, bool __b);
+
+ inline void
+ atomic_init(volatile atomic_bool* __a, bool __b);
+
+ inline void
+ atomic_store_explicit(atomic_bool* __a, bool __i, memory_order __m)
+ { __a->store(__i, __m); }
+
+ inline void
+ atomic_store_explicit(volatile atomic_bool* __a, bool __i, memory_order __m)
+ { __a->store(__i, __m); }
+
inline void
atomic_store(atomic_bool* __a, bool __i)
{ __a->store(__i); }
inline void
- atomic_store_explicit(atomic_bool* __a, bool __i, memory_order __m)
- { __a->store(__i, __m); }
+ atomic_store(volatile atomic_bool* __a, bool __i)
+ { __a->store(__i); }
+
+ inline bool
+ atomic_load_explicit(const atomic_bool* __a, memory_order __m)
+ { return __a->load(__m); }
+
+ inline bool
+ atomic_load_explicit(const volatile atomic_bool* __a, memory_order __m)
+ { return __a->load(__m); }
inline bool
atomic_load(const atomic_bool* __a)
{ return __a->load(); }
inline bool
- atomic_load_explicit(const atomic_bool* __a, memory_order __m)
- { return __a->load(__m); }
+ atomic_load(const volatile atomic_bool* __a)
+ { return __a->load(); }
+
+ inline bool
+ atomic_exchange_explicit(atomic_bool* __a, bool __i, memory_order __m)
+ { return __a->exchange(__i, __m); }
+
+ inline bool
+ atomic_exchange_explicit(volatile atomic_bool* __a, bool __i,
+ memory_order __m)
+ { return __a->exchange(__i, __m); }
inline bool
atomic_exchange(atomic_bool* __a, bool __i)
{ return __a->exchange(__i); }
inline bool
- atomic_exchange_explicit(atomic_bool* __a, bool __i, memory_order __m)
- { return __a->exchange(__i, __m); }
+ atomic_exchange(volatile atomic_bool* __a, bool __i)
+ { return __a->exchange(__i); }
+
+ inline bool
+ atomic_compare_exchange_weak_explicit(atomic_bool* __a, bool* __i1,
+ bool __i2, memory_order __m1,
+ memory_order __m2)
+ { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
+
+ inline bool
+ atomic_compare_exchange_weak_explicit(volatile atomic_bool* __a, bool* __i1,
+ bool __i2, memory_order __m1,
+ memory_order __m2)
+ { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
inline bool
atomic_compare_exchange_weak(atomic_bool* __a, bool* __i1, bool __i2)
@@ -667,45 +1046,96 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
inline bool
- atomic_compare_exchange_strong(atomic_bool* __a, bool* __i1, bool __i2)
+ atomic_compare_exchange_weak(volatile atomic_bool* __a, bool* __i1, bool __i2)
{
- return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst,
- memory_order_seq_cst);
+ return __a->compare_exchange_weak(*__i1, __i2, memory_order_seq_cst,
+ memory_order_seq_cst);
}
inline bool
- atomic_compare_exchange_weak_explicit(atomic_bool* __a, bool* __i1,
- bool __i2, memory_order __m1,
- memory_order __m2)
- { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
+ atomic_compare_exchange_strong_explicit(atomic_bool* __a,
+ bool* __i1, bool __i2,
+ memory_order __m1, memory_order __m2)
+ { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
inline bool
- atomic_compare_exchange_strong_explicit(atomic_bool* __a,
+ atomic_compare_exchange_strong_explicit(volatile atomic_bool* __a,
bool* __i1, bool __i2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
+ inline bool
+ atomic_compare_exchange_strong(atomic_bool* __a, bool* __i1, bool __i2)
+ {
+ return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+ inline bool
+ atomic_compare_exchange_strong(volatile atomic_bool* __a,
+ bool* __i1, bool __i2)
+ {
+ return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+
+
+ // Function templates for atomic_integral operations, using
+ // __atomic_base . Template argument should be constricted to
+ // intergral types as specified in the standard.
+ template<typename _ITp>
+ inline bool
+ atomic_is_lock_free(const __atomic_base<_ITp>* __a)
+ { return __a->is_lock_free(); }
+
+ template<typename _ITp>
+ inline bool
+ atomic_is_lock_free(const volatile __atomic_base<_ITp>* __a)
+ { return __a->is_lock_free(); }
+
+ template<typename _ITp>
+ inline void
+ atomic_init(__atomic_base<_ITp>* __a, _ITp __i);
+
+ template<typename _ITp>
+ inline void
+ atomic_init(volatile __atomic_base<_ITp>* __a, _ITp __i);
- // Free standing functions. Template argument should be constricted
- // to intergral types as specified in the standard.
template<typename _ITp>
inline void
atomic_store_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m)
{ __a->store(__i, __m); }
template<typename _ITp>
+ inline void
+ atomic_store_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { __a->store(__i, __m); }
+
+ template<typename _ITp>
inline _ITp
atomic_load_explicit(const __atomic_base<_ITp>* __a, memory_order __m)
{ return __a->load(__m); }
template<typename _ITp>
inline _ITp
+ atomic_load_explicit(const volatile __atomic_base<_ITp>* __a,
+ memory_order __m)
+ { return __a->load(__m); }
+
+ template<typename _ITp>
+ inline _ITp
atomic_exchange_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->exchange(__i, __m); }
template<typename _ITp>
+ inline _ITp
+ atomic_exchange_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->exchange(__i, __m); }
+
+ template<typename _ITp>
inline bool
atomic_compare_exchange_weak_explicit(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2,
@@ -714,6 +1144,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _ITp>
inline bool
+ atomic_compare_exchange_weak_explicit(volatile __atomic_base<_ITp>* __a,
+ _ITp* __i1, _ITp __i2,
+ memory_order __m1, memory_order __m2)
+ { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
+
+ template<typename _ITp>
+ inline bool
atomic_compare_exchange_strong_explicit(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2,
memory_order __m1,
@@ -721,6 +1158,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
template<typename _ITp>
+ inline bool
+ atomic_compare_exchange_strong_explicit(volatile __atomic_base<_ITp>* __a,
+ _ITp* __i1, _ITp __i2,
+ memory_order __m1,
+ memory_order __m2)
+ { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
+
+ template<typename _ITp>
inline _ITp
atomic_fetch_add_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
@@ -728,32 +1173,57 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _ITp>
inline _ITp
+ atomic_fetch_add_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->fetch_add(__i, __m); }
+
+ template<typename _ITp>
+ inline _ITp
atomic_fetch_sub_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_sub(__i, __m); }
template<typename _ITp>
inline _ITp
+ atomic_fetch_sub_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->fetch_sub(__i, __m); }
+
+ template<typename _ITp>
+ inline _ITp
atomic_fetch_and_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_and(__i, __m); }
template<typename _ITp>
inline _ITp
+ atomic_fetch_and_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->fetch_and(__i, __m); }
+
+ template<typename _ITp>
+ inline _ITp
atomic_fetch_or_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_or(__i, __m); }
template<typename _ITp>
inline _ITp
+ atomic_fetch_or_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->fetch_or(__i, __m); }
+
+ template<typename _ITp>
+ inline _ITp
atomic_fetch_xor_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_xor(__i, __m); }
template<typename _ITp>
- inline bool
- atomic_is_lock_free(const __atomic_base<_ITp>* __a)
- { return __a->is_lock_free(); }
+ inline _ITp
+ atomic_fetch_xor_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->fetch_xor(__i, __m); }
template<typename _ITp>
inline void
@@ -761,16 +1231,31 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ atomic_store_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
+ inline void
+ atomic_store(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { atomic_store_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
inline _ITp
atomic_load(const __atomic_base<_ITp>* __a)
{ return atomic_load_explicit(__a, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
+ atomic_load(const volatile __atomic_base<_ITp>* __a)
+ { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline _ITp
atomic_exchange(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
+ inline _ITp
+ atomic_exchange(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
inline bool
atomic_compare_exchange_weak(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2)
@@ -782,6 +1267,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _ITp>
inline bool
+ atomic_compare_exchange_weak(volatile __atomic_base<_ITp>* __a,
+ _ITp* __i1, _ITp __i2)
+ {
+ return atomic_compare_exchange_weak_explicit(__a, __i1, __i2,
+ memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+
+ template<typename _ITp>
+ inline bool
atomic_compare_exchange_strong(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2)
{
@@ -791,30 +1286,65 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
template<typename _ITp>
+ inline bool
+ atomic_compare_exchange_strong(volatile __atomic_base<_ITp>* __a,
+ _ITp* __i1, _ITp __i2)
+ {
+ return atomic_compare_exchange_strong_explicit(__a, __i1, __i2,
+ memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+
+ template<typename _ITp>
inline _ITp
atomic_fetch_add(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
+ atomic_fetch_add(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline _ITp
atomic_fetch_sub(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
+ atomic_fetch_sub(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline _ITp
atomic_fetch_and(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
+ atomic_fetch_and(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline _ITp
atomic_fetch_or(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
+ atomic_fetch_or(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline _ITp
atomic_fetch_xor(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
+ template<typename _ITp>
+ inline _ITp
+ atomic_fetch_xor(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
+
// @} group atomics
_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index 1c71c4fb969..db20eaf0714 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -72,36 +72,39 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
/// 0 is the least significant word.
_WordT _M_w[_Nw];
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ constexpr _Base_bitset() : _M_w({ }) { }
+
+ constexpr _Base_bitset(unsigned long long __val)
+ : _M_w({ _WordT(__val)
+#if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__
+ , _WordT(__val >> _GLIBCXX_BITSET_BITS_PER_WORD)
+#endif
+ }) { }
+#else
_Base_bitset()
{ _M_do_reset(); }
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- _Base_bitset(unsigned long long __val)
-#else
_Base_bitset(unsigned long __val)
-#endif
{
_M_do_reset();
_M_w[0] = __val;
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- if (sizeof(unsigned long long) > sizeof(unsigned long))
- _M_w[1] = __val >> _GLIBCXX_BITSET_BITS_PER_WORD;
-#endif
}
+#endif
- static size_t
+ static _GLIBCXX_CONSTEXPR size_t
_S_whichword(size_t __pos )
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
- static size_t
+ static _GLIBCXX_CONSTEXPR size_t
_S_whichbyte(size_t __pos )
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
- static size_t
+ static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos )
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
- static _WordT
+ static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos )
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
@@ -123,7 +126,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_M_hiword()
{ return _M_w[_Nw - 1]; }
- _WordT
+ _GLIBCXX_CONSTEXPR _WordT
_M_hiword() const
{ return _M_w[_Nw - 1]; }
@@ -368,31 +371,31 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
typedef unsigned long _WordT;
_WordT _M_w;
- _Base_bitset(void)
+ _GLIBCXX_CONSTEXPR _Base_bitset()
: _M_w(0)
{ }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- _Base_bitset(unsigned long long __val)
+ constexpr _Base_bitset(unsigned long long __val)
#else
_Base_bitset(unsigned long __val)
#endif
: _M_w(__val)
{ }
- static size_t
+ static _GLIBCXX_CONSTEXPR size_t
_S_whichword(size_t __pos )
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
- static size_t
+ static _GLIBCXX_CONSTEXPR size_t
_S_whichbyte(size_t __pos )
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
- static size_t
+ static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos )
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
- static _WordT
+ static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos )
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
@@ -414,7 +417,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_M_hiword()
{ return _M_w; }
- _WordT
+ _GLIBCXX_CONSTEXPR _WordT
_M_hiword() const
{ return _M_w; }
@@ -511,29 +514,29 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{
typedef unsigned long _WordT;
- _Base_bitset()
+ _GLIBCXX_CONSTEXPR _Base_bitset()
{ }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- _Base_bitset(unsigned long long)
+ constexpr _Base_bitset(unsigned long long)
#else
_Base_bitset(unsigned long)
#endif
{ }
- static size_t
+ static _GLIBCXX_CONSTEXPR size_t
_S_whichword(size_t __pos )
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
- static size_t
+ static _GLIBCXX_CONSTEXPR size_t
_S_whichbyte(size_t __pos )
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
- static size_t
+ static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos )
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
- static _WordT
+ static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos )
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
@@ -545,13 +548,17 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
// make an unchecked call; all the memory ugliness is therefore
// localized to this single should-never-get-this-far function.
_WordT&
- _M_getword(size_t) const
+ _M_getword(size_t)
{
__throw_out_of_range(__N("_Base_bitset::_M_getword"));
return *new _WordT;
}
_WordT
+ _M_getword(size_t __pos) const
+ { return 0; }
+
+ _GLIBCXX_CONSTEXPR _WordT
_M_hiword() const
{ return 0; }
@@ -632,13 +639,21 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
template<size_t _Extrabits>
struct _Sanitize
{
- static void _S_do_sanitize(unsigned long& __val)
- { __val &= ~((~static_cast<unsigned long>(0)) << _Extrabits); }
+ typedef unsigned long _WordT;
+
+ static void
+ _S_do_sanitize(_WordT& __val)
+ { __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); }
};
template<>
struct _Sanitize<0>
- { static void _S_do_sanitize(unsigned long) {} };
+ {
+ typedef unsigned long _WordT;
+
+ static void
+ _S_do_sanitize(_WordT) { }
+ };
/**
* @brief The %bitset class represents a @e fixed-size sequence of bits.
@@ -713,11 +728,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
typedef unsigned long _WordT;
void
- _M_do_sanitize()
- {
- _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD>::
- _S_do_sanitize(this->_M_hiword());
- }
+ _M_do_sanitize()
+ {
+ typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type;
+ __sanitize_type::_S_do_sanitize(this->_M_hiword());
+ }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename> friend class hash;
@@ -740,8 +755,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{
friend class bitset;
- _WordT *_M_wp;
- size_t _M_bpos;
+ _WordT* _M_wp;
+ size_t _M_bpos;
// left undefined
reference();
@@ -799,17 +814,18 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
// 23.3.5.1 constructors:
/// All bits set to zero.
- bitset()
+ _GLIBCXX_CONSTEXPR bitset()
{ }
/// Initial bits bitwise-copied from a single word (others set to zero).
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- bitset(unsigned long long __val)
+ constexpr bitset(unsigned long long __val)
+ : _Base(__val) { }
#else
bitset(unsigned long __val)
-#endif
: _Base(__val)
{ _M_do_sanitize(); }
+#endif
/**
* @brief Use a subset of a string.
@@ -1088,8 +1104,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
/**
* @brief Array-indexing support.
* @param position Index into the %bitset.
- * @return A bool for a <em>const %bitset</em>. For non-const bitsets, an
- * instance of the reference proxy class.
+ * @return A bool for a <em>const %bitset</em>. For non-const
+ * bitsets, an instance of the reference proxy class.
* @note These operators do no range checking and throw no exceptions,
* as required by DR 11 to the standard.
*
@@ -1101,7 +1117,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
reference
operator[](size_t __position)
- { return reference(*this,__position); }
+ { return reference(*this, __position); }
bool
operator[](size_t __position) const
@@ -1236,7 +1252,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ return this->_M_do_count(); }
/// Returns the total number of bits.
- size_t
+ _GLIBCXX_CONSTEXPR size_t
size() const
{ return _Nb; }
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 230b7f4e813..c4dcbd5f67f 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -35,10 +35,6 @@
# include <bits/c++0x_warning.h>
#else
-#ifdef _GLIBCXX_INCLUDE_AS_TR1
-# error C++0x header cannot be included from TR1 header
-#endif
-
#include <ratio>
#include <type_traits>
#include <limits>
@@ -46,8 +42,8 @@
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
/**
* @defgroup chrono Time
* @ingroup utilities
@@ -64,78 +60,92 @@ namespace std
template<typename _Rep, typename _Period = ratio<1>>
struct duration;
- template<typename _Clock, typename _Duration = typename _Clock::duration>
+ template<typename _Clock, typename _Dur = typename _Clock::duration>
struct time_point;
}
// 20.8.2.3 specialization of common_type (for duration)
template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2>
struct common_type<chrono::duration<_Rep1, _Period1>,
- chrono::duration<_Rep2, _Period2>>
+ chrono::duration<_Rep2, _Period2>>
{
- typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
- ratio<__static_gcd<_Period1::num, _Period2::num>::value,
- (_Period1::den / __static_gcd<_Period1::den, _Period2::den>::value)
- * _Period2::den>> type;
+ private:
+ typedef __static_gcd<_Period1::num, _Period2::num> __gcd_num;
+ typedef __static_gcd<_Period1::den, _Period2::den> __gcd_den;
+ typedef typename common_type<_Rep1, _Rep2>::type __cr;
+ typedef ratio<__gcd_num::value,
+ (_Period1::den / __gcd_den::value) * _Period2::den> __r;
+
+ public:
+ typedef chrono::duration<__cr, __r> type;
};
-
+
// 20.8.2.3 specialization of common_type (for time_point)
- template<typename _Clock, typename _Duration1, typename _Duration2>
- struct common_type<chrono::time_point<_Clock, _Duration1>,
- chrono::time_point<_Clock, _Duration2>>
+ template<typename _Clock, typename _Dur1, typename _Dur2>
+ struct common_type<chrono::time_point<_Clock, _Dur1>,
+ chrono::time_point<_Clock, _Dur2>>
{
- typedef chrono::time_point<_Clock,
- typename common_type<_Duration1, _Duration2>::type> type;
+ private:
+ typedef typename common_type<_Dur1, _Dur2>::type __ct;
+
+ public:
+ typedef chrono::time_point<_Clock, __ct> type;
};
- namespace chrono
+ namespace chrono
{
// Primary template for duration_cast impl.
- template<typename _ToDuration, typename _CF, typename _CR,
- bool _NumIsOne = false, bool _DenIsOne = false>
+ template<typename _ToDur, typename _CF, typename _CR,
+ bool _NumIsOne = false, bool _DenIsOne = false>
struct __duration_cast_impl
{
- template<typename _Rep, typename _Period>
- static _ToDuration __cast(const duration<_Rep, _Period>& __d)
- {
- return _ToDuration(static_cast<
- typename _ToDuration::rep>(static_cast<_CR>(__d.count())
- * static_cast<_CR>(_CF::num)
- / static_cast<_CR>(_CF::den)));
- }
+ template<typename _Rep, typename _Period>
+ static constexpr _ToDur
+ __cast(const duration<_Rep, _Period>& __d)
+ {
+ typedef typename _ToDur::rep __to_rep;
+ return _ToDur(static_cast<__to_rep>(static_cast<_CR>(__d.count())
+ * static_cast<_CR>(_CF::num)
+ / static_cast<_CR>(_CF::den)));
+ }
};
- template<typename _ToDuration, typename _CF, typename _CR>
- struct __duration_cast_impl<_ToDuration, _CF, _CR, true, true>
+ template<typename _ToDur, typename _CF, typename _CR>
+ struct __duration_cast_impl<_ToDur, _CF, _CR, true, true>
{
- template<typename _Rep, typename _Period>
- static _ToDuration __cast(const duration<_Rep, _Period>& __d)
- {
- return _ToDuration(
- static_cast<typename _ToDuration::rep>(__d.count()));
- }
+ template<typename _Rep, typename _Period>
+ static constexpr _ToDur
+ __cast(const duration<_Rep, _Period>& __d)
+ {
+ typedef typename _ToDur::rep __to_rep;
+ return _ToDur(static_cast<__to_rep>(__d.count()));
+ }
};
- template<typename _ToDuration, typename _CF, typename _CR>
- struct __duration_cast_impl<_ToDuration, _CF, _CR, true, false>
+ template<typename _ToDur, typename _CF, typename _CR>
+ struct __duration_cast_impl<_ToDur, _CF, _CR, true, false>
{
- template<typename _Rep, typename _Period>
- static _ToDuration __cast(const duration<_Rep, _Period>& __d)
- {
- return _ToDuration(static_cast<typename _ToDuration::rep>(
- static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
- }
+ template<typename _Rep, typename _Period>
+ static constexpr _ToDur
+ __cast(const duration<_Rep, _Period>& __d)
+ {
+ typedef typename _ToDur::rep __to_rep;
+ return _ToDur(static_cast<__to_rep>(
+ static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
+ }
};
- template<typename _ToDuration, typename _CF, typename _CR>
- struct __duration_cast_impl<_ToDuration, _CF, _CR, false, true>
+ template<typename _ToDur, typename _CF, typename _CR>
+ struct __duration_cast_impl<_ToDur, _CF, _CR, false, true>
{
- template<typename _Rep, typename _Period>
- static _ToDuration __cast(const duration<_Rep, _Period>& __d)
- {
- return _ToDuration(static_cast<typename _ToDuration::rep>(
- static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
- }
+ template<typename _Rep, typename _Period>
+ static constexpr _ToDur
+ __cast(const duration<_Rep, _Period>& __d)
+ {
+ typedef typename _ToDur::rep __to_rep;
+ return _ToDur(static_cast<__to_rep>(
+ static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
+ }
};
template<typename _Tp>
@@ -149,18 +159,20 @@ namespace std
{ };
/// duration_cast
- template<typename _ToDuration, typename _Rep, typename _Period>
- inline typename enable_if<__is_duration<_ToDuration>::value,
- _ToDuration>::type
+ template<typename _ToDur, typename _Rep, typename _Period>
+ inline constexpr typename enable_if<__is_duration<_ToDur>::value,
+ _ToDur>::type
duration_cast(const duration<_Rep, _Period>& __d)
{
- typedef typename
- ratio_divide<_Period, typename _ToDuration::period>::type __cf;
- typedef typename
- common_type<typename _ToDuration::rep, _Rep, intmax_t>::type __cr;
-
- return __duration_cast_impl<_ToDuration, __cf, __cr,
- __cf::num == 1, __cf::den == 1>::__cast(__d);
+ typedef typename _ToDur::period __to_period;
+ typedef typename _ToDur::rep __to_rep;
+ typedef ratio_divide<_Period, __to_period> __r_div;
+ typedef typename __r_div::type __cf;
+ typedef typename common_type<__to_rep, _Rep, intmax_t>::type
+ __cr;
+ typedef __duration_cast_impl<_ToDur, __cf, __cr,
+ __cf::num == 1, __cf::den == 1> __dc;
+ return __dc::__cast(__d);
}
/// treat_as_floating_point
@@ -173,17 +185,17 @@ namespace std
template<typename _Rep>
struct duration_values
{
- static const _Rep
- zero()
- { return _Rep(0); }
-
- static const _Rep
- max()
- { return numeric_limits<_Rep>::max(); }
-
- static const _Rep
- min()
- { return numeric_limits<_Rep>::min(); }
+ static constexpr _Rep
+ zero()
+ { return _Rep(0); }
+
+ static constexpr _Rep
+ max()
+ { return numeric_limits<_Rep>::max(); }
+
+ static constexpr _Rep
+ min()
+ { return numeric_limits<_Rep>::min(); }
};
template<typename T>
@@ -200,98 +212,98 @@ namespace std
template<typename _Rep, typename _Period>
struct duration
{
+ typedef _Rep rep;
+ typedef _Period period;
+
static_assert(!__is_duration<_Rep>::value, "rep cannot be a duration");
- static_assert(__is_ratio<_Period>::value,
+ static_assert(__is_ratio<_Period>::value,
"period must be a specialization of ratio");
- static_assert(_Period::num > 0, "period must be positive");
-
- typedef _Rep rep;
- typedef _Period period;
-
- // 20.8.3.1 construction / copy / destroy
- duration() = default;
-
- template<typename _Rep2, typename = typename
+ static_assert(_Period::num > 0, "period must be positive");
+
+ // 20.8.3.1 construction / copy / destroy
+ constexpr duration() : __r() { }
+
+ template<typename _Rep2, typename = typename
enable_if<is_convertible<_Rep2, rep>::value
&& (treat_as_floating_point<rep>::value
|| !treat_as_floating_point<_Rep2>::value)>::type>
- explicit duration(const _Rep2& __rep)
- : __r(static_cast<rep>(__rep)) { }
+ constexpr explicit duration(const _Rep2& __rep)
+ : __r(static_cast<rep>(__rep)) { }
- template<typename _Rep2, typename _Period2, typename = typename
- enable_if<treat_as_floating_point<rep>::value
+ template<typename _Rep2, typename _Period2, typename = typename
+ enable_if<treat_as_floating_point<rep>::value
|| (ratio_divide<_Period2, period>::type::den == 1
&& !treat_as_floating_point<_Rep2>::value)>::type>
- duration(const duration<_Rep2, _Period2>& __d)
- : __r(duration_cast<duration>(__d).count()) { }
+ constexpr duration(const duration<_Rep2, _Period2>& __d)
+ : __r(duration_cast<duration>(__d).count()) { }
~duration() = default;
duration(const duration&) = default;
duration& operator=(const duration&) = default;
- // 20.8.3.2 observer
- rep
- count() const
- { return __r; }
-
- // 20.8.3.3 arithmetic
- duration
- operator+() const
- { return *this; }
-
- duration
- operator-() const
- { return duration(-__r); }
-
- duration&
- operator++()
- {
- ++__r;
- return *this;
- }
-
- duration
- operator++(int)
- { return duration(__r++); }
-
- duration&
- operator--()
- {
- --__r;
- return *this;
- }
-
- duration
- operator--(int)
- { return duration(__r--); }
-
- duration&
- operator+=(const duration& __d)
- {
- __r += __d.count();
- return *this;
- }
-
- duration&
- operator-=(const duration& __d)
- {
- __r -= __d.count();
- return *this;
- }
-
- duration&
- operator*=(const rep& __rhs)
- {
- __r *= __rhs;
- return *this;
- }
-
- duration&
- operator/=(const rep& __rhs)
- {
- __r /= __rhs;
- return *this;
- }
+ // 20.8.3.2 observer
+ constexpr rep
+ count() const
+ { return __r; }
+
+ // 20.8.3.3 arithmetic
+ constexpr duration
+ operator+() const
+ { return *this; }
+
+ constexpr duration
+ operator-() const
+ { return duration(-__r); }
+
+ duration&
+ operator++()
+ {
+ ++__r;
+ return *this;
+ }
+
+ duration
+ operator++(int)
+ { return duration(__r++); }
+
+ duration&
+ operator--()
+ {
+ --__r;
+ return *this;
+ }
+
+ duration
+ operator--(int)
+ { return duration(__r--); }
+
+ duration&
+ operator+=(const duration& __d)
+ {
+ __r += __d.count();
+ return *this;
+ }
+
+ duration&
+ operator-=(const duration& __d)
+ {
+ __r -= __d.count();
+ return *this;
+ }
+
+ duration&
+ operator*=(const rep& __rhs)
+ {
+ __r *= __rhs;
+ return *this;
+ }
+
+ duration&
+ operator/=(const rep& __rhs)
+ {
+ __r /= __rhs;
+ return *this;
+ }
// DR 934.
template<typename _Rep2 = rep>
@@ -312,46 +324,47 @@ namespace std
return *this;
}
- // 20.8.3.4 special values
- // TODO: These should be constexprs.
- static const duration
- zero()
- { return duration(duration_values<rep>::zero()); }
+ // 20.8.3.4 special values
+ static constexpr duration
+ zero()
+ { return duration(duration_values<rep>::zero()); }
- static const duration
- min()
- { return duration(duration_values<rep>::min()); }
-
- static const duration
- max()
- { return duration(duration_values<rep>::max()); }
+ static constexpr duration
+ min()
+ { return duration(duration_values<rep>::min()); }
+
+ static constexpr duration
+ max()
+ { return duration(duration_values<rep>::max()); }
private:
- rep __r;
+ rep __r;
};
template<typename _Rep1, typename _Period1,
- typename _Rep2, typename _Period2>
- inline typename common_type<duration<_Rep1, _Period1>,
- duration<_Rep2, _Period2>>::type
- operator+(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ typename _Rep2, typename _Period2>
+ inline typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type
+ operator+(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{
- typedef typename common_type<duration<_Rep1, _Period1>,
- duration<_Rep2, _Period2>>::type __ct;
- return __ct(__lhs) += __rhs;
+ typedef duration<_Rep1, _Period1> __dur1;
+ typedef duration<_Rep2, _Period2> __dur2;
+ typedef typename common_type<__dur1,__dur2>::type __ct;
+ return __ct(__lhs) += __rhs;
}
- template<typename _Rep1, typename _Period1,
- typename _Rep2, typename _Period2>
- inline typename common_type<duration<_Rep1, _Period1>,
- duration<_Rep2, _Period2>>::type
- operator-(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type
+ operator-(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{
- typedef typename common_type<duration<_Rep1, _Period1>,
- duration<_Rep2, _Period2>>::type __ct;
- return __ct(__lhs) -= __rhs;
+ typedef duration<_Rep1, _Period1> __dur1;
+ typedef duration<_Rep2, _Period2> __dur2;
+ typedef typename common_type<__dur1,__dur2>::type __ct;
+ return __ct(__lhs) -= __rhs;
}
template<typename _Rep1, typename _Rep2, bool =
@@ -361,39 +374,40 @@ namespace std
template<typename _Rep1, typename _Rep2>
struct __common_rep_type<_Rep1, _Rep2, true>
- { typedef typename common_type<_Rep1, _Rep2>::type type; };
+ { typedef typename common_type<_Rep1, _Rep2>::type type; };
template<typename _Rep1, typename _Period, typename _Rep2>
inline duration<typename __common_rep_type<_Rep1, _Rep2>::type, _Period>
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
- typedef typename common_type<_Rep1, _Rep2>::type __cr;
- return duration<__cr, _Period>(__d) *= __s;
+ typedef typename common_type<_Rep1, _Rep2>::type __cr;
+ return duration<__cr, _Period>(__d) *= __s;
}
template<typename _Rep1, typename _Period, typename _Rep2>
inline duration<typename __common_rep_type<_Rep2, _Rep1>::type, _Period>
operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
{ return __d * __s; }
-
+
template<typename _Rep1, typename _Period, typename _Rep2>
inline duration<typename __common_rep_type<_Rep1, typename
enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period>
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
- typedef typename common_type<_Rep1, _Rep2>::type __cr;
+ typedef typename common_type<_Rep1, _Rep2>::type __cr;
return duration<__cr, _Period>(__d) /= __s;
}
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline typename common_type<_Rep1, _Rep2>::type
- operator/(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ operator/(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{
- typedef typename common_type<duration<_Rep1, _Period1>,
- duration<_Rep2, _Period2>>::type __ct;
- return __ct(__lhs).count() / __ct(__rhs).count();
+ typedef duration<_Rep1, _Period1> __dur1;
+ typedef duration<_Rep2, _Period2> __dur2;
+ typedef typename common_type<__dur1,__dur2>::type __ct;
+ return __ct(__lhs).count() / __ct(__rhs).count();
}
// DR 934.
@@ -402,118 +416,121 @@ namespace std
enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period>
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
- typedef typename common_type<_Rep1, _Rep2>::type __cr;
+ typedef typename common_type<_Rep1, _Rep2>::type __cr;
return duration<__cr, _Period>(__d) %= __s;
}
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
- inline typename common_type<duration<_Rep1, _Period1>,
- duration<_Rep2, _Period2>>::type
- operator%(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ inline typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type
+ operator%(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{
- typedef typename common_type<duration<_Rep1, _Period1>,
- duration<_Rep2, _Period2>>::type __ct;
- return __ct(__lhs) %= __rhs;
+ typedef duration<_Rep1, _Period1> __dur1;
+ typedef duration<_Rep2, _Period2> __dur2;
+ typedef typename common_type<__dur1,__dur2>::type __ct;
+ return __ct(__lhs) %= __rhs;
}
// comparisons
template<typename _Rep1, typename _Period1,
- typename _Rep2, typename _Period2>
- inline bool
- operator==(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ typename _Rep2, typename _Period2>
+ inline constexpr bool
+ operator==(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{
- typedef typename common_type<duration<_Rep1, _Period1>,
- duration<_Rep2, _Period2>>::type __ct;
- return __ct(__lhs).count() == __ct(__rhs).count();
+ typedef duration<_Rep1, _Period1> __dur1;
+ typedef duration<_Rep2, _Period2> __dur2;
+ typedef typename common_type<__dur1,__dur2>::type __ct;
+ return __ct(__lhs).count() == __ct(__rhs).count();
}
template<typename _Rep1, typename _Period1,
- typename _Rep2, typename _Period2>
- inline bool
- operator<(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ typename _Rep2, typename _Period2>
+ inline constexpr bool
+ operator<(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{
- typedef typename common_type<duration<_Rep1, _Period1>,
- duration<_Rep2, _Period2>>::type __ct;
- return __ct(__lhs).count() < __ct(__rhs).count();
+ typedef duration<_Rep1, _Period1> __dur1;
+ typedef duration<_Rep2, _Period2> __dur2;
+ typedef typename common_type<__dur1,__dur2>::type __ct;
+ return __ct(__lhs).count() < __ct(__rhs).count();
}
template<typename _Rep1, typename _Period1,
- typename _Rep2, typename _Period2>
- inline bool
- operator!=(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ typename _Rep2, typename _Period2>
+ inline constexpr bool
+ operator!=(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{ return !(__lhs == __rhs); }
template<typename _Rep1, typename _Period1,
- typename _Rep2, typename _Period2>
- inline bool
- operator<=(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ typename _Rep2, typename _Period2>
+ inline constexpr bool
+ operator<=(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{ return !(__rhs < __lhs); }
template<typename _Rep1, typename _Period1,
- typename _Rep2, typename _Period2>
- inline bool
- operator>(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ typename _Rep2, typename _Period2>
+ inline constexpr bool
+ operator>(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{ return __rhs < __lhs; }
- template<typename _Rep1, typename _Period1,
- typename _Rep2, typename _Period2>
- inline bool
- operator>=(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline constexpr bool
+ operator>=(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{ return !(__lhs < __rhs); }
/// nanoseconds
- typedef duration<int64_t, nano> nanoseconds;
+ typedef duration<int64_t, nano> nanoseconds;
/// microseconds
- typedef duration<int64_t, micro> microseconds;
+ typedef duration<int64_t, micro> microseconds;
/// milliseconds
- typedef duration<int64_t, milli> milliseconds;
-
+ typedef duration<int64_t, milli> milliseconds;
+
/// seconds
- typedef duration<int64_t > seconds;
+ typedef duration<int64_t> seconds;
/// minutes
- typedef duration<int, ratio< 60>> minutes;
+ typedef duration<int, ratio< 60>> minutes;
/// hours
- typedef duration<int, ratio<3600>> hours;
+ typedef duration<int, ratio<3600>> hours;
/// time_point
- template<typename _Clock, typename _Duration>
+ template<typename _Clock, typename _Dur>
struct time_point
{
- typedef _Clock clock;
- typedef _Duration duration;
- typedef typename duration::rep rep;
- typedef typename duration::period period;
+ typedef _Clock clock;
+ typedef _Dur duration;
+ typedef typename duration::rep rep;
+ typedef typename duration::period period;
- time_point() : __d(duration::zero())
+ constexpr time_point() : __d(duration::zero())
{ }
- explicit time_point(const duration& __dur)
- : __d(duration::zero() + __dur)
+ constexpr explicit time_point(const duration& __dur)
+ : __d(__dur)
{ }
// conversions
- template<typename _Duration2>
- time_point(const time_point<clock, _Duration2>& __t)
+ template<typename _Dur2>
+ constexpr time_point(const time_point<clock, _Dur2>& __t)
: __d(__t.time_since_epoch())
{ }
// observer
- duration
+ constexpr duration
time_since_epoch() const
{ return __d; }
-
+
// arithmetic
time_point&
operator+=(const duration& __dur)
@@ -521,124 +538,127 @@ namespace std
__d += __dur;
return *this;
}
-
+
time_point&
operator-=(const duration& __dur)
{
__d -= __dur;
return *this;
}
-
+
// special values
- // TODO: These should be constexprs.
- static const time_point
+ static constexpr time_point
min()
{ return time_point(duration::min()); }
-
- static const time_point
+
+ static constexpr time_point
max()
{ return time_point(duration::max()); }
-
+
private:
duration __d;
};
-
+
/// time_point_cast
- template<typename _ToDuration, typename _Clock, typename _Duration>
- inline typename enable_if<__is_duration<_ToDuration>::value,
- time_point<_Clock, _ToDuration>>::type
- time_point_cast(const time_point<_Clock, _Duration>& __t)
+ template<typename _ToDur, typename _Clock, typename _Dur>
+ inline constexpr typename enable_if<__is_duration<_ToDur>::value,
+ time_point<_Clock, _ToDur>>::type
+ time_point_cast(const time_point<_Clock, _Dur>& __t)
{
- return time_point<_Clock, _ToDuration>(
- duration_cast<_ToDuration>(__t.time_since_epoch()));
+ typedef time_point<_Clock, _ToDur> __time_point;
+ return __time_point(duration_cast<_ToDur>(__t.time_since_epoch()));
}
- template<typename _Clock, typename _Duration1,
- typename _Rep2, typename _Period2>
- inline time_point<_Clock,
- typename common_type<_Duration1, duration<_Rep2, _Period2>>::type>
- operator+(const time_point<_Clock, _Duration1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ template<typename _Clock, typename _Dur1,
+ typename _Rep2, typename _Period2>
+ inline time_point<_Clock,
+ typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
+ operator+(const time_point<_Clock, _Dur1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{
- typedef time_point<_Clock,
- typename common_type<_Duration1,
- duration<_Rep2, _Period2>>::type> __ct;
- return __ct(__lhs) += __rhs;
+ typedef duration<_Rep2, _Period2> __dur2;
+ typedef typename common_type<_Dur1,__dur2>::type __ct;
+ typedef time_point<_Clock, __ct> __time_point;
+ return __time_point(__lhs) += __rhs;
}
template<typename _Rep1, typename _Period1,
- typename _Clock, typename _Duration2>
- inline time_point<_Clock,
- typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
- operator+(const duration<_Rep1, _Period1>& __lhs,
- const time_point<_Clock, _Duration2>& __rhs)
+ typename _Clock, typename _Dur2>
+ inline time_point<_Clock,
+ typename common_type<duration<_Rep1, _Period1>, _Dur2>::type>
+ operator+(const duration<_Rep1, _Period1>& __lhs,
+ const time_point<_Clock, _Dur2>& __rhs)
{ return __rhs + __lhs; }
- template<typename _Clock, typename _Duration1,
- typename _Rep2, typename _Period2>
- inline time_point<_Clock,
- typename common_type<_Duration1, duration<_Rep2, _Period2>>::type>
- operator-(const time_point<_Clock, _Duration1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
+ template<typename _Clock, typename _Dur1,
+ typename _Rep2, typename _Period2>
+ inline time_point<_Clock,
+ typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
+ operator-(const time_point<_Clock, _Dur1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
{ return __lhs + (-__rhs); }
- template<typename _Clock, typename _Duration1, typename _Duration2>
- inline typename common_type<_Duration1, _Duration2>::type
- operator-(const time_point<_Clock, _Duration1>& __lhs,
- const time_point<_Clock, _Duration2>& __rhs)
+ template<typename _Clock, typename _Dur1, typename _Dur2>
+ inline typename common_type<_Dur1, _Dur2>::type
+ operator-(const time_point<_Clock, _Dur1>& __lhs,
+ const time_point<_Clock, _Dur2>& __rhs)
{ return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
- template<typename _Clock, typename _Duration1, typename _Duration2>
- inline bool
- operator==(const time_point<_Clock, _Duration1>& __lhs,
- const time_point<_Clock, _Duration2>& __rhs)
+ template<typename _Clock, typename _Dur1, typename _Dur2>
+ inline constexpr bool
+ operator==(const time_point<_Clock, _Dur1>& __lhs,
+ const time_point<_Clock, _Dur2>& __rhs)
{ return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
- template<typename _Clock, typename _Duration1, typename _Duration2>
- inline bool
- operator!=(const time_point<_Clock, _Duration1>& __lhs,
- const time_point<_Clock, _Duration2>& __rhs)
+ template<typename _Clock, typename _Dur1, typename _Dur2>
+ inline constexpr bool
+ operator!=(const time_point<_Clock, _Dur1>& __lhs,
+ const time_point<_Clock, _Dur2>& __rhs)
{ return !(__lhs == __rhs); }
- template<typename _Clock, typename _Duration1, typename _Duration2>
- inline bool
- operator<(const time_point<_Clock, _Duration1>& __lhs,
- const time_point<_Clock, _Duration2>& __rhs)
+ template<typename _Clock, typename _Dur1, typename _Dur2>
+ inline constexpr bool
+ operator<(const time_point<_Clock, _Dur1>& __lhs,
+ const time_point<_Clock, _Dur2>& __rhs)
{ return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
- template<typename _Clock, typename _Duration1, typename _Duration2>
- inline bool
- operator<=(const time_point<_Clock, _Duration1>& __lhs,
- const time_point<_Clock, _Duration2>& __rhs)
+ template<typename _Clock, typename _Dur1, typename _Dur2>
+ inline constexpr bool
+ operator<=(const time_point<_Clock, _Dur1>& __lhs,
+ const time_point<_Clock, _Dur2>& __rhs)
{ return !(__rhs < __lhs); }
- template<typename _Clock, typename _Duration1, typename _Duration2>
- inline bool
- operator>(const time_point<_Clock, _Duration1>& __lhs,
- const time_point<_Clock, _Duration2>& __rhs)
+ template<typename _Clock, typename _Dur1, typename _Dur2>
+ inline constexpr bool
+ operator>(const time_point<_Clock, _Dur1>& __lhs,
+ const time_point<_Clock, _Dur2>& __rhs)
{ return __rhs < __lhs; }
- template<typename _Clock, typename _Duration1, typename _Duration2>
- inline bool
- operator>=(const time_point<_Clock, _Duration1>& __lhs,
- const time_point<_Clock, _Duration2>& __rhs)
+ template<typename _Clock, typename _Dur1, typename _Dur2>
+ inline constexpr bool
+ operator>=(const time_point<_Clock, _Dur1>& __lhs,
+ const time_point<_Clock, _Dur2>& __rhs)
{ return !(__lhs < __rhs); }
/// system_clock
struct system_clock
{
#ifdef _GLIBCXX_USE_CLOCK_REALTIME
- typedef chrono::nanoseconds duration;
+ typedef chrono::nanoseconds duration;
#elif defined(_GLIBCXX_USE_GETTIMEOFDAY)
- typedef chrono::microseconds duration;
+ typedef chrono::microseconds duration;
#else
- typedef chrono::seconds duration;
+ typedef chrono::seconds duration;
#endif
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock, duration> time_point;
+ static_assert(system_clock::duration::min()
+ < system_clock::duration::zero(),
+ "a clock's minimum duration cannot be less than its epoch");
+
static const bool is_monotonic = false;
static time_point
@@ -648,25 +668,17 @@ namespace std
static std::time_t
to_time_t(const time_point& __t)
{
- return std::time_t(
- duration_cast<chrono::seconds>(__t.time_since_epoch()).count());
+ return std::time_t(duration_cast<chrono::seconds>
+ (__t.time_since_epoch()).count());
}
static time_point
from_time_t(std::time_t __t)
- {
- return time_point_cast<system_clock::duration>(
- chrono::time_point<system_clock, chrono::seconds>(
- chrono::seconds(__t)));
+ {
+ typedef chrono::time_point<system_clock, seconds> __from;
+ return time_point_cast<system_clock::duration>
+ (__from(chrono::seconds(__t)));
}
-
- // TODO: requires constexpr
- /*
- static_assert(
- system_clock::duration::min() <
- system_clock::duration::zero(),
- "a clock's minimum duration cannot be less than its epoch");
- */
};
#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
@@ -691,7 +703,7 @@ namespace std
} // namespace chrono
// @} group chrono
-} // namespace std
+_GLIBCXX_END_NAMESPACE
#endif //_GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index 93056510e08..46a198c7e92 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -126,49 +126,49 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
/// Default constructor. First parameter is x, second parameter is y.
/// Unspecified parameters default to 0.
- complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp())
+ _GLIBCXX_CONSTEXPR complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp())
: _M_real(__r), _M_imag(__i) { }
// Lets the compiler synthesize the copy constructor
// complex (const complex<_Tp>&);
/// Copy constructor.
template<typename _Up>
- complex(const complex<_Up>& __z)
+ _GLIBCXX_CONSTEXPR complex(const complex<_Up>& __z)
: _M_real(__z.real()), _M_imag(__z.imag()) { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
- _Tp real() const
- { return _M_real; }
+ constexpr _Tp
+ real() const { return _M_real; }
- _Tp imag() const
- { return _M_imag; }
+ constexpr _Tp
+ imag() const { return _M_imag; }
#else
/// Return real part of complex number.
- _Tp& real()
- { return _M_real; }
+ _Tp&
+ real() { return _M_real; }
/// Return real part of complex number.
- const _Tp& real() const
- { return _M_real; }
+ const _Tp&
+ real() const { return _M_real; }
/// Return imaginary part of complex number.
- _Tp& imag()
- { return _M_imag; }
+ _Tp&
+ imag() { return _M_imag; }
/// Return imaginary part of complex number.
- const _Tp& imag() const
- { return _M_imag; }
+ const _Tp&
+ imag() const { return _M_imag; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
- void real(_Tp __val)
- { _M_real = __val; }
+ void
+ real(_Tp __val) { _M_real = __val; }
- void imag(_Tp __val)
- { _M_imag = __val; }
+ void
+ imag(_Tp __val) { _M_imag = __val; }
/// Assign this complex number to scalar @a t.
complex<_Tp>& operator=(const _Tp&);
@@ -215,7 +215,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Up>
complex<_Tp>& operator/=(const complex<_Up>&);
- const complex& __rep() const
+ _GLIBCXX_USE_CONSTEXPR complex __rep() const
{ return *this; }
private:
@@ -1041,46 +1041,43 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef float value_type;
typedef __complex__ float _ComplexT;
- complex(_ComplexT __z) : _M_value(__z) { }
+ _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
- complex(float __r = 0.0f, float __i = 0.0f)
- {
- __real__ _M_value = __r;
- __imag__ _M_value = __i;
- }
+ _GLIBCXX_CONSTEXPR complex(float __r = 0.0f, float __i = 0.0f)
+ : _M_value(__r + __i * 1.0fi) { }
- explicit complex(const complex<double>&);
- explicit complex(const complex<long double>&);
+ explicit _GLIBCXX_CONSTEXPR complex(const complex<double>&);
+ explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
- float real() const
- { return __real__ _M_value; }
+ constexpr float
+ real() const { return __real__ _M_value; }
- float imag() const
- { return __imag__ _M_value; }
+ constexpr float
+ imag() const { return __imag__ _M_value; }
#else
- float& real()
- { return __real__ _M_value; }
+ float&
+ real() { return __real__ _M_value; }
- const float& real() const
- { return __real__ _M_value; }
+ const float&
+ real() const { return __real__ _M_value; }
- float& imag()
- { return __imag__ _M_value; }
+ float&
+ imag() { return __imag__ _M_value; }
- const float& imag() const
- { return __imag__ _M_value; }
+ const float&
+ imag() const { return __imag__ _M_value; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
- void real(float __val)
- { __real__ _M_value = __val; }
+ void
+ real(float __val) { __real__ _M_value = __val; }
- void imag(float __val)
- { __imag__ _M_value = __val; }
+ void
+ imag(float __val) { __imag__ _M_value = __val; }
complex&
operator=(float __f)
@@ -1170,7 +1167,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return *this;
}
- const _ComplexT& __rep() const { return _M_value; }
+ _GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; }
private:
_ComplexT _M_value;
@@ -1184,48 +1181,45 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef double value_type;
typedef __complex__ double _ComplexT;
- complex(_ComplexT __z) : _M_value(__z) { }
+ _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
- complex(double __r = 0.0, double __i = 0.0)
- {
- __real__ _M_value = __r;
- __imag__ _M_value = __i;
- }
+ _GLIBCXX_CONSTEXPR complex(double __r = 0.0, double __i = 0.0)
+ : _M_value(__r + __i * 1.0i) { }
- complex(const complex<float>& __z)
+ _GLIBCXX_CONSTEXPR complex(const complex<float>& __z)
: _M_value(__z.__rep()) { }
- explicit complex(const complex<long double>&);
+ explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
- double real() const
- { return __real__ _M_value; }
+ constexpr double
+ real() const { return __real__ _M_value; }
- double imag() const
- { return __imag__ _M_value; }
+ constexpr double
+ imag() const { return __imag__ _M_value; }
#else
- double& real()
- { return __real__ _M_value; }
+ double&
+ real() { return __real__ _M_value; }
- const double& real() const
- { return __real__ _M_value; }
+ const double&
+ real() const { return __real__ _M_value; }
- double& imag()
- { return __imag__ _M_value; }
+ double&
+ imag() { return __imag__ _M_value; }
- const double& imag() const
- { return __imag__ _M_value; }
+ const double&
+ imag() const { return __imag__ _M_value; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
- void real(double __val)
- { __real__ _M_value = __val; }
+ void
+ real(double __val) { __real__ _M_value = __val; }
- void imag(double __val)
- { __imag__ _M_value = __val; }
+ void
+ imag(double __val) { __imag__ _M_value = __val; }
complex&
operator=(double __d)
@@ -1314,7 +1308,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return *this;
}
- const _ComplexT& __rep() const { return _M_value; }
+ _GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; }
private:
_ComplexT _M_value;
@@ -1328,49 +1322,47 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef long double value_type;
typedef __complex__ long double _ComplexT;
- complex(_ComplexT __z) : _M_value(__z) { }
+ _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
- complex(long double __r = 0.0L, long double __i = 0.0L)
- {
- __real__ _M_value = __r;
- __imag__ _M_value = __i;
- }
+ _GLIBCXX_CONSTEXPR complex(long double __r = 0.0L,
+ long double __i = 0.0L)
+ : _M_value(__r + __i * 1.0Li) { }
- complex(const complex<float>& __z)
+ _GLIBCXX_CONSTEXPR complex(const complex<float>& __z)
: _M_value(__z.__rep()) { }
- complex(const complex<double>& __z)
+ _GLIBCXX_CONSTEXPR complex(const complex<double>& __z)
: _M_value(__z.__rep()) { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
- long double real() const
- { return __real__ _M_value; }
+ constexpr long double
+ real() const { return __real__ _M_value; }
- long double imag() const
- { return __imag__ _M_value; }
+ constexpr long double
+ imag() const { return __imag__ _M_value; }
#else
- long double& real()
- { return __real__ _M_value; }
+ long double&
+ real() { return __real__ _M_value; }
- const long double& real() const
- { return __real__ _M_value; }
+ const long double&
+ real() const { return __real__ _M_value; }
- long double& imag()
- { return __imag__ _M_value; }
+ long double&
+ imag() { return __imag__ _M_value; }
- const long double& imag() const
- { return __imag__ _M_value; }
+ const long double&
+ imag() const { return __imag__ _M_value; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
- void real(long double __val)
- { __real__ _M_value = __val; }
+ void
+ real(long double __val) { __real__ _M_value = __val; }
- void imag(long double __val)
- { __imag__ _M_value = __val; }
+ void
+ imag(long double __val) { __imag__ _M_value = __val; }
complex&
operator=(long double __r)
@@ -1459,7 +1451,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return *this;
}
- const _ComplexT& __rep() const { return _M_value; }
+ _GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; }
private:
_ComplexT _M_value;
@@ -1467,15 +1459,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// These bits have to be at the end of this file, so that the
// specializations have all been defined.
- inline
+ inline _GLIBCXX_CONSTEXPR
complex<float>::complex(const complex<double>& __z)
: _M_value(__z.__rep()) { }
- inline
+ inline _GLIBCXX_CONSTEXPR
complex<float>::complex(const complex<long double>& __z)
: _M_value(__z.__rep()) { }
- inline
+ inline _GLIBCXX_CONSTEXPR
complex<double>::complex(const complex<long double>& __z)
: _M_value(__z.__rep()) { }
@@ -1531,26 +1523,324 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_GLIBCXX_END_NAMESPACE
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/complex>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/complex>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
_GLIBCXX_BEGIN_NAMESPACE(std)
// Forward declarations.
+ template<typename _Tp> std::complex<_Tp> acos(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> asin(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> atan(const std::complex<_Tp>&);
+
+ template<typename _Tp> std::complex<_Tp> acosh(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> asinh(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> atanh(const std::complex<_Tp>&);
+ // DR 595.
+ template<typename _Tp> _Tp fabs(const std::complex<_Tp>&);
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ __complex_acos(const std::complex<_Tp>& __z)
+ {
+ const std::complex<_Tp> __t = std::asin(__z);
+ const _Tp __pi_2 = 1.5707963267948966192313216916397514L;
+ return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag());
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_acos(__complex__ float __z)
+ { return __builtin_cacosf(__z); }
+
+ inline __complex__ double
+ __complex_acos(__complex__ double __z)
+ { return __builtin_cacos(__z); }
+
+ inline __complex__ long double
+ __complex_acos(const __complex__ long double& __z)
+ { return __builtin_cacosl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acos(const std::complex<_Tp>& __z)
+ { return __complex_acos(__z.__rep()); }
+#else
+ /// acos(__z) [8.1.2].
+ // Effects: Behaves the same as C99 function cacos, defined
+ // in subclause 7.3.5.1.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acos(const std::complex<_Tp>& __z)
+ { return __complex_acos(__z); }
+#endif
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ __complex_asin(const std::complex<_Tp>& __z)
+ {
+ std::complex<_Tp> __t(-__z.imag(), __z.real());
+ __t = std::asinh(__t);
+ return std::complex<_Tp>(__t.imag(), -__t.real());
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_asin(__complex__ float __z)
+ { return __builtin_casinf(__z); }
+
+ inline __complex__ double
+ __complex_asin(__complex__ double __z)
+ { return __builtin_casin(__z); }
+
+ inline __complex__ long double
+ __complex_asin(const __complex__ long double& __z)
+ { return __builtin_casinl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asin(const std::complex<_Tp>& __z)
+ { return __complex_asin(__z.__rep()); }
+#else
+ /// asin(__z) [8.1.3].
+ // Effects: Behaves the same as C99 function casin, defined
+ // in subclause 7.3.5.2.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asin(const std::complex<_Tp>& __z)
+ { return __complex_asin(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_atan(const std::complex<_Tp>& __z)
+ {
+ const _Tp __r2 = __z.real() * __z.real();
+ const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();
+
+ _Tp __num = __z.imag() + _Tp(1.0);
+ _Tp __den = __z.imag() - _Tp(1.0);
+
+ __num = __r2 + __num * __num;
+ __den = __r2 + __den * __den;
+
+ return std::complex<_Tp>(_Tp(0.5) * atan2(_Tp(2.0) * __z.real(), __x),
+ _Tp(0.25) * log(__num / __den));
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_atan(__complex__ float __z)
+ { return __builtin_catanf(__z); }
+
+ inline __complex__ double
+ __complex_atan(__complex__ double __z)
+ { return __builtin_catan(__z); }
+
+ inline __complex__ long double
+ __complex_atan(const __complex__ long double& __z)
+ { return __builtin_catanl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atan(const std::complex<_Tp>& __z)
+ { return __complex_atan(__z.__rep()); }
+#else
+ /// atan(__z) [8.1.4].
+ // Effects: Behaves the same as C99 function catan, defined
+ // in subclause 7.3.5.3.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atan(const std::complex<_Tp>& __z)
+ { return __complex_atan(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_acosh(const std::complex<_Tp>& __z)
+ {
+ std::complex<_Tp> __t((__z.real() - __z.imag())
+ * (__z.real() + __z.imag()) - _Tp(1.0),
+ _Tp(2.0) * __z.real() * __z.imag());
+ __t = std::sqrt(__t);
+
+ return std::log(__t + __z);
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_acosh(__complex__ float __z)
+ { return __builtin_cacoshf(__z); }
+
+ inline __complex__ double
+ __complex_acosh(__complex__ double __z)
+ { return __builtin_cacosh(__z); }
+
+ inline __complex__ long double
+ __complex_acosh(const __complex__ long double& __z)
+ { return __builtin_cacoshl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acosh(const std::complex<_Tp>& __z)
+ { return __complex_acosh(__z.__rep()); }
+#else
+ /// acosh(__z) [8.1.5].
+ // Effects: Behaves the same as C99 function cacosh, defined
+ // in subclause 7.3.6.1.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acosh(const std::complex<_Tp>& __z)
+ { return __complex_acosh(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_asinh(const std::complex<_Tp>& __z)
+ {
+ std::complex<_Tp> __t((__z.real() - __z.imag())
+ * (__z.real() + __z.imag()) + _Tp(1.0),
+ _Tp(2.0) * __z.real() * __z.imag());
+ __t = std::sqrt(__t);
+
+ return std::log(__t + __z);
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_asinh(__complex__ float __z)
+ { return __builtin_casinhf(__z); }
+
+ inline __complex__ double
+ __complex_asinh(__complex__ double __z)
+ { return __builtin_casinh(__z); }
+
+ inline __complex__ long double
+ __complex_asinh(const __complex__ long double& __z)
+ { return __builtin_casinhl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asinh(const std::complex<_Tp>& __z)
+ { return __complex_asinh(__z.__rep()); }
+#else
+ /// asinh(__z) [8.1.6].
+ // Effects: Behaves the same as C99 function casin, defined
+ // in subclause 7.3.6.2.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asinh(const std::complex<_Tp>& __z)
+ { return __complex_asinh(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_atanh(const std::complex<_Tp>& __z)
+ {
+ const _Tp __i2 = __z.imag() * __z.imag();
+ const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();
+
+ _Tp __num = _Tp(1.0) + __z.real();
+ _Tp __den = _Tp(1.0) - __z.real();
+
+ __num = __i2 + __num * __num;
+ __den = __i2 + __den * __den;
+
+ return std::complex<_Tp>(_Tp(0.25) * (log(__num) - log(__den)),
+ _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_atanh(__complex__ float __z)
+ { return __builtin_catanhf(__z); }
+
+ inline __complex__ double
+ __complex_atanh(__complex__ double __z)
+ { return __builtin_catanh(__z); }
+
+ inline __complex__ long double
+ __complex_atanh(const __complex__ long double& __z)
+ { return __builtin_catanhl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atanh(const std::complex<_Tp>& __z)
+ { return __complex_atanh(__z.__rep()); }
+#else
+ /// atanh(__z) [8.1.7].
+ // Effects: Behaves the same as C99 function catanh, defined
+ // in subclause 7.3.6.3.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atanh(const std::complex<_Tp>& __z)
+ { return __complex_atanh(__z); }
+#endif
+
+ template<typename _Tp>
+ inline _Tp
+ /// fabs(__z) [8.1.8].
+ // Effects: Behaves the same as C99 function cabs, defined
+ // in subclause 7.3.8.1.
+ fabs(const std::complex<_Tp>& __z)
+ { return std::abs(__z); }
+
+ /// Additional overloads [8.1.9].
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ arg(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+#if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
+ return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
+ : __type();
+#else
+ return std::arg(std::complex<__type>(__x));
+#endif
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ imag(_Tp)
+ { return _Tp(); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ norm(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __type(__x) * __type(__x);
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ real(_Tp __x)
+ { return __x; }
+
+ template<typename _Tp, typename _Up>
+ inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
+ pow(const std::complex<_Tp>& __x, const _Up& __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return std::pow(std::complex<__type>(__x), __type(__y));
+ }
+
+ template<typename _Tp, typename _Up>
+ inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
+ pow(const _Tp& __x, const std::complex<_Up>& __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return std::pow(__type(__x), std::complex<__type>(__y));
+ }
+
+ template<typename _Tp, typename _Up>
+ inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
+ pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return std::pow(std::complex<__type>(__x),
+ std::complex<__type>(__y));
+ }
+
+ // Forward declarations.
// DR 781.
template<typename _Tp> std::complex<_Tp> proj(const std::complex<_Tp>&);
@@ -1602,6 +1892,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE
-#endif
+#endif // __GXX_EXPERIMENTAL_CXX0X__
-#endif /* _GLIBCXX_COMPLEX */
+#endif /* _GLIBCXX_COMPLEX */
diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable
index c5ce207a905..71d2133a6e8 100644
--- a/libstdc++-v3/include/std/condition_variable
+++ b/libstdc++-v3/include/std/condition_variable
@@ -40,8 +40,8 @@
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
/**
* @defgroup condition_variables Condition Variables
* @ingroup concurrency
@@ -254,7 +254,7 @@ namespace std
};
// @} group condition_variables
-}
+_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index cf178e336e7..0c37ccc0e9f 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -58,8 +58,8 @@
#include <bits/functexcept.h>
#include <bits/functional_hash.h>
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
_GLIBCXX_HAS_NESTED_TYPE(result_type)
/// If we have found a result_type, extract it.
@@ -2244,7 +2244,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
inline void
swap(function<_Res(_Args...)>& __x, function<_Res(_Args...)>& __y)
{ __x.swap(__y); }
-}
+
+_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index 2933c8be63f..0c367955914 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -45,8 +45,8 @@
#include <atomic>
#include <bits/functexcept.h>
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
/**
* @defgroup futures Futures
* @ingroup concurrency
@@ -64,19 +64,23 @@ namespace std
no_state
};
+ /// Specialization.
template<>
struct is_error_code_enum<future_errc> : public true_type { };
/// Points to a statically-allocated object derived from error_category.
- extern const error_category* const future_category;
+ const error_category&
+ future_category();
- // TODO: requires constexpr
- inline error_code make_error_code(future_errc __errc)
- { return error_code(static_cast<int>(__errc), *future_category); }
+ /// Overload for make_error_code.
+ inline error_code
+ make_error_code(future_errc __errc)
+ { return error_code(static_cast<int>(__errc), future_category()); }
- // TODO: requires constexpr
- inline error_condition make_error_condition(future_errc __errc)
- { return error_condition(static_cast<int>(__errc), *future_category); }
+ /// Overload for make_error_condition.
+ inline error_condition
+ make_error_condition(future_errc __errc)
+ { return error_condition(static_cast<int>(__errc), future_category()); }
/**
* @brief Exception type thrown by futures.
@@ -116,7 +120,21 @@ namespace std
template<typename _Res>
class promise;
- enum class launch { any, async, sync };
+ /// Launch code for futures
+ enum class launch
+ {
+ any,
+ async,
+ sync
+ };
+
+ /// Status code for futures
+ enum class future_status
+ {
+ ready,
+ timeout,
+ deferred
+ };
template<typename _Fn, typename... _Args>
future<typename result_of<_Fn(_Args...)>::type>
@@ -1242,6 +1260,7 @@ namespace std
}
};
+ /// swap
template<typename _Res, typename... _ArgTypes>
inline void
swap(packaged_task<_Res(_ArgTypes...)>& __x,
@@ -1307,6 +1326,7 @@ namespace std
thread _M_thread;
};
+ /// async
template<typename _Fn, typename... _Args>
future<typename result_of<_Fn(_Args...)>::type>
async(launch __policy, _Fn&& __fn, _Args&&... __args)
@@ -1328,6 +1348,7 @@ namespace std
return future<result_type>(__state);
}
+ /// async, potential overload
template<typename _Fn, typename... _Args>
inline typename
enable_if<!is_same<typename decay<_Fn>::type, launch>::value,
@@ -1343,7 +1364,7 @@ namespace std
// && _GLIBCXX_ATOMIC_BUILTINS_4
// @} group futures
-}
+_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits
index 65b623e853d..4594c93eb32 100644
--- a/libstdc++-v3/include/std/limits
+++ b/libstdc++-v3/include/std/limits
@@ -1,4 +1,4 @@
-// The template and inlines for the numeric_limits classes. -*- C++ -*-
+// The template and inlines for the numeric_limits classes. -*- C++ -*-
// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
// 2008, 2009, 2010 Free Software Foundation, Inc.
@@ -47,7 +47,7 @@
// of fundamental arithmetic data types (integers and floating points).
// From Standard C++ point of view, there are 14 such types:
// * integers
-// bool (1)
+// bool (1)
// char, signed char, unsigned char, wchar_t (4)
// short, unsigned short (2)
// int, unsigned (2)
@@ -140,10 +140,10 @@
// The fraction 643/2136 approximates log10(2) to 7 significant digits.
#define __glibcxx_digits10(T) \
- (__glibcxx_digits (T) * 643 / 2136)
+ (__glibcxx_digits (T) * 643L / 2136)
#define __glibcxx_max_digits10(T) \
- (2 + (T) * 643 / 2136)
+ (2 + (T) * 643L / 2136)
_GLIBCXX_BEGIN_NAMESPACE(std)
@@ -190,83 +190,101 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
struct __numeric_limits_base
{
/** This will be true for all fundamental types (which have
- specializations), and false for everything else. */
- static const bool is_specialized = false;
+ specializations), and false for everything else. */
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false;
/** The number of @c radix digits that be represented without change: for
- integer types, the number of non-sign bits in the mantissa; for
- floating types, the number of @c radix digits in the mantissa. */
- static const int digits = 0;
+ integer types, the number of non-sign bits in the mantissa; for
+ floating types, the number of @c radix digits in the mantissa. */
+ static _GLIBCXX_USE_CONSTEXPR int digits = 0;
+
/** The number of base 10 digits that can be represented without change. */
- static const int digits10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
+
#ifdef __GXX_EXPERIMENTAL_CXX0X__
/** The number of base 10 digits required to ensure that values which
differ are always differentiated. */
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
+
/** True if the type is signed. */
- static const bool is_signed = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+
/** True if the type is integer.
* Is this supposed to be <em>if the type is integral?</em> */
- static const bool is_integer = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
+
/** True if the type uses an exact representation. <em>All integer types are
- exact, but not all exact types are integer. For example, rational and
- fixed-exponent representations are exact but not integer.</em>
- [18.2.1.2]/15 */
- static const bool is_exact = false;
+ exact, but not all exact types are integer. For example, rational and
+ fixed-exponent representations are exact but not integer.</em>
+ [18.2.1.2]/15 */
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
+
/** For integer types, specifies the base of the representation. For
- floating types, specifies the base of the exponent representation. */
- static const int radix = 0;
+ floating types, specifies the base of the exponent representation. */
+ static _GLIBCXX_USE_CONSTEXPR int radix = 0;
/** The minimum negative integer such that @c radix raised to the power of
- (one less than that integer) is a normalized floating point number. */
- static const int min_exponent = 0;
+ (one less than that integer) is a normalized floating point number. */
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+
/** The minimum negative integer such that 10 raised to that power is in
- the range of normalized floating point numbers. */
- static const int min_exponent10 = 0;
+ the range of normalized floating point numbers. */
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+
/** The maximum positive integer such that @c radix raised to the power of
- (one less than that integer) is a representable finite floating point
+ (one less than that integer) is a representable finite floating point
number. */
- static const int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+
/** The maximum positive integer such that 10 raised to that power is in
- the range of representable finite floating point numbers. */
- static const int max_exponent10 = 0;
+ the range of representable finite floating point numbers. */
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
/** True if the type has a representation for positive infinity. */
- static const bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+
/** True if the type has a representation for a quiet (non-signaling)
- <em>Not a Number</em>. */
- static const bool has_quiet_NaN = false;
+ <em>Not a Number</em>. */
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+
/** True if the type has a representation for a signaling
- <em>Not a Number</em>. */
- static const bool has_signaling_NaN = false;
+ <em>Not a Number</em>. */
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+
/** See std::float_denorm_style for more information. */
- static const float_denorm_style has_denorm = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent;
+
/** <em>True if loss of accuracy is detected as a denormalization loss,
- rather than as an inexact result.</em> [18.2.1.2]/42 */
- static const bool has_denorm_loss = false;
+ rather than as an inexact result.</em> [18.2.1.2]/42 */
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
/** True if-and-only-if the type adheres to the IEC 559 standard, also
- known as IEEE 754. (Only makes sense for floating point types.) */
- static const bool is_iec559 = false;
+ known as IEEE 754. (Only makes sense for floating point types.) */
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+
/** <em>True if the set of values representable by the type is
- finite. All built-in types are bounded, this member would be
- false for arbitrary precision types.</em> [18.2.1.2]/54 */
- static const bool is_bounded = false;
+ finite. All built-in types are bounded, this member would be
+ false for arbitrary precision types.</em> [18.2.1.2]/54 */
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false;
+
/** True if the type is @e modulo, that is, if it is possible to add two
- positive numbers and have a result that wraps around to a third number
- that is less. Typically false for floating types, true for unsigned
- integers, and true for signed integers. */
- static const bool is_modulo = false;
+ positive numbers and have a result that wraps around to a third number
+ that is less. Typically false for floating types, true for unsigned
+ integers, and true for signed integers. */
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
/** True if trapping is implemented for this type. */
- static const bool traps = false;
+ static _GLIBCXX_USE_CONSTEXPR bool traps = false;
+
/** True if tininess is detected before rounding. (see IEC 559) */
- static const bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+
/** See std::float_round_style for more information. This is only
- meaningful for floating types; integer types will all be
+ meaningful for floating types; integer types will all be
round_toward_zero. */
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style =
+ round_toward_zero;
};
/**
@@ -284,33 +302,49 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
struct numeric_limits : public __numeric_limits_base
{
/** The minimum finite value, or for floating types with
- denormalization, the minimum positive normalized value. */
- static _Tp min() throw() { return static_cast<_Tp>(0); }
+ denormalization, the minimum positive normalized value. */
+ static _GLIBCXX_CONSTEXPR _Tp
+ min() throw() { return static_cast<_Tp>(0); }
+
/** The maximum finite value. */
- static _Tp max() throw() { return static_cast<_Tp>(0); }
+ static _GLIBCXX_CONSTEXPR _Tp
+ max() throw() { return static_cast<_Tp>(0); }
+
#ifdef __GXX_EXPERIMENTAL_CXX0X__
/** A finite value x such that there is no other finite value y
* where y < x. */
- static _Tp lowest() throw() { return static_cast<_Tp>(0); }
+ static constexpr _Tp
+ lowest() throw() { return static_cast<_Tp>(0); }
#endif
+
/** The @e machine @e epsilon: the difference between 1 and the least
- value greater than 1 that is representable. */
- static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
+ value greater than 1 that is representable. */
+ static _GLIBCXX_CONSTEXPR _Tp
+ epsilon() throw() { return static_cast<_Tp>(0); }
+
/** The maximum rounding error measurement (see LIA-1). */
- static _Tp round_error() throw() { return static_cast<_Tp>(0); }
+ static _GLIBCXX_CONSTEXPR _Tp
+ round_error() throw() { return static_cast<_Tp>(0); }
+
/** The representation of positive infinity, if @c has_infinity. */
- static _Tp infinity() throw() { return static_cast<_Tp>(0); }
+ static _GLIBCXX_CONSTEXPR _Tp
+ infinity() throw() { return static_cast<_Tp>(0); }
- /** The representation of a quiet <em>Not a Number</em>,
+ /** The representation of a quiet <em>Not a Number</em>,
if @c has_quiet_NaN. */
- static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
+ static _GLIBCXX_CONSTEXPR _Tp
+ quiet_NaN() throw() { return static_cast<_Tp>(0); }
+
/** The representation of a signaling <em>Not a Number</em>, if
- @c has_signaling_NaN. */
- static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
+ @c has_signaling_NaN. */
+ static _GLIBCXX_CONSTEXPR _Tp
+ signaling_NaN() throw() { return static_cast<_Tp>(0); }
+
/** The minimum positive denormalized value. For types where
- @c has_denorm is false, this is the minimum positive normalized
+ @c has_denorm is false, this is the minimum positive normalized
value. */
- static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
+ static _GLIBCXX_CONSTEXPR _Tp
+ denorm_min() throw() { return static_cast<_Tp>(0); }
};
#ifdef __GXX_EXPERIMENTAL_CXX0X__
@@ -334,292 +368,341 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<>
struct numeric_limits<bool>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR bool
+ min() throw() { return false; }
+
+ static _GLIBCXX_CONSTEXPR bool
+ max() throw() { return true; }
- static bool min() throw()
- { return false; }
- static bool max() throw()
- { return true; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static bool lowest() throw()
- { return min(); }
+ static constexpr bool
+ lowest() throw() { return min(); }
#endif
- static const int digits = 1;
- static const int digits10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int digits = 1;
+ static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = false;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static bool epsilon() throw()
- { return false; }
- static bool round_error() throw()
- { return false; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static bool infinity() throw()
- { return false; }
- static bool quiet_NaN() throw()
- { return false; }
- static bool signaling_NaN() throw()
- { return false; }
- static bool denorm_min() throw()
- { return false; }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR bool
+ epsilon() throw() { return false; }
+
+ static _GLIBCXX_CONSTEXPR bool
+ round_error() throw() { return false; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR bool
+ infinity() throw() { return false; }
+
+ static _GLIBCXX_CONSTEXPR bool
+ quiet_NaN() throw() { return false; }
+
+ static _GLIBCXX_CONSTEXPR bool
+ signaling_NaN() throw() { return false; }
+
+ static _GLIBCXX_CONSTEXPR bool
+ denorm_min() throw() { return false; }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
// It is not clear what it means for a boolean type to trap.
// This is a DR on the LWG issue list. Here, I use integer
// promotion semantics.
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<char> specialization.
template<>
struct numeric_limits<char>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR char
+ min() throw() { return __glibcxx_min(char); }
+
+ static _GLIBCXX_CONSTEXPR char
+ max() throw() { return __glibcxx_max(char); }
- static char min() throw()
- { return __glibcxx_min(char); }
- static char max() throw()
- { return __glibcxx_max(char); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static char lowest() throw()
- { return min(); }
+ static constexpr char
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (char);
- static const int digits10 = __glibcxx_digits10 (char);
+ static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char);
+ static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = __glibcxx_signed (char);
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static char epsilon() throw()
- { return 0; }
- static char round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static char infinity() throw()
- { return char(); }
- static char quiet_NaN() throw()
- { return char(); }
- static char signaling_NaN() throw()
- { return char(); }
- static char denorm_min() throw()
- { return static_cast<char>(0); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char);
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR char
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR char
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR
+ char infinity() throw() { return char(); }
+
+ static _GLIBCXX_CONSTEXPR char
+ quiet_NaN() throw() { return char(); }
+
+ static _GLIBCXX_CONSTEXPR char
+ signaling_NaN() throw() { return char(); }
+
+ static _GLIBCXX_CONSTEXPR char
+ denorm_min() throw() { return static_cast<char>(0); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<signed char> specialization.
template<>
struct numeric_limits<signed char>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR signed char
+ min() throw() { return -__SCHAR_MAX__ - 1; }
+
+ static _GLIBCXX_CONSTEXPR signed char
+ max() throw() { return __SCHAR_MAX__; }
- static signed char min() throw()
- { return -__SCHAR_MAX__ - 1; }
- static signed char max() throw()
- { return __SCHAR_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static signed char lowest() throw()
- { return min(); }
+ static constexpr signed char
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (signed char);
- static const int digits10 = __glibcxx_digits10 (signed char);
+ static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char);
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = __glibcxx_digits10 (signed char);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = true;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static signed char epsilon() throw()
- { return 0; }
- static signed char round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static signed char infinity() throw()
- { return static_cast<signed char>(0); }
- static signed char quiet_NaN() throw()
- { return static_cast<signed char>(0); }
- static signed char signaling_NaN() throw()
- { return static_cast<signed char>(0); }
- static signed char denorm_min() throw()
- { return static_cast<signed char>(0); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR signed char
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR signed char
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR signed char
+ infinity() throw() { return static_cast<signed char>(0); }
+
+ static _GLIBCXX_CONSTEXPR signed char
+ quiet_NaN() throw() { return static_cast<signed char>(0); }
+
+ static _GLIBCXX_CONSTEXPR signed char
+ signaling_NaN() throw() { return static_cast<signed char>(0); }
+
+ static _GLIBCXX_CONSTEXPR signed char
+ denorm_min() throw() { return static_cast<signed char>(0); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<unsigned char> specialization.
template<>
struct numeric_limits<unsigned char>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR unsigned char
+ min() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned char
+ max() throw() { return __SCHAR_MAX__ * 2U + 1; }
- static unsigned char min() throw()
- { return 0; }
- static unsigned char max() throw()
- { return __SCHAR_MAX__ * 2U + 1; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static unsigned char lowest() throw()
- { return min(); }
+ static constexpr unsigned char
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (unsigned char);
- static const int digits10 = __glibcxx_digits10 (unsigned char);
+ static _GLIBCXX_USE_CONSTEXPR int digits
+ = __glibcxx_digits (unsigned char);
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = __glibcxx_digits10 (unsigned char);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = false;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static unsigned char epsilon() throw()
- { return 0; }
- static unsigned char round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static unsigned char infinity() throw()
- { return static_cast<unsigned char>(0); }
- static unsigned char quiet_NaN() throw()
- { return static_cast<unsigned char>(0); }
- static unsigned char signaling_NaN() throw()
- { return static_cast<unsigned char>(0); }
- static unsigned char denorm_min() throw()
- { return static_cast<unsigned char>(0); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR unsigned char
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned char
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR unsigned char
+ infinity() throw() { return static_cast<unsigned char>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned char
+ quiet_NaN() throw() { return static_cast<unsigned char>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned char
+ signaling_NaN() throw() { return static_cast<unsigned char>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned char
+ denorm_min() throw() { return static_cast<unsigned char>(0); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<wchar_t> specialization.
template<>
struct numeric_limits<wchar_t>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR wchar_t
+ min() throw() { return __glibcxx_min (wchar_t); }
+
+ static _GLIBCXX_CONSTEXPR wchar_t
+ max() throw() { return __glibcxx_max (wchar_t); }
- static wchar_t min() throw()
- { return __glibcxx_min (wchar_t); }
- static wchar_t max() throw()
- { return __glibcxx_max (wchar_t); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static wchar_t lowest() throw()
- { return min(); }
+ static constexpr wchar_t
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (wchar_t);
- static const int digits10 = __glibcxx_digits10 (wchar_t);
+ static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t);
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = __glibcxx_digits10 (wchar_t);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = __glibcxx_signed (wchar_t);
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static wchar_t epsilon() throw()
- { return 0; }
- static wchar_t round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static wchar_t infinity() throw()
- { return wchar_t(); }
- static wchar_t quiet_NaN() throw()
- { return wchar_t(); }
- static wchar_t signaling_NaN() throw()
- { return wchar_t(); }
- static wchar_t denorm_min() throw()
- { return wchar_t(); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t);
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR wchar_t
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR wchar_t
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR wchar_t
+ infinity() throw() { return wchar_t(); }
+
+ static _GLIBCXX_CONSTEXPR wchar_t
+ quiet_NaN() throw() { return wchar_t(); }
+
+ static _GLIBCXX_CONSTEXPR wchar_t
+ signaling_NaN() throw() { return wchar_t(); }
+
+ static _GLIBCXX_CONSTEXPR wchar_t
+ denorm_min() throw() { return wchar_t(); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
#ifdef __GXX_EXPERIMENTAL_CXX0X__
@@ -627,116 +710,139 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<>
struct numeric_limits<char16_t>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR char16_t
+ min() throw() { return __glibcxx_min (char16_t); }
+
+ static _GLIBCXX_CONSTEXPR char16_t
+ max() throw() { return __glibcxx_max (char16_t); }
- static char16_t min() throw()
- { return __glibcxx_min (char16_t); }
- static char16_t max() throw()
- { return __glibcxx_max (char16_t); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static char16_t lowest() throw()
- { return min(); }
+ static constexpr char16_t
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (char16_t);
- static const int digits10 = __glibcxx_digits10 (char16_t);
+ static _GLIBCXX_USE_CONSTEXPR int digits
+ = __glibcxx_digits (char16_t);
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = __glibcxx_digits10 (char16_t);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = __glibcxx_signed (char16_t);
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static char16_t epsilon() throw()
- { return 0; }
- static char16_t round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static char16_t infinity() throw()
- { return char16_t(); }
- static char16_t quiet_NaN() throw()
- { return char16_t(); }
- static char16_t signaling_NaN() throw()
- { return char16_t(); }
- static char16_t denorm_min() throw()
- { return char16_t(); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed
+ = __glibcxx_signed (char16_t);
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR char16_t
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR char16_t
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR char16_t
+ infinity() throw() { return char16_t(); }
+
+ static _GLIBCXX_CONSTEXPR char16_t
+ quiet_NaN() throw() { return char16_t(); }
+
+ static _GLIBCXX_CONSTEXPR char16_t
+ signaling_NaN() throw() { return char16_t(); }
+
+ static _GLIBCXX_CONSTEXPR char16_t
+ denorm_min() throw() { return char16_t(); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<char32_t> specialization.
template<>
struct numeric_limits<char32_t>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR char32_t
+ min() throw() { return __glibcxx_min (char32_t); }
+
+ static _GLIBCXX_CONSTEXPR char32_t
+ max() throw() { return __glibcxx_max (char32_t); }
- static char32_t min() throw()
- { return __glibcxx_min (char32_t); }
- static char32_t max() throw()
- { return __glibcxx_max (char32_t); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static char32_t lowest() throw()
- { return min(); }
+ static constexpr char32_t
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (char32_t);
- static const int digits10 = __glibcxx_digits10 (char32_t);
+ static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char32_t);
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = __glibcxx_digits10 (char32_t);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = __glibcxx_signed (char32_t);
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static char32_t epsilon() throw()
- { return 0; }
- static char32_t round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static char32_t infinity() throw()
- { return char32_t(); }
- static char32_t quiet_NaN() throw()
- { return char32_t(); }
- static char32_t signaling_NaN() throw()
- { return char32_t(); }
- static char32_t denorm_min() throw()
- { return char32_t(); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed
+ = __glibcxx_signed (char32_t);
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR char32_t
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR char32_t
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR char32_t
+ infinity() throw() { return char32_t(); }
+
+ static _GLIBCXX_CONSTEXPR char32_t
+ quiet_NaN() throw() { return char32_t(); }
+
+ static _GLIBCXX_CONSTEXPR char32_t
+ signaling_NaN() throw() { return char32_t(); }
+
+ static _GLIBCXX_CONSTEXPR char32_t
+ denorm_min() throw() { return char32_t(); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
#endif
@@ -744,525 +850,617 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<>
struct numeric_limits<short>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR short
+ min() throw() { return -__SHRT_MAX__ - 1; }
+
+ static _GLIBCXX_CONSTEXPR short
+ max() throw() { return __SHRT_MAX__; }
- static short min() throw()
- { return -__SHRT_MAX__ - 1; }
- static short max() throw()
- { return __SHRT_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static short lowest() throw()
- { return min(); }
+ static constexpr short
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (short);
- static const int digits10 = __glibcxx_digits10 (short);
+ static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short);
+ static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = true;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static short epsilon() throw()
- { return 0; }
- static short round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static short infinity() throw()
- { return short(); }
- static short quiet_NaN() throw()
- { return short(); }
- static short signaling_NaN() throw()
- { return short(); }
- static short denorm_min() throw()
- { return short(); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR short
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR short
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR short
+ infinity() throw() { return short(); }
+
+ static _GLIBCXX_CONSTEXPR short
+ quiet_NaN() throw() { return short(); }
+
+ static _GLIBCXX_CONSTEXPR short
+ signaling_NaN() throw() { return short(); }
+
+ static _GLIBCXX_CONSTEXPR short
+ denorm_min() throw() { return short(); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<unsigned short> specialization.
template<>
struct numeric_limits<unsigned short>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR unsigned short
+ min() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned short
+ max() throw() { return __SHRT_MAX__ * 2U + 1; }
- static unsigned short min() throw()
- { return 0; }
- static unsigned short max() throw()
- { return __SHRT_MAX__ * 2U + 1; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static unsigned short lowest() throw()
- { return min(); }
+ static constexpr unsigned short
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (unsigned short);
- static const int digits10 = __glibcxx_digits10 (unsigned short);
+ static _GLIBCXX_USE_CONSTEXPR int digits
+ = __glibcxx_digits (unsigned short);
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = __glibcxx_digits10 (unsigned short);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = false;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static unsigned short epsilon() throw()
- { return 0; }
- static unsigned short round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static unsigned short infinity() throw()
- { return static_cast<unsigned short>(0); }
- static unsigned short quiet_NaN() throw()
- { return static_cast<unsigned short>(0); }
- static unsigned short signaling_NaN() throw()
- { return static_cast<unsigned short>(0); }
- static unsigned short denorm_min() throw()
- { return static_cast<unsigned short>(0); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR unsigned short
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned short
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR unsigned short
+ infinity() throw() { return static_cast<unsigned short>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned short
+ quiet_NaN() throw() { return static_cast<unsigned short>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned short
+ signaling_NaN() throw() { return static_cast<unsigned short>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned short
+ denorm_min() throw() { return static_cast<unsigned short>(0); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<int> specialization.
template<>
struct numeric_limits<int>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR int
+ min() throw() { return -__INT_MAX__ - 1; }
+
+ static _GLIBCXX_CONSTEXPR int
+ max() throw() { return __INT_MAX__; }
- static int min() throw()
- { return -__INT_MAX__ - 1; }
- static int max() throw()
- { return __INT_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static int lowest() throw()
- { return min(); }
+ static constexpr int
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (int);
- static const int digits10 = __glibcxx_digits10 (int);
+ static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int);
+ static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = true;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static int epsilon() throw()
- { return 0; }
- static int round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static int infinity() throw()
- { return static_cast<int>(0); }
- static int quiet_NaN() throw()
- { return static_cast<int>(0); }
- static int signaling_NaN() throw()
- { return static_cast<int>(0); }
- static int denorm_min() throw()
- { return static_cast<int>(0); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR int
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR int
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR int
+ infinity() throw() { return static_cast<int>(0); }
+
+ static _GLIBCXX_CONSTEXPR int
+ quiet_NaN() throw() { return static_cast<int>(0); }
+
+ static _GLIBCXX_CONSTEXPR int
+ signaling_NaN() throw() { return static_cast<int>(0); }
+
+ static _GLIBCXX_CONSTEXPR int
+ denorm_min() throw() { return static_cast<int>(0); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<unsigned int> specialization.
template<>
struct numeric_limits<unsigned int>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR unsigned int
+ min() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned int
+ max() throw() { return __INT_MAX__ * 2U + 1; }
- static unsigned int min() throw()
- { return 0; }
- static unsigned int max() throw()
- { return __INT_MAX__ * 2U + 1; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static unsigned int lowest() throw()
- { return min(); }
+ static constexpr unsigned int
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (unsigned int);
- static const int digits10 = __glibcxx_digits10 (unsigned int);
+ static _GLIBCXX_USE_CONSTEXPR int digits
+ = __glibcxx_digits (unsigned int);
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = __glibcxx_digits10 (unsigned int);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = false;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static unsigned int epsilon() throw()
- { return 0; }
- static unsigned int round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static unsigned int infinity() throw()
- { return static_cast<unsigned int>(0); }
- static unsigned int quiet_NaN() throw()
- { return static_cast<unsigned int>(0); }
- static unsigned int signaling_NaN() throw()
- { return static_cast<unsigned int>(0); }
- static unsigned int denorm_min() throw()
- { return static_cast<unsigned int>(0); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR unsigned int
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned int
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR unsigned int
+ infinity() throw() { return static_cast<unsigned int>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned int
+ quiet_NaN() throw() { return static_cast<unsigned int>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned int
+ signaling_NaN() throw() { return static_cast<unsigned int>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned int
+ denorm_min() throw() { return static_cast<unsigned int>(0); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<long> specialization.
template<>
struct numeric_limits<long>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR long
+ min() throw() { return -__LONG_MAX__ - 1; }
+
+ static _GLIBCXX_CONSTEXPR long
+ max() throw() { return __LONG_MAX__; }
- static long min() throw()
- { return -__LONG_MAX__ - 1; }
- static long max() throw()
- { return __LONG_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static long lowest() throw()
- { return min(); }
+ static constexpr long
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (long);
- static const int digits10 = __glibcxx_digits10 (long);
+ static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long);
+ static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = true;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static long epsilon() throw()
- { return 0; }
- static long round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static long infinity() throw()
- { return static_cast<long>(0); }
- static long quiet_NaN() throw()
- { return static_cast<long>(0); }
- static long signaling_NaN() throw()
- { return static_cast<long>(0); }
- static long denorm_min() throw()
- { return static_cast<long>(0); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR long
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR long
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR long
+ infinity() throw() { return static_cast<long>(0); }
+
+ static _GLIBCXX_CONSTEXPR long
+ quiet_NaN() throw() { return static_cast<long>(0); }
+
+ static _GLIBCXX_CONSTEXPR long
+ signaling_NaN() throw() { return static_cast<long>(0); }
+
+ static _GLIBCXX_CONSTEXPR long
+ denorm_min() throw() { return static_cast<long>(0); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<unsigned long> specialization.
template<>
struct numeric_limits<unsigned long>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR unsigned long
+ min() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned long
+ max() throw() { return __LONG_MAX__ * 2UL + 1; }
- static unsigned long min() throw()
- { return 0; }
- static unsigned long max() throw()
- { return __LONG_MAX__ * 2UL + 1; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static unsigned long lowest() throw()
- { return min(); }
+ static constexpr unsigned long
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (unsigned long);
- static const int digits10 = __glibcxx_digits10 (unsigned long);
+ static _GLIBCXX_USE_CONSTEXPR int digits
+ = __glibcxx_digits (unsigned long);
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = __glibcxx_digits10 (unsigned long);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = false;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static unsigned long epsilon() throw()
- { return 0; }
- static unsigned long round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static unsigned long infinity() throw()
- { return static_cast<unsigned long>(0); }
- static unsigned long quiet_NaN() throw()
- { return static_cast<unsigned long>(0); }
- static unsigned long signaling_NaN() throw()
- { return static_cast<unsigned long>(0); }
- static unsigned long denorm_min() throw()
- { return static_cast<unsigned long>(0); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR unsigned long
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned long
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR unsigned long
+ infinity() throw() { return static_cast<unsigned long>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned long
+ quiet_NaN() throw() { return static_cast<unsigned long>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned long
+ signaling_NaN() throw() { return static_cast<unsigned long>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned long
+ denorm_min() throw() { return static_cast<unsigned long>(0); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<long long> specialization.
template<>
struct numeric_limits<long long>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR long long
+ min() throw() { return -__LONG_LONG_MAX__ - 1; }
+
+ static _GLIBCXX_CONSTEXPR long long
+ max() throw() { return __LONG_LONG_MAX__; }
- static long long min() throw()
- { return -__LONG_LONG_MAX__ - 1; }
- static long long max() throw()
- { return __LONG_LONG_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static long long lowest() throw()
- { return min(); }
+ static constexpr long long
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (long long);
- static const int digits10 = __glibcxx_digits10 (long long);
+ static _GLIBCXX_USE_CONSTEXPR int digits
+ = __glibcxx_digits (long long);
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = __glibcxx_digits10 (long long);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = true;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static long long epsilon() throw()
- { return 0; }
- static long long round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static long long infinity() throw()
- { return static_cast<long long>(0); }
- static long long quiet_NaN() throw()
- { return static_cast<long long>(0); }
- static long long signaling_NaN() throw()
- { return static_cast<long long>(0); }
- static long long denorm_min() throw()
- { return static_cast<long long>(0); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR long long
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR long long
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR long long
+ infinity() throw() { return static_cast<long long>(0); }
+
+ static _GLIBCXX_CONSTEXPR long long
+ quiet_NaN() throw() { return static_cast<long long>(0); }
+
+ static _GLIBCXX_CONSTEXPR long long
+ signaling_NaN() throw() { return static_cast<long long>(0); }
+
+ static _GLIBCXX_CONSTEXPR long long
+ denorm_min() throw() { return static_cast<long long>(0); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<unsigned long long> specialization.
template<>
struct numeric_limits<unsigned long long>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR unsigned long long
+ min() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned long long
+ max() throw() { return __LONG_LONG_MAX__ * 2ULL + 1; }
- static unsigned long long min() throw()
- { return 0; }
- static unsigned long long max() throw()
- { return __LONG_LONG_MAX__ * 2ULL + 1; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static unsigned long long lowest() throw()
- { return min(); }
+ static constexpr unsigned long long
+ lowest() throw() { return min(); }
#endif
- static const int digits = __glibcxx_digits (unsigned long long);
- static const int digits10 = __glibcxx_digits10 (unsigned long long);
+ static _GLIBCXX_USE_CONSTEXPR int digits
+ = __glibcxx_digits (unsigned long long);
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = __glibcxx_digits10 (unsigned long long);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10 = 0;
+ static constexpr int max_digits10 = 0;
#endif
- static const bool is_signed = false;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static unsigned long long epsilon() throw()
- { return 0; }
- static unsigned long long round_error() throw()
- { return 0; }
-
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
-
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
-
- static unsigned long long infinity() throw()
- { return static_cast<unsigned long long>(0); }
- static unsigned long long quiet_NaN() throw()
- { return static_cast<unsigned long long>(0); }
- static unsigned long long signaling_NaN() throw()
- { return static_cast<unsigned long long>(0); }
- static unsigned long long denorm_min() throw()
- { return static_cast<unsigned long long>(0); }
-
- static const bool is_iec559 = false;
- static const bool is_bounded = true;
- static const bool is_modulo = true;
-
- static const bool traps = __glibcxx_integral_traps;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR unsigned long long
+ epsilon() throw() { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned long long
+ round_error() throw() { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR unsigned long long
+ infinity() throw() { return static_cast<unsigned long long>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned long long
+ quiet_NaN() throw() { return static_cast<unsigned long long>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned long long
+ signaling_NaN() throw() { return static_cast<unsigned long long>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned long long
+ denorm_min() throw() { return static_cast<unsigned long long>(0); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
};
/// numeric_limits<float> specialization.
template<>
struct numeric_limits<float>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR float
+ min() throw() { return __FLT_MIN__; }
+
+ static _GLIBCXX_CONSTEXPR float
+ max() throw() { return __FLT_MAX__; }
- static float min() throw()
- { return __FLT_MIN__; }
- static float max() throw()
- { return __FLT_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static float lowest() throw()
- { return -__FLT_MAX__; }
+ static constexpr float
+ lowest() throw() { return -__FLT_MAX__; }
#endif
- static const int digits = __FLT_MANT_DIG__;
- static const int digits10 = __FLT_DIG__;
+ static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__;
+ static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10
+ static constexpr int max_digits10
= __glibcxx_max_digits10 (__FLT_MANT_DIG__);
#endif
- static const bool is_signed = true;
- static const bool is_integer = false;
- static const bool is_exact = false;
- static const int radix = __FLT_RADIX__;
- static float epsilon() throw()
- { return __FLT_EPSILON__; }
- static float round_error() throw()
- { return 0.5F; }
-
- static const int min_exponent = __FLT_MIN_EXP__;
- static const int min_exponent10 = __FLT_MIN_10_EXP__;
- static const int max_exponent = __FLT_MAX_EXP__;
- static const int max_exponent10 = __FLT_MAX_10_EXP__;
-
- static const bool has_infinity = __FLT_HAS_INFINITY__;
- static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
- static const bool has_signaling_NaN = has_quiet_NaN;
- static const float_denorm_style has_denorm
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
+ static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
+
+ static _GLIBCXX_CONSTEXPR float
+ epsilon() throw() { return __FLT_EPSILON__; }
+
+ static _GLIBCXX_CONSTEXPR float
+ round_error() throw() { return 0.5F; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
- static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss;
-
- static float infinity() throw()
- { return __builtin_huge_valf (); }
- static float quiet_NaN() throw()
- { return __builtin_nanf (""); }
- static float signaling_NaN() throw()
- { return __builtin_nansf (""); }
- static float denorm_min() throw()
- { return __FLT_DENORM_MIN__; }
-
- static const bool is_iec559
- = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
- static const bool is_bounded = true;
- static const bool is_modulo = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
+ = __glibcxx_float_has_denorm_loss;
+
+ static _GLIBCXX_CONSTEXPR float
+ infinity() throw() { return __builtin_huge_valf (); }
- static const bool traps = __glibcxx_float_traps;
- static const bool tinyness_before = __glibcxx_float_tinyness_before;
- static const float_round_style round_style = round_to_nearest;
+ static _GLIBCXX_CONSTEXPR float
+ quiet_NaN() throw() { return __builtin_nanf (""); }
+
+ static _GLIBCXX_CONSTEXPR float
+ signaling_NaN() throw() { return __builtin_nansf (""); }
+
+ static _GLIBCXX_CONSTEXPR float
+ denorm_min() throw() { return __FLT_DENORM_MIN__; }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559
+ = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before
+ = __glibcxx_float_tinyness_before;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_to_nearest;
};
#undef __glibcxx_float_has_denorm_loss
@@ -1273,61 +1471,71 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<>
struct numeric_limits<double>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR double
+ min() throw() { return __DBL_MIN__; }
+
+ static _GLIBCXX_CONSTEXPR double
+ max() throw() { return __DBL_MAX__; }
- static double min() throw()
- { return __DBL_MIN__; }
- static double max() throw()
- { return __DBL_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static double lowest() throw()
- { return -__DBL_MAX__; }
+ static constexpr double
+ lowest() throw() { return -__DBL_MAX__; }
#endif
- static const int digits = __DBL_MANT_DIG__;
- static const int digits10 = __DBL_DIG__;
+ static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__;
+ static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10
+ static constexpr int max_digits10
= __glibcxx_max_digits10 (__DBL_MANT_DIG__);
#endif
- static const bool is_signed = true;
- static const bool is_integer = false;
- static const bool is_exact = false;
- static const int radix = __FLT_RADIX__;
- static double epsilon() throw()
- { return __DBL_EPSILON__; }
- static double round_error() throw()
- { return 0.5; }
-
- static const int min_exponent = __DBL_MIN_EXP__;
- static const int min_exponent10 = __DBL_MIN_10_EXP__;
- static const int max_exponent = __DBL_MAX_EXP__;
- static const int max_exponent10 = __DBL_MAX_10_EXP__;
-
- static const bool has_infinity = __DBL_HAS_INFINITY__;
- static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
- static const bool has_signaling_NaN = has_quiet_NaN;
- static const float_denorm_style has_denorm
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
+ static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
+
+ static _GLIBCXX_CONSTEXPR double
+ epsilon() throw() { return __DBL_EPSILON__; }
+
+ static _GLIBCXX_CONSTEXPR double
+ round_error() throw() { return 0.5; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;
- static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss;
-
- static double infinity() throw()
- { return __builtin_huge_val(); }
- static double quiet_NaN() throw()
- { return __builtin_nan (""); }
- static double signaling_NaN() throw()
- { return __builtin_nans (""); }
- static double denorm_min() throw()
- { return __DBL_DENORM_MIN__; }
-
- static const bool is_iec559
- = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
- static const bool is_bounded = true;
- static const bool is_modulo = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
+ = __glibcxx_double_has_denorm_loss;
+
+ static _GLIBCXX_CONSTEXPR double
+ infinity() throw() { return __builtin_huge_val(); }
+
+ static _GLIBCXX_CONSTEXPR double
+ quiet_NaN() throw() { return __builtin_nan (""); }
- static const bool traps = __glibcxx_double_traps;
- static const bool tinyness_before = __glibcxx_double_tinyness_before;
- static const float_round_style round_style = round_to_nearest;
+ static _GLIBCXX_CONSTEXPR double
+ signaling_NaN() throw() { return __builtin_nans (""); }
+
+ static _GLIBCXX_CONSTEXPR double
+ denorm_min() throw() { return __DBL_DENORM_MIN__; }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559
+ = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before
+ = __glibcxx_double_tinyness_before;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_to_nearest;
};
#undef __glibcxx_double_has_denorm_loss
@@ -1338,62 +1546,71 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<>
struct numeric_limits<long double>
{
- static const bool is_specialized = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR long double
+ min() throw() { return __LDBL_MIN__; }
+
+ static _GLIBCXX_CONSTEXPR long double
+ max() throw() { return __LDBL_MAX__; }
- static long double min() throw()
- { return __LDBL_MIN__; }
- static long double max() throw()
- { return __LDBL_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static long double lowest() throw()
- { return -__LDBL_MAX__; }
+ static constexpr long double
+ lowest() throw() { return -__LDBL_MAX__; }
#endif
- static const int digits = __LDBL_MANT_DIG__;
- static const int digits10 = __LDBL_DIG__;
+ static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__;
+ static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- static const int max_digits10
+ static _GLIBCXX_USE_CONSTEXPR int max_digits10
= __glibcxx_max_digits10 (__LDBL_MANT_DIG__);
#endif
- static const bool is_signed = true;
- static const bool is_integer = false;
- static const bool is_exact = false;
- static const int radix = __FLT_RADIX__;
- static long double epsilon() throw()
- { return __LDBL_EPSILON__; }
- static long double round_error() throw()
- { return 0.5L; }
-
- static const int min_exponent = __LDBL_MIN_EXP__;
- static const int min_exponent10 = __LDBL_MIN_10_EXP__;
- static const int max_exponent = __LDBL_MAX_EXP__;
- static const int max_exponent10 = __LDBL_MAX_10_EXP__;
-
- static const bool has_infinity = __LDBL_HAS_INFINITY__;
- static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
- static const bool has_signaling_NaN = has_quiet_NaN;
- static const float_denorm_style has_denorm
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
+ static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
+
+ static _GLIBCXX_CONSTEXPR long double
+ epsilon() throw() { return __LDBL_EPSILON__; }
+
+ static _GLIBCXX_CONSTEXPR long double
+ round_error() throw() { return 0.5L; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;
- static const bool has_denorm_loss
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
= __glibcxx_long_double_has_denorm_loss;
- static long double infinity() throw()
- { return __builtin_huge_vall (); }
- static long double quiet_NaN() throw()
- { return __builtin_nanl (""); }
- static long double signaling_NaN() throw()
- { return __builtin_nansl (""); }
- static long double denorm_min() throw()
- { return __LDBL_DENORM_MIN__; }
+ static _GLIBCXX_CONSTEXPR long double
+ infinity() throw() { return __builtin_huge_vall (); }
- static const bool is_iec559
- = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
- static const bool is_bounded = true;
- static const bool is_modulo = false;
+ static _GLIBCXX_CONSTEXPR long double
+ quiet_NaN() throw() { return __builtin_nanl (""); }
- static const bool traps = __glibcxx_long_double_traps;
- static const bool tinyness_before = __glibcxx_long_double_tinyness_before;
- static const float_round_style round_style = round_to_nearest;
+ static _GLIBCXX_CONSTEXPR long double
+ signaling_NaN() throw() { return __builtin_nansl (""); }
+
+ static _GLIBCXX_CONSTEXPR long double
+ denorm_min() throw() { return __LDBL_DENORM_MIN__; }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559
+ = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before =
+ __glibcxx_long_double_tinyness_before;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style =
+ round_to_nearest;
};
#undef __glibcxx_long_double_has_denorm_loss
diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index 42e948a30d0..bfc038de326 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -69,9 +69,6 @@
#include <bits/stl_raw_storage_iter.h>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
# include <exception> // std::exception
# include <typeinfo> // std::type_info in get_deleter
# include <iosfwd> // std::basic_ostream
@@ -86,19 +83,6 @@
# include <backward/auto_ptr.h>
# endif
# include <bits/unique_ptr.h>
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/boost_sp_counted_base.h>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/boost_sp_counted_base.h>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
# include <bits/shared_ptr.h>
#else
# include <backward/auto_ptr.h>
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index c11ddd44668..6d86cde8c5d 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -48,8 +48,8 @@
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
/**
* @defgroup mutexes Mutexes
* @ingroup concurrency
@@ -67,16 +67,15 @@ namespace std
public:
typedef __native_type* native_handle_type;
+#ifdef __GTHREAD_MUTEX_INIT
+ constexpr mutex() : _M_mutex(__GTHREAD_MUTEX_INIT) { }
+#else
mutex()
{
// XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
-#ifdef __GTHREAD_MUTEX_INIT
- __native_type __tmp = __GTHREAD_MUTEX_INIT;
- _M_mutex = __tmp;
-#else
__GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
-#endif
}
+#endif
mutex(const mutex&) = delete;
mutex& operator=(const mutex&) = delete;
@@ -381,9 +380,9 @@ namespace std
/// and manage it.
struct adopt_lock_t { };
- extern const defer_lock_t defer_lock;
- extern const try_to_lock_t try_to_lock;
- extern const adopt_lock_t adopt_lock;
+ constexpr defer_lock_t defer_lock { };
+ constexpr try_to_lock_t try_to_lock { };
+ constexpr adopt_lock_t adopt_lock { };
/// @brief Scoped lock idiom.
// Acquire the mutex here with a constructor call, then release with
@@ -679,11 +678,7 @@ namespace std
__native_type _M_once;
public:
- once_flag()
- {
- __native_type __tmp = __GTHREAD_ONCE_INIT;
- _M_once = __tmp;
- }
+ constexpr once_flag() : _M_once(__GTHREAD_ONCE_INIT) { }
once_flag(const once_flag&) = delete;
once_flag& operator=(const once_flag&) = delete;
@@ -744,7 +739,7 @@ namespace std
}
// @} group mutexes
-}
+_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/include/std/ratio b/libstdc++-v3/include/std/ratio
index b999e31a56f..80c5d15e789 100644
--- a/libstdc++-v3/include/std/ratio
+++ b/libstdc++-v3/include/std/ratio
@@ -40,8 +40,8 @@
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
/**
* @defgroup ratio Rational Arithmetic
* @ingroup utilities
@@ -155,20 +155,20 @@ namespace std
"out of range");
// Note: sign(N) * abs(N) == N
- static const intmax_t num =
+ static constexpr intmax_t num =
_Num * __static_sign<_Den>::value / __static_gcd<_Num, _Den>::value;
- static const intmax_t den =
+ static constexpr intmax_t den =
__static_abs<_Den>::value / __static_gcd<_Num, _Den>::value;
typedef ratio<num, den> type;
};
template<intmax_t _Num, intmax_t _Den>
- const intmax_t ratio<_Num, _Den>::num;
+ constexpr intmax_t ratio<_Num, _Den>::num;
template<intmax_t _Num, intmax_t _Den>
- const intmax_t ratio<_Num, _Den>::den;
+ constexpr intmax_t ratio<_Num, _Den>::den;
/// ratio_add
template<typename _R1, typename _R2>
@@ -185,15 +185,15 @@ namespace std
__safe_multiply<_R2::num, (_R1::den / __gcd)>::value>::value,
__safe_multiply<_R1::den, (_R2::den / __gcd)>::value> type;
- static const intmax_t num = type::num;
- static const intmax_t den = type::den;
+ static constexpr intmax_t num = type::num;
+ static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
- const intmax_t ratio_add<_R1, _R2>::num;
+ constexpr intmax_t ratio_add<_R1, _R2>::num;
template<typename _R1, typename _R2>
- const intmax_t ratio_add<_R1, _R2>::den;
+ constexpr intmax_t ratio_add<_R1, _R2>::den;
/// ratio_subtract
template<typename _R1, typename _R2>
@@ -203,15 +203,15 @@ namespace std
_R1,
ratio<-_R2::num, _R2::den>>::type type;
- static const intmax_t num = type::num;
- static const intmax_t den = type::den;
+ static constexpr intmax_t num = type::num;
+ static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
- const intmax_t ratio_subtract<_R1, _R2>::num;
+ constexpr intmax_t ratio_subtract<_R1, _R2>::num;
template<typename _R1, typename _R2>
- const intmax_t ratio_subtract<_R1, _R2>::den;
+ constexpr intmax_t ratio_subtract<_R1, _R2>::den;
/// ratio_multiply
template<typename _R1, typename _R2>
@@ -230,15 +230,15 @@ namespace std
__safe_multiply<(_R1::den / __gcd2),
(_R2::den / __gcd1)>::value> type;
- static const intmax_t num = type::num;
- static const intmax_t den = type::den;
+ static constexpr intmax_t num = type::num;
+ static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
- const intmax_t ratio_multiply<_R1, _R2>::num;
+ constexpr intmax_t ratio_multiply<_R1, _R2>::num;
template<typename _R1, typename _R2>
- const intmax_t ratio_multiply<_R1, _R2>::den;
+ constexpr intmax_t ratio_multiply<_R1, _R2>::den;
/// ratio_divide
template<typename _R1, typename _R2>
@@ -250,15 +250,15 @@ namespace std
_R1,
ratio<_R2::den, _R2::num>>::type type;
- static const intmax_t num = type::num;
- static const intmax_t den = type::den;
+ static constexpr intmax_t num = type::num;
+ static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
- const intmax_t ratio_divide<_R1, _R2>::num;
+ constexpr intmax_t ratio_divide<_R1, _R2>::num;
template<typename _R1, typename _R2>
- const intmax_t ratio_divide<_R1, _R2>::den;
+ constexpr intmax_t ratio_divide<_R1, _R2>::den;
/// ratio_equal
template<typename _R1, typename _R2>
@@ -339,7 +339,7 @@ namespace std
typedef ratio< 1000000000000000000, 1> exa;
// @} group ratio
-}
+_GLIBCXX_END_NAMESPACE
#endif //_GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index 4a3818e7278..944d0a8a5b2 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -46,8 +46,8 @@
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
/**
* @defgroup threads Threads
* @ingroup concurrency
@@ -283,7 +283,7 @@ namespace std
}
// @} group threads
-}
+_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 67a6eb79e94..682712104a2 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -37,8 +37,8 @@
#include <utility>
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
// Adds a const reference to a non-reference type.
template<typename _Tp>
struct __add_c_ref
@@ -64,7 +64,7 @@ namespace std
struct _Head_base<_Idx, _Head, true>
: public _Head
{
- _Head_base()
+ constexpr _Head_base()
: _Head() { }
_Head_base(const _Head& __h)
@@ -83,7 +83,7 @@ namespace std
template<std::size_t _Idx, typename _Head>
struct _Head_base<_Idx, _Head, false>
{
- _Head_base()
+ constexpr _Head_base()
: _M_head_impl() { }
_Head_base(const _Head& __h)
@@ -147,7 +147,7 @@ namespace std
_Inherited& _M_tail() { return *this; }
const _Inherited& _M_tail() const { return *this; }
- _Tuple_impl()
+ constexpr _Tuple_impl()
: _Inherited(), _Base() { }
explicit
@@ -225,7 +225,7 @@ namespace std
typedef _Tuple_impl<0, _Elements...> _Inherited;
public:
- tuple()
+ constexpr tuple()
: _Inherited() { }
explicit
@@ -310,7 +310,7 @@ namespace std
typedef _Tuple_impl<0, _T1, _T2> _Inherited;
public:
- tuple()
+ constexpr tuple()
: _Inherited() { }
explicit
@@ -408,7 +408,7 @@ namespace std
typedef _Tuple_impl<0, _T1> _Inherited;
public:
- tuple()
+ constexpr tuple()
: _Inherited() { }
explicit
@@ -791,7 +791,8 @@ namespace std
__do_cons(tuple<_Args...>&& __tuple,
const _Index_tuple<_Indexes...>&)
{ return _Tp(std::forward<_Args>(get<_Indexes>(__tuple))...); }
-}
+
+_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index cde741eb43a..fe84a6f92ac 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -35,32 +35,463 @@
# include <bits/c++0x_warning.h>
#else
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-#endif
-
#include <bits/c++config.h>
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/type_traits>
-#else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/type_traits>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-#endif
+_GLIBCXX_BEGIN_NAMESPACE(std)
-namespace std
-{
/**
* @addtogroup metaprogramming
* @{
*/
+ struct __sfinae_types
+ {
+ typedef char __one;
+ typedef struct { char __arr[2]; } __two;
+ };
+
+#define _DEFINE_SPEC_0_HELPER \
+ template<>
+
+#define _DEFINE_SPEC_1_HELPER \
+ template<typename _Tp>
+
+#define _DEFINE_SPEC_2_HELPER \
+ template<typename _Tp, typename _Cp>
+
+#define _DEFINE_SPEC(_Order, _Trait, _Type, _Value) \
+ _DEFINE_SPEC_##_Order##_HELPER \
+ struct _Trait<_Type> \
+ : public integral_constant<bool, _Value> { };
+
+ // helper classes.
+
+ /// integral_constant
+ template<typename _Tp, _Tp __v>
+ struct integral_constant
+ {
+ static constexpr _Tp value = __v;
+ typedef _Tp value_type;
+ typedef integral_constant<_Tp, __v> type;
+ constexpr operator value_type() { return value; }
+ };
+
+ /// typedef for true_type
+ typedef integral_constant<bool, true> true_type;
+
+ /// typedef for false_type
+ typedef integral_constant<bool, false> false_type;
+
+ template<typename _Tp, _Tp __v>
+ constexpr _Tp integral_constant<_Tp, __v>::value;
+
+ /// remove_cv
+ template<typename>
+ struct remove_cv;
+
+ template<typename>
+ struct __is_void_helper
+ : public false_type { };
+ _DEFINE_SPEC(0, __is_void_helper, void, true)
+
+ // primary type categories.
+
+ /// is_void
+ template<typename _Tp>
+ struct is_void
+ : public integral_constant<bool, (__is_void_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ template<typename>
+ struct __is_integral_helper
+ : public false_type { };
+ _DEFINE_SPEC(0, __is_integral_helper, bool, true)
+ _DEFINE_SPEC(0, __is_integral_helper, char, true)
+ _DEFINE_SPEC(0, __is_integral_helper, signed char, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned char, true)
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _DEFINE_SPEC(0, __is_integral_helper, wchar_t, true)
+#endif
+ _DEFINE_SPEC(0, __is_integral_helper, char16_t, true)
+ _DEFINE_SPEC(0, __is_integral_helper, char32_t, true)
+ _DEFINE_SPEC(0, __is_integral_helper, short, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned short, true)
+ _DEFINE_SPEC(0, __is_integral_helper, int, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned int, true)
+ _DEFINE_SPEC(0, __is_integral_helper, long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, long long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned long long, true)
+
+ /// is_integral
+ template<typename _Tp>
+ struct is_integral
+ : public integral_constant<bool, (__is_integral_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ template<typename>
+ struct __is_floating_point_helper
+ : public false_type { };
+ _DEFINE_SPEC(0, __is_floating_point_helper, float, true)
+ _DEFINE_SPEC(0, __is_floating_point_helper, double, true)
+ _DEFINE_SPEC(0, __is_floating_point_helper, long double, true)
+
+ /// is_floating_point
+ template<typename _Tp>
+ struct is_floating_point
+ : public integral_constant<bool, (__is_floating_point_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ /// is_array
+ template<typename>
+ struct is_array
+ : public false_type { };
+
+ template<typename _Tp, std::size_t _Size>
+ struct is_array<_Tp[_Size]>
+ : public true_type { };
+
+ template<typename _Tp>
+ struct is_array<_Tp[]>
+ : public true_type { };
+
+ template<typename>
+ struct __is_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(1, __is_pointer_helper, _Tp*, true)
+
+ /// is_pointer
+ template<typename _Tp>
+ struct is_pointer
+ : public integral_constant<bool, (__is_pointer_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ /// is_reference
+ template<typename _Tp>
+ struct is_reference;
+
+ /// is_function
+ template<typename _Tp>
+ struct is_function;
+
+ template<typename>
+ struct __is_member_object_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(2, __is_member_object_pointer_helper, _Tp _Cp::*,
+ !is_function<_Tp>::value)
+
+ /// is_member_object_pointer
+ template<typename _Tp>
+ struct is_member_object_pointer
+ : public integral_constant<bool, (__is_member_object_pointer_helper<
+ typename remove_cv<_Tp>::type>::value)>
+ { };
+
+ template<typename>
+ struct __is_member_function_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(2, __is_member_function_pointer_helper, _Tp _Cp::*,
+ is_function<_Tp>::value)
+
+ /// is_member_function_pointer
+ template<typename _Tp>
+ struct is_member_function_pointer
+ : public integral_constant<bool, (__is_member_function_pointer_helper<
+ typename remove_cv<_Tp>::type>::value)>
+ { };
+
+ /// is_enum
+ template<typename _Tp>
+ struct is_enum
+ : public integral_constant<bool, __is_enum(_Tp)>
+ { };
+
+ /// is_union
+ template<typename _Tp>
+ struct is_union
+ : public integral_constant<bool, __is_union(_Tp)>
+ { };
+
+ /// is_class
+ template<typename _Tp>
+ struct is_class
+ : public integral_constant<bool, __is_class(_Tp)>
+ { };
+
+ /// is_function
+ template<typename>
+ struct is_function
+ : public false_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...)>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......)>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...) const>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......) const>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...) volatile>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......) volatile>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...) const volatile>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......) const volatile>
+ : public true_type { };
+
+ // composite type traits.
+
+ /// is_arithmetic
+ template<typename _Tp>
+ struct is_arithmetic
+ : public integral_constant<bool, (is_integral<_Tp>::value
+ || is_floating_point<_Tp>::value)>
+ { };
+
+ /// is_fundamental
+ template<typename _Tp>
+ struct is_fundamental
+ : public integral_constant<bool, (is_arithmetic<_Tp>::value
+ || is_void<_Tp>::value)>
+ { };
+
+ /// is_object
+ template<typename _Tp>
+ struct is_object
+ : public integral_constant<bool, !(is_function<_Tp>::value
+ || is_reference<_Tp>::value
+ || is_void<_Tp>::value)>
+ { };
+
+ /// is_member_pointer
+ template<typename _Tp>
+ struct is_member_pointer;
+
+ /// is_scalar
+ template<typename _Tp>
+ struct is_scalar
+ : public integral_constant<bool, (is_arithmetic<_Tp>::value
+ || is_enum<_Tp>::value
+ || is_pointer<_Tp>::value
+ || is_member_pointer<_Tp>::value)>
+ { };
+
+ /// is_compound
+ template<typename _Tp>
+ struct is_compound
+ : public integral_constant<bool, !is_fundamental<_Tp>::value> { };
+
+ /// is_member_pointer
+ template<typename _Tp>
+ struct __is_member_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(2, __is_member_pointer_helper, _Tp _Cp::*, true)
+
+ template<typename _Tp>
+ struct is_member_pointer
+ : public integral_constant<bool, (__is_member_pointer_helper<
+ typename remove_cv<_Tp>::type>::value)>
+ { };
+
+ // type properties.
+ /// is_const
+ template<typename>
+ struct is_const
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_const<_Tp const>
+ : public true_type { };
+
+ /// is_volatile
+ template<typename>
+ struct is_volatile
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_volatile<_Tp volatile>
+ : public true_type { };
+
+ /// is_empty
+ template<typename _Tp>
+ struct is_empty
+ : public integral_constant<bool, __is_empty(_Tp)>
+ { };
+
+ /// is_polymorphic
+ template<typename _Tp>
+ struct is_polymorphic
+ : public integral_constant<bool, __is_polymorphic(_Tp)>
+ { };
+
+ /// is_abstract
+ template<typename _Tp>
+ struct is_abstract
+ : public integral_constant<bool, __is_abstract(_Tp)>
+ { };
+
+ /// has_virtual_destructor
+ template<typename _Tp>
+ struct has_virtual_destructor
+ : public integral_constant<bool, __has_virtual_destructor(_Tp)>
+ { };
+
+ /// alignment_of
+ template<typename _Tp>
+ struct alignment_of
+ : public integral_constant<std::size_t, __alignof__(_Tp)> { };
+
+ /// rank
+ template<typename>
+ struct rank
+ : public integral_constant<std::size_t, 0> { };
+
+ template<typename _Tp, std::size_t _Size>
+ struct rank<_Tp[_Size]>
+ : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
+
+ template<typename _Tp>
+ struct rank<_Tp[]>
+ : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
+
+ /// extent
+ template<typename, unsigned _Uint = 0>
+ struct extent
+ : public integral_constant<std::size_t, 0> { };
+
+ template<typename _Tp, unsigned _Uint, std::size_t _Size>
+ struct extent<_Tp[_Size], _Uint>
+ : public integral_constant<std::size_t,
+ _Uint == 0 ? _Size : extent<_Tp,
+ _Uint - 1>::value>
+ { };
+
+ template<typename _Tp, unsigned _Uint>
+ struct extent<_Tp[], _Uint>
+ : public integral_constant<std::size_t,
+ _Uint == 0 ? 0 : extent<_Tp,
+ _Uint - 1>::value>
+ { };
+
+ // relationships between types [4.6].
+
+ /// is_same
+ template<typename, typename>
+ struct is_same
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_same<_Tp, _Tp>
+ : public true_type { };
+
+ // const-volatile modifications [4.7.1].
+
+ /// remove_const
+ template<typename _Tp>
+ struct remove_const
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_const<_Tp const>
+ { typedef _Tp type; };
+
+ /// remove_volatile
+ template<typename _Tp>
+ struct remove_volatile
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_volatile<_Tp volatile>
+ { typedef _Tp type; };
+
+ /// remove_cv
+ template<typename _Tp>
+ struct remove_cv
+ {
+ typedef typename
+ remove_const<typename remove_volatile<_Tp>::type>::type type;
+ };
+
+ /// add_const
+ template<typename _Tp>
+ struct add_const
+ { typedef _Tp const type; };
+
+ /// add_volatile
+ template<typename _Tp>
+ struct add_volatile
+ { typedef _Tp volatile type; };
+
+ /// add_cv
+ template<typename _Tp>
+ struct add_cv
+ {
+ typedef typename
+ add_const<typename add_volatile<_Tp>::type>::type type;
+ };
+
+ // array modifications.
+
+ /// remove_extent
+ template<typename _Tp>
+ struct remove_extent
+ { typedef _Tp type; };
+
+ template<typename _Tp, std::size_t _Size>
+ struct remove_extent<_Tp[_Size]>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_extent<_Tp[]>
+ { typedef _Tp type; };
+
+ /// remove_all_extents
+ template<typename _Tp>
+ struct remove_all_extents
+ { typedef _Tp type; };
+
+ template<typename _Tp, std::size_t _Size>
+ struct remove_all_extents<_Tp[_Size]>
+ { typedef typename remove_all_extents<_Tp>::type type; };
+
+ template<typename _Tp>
+ struct remove_all_extents<_Tp[]>
+ { typedef typename remove_all_extents<_Tp>::type type; };
+
+ // pointer modifications.
+
+ template<typename _Tp, typename>
+ struct __remove_pointer_helper
+ { typedef _Tp type; };
+
+ template<typename _Tp, typename _Up>
+ struct __remove_pointer_helper<_Tp, _Up*>
+ { typedef _Up type; };
+
+ /// remove_pointer
+ template<typename _Tp>
+ struct remove_pointer
+ : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
+ { };
+
+ template<typename>
+ struct remove_reference;
+
+ /// add_pointer
+ template<typename _Tp>
+ struct add_pointer
+ { typedef typename remove_reference<_Tp>::type* type; };
// Primary classification traits.
@@ -192,6 +623,12 @@ namespace std
: public integral_constant<bool, __is_pod(_Tp)>
{ };
+ /// is_literal_type
+ template<typename _Tp>
+ struct is_literal_type
+ : public integral_constant<bool, __is_literal_type(_Tp)>
+ { };
+
template<typename _Tp>
typename add_rvalue_reference<_Tp>::type declval() noexcept;
@@ -725,8 +1162,13 @@ namespace std
<typename remove_cv<_Tp>::type>::value> \
{ };
+#undef _DEFINE_SPEC_0_HELPER
+#undef _DEFINE_SPEC_1_HELPER
+#undef _DEFINE_SPEC_2_HELPER
+#undef _DEFINE_SPEC
+
// @} group metaprogramming
-}
+_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
diff --git a/libstdc++-v3/include/std/typeindex b/libstdc++-v3/include/std/typeindex
index 44836f67ea3..d40306421d4 100644
--- a/libstdc++-v3/include/std/typeindex
+++ b/libstdc++-v3/include/std/typeindex
@@ -37,8 +37,8 @@
#include <typeinfo>
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
/**
@brief The class type_index provides a simple wrapper for type_info
which can be used as an index type in associative containers (23.6)
@@ -98,7 +98,8 @@ namespace std
operator()(const type_index& __ti) const
{ return __ti.hash_code(); }
};
-}
+
+_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index c3826eaca6b..e54a5868c90 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -1,6 +1,6 @@
// <utility> -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -71,24 +71,73 @@
#include <bits/stl_pair.h>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-# endif
-# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/utility>
-# else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/utility>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-# endif
-# include <bits/move.h>
-# include <initializer_list>
+#include <bits/move.h>
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<class _Tp>
+ class tuple_size;
+
+ template<std::size_t _Int, class _Tp>
+ class tuple_element;
+
+ // Various functions which give std::pair a tuple-like interface.
+ template<class _Tp1, class _Tp2>
+ struct tuple_size<std::pair<_Tp1, _Tp2> >
+ { static const std::size_t value = 2; };
+
+ template<class _Tp1, class _Tp2>
+ const std::size_t
+ tuple_size<std::pair<_Tp1, _Tp2> >::value;
+
+ template<class _Tp1, class _Tp2>
+ struct tuple_element<0, std::pair<_Tp1, _Tp2> >
+ { typedef _Tp1 type; };
+
+ template<class _Tp1, class _Tp2>
+ struct tuple_element<1, std::pair<_Tp1, _Tp2> >
+ { typedef _Tp2 type; };
+
+ template<std::size_t _Int>
+ struct __pair_get;
+
+ template<>
+ struct __pair_get<0>
+ {
+ template<typename _Tp1, typename _Tp2>
+ static _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.first; }
+
+ template<typename _Tp1, typename _Tp2>
+ static const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.first; }
+ };
+
+ template<>
+ struct __pair_get<1>
+ {
+ template<typename _Tp1, typename _Tp2>
+ static _Tp2& __get(std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.second; }
+
+ template<typename _Tp1, typename _Tp2>
+ static const _Tp2& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.second; }
+ };
+
+ template<std::size_t _Int, class _Tp1, class _Tp2>
+ inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
+ get(std::pair<_Tp1, _Tp2>& __in)
+ { return __pair_get<_Int>::__get(__in); }
+
+ template<std::size_t _Int, class _Tp1, class _Tp2>
+ inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
+ get(const std::pair<_Tp1, _Tp2>& __in)
+ { return __pair_get<_Int>::__const_get(__in); }
+
+_GLIBCXX_END_NAMESPACE
+
#endif
#endif /* _GLIBCXX_UTILITY */
diff --git a/libstdc++-v3/include/tr1/array b/libstdc++-v3/include/tr1/array
index 17cf5d290d2..3a1ff4caa8c 100644
--- a/libstdc++-v3/include/tr1/array
+++ b/libstdc++-v3/include/tr1/array
@@ -1,6 +1,7 @@
// class template array -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// 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
@@ -31,24 +32,217 @@
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
#include <bits/stl_algobase.h>
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/array>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/array>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
-#endif
+namespace std
+{
+namespace tr1
+{
+ /**
+ * @brief A standard container for storing a fixed size sequence of elements.
+ *
+ * @ingroup sequences
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#66">reversible container</a>, and a
+ * <a href="tables.html#67">sequence</a>.
+ *
+ * Sets support random access iterators.
+ *
+ * @param Tp Type of element. Required to be a complete type.
+ * @param N Number of elements.
+ */
+ template<typename _Tp, std::size_t _Nm>
+ struct array
+ {
+ typedef _Tp value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // Support for zero-sized arrays mandatory.
+ value_type _M_instance[_Nm ? _Nm : 1];
+
+ // No explicit construct/copy/destroy for aggregate type.
+
+ void
+ assign(const value_type& __u)
+ { std::fill_n(begin(), size(), __u); }
+
+ void
+ swap(array& __other)
+ { std::swap_ranges(begin(), end(), __other.begin()); }
+
+ // Iterators.
+ iterator
+ begin()
+ { return iterator(std::__addressof(_M_instance[0])); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(std::__addressof(_M_instance[0])); }
+
+ iterator
+ end()
+ { return iterator(std::__addressof(_M_instance[_Nm])); }
+
+ const_iterator
+ end() const
+ { return const_iterator(std::__addressof(_M_instance[_Nm])); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+ // Capacity.
+ size_type
+ size() const { return _Nm; }
+
+ size_type
+ max_size() const { return _Nm; }
+
+ bool
+ empty() const { return size() == 0; }
+
+ // Element access.
+ reference
+ operator[](size_type __n)
+ { return _M_instance[__n]; }
+
+ const_reference
+ operator[](size_type __n) const
+ { return _M_instance[__n]; }
+
+ reference
+ at(size_type __n)
+ {
+ if (__n >= _Nm)
+ std::__throw_out_of_range(__N("array::at"));
+ return _M_instance[__n];
+ }
+
+ const_reference
+ at(size_type __n) const
+ {
+ if (__n >= _Nm)
+ std::__throw_out_of_range(__N("array::at"));
+ return _M_instance[__n];
+ }
+
+ reference
+ front()
+ { return *begin(); }
+
+ const_reference
+ front() const
+ { return *begin(); }
+
+ reference
+ back()
+ { return _Nm ? *(end() - 1) : *end(); }
+
+ const_reference
+ back() const
+ { return _Nm ? *(end() - 1) : *end(); }
+
+ _Tp*
+ data()
+ { return std::__addressof(_M_instance[0]); }
+
+ const _Tp*
+ data() const
+ { return std::__addressof(_M_instance[0]); }
+ };
+
+ // Array comparisons.
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return std::equal(__one.begin(), __one.end(), __two.begin()); }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return !(__one == __two); }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
+ {
+ return std::lexicographical_compare(__a.begin(), __a.end(),
+ __b.begin(), __b.end());
+ }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return __two < __one; }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return !(__one > __two); }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return !(__one < __two); }
+
+ // Specialized algorithms [6.2.2.2].
+ template<typename _Tp, std::size_t _Nm>
+ inline void
+ swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
+ { __one.swap(__two); }
+
+ // Tuple interface to class template array [6.2.2.5].
+
+ /// tuple_size
+ template<typename _Tp>
+ class tuple_size;
+
+ /// tuple_element
+ template<int _Int, typename _Tp>
+ class tuple_element;
+
+ template<typename _Tp, std::size_t _Nm>
+ struct tuple_size<array<_Tp, _Nm> >
+ { static const int value = _Nm; };
+
+ template<typename _Tp, std::size_t _Nm>
+ const int
+ tuple_size<array<_Tp, _Nm> >::value;
+
+ template<int _Int, typename _Tp, std::size_t _Nm>
+ struct tuple_element<_Int, array<_Tp, _Nm> >
+ { typedef _Tp type; };
+
+ template<int _Int, typename _Tp, std::size_t _Nm>
+ inline _Tp&
+ get(array<_Tp, _Nm>& __arr)
+ { return __arr[_Int]; }
+
+ template<int _Int, typename _Tp, std::size_t _Nm>
+ inline const _Tp&
+ get(const array<_Tp, _Nm>& __arr)
+ { return __arr[_Int]; }
+}
+}
#endif // _GLIBCXX_TR1_ARRAY
diff --git a/libstdc++-v3/include/tr1/cctype b/libstdc++-v3/include/tr1/cctype
index 93e864eb890..ecdb0833fc6 100644
--- a/libstdc++-v3/include/tr1/cctype
+++ b/libstdc++-v3/include/tr1/cctype
@@ -32,18 +32,18 @@
#include <bits/c++config.h>
#include <cctype>
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/cctype>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/cctype>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
+#ifdef _GLIBCXX_USE_C99_CTYPE_TR1
+
+#undef isblank
+
+namespace std
+{
+namespace tr1
+{
+ using ::isblank;
+}
+}
+
#endif
#endif // _GLIBCXX_TR1_CCTYPE
diff --git a/libstdc++-v3/include/tr1/cfenv b/libstdc++-v3/include/tr1/cfenv
index e4c4facaa41..14db2ca3f75 100644
--- a/libstdc++-v3/include/tr1/cfenv
+++ b/libstdc++-v3/include/tr1/cfenv
@@ -1,6 +1,6 @@
// TR1 cfenv -*- C++ -*-
-// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 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
@@ -32,22 +32,50 @@
#pragma GCC system_header
#include <bits/c++config.h>
+
#if _GLIBCXX_HAVE_FENV_H
# include <fenv.h>
#endif
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/cfenv>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/cfenv>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
-#endif
+#ifdef _GLIBCXX_USE_C99_FENV_TR1
+
+#undef feclearexcept
+#undef fegetexceptflag
+#undef feraiseexcept
+#undef fesetexceptflag
+#undef fetestexcept
+#undef fegetround
+#undef fesetround
+#undef fegetenv
+#undef feholdexcept
+#undef fesetenv
+#undef feupdateenv
+
+namespace std
+{
+namespace tr1
+{
+ // types
+ using ::fenv_t;
+ using ::fexcept_t;
+
+ // functions
+ using ::feclearexcept;
+ using ::fegetexceptflag;
+ using ::feraiseexcept;
+ using ::fesetexceptflag;
+ using ::fetestexcept;
+
+ using ::fegetround;
+ using ::fesetround;
+
+ using ::fegetenv;
+ using ::feholdexcept;
+ using ::fesetenv;
+ using ::feupdateenv;
+}
+}
+
+#endif // _GLIBCXX_USE_C99_FENV_TR1
#endif // _GLIBCXX_TR1_CFENV
diff --git a/libstdc++-v3/include/tr1/cinttypes b/libstdc++-v3/include/tr1/cinttypes
index 71fd545d29d..e0cd1718e6d 100644
--- a/libstdc++-v3/include/tr1/cinttypes
+++ b/libstdc++-v3/include/tr1/cinttypes
@@ -1,6 +1,6 @@
// TR1 cinttypes -*- C++ -*-
-// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 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
@@ -46,18 +46,39 @@
# endif
#endif
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/cinttypes>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/cinttypes>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
+#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1
+
+namespace std
+{
+namespace tr1
+{
+ // types
+ using ::imaxdiv_t;
+
+ // functions
+ using ::imaxabs;
+
+ // May collide with _Longlong abs(_Longlong), and is not described
+ // anywhere outside the synopsis. Likely, a defect.
+ //
+ // intmax_t abs(intmax_t)
+
+ using ::imaxdiv;
+
+ // Likewise, with lldiv_t div(_Longlong, _Longlong).
+ //
+ // imaxdiv_t div(intmax_t, intmax_t)
+
+ using ::strtoimax;
+ using ::strtoumax;
+
+#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
+ using ::wcstoimax;
+ using ::wcstoumax;
#endif
+}
+}
+
+#endif // _GLIBCXX_USE_C99_INTTYPES_TR1
#endif // _GLIBCXX_TR1_CINTTYPES
diff --git a/libstdc++-v3/include/tr1/cmath b/libstdc++-v3/include/tr1/cmath
index a9fbf2b6bb6..36c9a733a6d 100644
--- a/libstdc++-v3/include/tr1/cmath
+++ b/libstdc++-v3/include/tr1/cmath
@@ -1,6 +1,6 @@
// TR1 cmath -*- C++ -*-
-// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 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
@@ -31,26 +31,975 @@
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
+#include <cmath>
+
+#ifdef _GLIBCXX_USE_C99_MATH_TR1
+
+#undef acosh
+#undef acoshf
+#undef acoshl
+#undef asinh
+#undef asinhf
+#undef asinhl
+#undef atanh
+#undef atanhf
+#undef atanhl
+#undef cbrt
+#undef cbrtf
+#undef cbrtl
+#undef copysign
+#undef copysignf
+#undef copysignl
+#undef erf
+#undef erff
+#undef erfl
+#undef erfc
+#undef erfcf
+#undef erfcl
+#undef exp2
+#undef exp2f
+#undef exp2l
+#undef expm1
+#undef expm1f
+#undef expm1l
+#undef fdim
+#undef fdimf
+#undef fdiml
+#undef fma
+#undef fmaf
+#undef fmal
+#undef fmax
+#undef fmaxf
+#undef fmaxl
+#undef fmin
+#undef fminf
+#undef fminl
+#undef hypot
+#undef hypotf
+#undef hypotl
+#undef ilogb
+#undef ilogbf
+#undef ilogbl
+#undef lgamma
+#undef lgammaf
+#undef lgammal
+#undef llrint
+#undef llrintf
+#undef llrintl
+#undef llround
+#undef llroundf
+#undef llroundl
+#undef log1p
+#undef log1pf
+#undef log1pl
+#undef log2
+#undef log2f
+#undef log2l
+#undef logb
+#undef logbf
+#undef logbl
+#undef lrint
+#undef lrintf
+#undef lrintl
+#undef lround
+#undef lroundf
+#undef lroundl
+#undef nan
+#undef nanf
+#undef nanl
+#undef nearbyint
+#undef nearbyintf
+#undef nearbyintl
+#undef nextafter
+#undef nextafterf
+#undef nextafterl
+#undef nexttoward
+#undef nexttowardf
+#undef nexttowardl
+#undef remainder
+#undef remainderf
+#undef remainderl
+#undef remquo
+#undef remquof
+#undef remquol
+#undef rint
+#undef rintf
+#undef rintl
+#undef round
+#undef roundf
+#undef roundl
+#undef scalbln
+#undef scalblnf
+#undef scalblnl
+#undef scalbn
+#undef scalbnf
+#undef scalbnl
+#undef tgamma
+#undef tgammaf
+#undef tgammal
+#undef trunc
+#undef truncf
+#undef truncl
+
#endif
-#include <cmath>
+namespace std
+{
+namespace tr1
+{
+#if _GLIBCXX_USE_C99_MATH_TR1
+
+ // types
+ using ::double_t;
+ using ::float_t;
+
+ // functions
+ using ::acosh;
+ using ::acoshf;
+ using ::acoshl;
+
+ using ::asinh;
+ using ::asinhf;
+ using ::asinhl;
+
+ using ::atanh;
+ using ::atanhf;
+ using ::atanhl;
+
+ using ::cbrt;
+ using ::cbrtf;
+ using ::cbrtl;
+
+ using ::copysign;
+ using ::copysignf;
+ using ::copysignl;
+
+ using ::erf;
+ using ::erff;
+ using ::erfl;
+
+ using ::erfc;
+ using ::erfcf;
+ using ::erfcl;
+
+ using ::exp2;
+ using ::exp2f;
+ using ::exp2l;
+
+ using ::expm1;
+ using ::expm1f;
+ using ::expm1l;
+
+ using ::fdim;
+ using ::fdimf;
+ using ::fdiml;
+
+ using ::fma;
+ using ::fmaf;
+ using ::fmal;
+
+ using ::fmax;
+ using ::fmaxf;
+ using ::fmaxl;
+
+ using ::fmin;
+ using ::fminf;
+ using ::fminl;
+
+ using ::hypot;
+ using ::hypotf;
+ using ::hypotl;
+
+ using ::ilogb;
+ using ::ilogbf;
+ using ::ilogbl;
+
+ using ::lgamma;
+ using ::lgammaf;
+ using ::lgammal;
+
+ using ::llrint;
+ using ::llrintf;
+ using ::llrintl;
+
+ using ::llround;
+ using ::llroundf;
+ using ::llroundl;
+
+ using ::log1p;
+ using ::log1pf;
+ using ::log1pl;
+
+ using ::log2;
+ using ::log2f;
+ using ::log2l;
+
+ using ::logb;
+ using ::logbf;
+ using ::logbl;
+
+ using ::lrint;
+ using ::lrintf;
+ using ::lrintl;
+
+ using ::lround;
+ using ::lroundf;
+ using ::lroundl;
+
+ using ::nan;
+ using ::nanf;
+ using ::nanl;
+
+ using ::nearbyint;
+ using ::nearbyintf;
+ using ::nearbyintl;
+
+ using ::nextafter;
+ using ::nextafterf;
+ using ::nextafterl;
+
+ using ::nexttoward;
+ using ::nexttowardf;
+ using ::nexttowardl;
+
+ using ::remainder;
+ using ::remainderf;
+ using ::remainderl;
+
+ using ::remquo;
+ using ::remquof;
+ using ::remquol;
+
+ using ::rint;
+ using ::rintf;
+ using ::rintl;
+
+ using ::round;
+ using ::roundf;
+ using ::roundl;
+
+ using ::scalbln;
+ using ::scalblnf;
+ using ::scalblnl;
+
+ using ::scalbn;
+ using ::scalbnf;
+ using ::scalbnl;
+
+ using ::tgamma;
+ using ::tgammaf;
+ using ::tgammal;
+
+ using ::trunc;
+ using ::truncf;
+ using ::truncl;
+
+#endif
+
+#if _GLIBCXX_USE_C99_MATH
+#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
+
+ /// Function template definitions [8.16.3].
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ fpclassify(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
+ FP_SUBNORMAL, FP_ZERO, __type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isfinite(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isfinite(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isinf(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isinf(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isnan(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isnan(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isnormal(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isnormal(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ signbit(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_signbit(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isgreater(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isgreater(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isgreaterequal(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isgreaterequal(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isless(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isless(__type(__f1), __type(__f2));
+ }
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/cmath>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/cmath>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ islessequal(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_islessequal(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ islessgreater(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_islessgreater(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isunordered(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isunordered(__type(__f1), __type(__f2));
+ }
+
+#endif
#endif
+#if _GLIBCXX_USE_C99_MATH_TR1
+
+ /// Additional overloads [8.16.4].
+ using std::acos;
+
+ inline float
+ acosh(float __x)
+ { return __builtin_acoshf(__x); }
+
+ inline long double
+ acosh(long double __x)
+ { return __builtin_acoshl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ acosh(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return acosh(__type(__x));
+ }
+
+ using std::asin;
+
+ inline float
+ asinh(float __x)
+ { return __builtin_asinhf(__x); }
+
+ inline long double
+ asinh(long double __x)
+ { return __builtin_asinhl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ asinh(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return asinh(__type(__x));
+ }
+
+ using std::atan;
+ using std::atan2;
+
+ inline float
+ atanh(float __x)
+ { return __builtin_atanhf(__x); }
+
+ inline long double
+ atanh(long double __x)
+ { return __builtin_atanhl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ atanh(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return atanh(__type(__x));
+ }
+
+ inline float
+ cbrt(float __x)
+ { return __builtin_cbrtf(__x); }
+
+ inline long double
+ cbrt(long double __x)
+ { return __builtin_cbrtl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ cbrt(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return cbrt(__type(__x));
+ }
+
+ using std::ceil;
+
+ inline float
+ copysign(float __x, float __y)
+ { return __builtin_copysignf(__x, __y); }
+
+ inline long double
+ copysign(long double __x, long double __y)
+ { return __builtin_copysignl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ copysign(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return copysign(__type(__x), __type(__y));
+ }
+
+ using std::cos;
+ using std::cosh;
+
+ inline float
+ erf(float __x)
+ { return __builtin_erff(__x); }
+
+ inline long double
+ erf(long double __x)
+ { return __builtin_erfl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ erf(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return erf(__type(__x));
+ }
+
+ inline float
+ erfc(float __x)
+ { return __builtin_erfcf(__x); }
+
+ inline long double
+ erfc(long double __x)
+ { return __builtin_erfcl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ erfc(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return erfc(__type(__x));
+ }
+
+ using std::exp;
+
+ inline float
+ exp2(float __x)
+ { return __builtin_exp2f(__x); }
+
+ inline long double
+ exp2(long double __x)
+ { return __builtin_exp2l(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ exp2(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return exp2(__type(__x));
+ }
+
+ inline float
+ expm1(float __x)
+ { return __builtin_expm1f(__x); }
+
+ inline long double
+ expm1(long double __x)
+ { return __builtin_expm1l(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ expm1(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return expm1(__type(__x));
+ }
+
+ using std::fabs;
+
+ inline float
+ fdim(float __x, float __y)
+ { return __builtin_fdimf(__x, __y); }
+
+ inline long double
+ fdim(long double __x, long double __y)
+ { return __builtin_fdiml(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ fdim(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return fdim(__type(__x), __type(__y));
+ }
+
+ using std::floor;
+
+ inline float
+ fma(float __x, float __y, float __z)
+ { return __builtin_fmaf(__x, __y, __z); }
+
+ inline long double
+ fma(long double __x, long double __y, long double __z)
+ { return __builtin_fmal(__x, __y, __z); }
+
+ template<typename _Tp, typename _Up, typename _Vp>
+ inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
+ fma(_Tp __x, _Up __y, _Vp __z)
+ {
+ typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
+ return fma(__type(__x), __type(__y), __type(__z));
+ }
+
+ inline float
+ fmax(float __x, float __y)
+ { return __builtin_fmaxf(__x, __y); }
+
+ inline long double
+ fmax(long double __x, long double __y)
+ { return __builtin_fmaxl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ fmax(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return fmax(__type(__x), __type(__y));
+ }
+
+ inline float
+ fmin(float __x, float __y)
+ { return __builtin_fminf(__x, __y); }
+
+ inline long double
+ fmin(long double __x, long double __y)
+ { return __builtin_fminl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ fmin(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return fmin(__type(__x), __type(__y));
+ }
+
+ using std::fmod;
+ using std::frexp;
+
+ inline float
+ hypot(float __x, float __y)
+ { return __builtin_hypotf(__x, __y); }
+
+ inline long double
+ hypot(long double __x, long double __y)
+ { return __builtin_hypotl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ hypot(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return hypot(__type(__x), __type(__y));
+ }
+
+ inline int
+ ilogb(float __x)
+ { return __builtin_ilogbf(__x); }
+
+ inline int
+ ilogb(long double __x)
+ { return __builtin_ilogbl(__x); }
+
+ template<typename _Tp>
+ inline int
+ ilogb(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return ilogb(__type(__x));
+ }
+
+ using std::ldexp;
+
+ inline float
+ lgamma(float __x)
+ { return __builtin_lgammaf(__x); }
+
+ inline long double
+ lgamma(long double __x)
+ { return __builtin_lgammal(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ lgamma(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return lgamma(__type(__x));
+ }
+
+ inline long long
+ llrint(float __x)
+ { return __builtin_llrintf(__x); }
+
+ inline long long
+ llrint(long double __x)
+ { return __builtin_llrintl(__x); }
+
+ template<typename _Tp>
+ inline long long
+ llrint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return llrint(__type(__x));
+ }
+
+ inline long long
+ llround(float __x)
+ { return __builtin_llroundf(__x); }
+
+ inline long long
+ llround(long double __x)
+ { return __builtin_llroundl(__x); }
+
+ template<typename _Tp>
+ inline long long
+ llround(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return llround(__type(__x));
+ }
+
+ using std::log;
+ using std::log10;
+
+ inline float
+ log1p(float __x)
+ { return __builtin_log1pf(__x); }
+
+ inline long double
+ log1p(long double __x)
+ { return __builtin_log1pl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ log1p(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return log1p(__type(__x));
+ }
+
+ // DR 568.
+ inline float
+ log2(float __x)
+ { return __builtin_log2f(__x); }
+
+ inline long double
+ log2(long double __x)
+ { return __builtin_log2l(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ log2(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return log2(__type(__x));
+ }
+
+ inline float
+ logb(float __x)
+ { return __builtin_logbf(__x); }
+
+ inline long double
+ logb(long double __x)
+ { return __builtin_logbl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ logb(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return logb(__type(__x));
+ }
+
+ inline long
+ lrint(float __x)
+ { return __builtin_lrintf(__x); }
+
+ inline long
+ lrint(long double __x)
+ { return __builtin_lrintl(__x); }
+
+ template<typename _Tp>
+ inline long
+ lrint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return lrint(__type(__x));
+ }
+
+ inline long
+ lround(float __x)
+ { return __builtin_lroundf(__x); }
+
+ inline long
+ lround(long double __x)
+ { return __builtin_lroundl(__x); }
+
+ template<typename _Tp>
+ inline long
+ lround(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return lround(__type(__x));
+ }
+
+ inline float
+ nearbyint(float __x)
+ { return __builtin_nearbyintf(__x); }
+
+ inline long double
+ nearbyint(long double __x)
+ { return __builtin_nearbyintl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ nearbyint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return nearbyint(__type(__x));
+ }
+
+ inline float
+ nextafter(float __x, float __y)
+ { return __builtin_nextafterf(__x, __y); }
+
+ inline long double
+ nextafter(long double __x, long double __y)
+ { return __builtin_nextafterl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ nextafter(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return nextafter(__type(__x), __type(__y));
+ }
+
+ inline float
+ nexttoward(float __x, long double __y)
+ { return __builtin_nexttowardf(__x, __y); }
+
+ inline long double
+ nexttoward(long double __x, long double __y)
+ { return __builtin_nexttowardl(__x, __y); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ nexttoward(_Tp __x, long double __y)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return nexttoward(__type(__x), __y);
+ }
+
+ // DR 550. What should the return type of pow(float,int) be?
+ // NB: C++0x and TR1 != C++03.
+ // using std::pow;
+
+ inline float
+ remainder(float __x, float __y)
+ { return __builtin_remainderf(__x, __y); }
+
+ inline long double
+ remainder(long double __x, long double __y)
+ { return __builtin_remainderl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ remainder(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return remainder(__type(__x), __type(__y));
+ }
+
+ inline float
+ remquo(float __x, float __y, int* __pquo)
+ { return __builtin_remquof(__x, __y, __pquo); }
+
+ inline long double
+ remquo(long double __x, long double __y, int* __pquo)
+ { return __builtin_remquol(__x, __y, __pquo); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ remquo(_Tp __x, _Up __y, int* __pquo)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return remquo(__type(__x), __type(__y), __pquo);
+ }
+
+ inline float
+ rint(float __x)
+ { return __builtin_rintf(__x); }
+
+ inline long double
+ rint(long double __x)
+ { return __builtin_rintl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ rint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return rint(__type(__x));
+ }
+
+ inline float
+ round(float __x)
+ { return __builtin_roundf(__x); }
+
+ inline long double
+ round(long double __x)
+ { return __builtin_roundl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ round(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return round(__type(__x));
+ }
+
+ inline float
+ scalbln(float __x, long __ex)
+ { return __builtin_scalblnf(__x, __ex); }
+
+ inline long double
+ scalbln(long double __x, long __ex)
+ { return __builtin_scalblnl(__x, __ex); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ scalbln(_Tp __x, long __ex)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return scalbln(__type(__x), __ex);
+ }
+
+ inline float
+ scalbn(float __x, int __ex)
+ { return __builtin_scalbnf(__x, __ex); }
+
+ inline long double
+ scalbn(long double __x, int __ex)
+ { return __builtin_scalbnl(__x, __ex); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ scalbn(_Tp __x, int __ex)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return scalbn(__type(__x), __ex);
+ }
+
+ using std::sin;
+ using std::sinh;
+ using std::sqrt;
+ using std::tan;
+ using std::tanh;
+
+ inline float
+ tgamma(float __x)
+ { return __builtin_tgammaf(__x); }
+
+ inline long double
+ tgamma(long double __x)
+ { return __builtin_tgammal(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ tgamma(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return tgamma(__type(__x));
+ }
+
+ inline float
+ trunc(float __x)
+ { return __builtin_truncf(__x); }
+
+ inline long double
+ trunc(long double __x)
+ { return __builtin_truncl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ trunc(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return trunc(__type(__x));
+ }
+
+#endif
+}
+}
+
namespace std
{
namespace tr1
diff --git a/libstdc++-v3/include/tr1/complex b/libstdc++-v3/include/tr1/complex
index 063112b440b..8cec0b11d8e 100644
--- a/libstdc++-v3/include/tr1/complex
+++ b/libstdc++-v3/include/tr1/complex
@@ -31,30 +31,334 @@
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
#include <complex>
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/complex>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/complex>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
-#endif
-
namespace std
{
namespace tr1
{
+ /**
+ * @addtogroup complex_numbers
+ * @{
+ */
+
+ // Forward declarations.
+ template<typename _Tp> std::complex<_Tp> acos(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> asin(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> atan(const std::complex<_Tp>&);
+
+ template<typename _Tp> std::complex<_Tp> acosh(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> asinh(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> atanh(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> fabs(const std::complex<_Tp>&);
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ __complex_acos(const std::complex<_Tp>& __z)
+ {
+ const std::complex<_Tp> __t = std::tr1::asin(__z);
+ const _Tp __pi_2 = 1.5707963267948966192313216916397514L;
+ return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag());
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_acos(__complex__ float __z)
+ { return __builtin_cacosf(__z); }
+
+ inline __complex__ double
+ __complex_acos(__complex__ double __z)
+ { return __builtin_cacos(__z); }
+
+ inline __complex__ long double
+ __complex_acos(const __complex__ long double& __z)
+ { return __builtin_cacosl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acos(const std::complex<_Tp>& __z)
+ { return __complex_acos(__z.__rep()); }
+#else
+ /// acos(__z) [8.1.2].
+ // Effects: Behaves the same as C99 function cacos, defined
+ // in subclause 7.3.5.1.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acos(const std::complex<_Tp>& __z)
+ { return __complex_acos(__z); }
+#endif
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ __complex_asin(const std::complex<_Tp>& __z)
+ {
+ std::complex<_Tp> __t(-__z.imag(), __z.real());
+ __t = std::tr1::asinh(__t);
+ return std::complex<_Tp>(__t.imag(), -__t.real());
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_asin(__complex__ float __z)
+ { return __builtin_casinf(__z); }
+
+ inline __complex__ double
+ __complex_asin(__complex__ double __z)
+ { return __builtin_casin(__z); }
+
+ inline __complex__ long double
+ __complex_asin(const __complex__ long double& __z)
+ { return __builtin_casinl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asin(const std::complex<_Tp>& __z)
+ { return __complex_asin(__z.__rep()); }
+#else
+ /// asin(__z) [8.1.3].
+ // Effects: Behaves the same as C99 function casin, defined
+ // in subclause 7.3.5.2.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asin(const std::complex<_Tp>& __z)
+ { return __complex_asin(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_atan(const std::complex<_Tp>& __z)
+ {
+ const _Tp __r2 = __z.real() * __z.real();
+ const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();
+
+ _Tp __num = __z.imag() + _Tp(1.0);
+ _Tp __den = __z.imag() - _Tp(1.0);
+
+ __num = __r2 + __num * __num;
+ __den = __r2 + __den * __den;
+
+ return std::complex<_Tp>(_Tp(0.5) * atan2(_Tp(2.0) * __z.real(), __x),
+ _Tp(0.25) * log(__num / __den));
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_atan(__complex__ float __z)
+ { return __builtin_catanf(__z); }
+
+ inline __complex__ double
+ __complex_atan(__complex__ double __z)
+ { return __builtin_catan(__z); }
+
+ inline __complex__ long double
+ __complex_atan(const __complex__ long double& __z)
+ { return __builtin_catanl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atan(const std::complex<_Tp>& __z)
+ { return __complex_atan(__z.__rep()); }
+#else
+ /// atan(__z) [8.1.4].
+ // Effects: Behaves the same as C99 function catan, defined
+ // in subclause 7.3.5.3.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atan(const std::complex<_Tp>& __z)
+ { return __complex_atan(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_acosh(const std::complex<_Tp>& __z)
+ {
+ std::complex<_Tp> __t((__z.real() - __z.imag())
+ * (__z.real() + __z.imag()) - _Tp(1.0),
+ _Tp(2.0) * __z.real() * __z.imag());
+ __t = std::sqrt(__t);
+
+ return std::log(__t + __z);
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_acosh(__complex__ float __z)
+ { return __builtin_cacoshf(__z); }
+
+ inline __complex__ double
+ __complex_acosh(__complex__ double __z)
+ { return __builtin_cacosh(__z); }
+
+ inline __complex__ long double
+ __complex_acosh(const __complex__ long double& __z)
+ { return __builtin_cacoshl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acosh(const std::complex<_Tp>& __z)
+ { return __complex_acosh(__z.__rep()); }
+#else
+ /// acosh(__z) [8.1.5].
+ // Effects: Behaves the same as C99 function cacosh, defined
+ // in subclause 7.3.6.1.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acosh(const std::complex<_Tp>& __z)
+ { return __complex_acosh(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_asinh(const std::complex<_Tp>& __z)
+ {
+ std::complex<_Tp> __t((__z.real() - __z.imag())
+ * (__z.real() + __z.imag()) + _Tp(1.0),
+ _Tp(2.0) * __z.real() * __z.imag());
+ __t = std::sqrt(__t);
+
+ return std::log(__t + __z);
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_asinh(__complex__ float __z)
+ { return __builtin_casinhf(__z); }
+
+ inline __complex__ double
+ __complex_asinh(__complex__ double __z)
+ { return __builtin_casinh(__z); }
+
+ inline __complex__ long double
+ __complex_asinh(const __complex__ long double& __z)
+ { return __builtin_casinhl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asinh(const std::complex<_Tp>& __z)
+ { return __complex_asinh(__z.__rep()); }
+#else
+ /// asinh(__z) [8.1.6].
+ // Effects: Behaves the same as C99 function casin, defined
+ // in subclause 7.3.6.2.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asinh(const std::complex<_Tp>& __z)
+ { return __complex_asinh(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_atanh(const std::complex<_Tp>& __z)
+ {
+ const _Tp __i2 = __z.imag() * __z.imag();
+ const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();
+
+ _Tp __num = _Tp(1.0) + __z.real();
+ _Tp __den = _Tp(1.0) - __z.real();
+
+ __num = __i2 + __num * __num;
+ __den = __i2 + __den * __den;
+
+ return std::complex<_Tp>(_Tp(0.25) * (log(__num) - log(__den)),
+ _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_atanh(__complex__ float __z)
+ { return __builtin_catanhf(__z); }
+
+ inline __complex__ double
+ __complex_atanh(__complex__ double __z)
+ { return __builtin_catanh(__z); }
+
+ inline __complex__ long double
+ __complex_atanh(const __complex__ long double& __z)
+ { return __builtin_catanhl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atanh(const std::complex<_Tp>& __z)
+ { return __complex_atanh(__z.__rep()); }
+#else
+ /// atanh(__z) [8.1.7].
+ // Effects: Behaves the same as C99 function catanh, defined
+ // in subclause 7.3.6.3.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atanh(const std::complex<_Tp>& __z)
+ { return __complex_atanh(__z); }
+#endif
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ /// fabs(__z) [8.1.8].
+ // Effects: Behaves the same as C99 function cabs, defined
+ // in subclause 7.3.8.1.
+ fabs(const std::complex<_Tp>& __z)
+ { return std::abs(__z); }
+
+ /// Additional overloads [8.1.9].
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ arg(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+#if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
+ return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
+ : __type();
+#else
+ return std::arg(std::complex<__type>(__x));
+#endif
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ imag(_Tp)
+ { return _Tp(); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ norm(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __type(__x) * __type(__x);
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ real(_Tp __x)
+ { return __x; }
+
+#endif
+
+ template<typename _Tp, typename _Up>
+ inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
+ pow(const std::complex<_Tp>& __x, const _Up& __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return std::pow(std::complex<__type>(__x), __type(__y));
+ }
+
+ template<typename _Tp, typename _Up>
+ inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
+ pow(const _Tp& __x, const std::complex<_Up>& __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return std::pow(__type(__x), std::complex<__type>(__y));
+ }
+
+ template<typename _Tp, typename _Up>
+ inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
+ pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return std::pow(std::complex<__type>(__x),
+ std::complex<__type>(__y));
+ }
+
using std::arg;
template<typename _Tp>
@@ -95,6 +399,8 @@ namespace tr1
inline std::complex<_Tp>
pow(const std::complex<_Tp>& __x, const std::complex<_Tp>& __y)
{ return std::pow(__x, __y); }
+
+// @} group complex_numbers
}
}
diff --git a/libstdc++-v3/include/tr1/cstdint b/libstdc++-v3/include/tr1/cstdint
index 1e6cc3714a9..c143bd279f4 100644
--- a/libstdc++-v3/include/tr1/cstdint
+++ b/libstdc++-v3/include/tr1/cstdint
@@ -31,10 +31,6 @@
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
#include <bits/c++config.h>
// For 8.22.1/1 (see C99, Notes 219, 220, 222)
@@ -58,19 +54,51 @@
# endif
# endif
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/cstdint>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/cstdint>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
-#endif
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+namespace std
+{
+namespace tr1
+{
+ using ::int8_t;
+ using ::int16_t;
+ using ::int32_t;
+ using ::int64_t;
+
+ using ::int_fast8_t;
+ using ::int_fast16_t;
+ using ::int_fast32_t;
+ using ::int_fast64_t;
+
+ using ::int_least8_t;
+ using ::int_least16_t;
+ using ::int_least32_t;
+ using ::int_least64_t;
+
+ using ::intmax_t;
+ using ::intptr_t;
+
+ using ::uint8_t;
+ using ::uint16_t;
+ using ::uint32_t;
+ using ::uint64_t;
+
+ using ::uint_fast8_t;
+ using ::uint_fast16_t;
+ using ::uint_fast32_t;
+ using ::uint_fast64_t;
+
+ using ::uint_least8_t;
+ using ::uint_least16_t;
+ using ::uint_least32_t;
+ using ::uint_least64_t;
+
+ using ::uintmax_t;
+ using ::uintptr_t;
+}
+}
+
+#endif // _GLIBCXX_USE_C99_STDINT_TR1
#endif // _GLIBCXX_TR1_CSTDINT
diff --git a/libstdc++-v3/include/tr1/cstdio b/libstdc++-v3/include/tr1/cstdio
index cfcf31a3fda..bd52aa2292d 100644
--- a/libstdc++-v3/include/tr1/cstdio
+++ b/libstdc++-v3/include/tr1/cstdio
@@ -31,24 +31,23 @@
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
#include <cstdio>
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/cstdio>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/cstdio>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
+#if _GLIBCXX_USE_C99
+
+namespace std
+{
+namespace tr1
+{
+ using std::snprintf;
+ using std::vsnprintf;
+
+ using std::vfscanf;
+ using std::vscanf;
+ using std::vsscanf;
+}
+}
+
#endif
#endif // _GLIBCXX_TR1_CSTDIO
diff --git a/libstdc++-v3/include/tr1/cstdlib b/libstdc++-v3/include/tr1/cstdlib
index c9fab202dcd..a4b8eb1c0d6 100644
--- a/libstdc++-v3/include/tr1/cstdlib
+++ b/libstdc++-v3/include/tr1/cstdlib
@@ -1,6 +1,6 @@
// TR1 cstdlib -*- C++ -*-
-// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 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
@@ -31,24 +31,42 @@
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
+#include <cstdlib>
+
+#if _GLIBCXX_HOSTED
+
+#if _GLIBCXX_USE_C99
+
+namespace std
+{
+namespace tr1
+{
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ // types
+ using std::lldiv_t;
+
+ // functions
+ using std::llabs;
+ using std::lldiv;
#endif
-#include <cstdlib>
+ using std::atoll;
+ using std::strtoll;
+ using std::strtoull;
+
+ using std::strtof;
+ using std::strtold;
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/cstdlib>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/cstdlib>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
+ // overloads
+ using std::abs;
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using std::div;
#endif
+}
+}
+
+#endif // _GLIBCXX_USE_C99
+
+#endif // _GLIBCXX_HOSTED
#endif // _GLIBCXX_TR1_CSTDLIB
diff --git a/libstdc++-v3/include/tr1/cwchar b/libstdc++-v3/include/tr1/cwchar
index a27ebc3b4ac..c14111b0cf6 100644
--- a/libstdc++-v3/include/tr1/cwchar
+++ b/libstdc++-v3/include/tr1/cwchar
@@ -1,6 +1,6 @@
// TR1 cwchar -*- C++ -*-
-// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 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
@@ -31,24 +31,35 @@
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
#include <cwchar>
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/cwchar>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/cwchar>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
+#ifdef _GLIBCXX_USE_WCHAR_T
+
+namespace std
+{
+namespace tr1
+{
+#if _GLIBCXX_HAVE_WCSTOF
+ using std::wcstof;
+#endif
+#if _GLIBCXX_HAVE_VFWSCANF
+ using std::vfwscanf;
+#endif
+#if _GLIBCXX_HAVE_VSWSCANF
+ using std::vswscanf;
#endif
+#if _GLIBCXX_HAVE_VWSCANF
+ using std::vwscanf;
+#endif
+
+#if _GLIBCXX_USE_C99
+ using std::wcstold;
+ using std::wcstoll;
+ using std::wcstoull;
+#endif
+}
+}
+
+#endif // _GLIBCXX_USE_WCHAR_T
#endif // _GLIBCXX_TR1_CWCHAR
diff --git a/libstdc++-v3/include/tr1/cwctype b/libstdc++-v3/include/tr1/cwctype
index 77cbb14a177..71da0bede00 100644
--- a/libstdc++-v3/include/tr1/cwctype
+++ b/libstdc++-v3/include/tr1/cwctype
@@ -31,24 +31,20 @@
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
#include <cwctype>
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/cwctype>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/cwctype>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
-#endif
+#ifdef _GLIBCXX_USE_WCHAR_T
+
+namespace std
+{
+namespace tr1
+{
+#if _GLIBCXX_HAVE_ISWBLANK
+ using std::iswblank;
+#endif
+}
+}
+
+#endif // _GLIBCXX_USE_WCHAR_T
#endif // _GLIBCXX_TR1_CWCTYPE
diff --git a/libstdc++-v3/include/tr1/memory b/libstdc++-v3/include/tr1/memory
index 8b021a1b102..eaf4932e5b5 100644
--- a/libstdc++-v3/include/tr1/memory
+++ b/libstdc++-v3/include/tr1/memory
@@ -1,6 +1,7 @@
// <tr1/memory> -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// 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,21 +48,6 @@
#include <bits/stl_function.h> // std::less
#include <debug/debug.h>
#include <tr1/type_traits>
-
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/boost_sp_counted_base.h>
-# include <tr1/shared_ptr.h>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/boost_sp_counted_base.h>
-# include <tr1/shared_ptr.h>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
-#endif
+#include <tr1/shared_ptr.h>
#endif // _GLIBCXX_TR1_MEMORY
diff --git a/libstdc++-v3/include/tr1/regex b/libstdc++-v3/include/tr1/regex
index b7e2cdfc808..d69844c2cd9 100644
--- a/libstdc++-v3/include/tr1/regex
+++ b/libstdc++-v3/include/tr1/regex
@@ -33,10 +33,6 @@
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
#include <algorithm>
#include <bitset>
#include <iterator>
@@ -47,18 +43,2682 @@
#include <utility>
#include <sstream>
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/regex>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/regex>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
+namespace std
+{
+namespace tr1
+{
+/**
+ * @defgroup tr1_regex Regular Expressions
+ * A facility for performing regular expression pattern matching.
+ */
+ //@{
+
+/** @namespace std::regex_constants
+ * @brief ISO C++ 0x entities sub namespace for regex.
+ */
+namespace regex_constants
+{
+ /**
+ * @name 5.1 Regular Expression Syntax Options
+ */
+ //@{
+ enum __syntax_option
+ {
+ _S_icase,
+ _S_nosubs,
+ _S_optimize,
+ _S_collate,
+ _S_ECMAScript,
+ _S_basic,
+ _S_extended,
+ _S_awk,
+ _S_grep,
+ _S_egrep,
+ _S_syntax_last
+ };
+
+ /**
+ * @brief This is a bitmask type indicating how to interpret the regex.
+ *
+ * The @c syntax_option_type is implementation defined but it is valid to
+ * perform bitwise operations on these values and expect the right thing to
+ * happen.
+ *
+ * A valid value of type syntax_option_type shall have exactly one of the
+ * elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep
+ * %set.
+ */
+ typedef unsigned int syntax_option_type;
+
+ /**
+ * Specifies that the matching of regular expressions against a character
+ * sequence shall be performed without regard to case.
+ */
+ static const syntax_option_type icase = 1 << _S_icase;
+
+ /**
+ * Specifies that when a regular expression is matched against a character
+ * container sequence, no sub-expression matches are to be stored in the
+ * supplied match_results structure.
+ */
+ static const syntax_option_type nosubs = 1 << _S_nosubs;
+
+ /**
+ * Specifies that the regular expression engine should pay more attention to
+ * the speed with which regular expressions are matched, and less to the
+ * speed with which regular expression objects are constructed. Otherwise
+ * it has no detectable effect on the program output.
+ */
+ static const syntax_option_type optimize = 1 << _S_optimize;
+
+ /**
+ * Specifies that character ranges of the form [a-b] should be locale
+ * sensitive.
+ */
+ static const syntax_option_type collate = 1 << _S_collate;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
+ * Language Specification, Standard Ecma-262, third edition, 1999], as
+ * modified in tr1 section [7.13]. This grammar is similar to that defined
+ * in the PERL scripting language but extended with elements found in the
+ * POSIX regular expression grammar.
+ */
+ static const syntax_option_type ECMAScript = 1 << _S_ECMAScript;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and
+ * Headers, Section 9, Regular Expressions [IEEE, Information Technology --
+ * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ */
+ static const syntax_option_type basic = 1 << _S_basic;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and Headers,
+ * Section 9, Regular Expressions.
+ */
+ static const syntax_option_type extended = 1 << _S_extended;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type extended, except that C-style escape
+ * sequences are supported. These sequences are:
+ * \\\\, \\a, \\b, \\f,
+ * \\n, \\r, \\t , \\v,
+ * \\&apos;, &apos;, and \\ddd
+ * (where ddd is one, two, or three octal digits).
+ */
+ static const syntax_option_type awk = 1 << _S_awk;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type basic, except that newlines are treated
+ * as whitespace.
+ */
+ static const syntax_option_type grep = 1 << _S_grep;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep when given the -E option in
+ * IEEE Std 1003.1-2001. This option is identical to syntax_option_type
+ * extended, except that newlines are treated as whitespace.
+ */
+ static const syntax_option_type egrep = 1 << _S_egrep;
+
+ //@}
+
+ /**
+ * @name 5.2 Matching Rules
+ *
+ * Matching a regular expression against a sequence of characters [first,
+ * last) proceeds according to the rules of the grammar specified for the
+ * regular expression object, modified according to the effects listed
+ * below for any bitmask elements set.
+ *
+ */
+ //@{
+
+ enum __match_flag
+ {
+ _S_not_bol,
+ _S_not_eol,
+ _S_not_bow,
+ _S_not_eow,
+ _S_any,
+ _S_not_null,
+ _S_continuous,
+ _S_prev_avail,
+ _S_sed,
+ _S_no_copy,
+ _S_first_only,
+ _S_match_flag_last
+ };
+
+ /**
+ * @brief This is a bitmask type indicating regex matching rules.
+ *
+ * The @c match_flag_type is implementation defined but it is valid to
+ * perform bitwise operations on these values and expect the right thing to
+ * happen.
+ */
+ typedef std::bitset<_S_match_flag_last> match_flag_type;
+
+ /**
+ * The default matching rules.
+ */
+ static const match_flag_type match_default = 0;
+
+ /**
+ * The first character in the sequence [first, last) is treated as though it
+ * is not at the beginning of a line, so the character (^) in the regular
+ * expression shall not match [first, first).
+ */
+ static const match_flag_type match_not_bol = 1 << _S_not_bol;
+
+ /**
+ * The last character in the sequence [first, last) is treated as though it
+ * is not at the end of a line, so the character ($) in the regular
+ * expression shall not match [last, last).
+ */
+ static const match_flag_type match_not_eol = 1 << _S_not_eol;
+
+ /**
+ * The expression \\b is not matched against the sub-sequence
+ * [first,first).
+ */
+ static const match_flag_type match_not_bow = 1 << _S_not_bow;
+
+ /**
+ * The expression \\b should not be matched against the sub-sequence
+ * [last,last).
+ */
+ static const match_flag_type match_not_eow = 1 << _S_not_eow;
+
+ /**
+ * If more than one match is possible then any match is an acceptable
+ * result.
+ */
+ static const match_flag_type match_any = 1 << _S_any;
+
+ /**
+ * The expression does not match an empty sequence.
+ */
+ static const match_flag_type match_not_null = 1 << _S_not_null;
+
+ /**
+ * The expression only matches a sub-sequence that begins at first .
+ */
+ static const match_flag_type match_continuous = 1 << _S_continuous;
+
+ /**
+ * --first is a valid iterator position. When this flag is set then the
+ * flags match_not_bol and match_not_bow are ignored by the regular
+ * expression algorithms 7.11 and iterators 7.12.
+ */
+ static const match_flag_type match_prev_avail = 1 << _S_prev_avail;
+
+ /**
+ * When a regular expression match is to be replaced by a new string, the
+ * new string is constructed using the rules used by the ECMAScript replace
+ * function in ECMA- 262 [Ecma International, ECMAScript Language
+ * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
+ * String.prototype.replace. In addition, during search and replace
+ * operations all non-overlapping occurrences of the regular expression
+ * are located and replaced, and sections of the input that did not match
+ * the expression are copied unchanged to the output string.
+ *
+ * Format strings (from ECMA-262 [15.5.4.11]):
+ * @li $$ The dollar-sign itself ($)
+ * @li $& The matched substring.
+ * @li $` The portion of @a string that precedes the matched substring.
+ * This would be match_results::prefix().
+ * @li $' The portion of @a string that follows the matched substring.
+ * This would be match_results::suffix().
+ * @li $n The nth capture, where n is in [1,9] and $n is not followed by a
+ * decimal digit. If n <= match_results::size() and the nth capture
+ * is undefined, use the empty string instead. If n >
+ * match_results::size(), the result is implementation-defined.
+ * @li $nn The nnth capture, where nn is a two-digit decimal number on
+ * [01, 99]. If nn <= match_results::size() and the nth capture is
+ * undefined, use the empty string instead. If
+ * nn > match_results::size(), the result is implementation-defined.
+ */
+ static const match_flag_type format_default = 0;
+
+ /**
+ * When a regular expression match is to be replaced by a new string, the
+ * new string is constructed using the rules used by the POSIX sed utility
+ * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
+ * Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ */
+ static const match_flag_type format_sed = 1 << _S_sed;
+
+ /**
+ * During a search and replace operation, sections of the character
+ * container sequence being searched that do not match the regular
+ * expression shall not be copied to the output string.
+ */
+ static const match_flag_type format_no_copy = 1 << _S_no_copy;
+
+ /**
+ * When specified during a search and replace operation, only the first
+ * occurrence of the regular expression shall be replaced.
+ */
+ static const match_flag_type format_first_only = 1 << _S_first_only;
+
+ //@}
+
+ /**
+ * @name 5.3 Error Types
+ */
+ //@{
+
+ enum error_type
+ {
+ _S_error_collate,
+ _S_error_ctype,
+ _S_error_escape,
+ _S_error_backref,
+ _S_error_brack,
+ _S_error_paren,
+ _S_error_brace,
+ _S_error_badbrace,
+ _S_error_range,
+ _S_error_space,
+ _S_error_badrepeat,
+ _S_error_complexity,
+ _S_error_stack,
+ _S_error_last
+ };
+
+ /** The expression contained an invalid collating element name. */
+ static const error_type error_collate(_S_error_collate);
+
+ /** The expression contained an invalid character class name. */
+ static const error_type error_ctype(_S_error_ctype);
+
+ /**
+ * The expression contained an invalid escaped character, or a trailing
+ * escape.
+ */
+ static const error_type error_escape(_S_error_escape);
+
+ /** The expression contained an invalid back reference. */
+ static const error_type error_backref(_S_error_backref);
+
+ /** The expression contained mismatched [ and ]. */
+ static const error_type error_brack(_S_error_brack);
+
+ /** The expression contained mismatched ( and ). */
+ static const error_type error_paren(_S_error_paren);
+
+ /** The expression contained mismatched { and } */
+ static const error_type error_brace(_S_error_brace);
+
+ /** The expression contained an invalid range in a {} expression. */
+ static const error_type error_badbrace(_S_error_badbrace);
+
+ /**
+ * The expression contained an invalid character range,
+ * such as [b-a] in most encodings.
+ */
+ static const error_type error_range(_S_error_range);
+
+ /**
+ * There was insufficient memory to convert the expression into a
+ * finite state machine.
+ */
+ static const error_type error_space(_S_error_space);
+
+ /**
+ * One of <em>*?+{</em> was not preceded by a valid regular expression.
+ */
+ static const error_type error_badrepeat(_S_error_badrepeat);
+
+ /**
+ * The complexity of an attempted match against a regular expression
+ * exceeded a pre-set level.
+ */
+ static const error_type error_complexity(_S_error_complexity);
+
+ /**
+ * There was insufficient memory to determine whether the
+ * regular expression could match the specified character sequence.
+ */
+ static const error_type error_stack(_S_error_stack);
+
+ //@}
+}
+
+
+ // [7.8] Class regex_error
+ /**
+ * @brief A regular expression exception class.
+ * @ingroup exceptions
+ *
+ * The regular expression library throws objects of this class on error.
+ */
+ class regex_error
+ : public std::runtime_error
+ {
+ public:
+ /**
+ * @brief Constructs a regex_error object.
+ *
+ * @param ecode the regex error code.
+ */
+ explicit
+ regex_error(regex_constants::error_type __ecode)
+ : std::runtime_error("regex_error"), _M_code(__ecode)
+ { }
+
+ /**
+ * @brief Gets the regex error code.
+ *
+ * @returns the regex error code.
+ */
+ regex_constants::error_type
+ code() const
+ { return _M_code; }
+
+ protected:
+ regex_constants::error_type _M_code;
+ };
+
+ // [7.7] Class regex_traits
+ /**
+ * @brief Describes aspects of a regular expression.
+ *
+ * A regular expression traits class that satisfies the requirements of tr1
+ * section [7.2].
+ *
+ * The class %regex is parameterized around a set of related types and
+ * functions used to complete the definition of its semantics. This class
+ * satisfies the requirements of such a traits class.
+ */
+ template<typename _Ch_type>
+ struct regex_traits
+ {
+ public:
+ typedef _Ch_type char_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef std::locale locale_type;
+ typedef std::ctype_base::mask char_class_type;
+
+ public:
+ /**
+ * @brief Constructs a default traits object.
+ */
+ regex_traits()
+ { }
+
+ /**
+ * @brief Gives the length of a C-style string starting at @p __p.
+ *
+ * @param __p a pointer to the start of a character sequence.
+ *
+ * @returns the number of characters between @p *__p and the first
+ * default-initialized value of type @p char_type. In other words, uses
+ * the C-string algorithm for determining the length of a sequence of
+ * characters.
+ */
+ static std::size_t
+ length(const char_type* __p)
+ { return string_type::traits_type::length(__p); }
+
+ /**
+ * @brief Performs the identity translation.
+ *
+ * @param c A character to the locale-specific character set.
+ *
+ * @returns c.
+ */
+ char_type
+ translate(char_type __c) const
+ { return __c; }
+
+ /**
+ * @brief Translates a character into a case-insensitive equivalent.
+ *
+ * @param c A character to the locale-specific character set.
+ *
+ * @returns the locale-specific lower-case equivalent of c.
+ * @throws std::bad_cast if the imbued locale does not support the ctype
+ * facet.
+ */
+ char_type
+ translate_nocase(char_type __c) const
+ {
+ using std::ctype;
+ using std::use_facet;
+ return use_facet<ctype<char_type> >(_M_locale).tolower(__c);
+ }
+
+ /**
+ * @brief Gets a sort key for a character sequence.
+ *
+ * @param first beginning of the character sequence.
+ * @param last one-past-the-end of the character sequence.
+ *
+ * Returns a sort key for the character sequence designated by the
+ * iterator range [F1, F2) such that if the character sequence [G1, G2)
+ * sorts before the character sequence [H1, H2) then
+ * v.transform(G1, G2) < v.transform(H1, H2).
+ *
+ * What this really does is provide a more efficient way to compare a
+ * string to multiple other strings in locales with fancy collation
+ * rules and equivalence classes.
+ *
+ * @returns a locale-specific sort key equivalent to the input range.
+ *
+ * @throws std::bad_cast if the current locale does not have a collate
+ * facet.
+ */
+ template<typename _Fwd_iter>
+ string_type
+ transform(_Fwd_iter __first, _Fwd_iter __last) const
+ {
+ using std::collate;
+ using std::use_facet;
+ const collate<_Ch_type>& __c(use_facet<
+ collate<_Ch_type> >(_M_locale));
+ string_type __s(__first, __last);
+ return __c.transform(__s.data(), __s.data() + __s.size());
+ }
+
+ /**
+ * @brief Dunno.
+ *
+ * @param first beginning of the character sequence.
+ * @param last one-past-the-end of the character sequence.
+ *
+ * Effects: if typeid(use_facet<collate<_Ch_type> >) ==
+ * typeid(collate_byname<_Ch_type>) and the form of the sort key
+ * returned by collate_byname<_Ch_type>::transform(first, last) is known
+ * and can be converted into a primary sort key then returns that key,
+ * otherwise returns an empty string. WTF??
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Fwd_iter>
+ string_type
+ transform_primary(_Fwd_iter __first, _Fwd_iter __last) const;
+
+ /**
+ * @brief Gets a collation element by name.
+ *
+ * @param first beginning of the collation element name.
+ * @param last one-past-the-end of the collation element name.
+ *
+ * @returns a sequence of one or more characters that represents the
+ * collating element consisting of the character sequence designated by
+ * the iterator range [first, last). Returns an empty string if the
+ * character sequence is not a valid collating element.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Fwd_iter>
+ string_type
+ lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const;
+
+ /**
+ * @brief Maps one or more characters to a named character
+ * classification.
+ *
+ * @param first beginning of the character sequence.
+ * @param last one-past-the-end of the character sequence.
+ *
+ * @returns an unspecified value that represents the character
+ * classification named by the character sequence designated by the
+ * iterator range [first, last). The value returned shall be independent
+ * of the case of the characters in the character sequence. If the name
+ * is not recognized then returns a value that compares equal to 0.
+ *
+ * At least the following names (or their wide-character equivalent) are
+ * supported.
+ * - d
+ * - w
+ * - s
+ * - alnum
+ * - alpha
+ * - blank
+ * - cntrl
+ * - digit
+ * - graph
+ * - lower
+ * - print
+ * - punct
+ * - space
+ * - upper
+ * - xdigit
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Fwd_iter>
+ char_class_type
+ lookup_classname(_Fwd_iter __first, _Fwd_iter __last) const;
+
+ /**
+ * @brief Determines if @p c is a member of an identified class.
+ *
+ * @param c a character.
+ * @param f a class type (as returned from lookup_classname).
+ *
+ * @returns true if the character @p c is a member of the classification
+ * represented by @p f, false otherwise.
+ *
+ * @throws std::bad_cast if the current locale does not have a ctype
+ * facet.
+ */
+ bool
+ isctype(_Ch_type __c, char_class_type __f) const;
+
+ /**
+ * @brief Converts a digit to an int.
+ *
+ * @param ch a character representing a digit.
+ * @param radix the radix if the numeric conversion (limited to 8, 10,
+ * or 16).
+ *
+ * @returns the value represented by the digit ch in base radix if the
+ * character ch is a valid digit in base radix; otherwise returns -1.
+ */
+ int
+ value(_Ch_type __ch, int __radix) const;
+
+ /**
+ * @brief Imbues the regex_traits object with a copy of a new locale.
+ *
+ * @param loc A locale.
+ *
+ * @returns a copy of the previous locale in use by the regex_traits
+ * object.
+ *
+ * @note Calling imbue with a different locale than the one currently in
+ * use invalidates all cached data held by *this.
+ */
+ locale_type
+ imbue(locale_type __loc)
+ {
+ std::swap(_M_locale, __loc);
+ return __loc;
+ }
+
+ /**
+ * @brief Gets a copy of the current locale in use by the regex_traits
+ * object.
+ */
+ locale_type
+ getloc() const
+ { return _M_locale; }
+
+ protected:
+ locale_type _M_locale;
+ };
+
+ template<typename _Ch_type>
+ bool regex_traits<_Ch_type>::
+ isctype(_Ch_type __c, char_class_type __f) const
+ {
+ using std::ctype;
+ using std::use_facet;
+ const ctype<_Ch_type>& __ctype(use_facet<
+ ctype<_Ch_type> >(_M_locale));
+
+ if (__ctype.is(__c, __f))
+ return true;
+
+ // special case of underscore in [[:w:]]
+ if (__c == __ctype.widen('_'))
+ {
+ const char* const __wb[] = "w";
+ char_class_type __wt = this->lookup_classname(__wb,
+ __wb + sizeof(__wb));
+ if (__f | __wt)
+ return true;
+ }
+
+ // special case of [[:space:]] in [[:blank:]]
+ if (__c == __ctype.isspace(__c))
+ {
+ const char* const __bb[] = "blank";
+ char_class_type __bt = this->lookup_classname(__bb,
+ __bb + sizeof(__bb));
+ if (__f | __bt)
+ return true;
+ }
+
+ return false;
+ }
+
+ template<typename _Ch_type>
+ int regex_traits<_Ch_type>::
+ value(_Ch_type __ch, int __radix) const
+ {
+ std::basic_istringstream<_Ch_type> __is(string_type(1, __ch));
+ int __v;
+ if (__radix == 8)
+ __is >> std::oct;
+ else if (__radix == 16)
+ __is >> std::hex;
+ __is >> __v;
+ return __is.fail() ? -1 : __v;
+ }
+
+ // [7.8] Class basic_regex
+ /**
+ * Objects of specializations of this class represent regular expressions
+ * constructed from sequences of character type @p _Ch_type.
+ *
+ * Storage for the regular expression is allocated and deallocated as
+ * necessary by the member functions of this class.
+ */
+ template<typename _Ch_type, typename _Rx_traits = regex_traits<_Ch_type> >
+ class basic_regex
+ {
+ public:
+ // types:
+ typedef _Ch_type value_type;
+ typedef regex_constants::syntax_option_type flag_type;
+ typedef typename _Rx_traits::locale_type locale_type;
+ typedef typename _Rx_traits::string_type string_type;
+
+ /**
+ * @name Constants
+ * tr1 [7.8.1] std [28.8.1]
+ */
+ //@{
+ static const regex_constants::syntax_option_type icase
+ = regex_constants::icase;
+ static const regex_constants::syntax_option_type nosubs
+ = regex_constants::nosubs;
+ static const regex_constants::syntax_option_type optimize
+ = regex_constants::optimize;
+ static const regex_constants::syntax_option_type collate
+ = regex_constants::collate;
+ static const regex_constants::syntax_option_type ECMAScript
+ = regex_constants::ECMAScript;
+ static const regex_constants::syntax_option_type basic
+ = regex_constants::basic;
+ static const regex_constants::syntax_option_type extended
+ = regex_constants::extended;
+ static const regex_constants::syntax_option_type awk
+ = regex_constants::awk;
+ static const regex_constants::syntax_option_type grep
+ = regex_constants::grep;
+ static const regex_constants::syntax_option_type egrep
+ = regex_constants::egrep;
+ //@}
+
+ // [7.8.2] construct/copy/destroy
+ /**
+ * Constructs a basic regular expression that does not match any
+ * character sequence.
+ */
+ basic_regex()
+ : _M_flags(regex_constants::ECMAScript), _M_pattern(), _M_mark_count(0)
+ { _M_compile(); }
+
+ /**
+ * @brief Constructs a basic regular expression from the sequence
+ * [p, p + char_traits<_Ch_type>::length(p)) interpreted according to the
+ * flags in @p f.
+ *
+ * @param p A pointer to the start of a C-style null-terminated string
+ * containing a regular expression.
+ * @param f Flags indicating the syntax rules and options.
+ *
+ * @throws regex_error if @p p is not a valid regular expression.
+ */
+ explicit
+ basic_regex(const _Ch_type* __p,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f), _M_pattern(__p), _M_mark_count(0)
+ { _M_compile(); }
+
+ /**
+ * @brief Constructs a basic regular expression from the sequence
+ * [p, p + len) interpreted according to the flags in @p f.
+ *
+ * @param p A pointer to the start of a string containing a regular
+ * expression.
+ * @param len The length of the string containing the regular expression.
+ * @param f Flags indicating the syntax rules and options.
+ *
+ * @throws regex_error if @p p is not a valid regular expression.
+ */
+ basic_regex(const _Ch_type* __p, std::size_t __len, flag_type __f)
+ : _M_flags(__f) , _M_pattern(__p, __len), _M_mark_count(0)
+ { _M_compile(); }
+
+ /**
+ * @brief Copy-constructs a basic regular expression.
+ *
+ * @param rhs A @p regex object.
+ */
+ basic_regex(const basic_regex& __rhs)
+ : _M_flags(__rhs._M_flags), _M_pattern(__rhs._M_pattern),
+ _M_mark_count(__rhs._M_mark_count)
+ { _M_compile(); }
+
+ /**
+ * @brief Constructs a basic regular expression from the string
+ * @p s interpreted according to the flags in @p f.
+ *
+ * @param s A string containing a regular expression.
+ * @param f Flags indicating the syntax rules and options.
+ *
+ * @throws regex_error if @p s is not a valid regular expression.
+ */
+ template<typename _Ch_traits, typename _Ch_alloc>
+ explicit
+ basic_regex(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f), _M_pattern(__s.begin(), __s.end()), _M_mark_count(0)
+ { _M_compile(); }
+
+ /**
+ * @brief Constructs a basic regular expression from the range
+ * [first, last) interpreted according to the flags in @p f.
+ *
+ * @param first The start of a range containing a valid regular
+ * expression.
+ * @param last The end of a range containing a valid regular
+ * expression.
+ * @param f The format flags of the regular expression.
+ *
+ * @throws regex_error if @p [first, last) is not a valid regular
+ * expression.
+ */
+ template<typename _InputIterator>
+ basic_regex(_InputIterator __first, _InputIterator __last,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f), _M_pattern(__first, __last), _M_mark_count(0)
+ { _M_compile(); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Constructs a basic regular expression from an initializer list.
+ *
+ * @param l The initializer list.
+ * @param f The format flags of the regular expression.
+ *
+ * @throws regex_error if @p l is not a valid regular expression.
+ */
+ basic_regex(initializer_list<_Ch_type> __l,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f), _M_pattern(__l.begin(), __l.end()), _M_mark_count(0)
+ { _M_compile(); }
+#endif
+
+ /**
+ * @brief Destroys a basic regular expression.
+ */
+ ~basic_regex()
+ { }
+
+ /**
+ * @brief Assigns one regular expression to another.
+ */
+ basic_regex&
+ operator=(const basic_regex& __rhs)
+ { return this->assign(__rhs); }
+
+ /**
+ * @brief Replaces a regular expression with a new one constructed from
+ * a C-style null-terminated string.
+ *
+ * @param A pointer to the start of a null-terminated C-style string
+ * containing a regular expression.
+ */
+ basic_regex&
+ operator=(const _Ch_type* __p)
+ { return this->assign(__p, flags()); }
+
+ /**
+ * @brief Replaces a regular expression with a new one constructed from
+ * a string.
+ *
+ * @param A pointer to a string containing a regular expression.
+ */
+ template<typename _Ch_typeraits, typename _Allocator>
+ basic_regex&
+ operator=(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s)
+ { return this->assign(__s, flags()); }
+
+ // [7.8.3] assign
+ /**
+ * @brief the real assignment operator.
+ *
+ * @param that Another regular expression object.
+ */
+ basic_regex&
+ assign(const basic_regex& __that)
+ {
+ basic_regex __tmp(__that);
+ this->swap(__tmp);
+ return *this;
+ }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object from a
+ * C-style null-terminated string containing a regular expression
+ * pattern.
+ *
+ * @param p A pointer to a C-style null-terminated string containing
+ * a regular expression pattern.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * *this remains unchanged.
+ */
+ basic_regex&
+ assign(const _Ch_type* __p,
+ flag_type __flags = regex_constants::ECMAScript)
+ { return this->assign(string_type(__p), __flags); }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object from a
+ * C-style string containing a regular expression pattern.
+ *
+ * @param p A pointer to a C-style string containing a
+ * regular expression pattern.
+ * @param len The length of the regular expression pattern string.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * *this remains unchanged.
+ */
+ basic_regex&
+ assign(const _Ch_type* __p, std::size_t __len, flag_type __flags)
+ { return this->assign(string_type(__p, __len), __flags); }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object from a
+ * string containing a regular expression pattern.
+ *
+ * @param s A string containing a regular expression pattern.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * *this remains unchanged.
+ */
+ template<typename _Ch_typeraits, typename _Allocator>
+ basic_regex&
+ assign(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s,
+ flag_type __f = regex_constants::ECMAScript)
+ {
+ basic_regex __tmp(__s, __f);
+ this->swap(__tmp);
+ return *this;
+ }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object.
+ *
+ * @param first The start of a range containing a valid regular
+ * expression.
+ * @param last The end of a range containing a valid regular
+ * expression.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * the object remains unchanged.
+ */
+ template<typename _InputIterator>
+ basic_regex&
+ assign(_InputIterator __first, _InputIterator __last,
+ flag_type __flags = regex_constants::ECMAScript)
+ { return this->assign(string_type(__first, __last), __flags); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Assigns a new regular expression to a regex object.
+ *
+ * @param l An initializer list representing a regular expression.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if @p l does not contain a valid regular
+ * expression pattern interpreted according to @p flags. If regex_error
+ * is thrown, the object remains unchanged.
+ */
+ basic_regex&
+ assign(initializer_list<_Ch_type> __l,
+ flag_type __f = regex_constants::ECMAScript)
+ { return this->assign(__l.begin(), __l.end(), __f); }
+#endif
+
+ // [7.8.4] const operations
+ /**
+ * @brief Gets the number of marked subexpressions within the regular
+ * expression.
+ */
+ unsigned int
+ mark_count() const
+ { return _M_mark_count; }
+
+ /**
+ * @brief Gets the flags used to construct the regular expression
+ * or in the last call to assign().
+ */
+ flag_type
+ flags() const
+ { return _M_flags; }
+
+ // [7.8.5] locale
+ /**
+ * @brief Imbues the regular expression object with the given locale.
+ *
+ * @param loc A locale.
+ */
+ locale_type
+ imbue(locale_type __loc)
+ { return _M_traits.imbue(__loc); }
+
+ /**
+ * @brief Gets the locale currently imbued in the regular expression
+ * object.
+ */
+ locale_type
+ getloc() const
+ { return _M_traits.getloc(); }
+
+ // [7.8.6] swap
+ /**
+ * @brief Swaps the contents of two regular expression objects.
+ *
+ * @param rhs Another regular expression object.
+ */
+ void
+ swap(basic_regex& __rhs)
+ {
+ std::swap(_M_flags, __rhs._M_flags);
+ std::swap(_M_pattern, __rhs._M_pattern);
+ std::swap(_M_mark_count, __rhs._M_mark_count);
+ std::swap(_M_traits, __rhs._M_traits);
+ }
+
+ private:
+ /**
+ * @brief Compiles a regular expression pattern into a NFA.
+ * @todo Implement this function.
+ */
+ void _M_compile();
+
+ protected:
+ flag_type _M_flags;
+ string_type _M_pattern;
+ unsigned int _M_mark_count;
+ _Rx_traits _M_traits;
+ };
+
+ /** @brief Standard regular expressions. */
+ typedef basic_regex<char> regex;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Standard wide-character regular expressions. */
+ typedef basic_regex<wchar_t> wregex;
+#endif
+
+
+ // [7.8.6] basic_regex swap
+ /**
+ * @brief Swaps the contents of two regular expression objects.
+ * @param lhs First regular expression.
+ * @param rhs Second regular expression.
+ */
+ template<typename _Ch_type, typename _Rx_traits>
+ inline void
+ swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
+ basic_regex<_Ch_type, _Rx_traits>& __rhs)
+ { __lhs.swap(__rhs); }
+
+
+ // [7.9] Class template sub_match
+ /**
+ * A sequence of characters matched by a particular marked sub-expression.
+ *
+ * An object of this class is essentially a pair of iterators marking a
+ * matched subexpression within a regular expression pattern match. Such
+ * objects can be converted to and compared with std::basic_string objects
+ * of a similar base character type as the pattern matched by the regular
+ * expression.
+ *
+ * The iterators that make up the pair are the usual half-open interval
+ * referencing the actual original pattern matched.
+ */
+ template<typename _BiIter>
+ class sub_match : public std::pair<_BiIter, _BiIter>
+ {
+ public:
+ typedef typename iterator_traits<_BiIter>::value_type value_type;
+ typedef typename iterator_traits<_BiIter>::difference_type
+ difference_type;
+ typedef _BiIter iterator;
+
+ public:
+ bool matched;
+
+ /**
+ * Gets the length of the matching sequence.
+ */
+ difference_type
+ length() const
+ { return this->matched ? std::distance(this->first, this->second) : 0; }
+
+ /**
+ * @brief Gets the matching sequence as a string.
+ *
+ * @returns the matching sequence as a string.
+ *
+ * This is the implicit conversion operator. It is identical to the
+ * str() member function except that it will want to pop up in
+ * unexpected places and cause a great deal of confusion and cursing
+ * from the unwary.
+ */
+ operator basic_string<value_type>() const
+ {
+ return this->matched
+ ? std::basic_string<value_type>(this->first, this->second)
+ : std::basic_string<value_type>();
+ }
+
+ /**
+ * @brief Gets the matching sequence as a string.
+ *
+ * @returns the matching sequence as a string.
+ */
+ basic_string<value_type>
+ str() const
+ {
+ return this->matched
+ ? std::basic_string<value_type>(this->first, this->second)
+ : std::basic_string<value_type>();
+ }
+
+ /**
+ * @brief Compares this and another matched sequence.
+ *
+ * @param s Another matched sequence to compare to this one.
+ *
+ * @retval <0 this matched sequence will collate before @p s.
+ * @retval =0 this matched sequence is equivalent to @p s.
+ * @retval <0 this matched sequence will collate after @p s.
+ */
+ int
+ compare(const sub_match& __s) const
+ { return this->str().compare(__s.str()); }
+
+ /**
+ * @brief Compares this sub_match to a string.
+ *
+ * @param s A string to compare to this sub_match.
+ *
+ * @retval <0 this matched sequence will collate before @p s.
+ * @retval =0 this matched sequence is equivalent to @p s.
+ * @retval <0 this matched sequence will collate after @p s.
+ */
+ int
+ compare(const basic_string<value_type>& __s) const
+ { return this->str().compare(__s); }
+
+ /**
+ * @brief Compares this sub_match to a C-style string.
+ *
+ * @param s A C-style string to compare to this sub_match.
+ *
+ * @retval <0 this matched sequence will collate before @p s.
+ * @retval =0 this matched sequence is equivalent to @p s.
+ * @retval <0 this matched sequence will collate after @p s.
+ */
+ int
+ compare(const value_type* __s) const
+ { return this->str().compare(__s); }
+ };
+
+
+ /** @brief Standard regex submatch over a C-style null-terminated string. */
+ typedef sub_match<const char*> csub_match;
+ /** @brief Standard regex submatch over a standard string. */
+ typedef sub_match<string::const_iterator> ssub_match;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Regex submatch over a C-style null-terminated wide string. */
+ typedef sub_match<const wchar_t*> wcsub_match;
+ /** @brief Regex submatch over a standard wide string. */
+ typedef sub_match<wstring::const_iterator> wssub_match;
+#endif
+
+ // [7.9.2] sub_match non-member operators
+
+ /**
+ * @brief Tests the equivalence of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator==(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) == 0; }
+
+ /**
+ * @brief Tests the inequivalence of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator!=(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) != 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator<(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) < 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator<=(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) <= 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator>=(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) >= 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator>(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) > 0; }
+
+ /**
+ * @brief Tests the equivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator==(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs == __rhs.str(); }
+
+ /**
+ * @brief Tests the inequivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator!=(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs != __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator<(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs < __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator>(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs > __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator>=(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs >= __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator<=(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs <= __rhs.str(); }
+
+ /**
+ * @brief Tests the equivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator==(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() == __rhs; }
+
+ /**
+ * @brief Tests the inequivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator!=(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() != __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator<(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() < __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator>(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() > __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator>=(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() >= __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator<=(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() <= __rhs; }
+
+ /**
+ * @brief Tests the equivalence of a C string and a regular expression
+ * submatch.
+ * @param lhs A C string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs == __rhs.str(); }
+
+ /**
+ * @brief Tests the inequivalence of an iterator value and a regular
+ * expression submatch.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs != __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs < __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs > __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs >= __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs <= __rhs.str(); }
+
+ /**
+ * @brief Tests the equivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A pointer to a string?
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() == __rhs; }
+
+ /**
+ * @brief Tests the inequivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A pointer to a string.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() != __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() < __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() > __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() >= __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() <= __rhs; }
+
+ /**
+ * @brief Tests the equivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs == __rhs.str(); }
+
+ /**
+ * @brief Tests the inequivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs != __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs < __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs > __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs >= __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs <= __rhs.str(); }
+
+ /**
+ * @brief Tests the equivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() == __rhs; }
+
+ /**
+ * @brief Tests the inequivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() != __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() < __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() > __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() >= __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() <= __rhs; }
+
+ /**
+ * @brief Inserts a matched string into an output stream.
+ *
+ * @param os The output stream.
+ * @param m A submatch string.
+ *
+ * @returns the output stream with the submatch string inserted.
+ */
+ template<typename _Ch_type, typename _Ch_traits, typename _Bi_iter>
+ inline
+ basic_ostream<_Ch_type, _Ch_traits>&
+ operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
+ const sub_match<_Bi_iter>& __m)
+ { return __os << __m.str(); }
+
+ // [7.10] Class template match_results
+ /**
+ * @brief The results of a match or search operation.
+ *
+ * A collection of character sequences representing the result of a regular
+ * expression match. Storage for the collection is allocated and freed as
+ * necessary by the member functions of class template match_results.
+ *
+ * This class satisfies the Sequence requirements, with the exception that
+ * only the operations defined for a const-qualified Sequence are supported.
+ *
+ * The sub_match object stored at index 0 represents sub-expression 0, i.e.
+ * the whole match. In this case the sub_match member matched is always true.
+ * The sub_match object stored at index n denotes what matched the marked
+ * sub-expression n within the matched expression. If the sub-expression n
+ * participated in a regular expression match then the sub_match member
+ * matched evaluates to true, and members first and second denote the range
+ * of characters [first, second) which formed that match. Otherwise matched
+ * is false, and members first and second point to the end of the sequence
+ * that was searched.
+ *
+ * @nosubgrouping
+ */
+ template<typename _Bi_iter,
+ typename _Allocator = allocator<sub_match<_Bi_iter> > >
+ class match_results
+ : private std::vector<std::tr1::sub_match<_Bi_iter>, _Allocator>
+ {
+ private:
+ typedef std::vector<std::tr1::sub_match<_Bi_iter>, _Allocator>
+ _Base_type;
+
+ public:
+ /**
+ * @name 10.? Public Types
+ */
+ //@{
+ typedef sub_match<_Bi_iter> value_type;
+ typedef typename _Allocator::const_reference const_reference;
+ typedef const_reference reference;
+ typedef typename _Base_type::const_iterator const_iterator;
+ typedef const_iterator iterator;
+ typedef typename iterator_traits<_Bi_iter>::difference_type
+ difference_type;
+ typedef typename _Allocator::size_type size_type;
+ typedef _Allocator allocator_type;
+ typedef typename iterator_traits<_Bi_iter>::value_type char_type;
+ typedef basic_string<char_type> string_type;
+ //@}
+
+ public:
+ /**
+ * @name 10.1 Construction, Copying, and Destruction
+ */
+ //@{
+
+ /**
+ * @brief Constructs a default %match_results container.
+ * @post size() returns 0 and str() returns an empty string.
+ */
+ explicit
+ match_results(const _Allocator& __a = _Allocator())
+ : _Base_type(__a), _M_matched(false)
+ { }
+
+ /**
+ * @brief Copy constructs a %match_results.
+ */
+ match_results(const match_results& __rhs)
+ : _Base_type(__rhs), _M_matched(__rhs._M_matched),
+ _M_prefix(__rhs._M_prefix), _M_suffix(__rhs._M_suffix)
+ { }
+
+ /**
+ * @brief Assigns rhs to *this.
+ */
+ match_results&
+ operator=(const match_results& __rhs)
+ {
+ match_results __tmp(__rhs);
+ this->swap(__tmp);
+ return *this;
+ }
+
+ /**
+ * @brief Destroys a %match_results object.
+ */
+ ~match_results()
+ { }
+
+ //@}
+
+ /**
+ * @name 10.2 Size
+ */
+ //@{
+
+ /**
+ * @brief Gets the number of matches and submatches.
+ *
+ * The number of matches for a given regular expression will be either 0
+ * if there was no match or mark_count() + 1 if a match was successful.
+ * Some matches may be empty.
+ *
+ * @returns the number of matches found.
+ */
+ size_type
+ size() const
+ { return _M_matched ? _Base_type::size() + 1 : 0; }
+
+ //size_type
+ //max_size() const;
+ using _Base_type::max_size;
+
+ /**
+ * @brief Indicates if the %match_results contains no results.
+ * @retval true The %match_results object is empty.
+ * @retval false The %match_results object is not empty.
+ */
+ bool
+ empty() const
+ { return size() == 0; }
+
+ //@}
+
+ /**
+ * @name 10.3 Element Access
+ */
+ //@{
+
+ /**
+ * @brief Gets the length of the indicated submatch.
+ * @param sub indicates the submatch.
+ *
+ * This function returns the length of the indicated submatch, or the
+ * length of the entire match if @p sub is zero (the default).
+ */
+ difference_type
+ length(size_type __sub = 0) const
+ { return _M_matched ? this->str(__sub).length() : 0; }
+
+ /**
+ * @brief Gets the offset of the beginning of the indicated submatch.
+ * @param sub indicates the submatch.
+ *
+ * This function returns the offset from the beginning of the target
+ * sequence to the beginning of the submatch, unless the value of @p sub
+ * is zero (the default), in which case this function returns the offset
+ * from the beginning of the target sequence to the beginning of the
+ * match.
+ */
+ difference_type
+ position(size_type __sub = 0) const
+ {
+ return _M_matched ? std::distance(this->prefix().first,
+ (*this)[__sub].first) : 0;
+ }
+
+ /**
+ * @brief Gets the match or submatch converted to a string type.
+ * @param sub indicates the submatch.
+ *
+ * This function gets the submatch (or match, if @p sub is zero) extracted
+ * from the target range and converted to the associated string type.
+ */
+ string_type
+ str(size_type __sub = 0) const
+ { return _M_matched ? (*this)[__sub].str() : string_type(); }
+
+ /**
+ * @brief Gets a %sub_match reference for the match or submatch.
+ * @param sub indicates the submatch.
+ *
+ * This function gets a reference to the indicated submatch, or the entire
+ * match if @p sub is zero.
+ *
+ * If @p sub >= size() then this function returns a %sub_match with a
+ * special value indicating no submatch.
+ */
+ const_reference
+ operator[](size_type __sub) const
+ { return _Base_type::operator[](__sub); }
+
+ /**
+ * @brief Gets a %sub_match representing the match prefix.
+ *
+ * This function gets a reference to a %sub_match object representing the
+ * part of the target range between the start of the target range and the
+ * start of the match.
+ */
+ const_reference
+ prefix() const
+ { return _M_prefix; }
+
+ /**
+ * @brief Gets a %sub_match representing the match suffix.
+ *
+ * This function gets a reference to a %sub_match object representing the
+ * part of the target range between the end of the match and the end of
+ * the target range.
+ */
+ const_reference
+ suffix() const
+ { return _M_suffix; }
+
+ /**
+ * @brief Gets an iterator to the start of the %sub_match collection.
+ */
+ const_iterator
+ begin() const
+ { return _Base_type::begin(); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Gets an iterator to the start of the %sub_match collection.
+ */
+ const_iterator
+ cbegin() const
+ { return _Base_type::begin(); }
+#endif
+
+ /**
+ * @brief Gets an iterator to one-past-the-end of the collection.
+ */
+ const_iterator
+ end() const
+ { return _Base_type::end(); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Gets an iterator to one-past-the-end of the collection.
+ */
+ const_iterator
+ cend() const
+ { return _Base_type::end(); }
+#endif
+
+ //@}
+
+ /**
+ * @name 10.4 Formatting
+ *
+ * These functions perform formatted substitution of the matched character
+ * sequences into their target. The format specifiers and escape sequences
+ * accepted by these functions are determined by their @p flags parameter
+ * as documented above.
+ */
+ //@{
+
+ /**
+ * @todo Implement this function.
+ */
+ template<typename _Out_iter>
+ _Out_iter
+ format(_Out_iter __out, const string_type& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::format_default) const;
+
+ /**
+ * @todo Implement this function.
+ */
+ string_type
+ format(const string_type& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::format_default) const;
+
+ //@}
+
+ /**
+ * @name 10.5 Allocator
+ */
+ //@{
+
+ /**
+ * @brief Gets a copy of the allocator.
+ */
+ //allocator_type
+ //get_allocator() const;
+ using _Base_type::get_allocator;
+
+ //@}
+
+ /**
+ * @name 10.6 Swap
+ */
+ //@{
+
+ /**
+ * @brief Swaps the contents of two match_results.
+ */
+ void
+ swap(match_results& __that)
+ {
+ _Base_type::swap(__that);
+ std::swap(_M_matched, __that._M_matched);
+ std::swap(_M_prefix, __that._M_prefix);
+ std::swap(_M_suffix, __that._M_suffix);
+ }
+ //@}
+
+ private:
+ bool _M_matched;
+ value_type _M_prefix;
+ value_type _M_suffix;
+ };
+
+ typedef match_results<const char*> cmatch;
+ typedef match_results<string::const_iterator> smatch;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef match_results<const wchar_t*> wcmatch;
+ typedef match_results<wstring::const_iterator> wsmatch;
+#endif
+
+ // match_results comparisons
+ /**
+ * @brief Compares two match_results for equality.
+ * @returns true if the two objects refer to the same match,
+ * false otherwise.
+ * @todo Implement this function.
+ */
+ template<typename _Bi_iter, typename _Allocator>
+ inline bool
+ operator==(const match_results<_Bi_iter, _Allocator>& __m1,
+ const match_results<_Bi_iter, _Allocator>& __m2);
+
+ /**
+ * @brief Compares two match_results for inequality.
+ * @returns true if the two objects do not refer to the same match,
+ * false otherwise.
+ */
+ template<typename _Bi_iter, class _Allocator>
+ inline bool
+ operator!=(const match_results<_Bi_iter, _Allocator>& __m1,
+ const match_results<_Bi_iter, _Allocator>& __m2)
+ { return !(__m1 == __m2); }
+
+ // [7.10.6] match_results swap
+ /**
+ * @brief Swaps two match results.
+ * @param lhs A match result.
+ * @param rhs A match result.
+ *
+ * The contents of the two match_results objects are swapped.
+ */
+ template<typename _Bi_iter, typename _Allocator>
+ inline void
+ swap(match_results<_Bi_iter, _Allocator>& __lhs,
+ match_results<_Bi_iter, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ // [7.11.2] Function template regex_match
+ /**
+ * @name Matching, Searching, and Replacing
+ */
+ //@{
+
+ /**
+ * @brief Determines if there is a match between the regular expression @p e
+ * and all of the character sequence [first, last).
+ *
+ * @param first Beginning of the character sequence to match.
+ * @param last One-past-the-end of the character sequence to match.
+ * @param m The match results.
+ * @param re The regular expression.
+ * @param flags Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Bi_iter, typename _Allocator,
+ typename _Ch_type, typename _Rx_traits>
+ bool
+ regex_match(_Bi_iter __first, _Bi_iter __last,
+ match_results<_Bi_iter, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default);
+
+ /**
+ * @brief Indicates if there is a match between the regular expression @p e
+ * and all of the character sequence [first, last).
+ *
+ * @param first Beginning of the character sequence to match.
+ * @param last One-past-the-end of the character sequence to match.
+ * @param re The regular expression.
+ * @param flags Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
+ bool
+ regex_match(_Bi_iter __first, _Bi_iter __last,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ match_results<_Bi_iter> __what;
+ return regex_match(__first, __last, __what, __re, __flags);
+ }
+
+ /**
+ * @brief Determines if there is a match between the regular expression @p e
+ * and a C-style null-terminated string.
+ *
+ * @param s The C-style null-terminated string to match.
+ * @param m The match results.
+ * @param re The regular expression.
+ * @param f Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, typename _Allocator, typename _Rx_traits>
+ inline bool
+ regex_match(const _Ch_type* __s,
+ match_results<const _Ch_type*, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
+
+ /**
+ * @brief Determines if there is a match between the regular expression @p e
+ * and a string.
+ *
+ * @param s The string to match.
+ * @param m The match results.
+ * @param re The regular expression.
+ * @param flags Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _Ch_alloc,
+ typename _Allocator, typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
+ match_results<typename basic_string<_Ch_type,
+ _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ { return regex_match(__s.begin(), __s.end(), __m, __re, __flags); }
+
+ /**
+ * @brief Indicates if there is a match between the regular expression @p e
+ * and a C-style null-terminated string.
+ *
+ * @param s The C-style null-terminated string to match.
+ * @param re The regular expression.
+ * @param f Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, class _Rx_traits>
+ inline bool
+ regex_match(const _Ch_type* __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
+
+ /**
+ * @brief Indicates if there is a match between the regular expression @p e
+ * and a string.
+ *
+ * @param s [IN] The string to match.
+ * @param re [IN] The regular expression.
+ * @param flags [IN] Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _Str_allocator,
+ typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ { return regex_match(__s.begin(), __s.end(), __re, __flags); }
+
+ // [7.11.3] Function template regex_search
+ /**
+ * Searches for a regular expression within a range.
+ * @param first [IN] The start of the string to search.
+ * @param last [IN] One-past-the-end of the string to search.
+ * @param m [OUT] The match results.
+ * @param re [IN] The regular expression to search for.
+ * @param flags [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string, the content of %m is
+ * undefined.
+ *
+ * @throws an exception of type regex_error.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Bi_iter, typename _Allocator,
+ typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(_Bi_iter __first, _Bi_iter __last,
+ match_results<_Bi_iter, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default);
+
+ /**
+ * Searches for a regular expression within a range.
+ * @param first [IN] The start of the string to search.
+ * @param last [IN] One-past-the-end of the string to search.
+ * @param re [IN] The regular expression to search for.
+ * @param flags [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(_Bi_iter __first, _Bi_iter __last,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ match_results<_Bi_iter> __what;
+ return regex_search(__first, __last, __what, __re, __flags);
+ }
+
+ /**
+ * @brief Searches for a regular expression within a C-string.
+ * @param s [IN] A C-string to search for the regex.
+ * @param m [OUT] The set of regex matches.
+ * @param e [IN] The regex to search for in @p s.
+ * @param f [IN] The search flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string, the content of %m is
+ * undefined.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, class _Allocator, class _Rx_traits>
+ inline bool
+ regex_search(const _Ch_type* __s,
+ match_results<const _Ch_type*, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
+
+ /**
+ * @brief Searches for a regular expression within a C-string.
+ * @param s [IN] The C-string to search.
+ * @param e [IN] The regular expression to search for.
+ * @param f [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(const _Ch_type* __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
+
+ /**
+ * @brief Searches for a regular expression within a string.
+ * @param s [IN] The string to search.
+ * @param e [IN] The regular expression to search for.
+ * @param flags [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _String_allocator,
+ typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(const basic_string<_Ch_type, _Ch_traits,
+ _String_allocator>& __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ { return regex_search(__s.begin(), __s.end(), __e, __flags); }
+
+ /**
+ * @brief Searches for a regular expression within a string.
+ * @param s [IN] A C++ string to search for the regex.
+ * @param m [OUT] The set of regex matches.
+ * @param e [IN] The regex to search for in @p s.
+ * @param f [IN] The search flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string, the content of %m is
+ * undefined.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _Ch_alloc,
+ typename _Allocator, typename _Ch_type,
+ typename _Rx_traits>
+ inline bool
+ regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
+ match_results<typename basic_string<_Ch_type,
+ _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_search(__s.begin(), __s.end(), __m, __e, __f); }
+
+ // tr1 [7.11.4] std [28.11.4] Function template regex_replace
+ /**
+ * @doctodo
+ * @param out
+ * @param first
+ * @param last
+ * @param e
+ * @param fmt
+ * @param flags
+ *
+ * @returns out
+ * @throws an exception of type regex_error.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Out_iter, typename _Bi_iter,
+ typename _Rx_traits, typename _Ch_type>
+ inline _Out_iter
+ regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ const basic_string<_Ch_type>& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default);
+
+ /**
+ * @doctodo
+ * @param s
+ * @param e
+ * @param fmt
+ * @param flags
+ *
+ * @returns a copy of string @p s with replacements.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Rx_traits, typename _Ch_type>
+ inline basic_string<_Ch_type>
+ regex_replace(const basic_string<_Ch_type>& __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ const basic_string<_Ch_type>& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ std::string __result;
+ regex_replace(std::back_inserter(__result),
+ __s.begin(), __s.end(), __e, __fmt, __flags);
+ return __result;
+ }
+
+ //@}
+
+ // tr1 [7.12.1] std [28.12] Class template regex_iterator
+ /**
+ * An iterator adaptor that will provide repeated calls of regex_search over
+ * a range until no more matches remain.
+ */
+ template<typename _Bi_iter,
+ typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
+ typename _Rx_traits = regex_traits<_Ch_type> >
+ class regex_iterator
+ {
+ public:
+ typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
+ typedef match_results<_Bi_iter> value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef std::forward_iterator_tag iterator_category;
+
+ public:
+ /**
+ * @brief Provides a singular iterator, useful for indicating
+ * one-past-the-end of a range.
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator();
+
+ /**
+ * Constructs a %regex_iterator...
+ * @param a [IN] The start of a text range to search.
+ * @param b [IN] One-past-the-end of the text range to search.
+ * @param re [IN] The regular expression to match.
+ * @param m [IN] Policy flags for match rules.
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * Copy constructs a %regex_iterator.
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator&
+ operator=(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ bool
+ operator==(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ bool
+ operator!=(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ const value_type&
+ operator*();
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ const value_type*
+ operator->();
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator&
+ operator++();
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator
+ operator++(int);
+
+ private:
+ // these members are shown for exposition only:
+ _Bi_iter begin;
+ _Bi_iter end;
+ const regex_type* pregex;
+ regex_constants::match_flag_type flags;
+ match_results<_Bi_iter> match;
+ };
+
+ typedef regex_iterator<const char*> cregex_iterator;
+ typedef regex_iterator<string::const_iterator> sregex_iterator;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef regex_iterator<const wchar_t*> wcregex_iterator;
+ typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
+#endif
+
+ // [7.12.2] Class template regex_token_iterator
+ /**
+ * Iterates over submatches in a range (or @a splits a text string).
+ *
+ * The purpose of this iterator is to enumerate all, or all specified,
+ * matches of a regular expression within a text range. The dereferenced
+ * value of an iterator of this class is a std::tr1::sub_match object.
+ */
+ template<typename _Bi_iter,
+ typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
+ typename _Rx_traits = regex_traits<_Ch_type> >
+ class regex_token_iterator
+ {
+ public:
+ typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
+ typedef sub_match<_Bi_iter> value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef std::forward_iterator_tag iterator_category;
+
+ public:
+ /**
+ * @brief Default constructs a %regex_token_iterator.
+ * @todo Implement this function.
+ *
+ * A default-constructed %regex_token_iterator is a singular iterator
+ * that will compare equal to the one-past-the-end value for any
+ * iterator of the same type.
+ */
+ regex_token_iterator();
+
+ /**
+ * Constructs a %regex_token_iterator...
+ * @param a [IN] The start of the text to search.
+ * @param b [IN] One-past-the-end of the text to search.
+ * @param re [IN] The regular expression to search for.
+ * @param submatch [IN] Which submatch to return. There are some
+ * special values for this parameter:
+ * - -1 each enumerated subexpression does NOT
+ * match the regular expression (aka field
+ * splitting)
+ * - 0 the entire string matching the
+ * subexpression is returned for each match
+ * within the text.
+ * - >0 enumerates only the indicated
+ * subexpression from a match within the text.
+ * @param m [IN] Policy flags for match rules.
+ *
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
+ int __submatch = 0,
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * Constructs a %regex_token_iterator...
+ * @param a [IN] The start of the text to search.
+ * @param b [IN] One-past-the-end of the text to search.
+ * @param re [IN] The regular expression to search for.
+ * @param submatches [IN] A list of subexpressions to return for each
+ * regular expression match within the text.
+ * @param m [IN] Policy flags for match rules.
+ *
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
+ const regex_type& __re,
+ const std::vector<int>& __submatches,
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * Constructs a %regex_token_iterator...
+ * @param a [IN] The start of the text to search.
+ * @param b [IN] One-past-the-end of the text to search.
+ * @param re [IN] The regular expression to search for.
+ * @param submatches [IN] A list of subexpressions to return for each
+ * regular expression match within the text.
+ * @param m [IN] Policy flags for match rules.
+
+ * @todo Implement this function.
+ * @doctodo
+ */
+ template<std::size_t _Nm>
+ regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
+ const regex_type& __re,
+ const int (&__submatches)[_Nm],
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * @brief Copy constructs a %regex_token_iterator.
+ * @param rhs [IN] A %regex_token_iterator to copy.
+ * @todo Implement this function.
+ */
+ regex_token_iterator(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Assigns a %regex_token_iterator to another.
+ * @param rhs [IN] A %regex_token_iterator to copy.
+ * @todo Implement this function.
+ */
+ regex_token_iterator&
+ operator=(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Compares a %regex_token_iterator to another for equality.
+ * @todo Implement this function.
+ */
+ bool
+ operator==(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Compares a %regex_token_iterator to another for inequality.
+ * @todo Implement this function.
+ */
+ bool
+ operator!=(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Dereferences a %regex_token_iterator.
+ * @todo Implement this function.
+ */
+ const value_type&
+ operator*();
+
+ /**
+ * @brief Selects a %regex_token_iterator member.
+ * @todo Implement this function.
+ */
+ const value_type*
+ operator->();
+
+ /**
+ * @brief Increments a %regex_token_iterator.
+ * @todo Implement this function.
+ */
+ regex_token_iterator&
+ operator++();
+
+ /**
+ * @brief Postincrements a %regex_token_iterator.
+ * @todo Implement this function.
+ */
+ regex_token_iterator
+ operator++(int);
+
+ private: // data members for exposition only:
+ typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> position_iterator;
+
+ position_iterator __position;
+ const value_type* __result;
+ value_type __suffix;
+ std::size_t __n;
+ std::vector<int> __subs;
+ };
+
+ /** @brief Token iterator for C-style NULL-terminated strings. */
+ typedef regex_token_iterator<const char*> cregex_token_iterator;
+ /** @brief Token iterator for standard strings. */
+ typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Token iterator for C-style NULL-terminated wide strings. */
+ typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
+ /** @brief Token iterator for standard wide-character strings. */
+ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#endif
+
+ //@}
+}
+}
#endif // _GLIBCXX_TR1_REGEX
diff --git a/libstdc++-v3/include/tr1/shared_ptr.h b/libstdc++-v3/include/tr1/shared_ptr.h
index f504e083c52..947ee7f32c1 100644
--- a/libstdc++-v3/include/tr1/shared_ptr.h
+++ b/libstdc++-v3/include/tr1/shared_ptr.h
@@ -49,14 +49,205 @@
#ifndef _TR1_SHARED_PTR_H
#define _TR1_SHARED_PTR_H 1
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
namespace std
{
namespace tr1
{
+ /**
+ * @brief Exception possibly thrown by @c shared_ptr.
+ * @ingroup exceptions
+ */
+ class bad_weak_ptr : public std::exception
+ {
+ public:
+ virtual char const*
+ what() const throw()
+ { return "tr1::bad_weak_ptr"; }
+ };
+
+ // Substitute for bad_weak_ptr object in the case of -fno-exceptions.
+ inline void
+ __throw_bad_weak_ptr()
+ {
+#if __EXCEPTIONS
+ throw bad_weak_ptr();
+#else
+ __builtin_abort();
+#endif
+ }
+
+ using __gnu_cxx::_Lock_policy;
+ using __gnu_cxx::__default_lock_policy;
+ using __gnu_cxx::_S_single;
+ using __gnu_cxx::_S_mutex;
+ using __gnu_cxx::_S_atomic;
+
+ // Empty helper class except when the template argument is _S_mutex.
+ template<_Lock_policy _Lp>
+ class _Mutex_base
+ {
+ protected:
+ // The atomic policy uses fully-fenced builtins, single doesn't care.
+ enum { _S_need_barriers = 0 };
+ };
+
+ template<>
+ class _Mutex_base<_S_mutex>
+ : public __gnu_cxx::__mutex
+ {
+ protected:
+ // This policy is used when atomic builtins are not available.
+ // The replacement atomic operations might not have the necessary
+ // memory barriers.
+ enum { _S_need_barriers = 1 };
+ };
+
+ template<_Lock_policy _Lp = __default_lock_policy>
+ class _Sp_counted_base
+ : public _Mutex_base<_Lp>
+ {
+ public:
+ _Sp_counted_base()
+ : _M_use_count(1), _M_weak_count(1) { }
+
+ virtual
+ ~_Sp_counted_base() // nothrow
+ { }
+
+ // Called when _M_use_count drops to zero, to release the resources
+ // managed by *this.
+ virtual void
+ _M_dispose() = 0; // nothrow
+
+ // Called when _M_weak_count drops to zero.
+ virtual void
+ _M_destroy() // nothrow
+ { delete this; }
+
+ virtual void*
+ _M_get_deleter(const std::type_info&) = 0;
+
+ void
+ _M_add_ref_copy()
+ { __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); }
+
+ void
+ _M_add_ref_lock();
+
+ void
+ _M_release() // nothrow
+ {
+ // Be race-detector-friendly. For more info see bits/c++config.
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count);
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
+ {
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
+ _M_dispose();
+ // There must be a memory barrier between dispose() and destroy()
+ // to ensure that the effects of dispose() are observed in the
+ // thread that runs destroy().
+ // See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html
+ if (_Mutex_base<_Lp>::_S_need_barriers)
+ {
+ _GLIBCXX_READ_MEM_BARRIER;
+ _GLIBCXX_WRITE_MEM_BARRIER;
+ }
+
+ // Be race-detector-friendly. For more info see bits/c++config.
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,
+ -1) == 1)
+ {
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
+ _M_destroy();
+ }
+ }
+ }
+
+ void
+ _M_weak_add_ref() // nothrow
+ { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
+
+ void
+ _M_weak_release() // nothrow
+ {
+ // Be race-detector-friendly. For more info see bits/c++config.
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)
+ {
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
+ if (_Mutex_base<_Lp>::_S_need_barriers)
+ {
+ // See _M_release(),
+ // destroy() must observe results of dispose()
+ _GLIBCXX_READ_MEM_BARRIER;
+ _GLIBCXX_WRITE_MEM_BARRIER;
+ }
+ _M_destroy();
+ }
+ }
+
+ long
+ _M_get_use_count() const // nothrow
+ {
+ // No memory barrier is used here so there is no synchronization
+ // with other threads.
+ return const_cast<const volatile _Atomic_word&>(_M_use_count);
+ }
+
+ private:
+ _Sp_counted_base(_Sp_counted_base const&);
+ _Sp_counted_base& operator=(_Sp_counted_base const&);
+
+ _Atomic_word _M_use_count; // #shared
+ _Atomic_word _M_weak_count; // #weak + (#shared != 0)
+ };
+
+ template<>
+ inline void
+ _Sp_counted_base<_S_single>::
+ _M_add_ref_lock()
+ {
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
+ {
+ _M_use_count = 0;
+ __throw_bad_weak_ptr();
+ }
+ }
+
+ template<>
+ inline void
+ _Sp_counted_base<_S_mutex>::
+ _M_add_ref_lock()
+ {
+ __gnu_cxx::__scoped_lock sentry(*this);
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
+ {
+ _M_use_count = 0;
+ __throw_bad_weak_ptr();
+ }
+ }
+
+ template<>
+ inline void
+ _Sp_counted_base<_S_atomic>::
+ _M_add_ref_lock()
+ {
+ // Perform lock-free add-if-not-zero operation.
+ _Atomic_word __count;
+ do
+ {
+ __count = _M_use_count;
+ if (__count == 0)
+ __throw_bad_weak_ptr();
+
+ // Replace the current counter value with the old value + 1, as
+ // long as it's not changed meanwhile.
+ }
+ while (!__sync_bool_compare_and_swap(&_M_use_count, __count,
+ __count + 1));
+ }
+
template<typename _Ptr, typename _Deleter, _Lock_policy _Lp>
class _Sp_counted_base_impl
: public _Sp_counted_base<_Lp>
diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits
index 33083ff9c73..88aae7ad8b1 100644
--- a/libstdc++-v3/include/tr1/type_traits
+++ b/libstdc++-v3/include/tr1/type_traits
@@ -32,35 +32,467 @@
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
#include <bits/c++config.h>
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/type_traits>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/type_traits>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
-#endif
-
namespace std
{
namespace tr1
{
-#define _DEFINE_SPEC(_Trait, _Type) \
- template<> \
- struct _Trait<_Type> \
+ /**
+ * @defgroup metaprogramming Type Traits
+ * @ingroup utilities
+ *
+ * Compile time type transformation and information.
+ * @{
+ */
+
+ struct __sfinae_types
+ {
+ typedef char __one;
+ typedef struct { char __arr[2]; } __two;
+ };
+
+#define _DEFINE_SPEC_0_HELPER \
+ template<>
+
+#define _DEFINE_SPEC_1_HELPER \
+ template<typename _Tp>
+
+#define _DEFINE_SPEC_2_HELPER \
+ template<typename _Tp, typename _Cp>
+
+#define _DEFINE_SPEC(_Order, _Trait, _Type, _Value) \
+ _DEFINE_SPEC_##_Order##_HELPER \
+ struct _Trait<_Type> \
+ : public integral_constant<bool, _Value> { };
+
+ // helper classes [4.3].
+
+ /// integral_constant
+ template<typename _Tp, _Tp __v>
+ struct integral_constant
+ {
+ static const _Tp value = __v;
+ typedef _Tp value_type;
+ typedef integral_constant<_Tp, __v> type;
+ };
+
+ /// typedef for true_type
+ typedef integral_constant<bool, true> true_type;
+
+ /// typedef for false_type
+ typedef integral_constant<bool, false> false_type;
+
+ template<typename _Tp, _Tp __v>
+ const _Tp integral_constant<_Tp, __v>::value;
+
+ /// remove_cv
+ template<typename>
+ struct remove_cv;
+
+ template<typename>
+ struct __is_void_helper
+ : public false_type { };
+ _DEFINE_SPEC(0, __is_void_helper, void, true)
+
+ // primary type categories [4.5.1].
+
+ /// is_void
+ template<typename _Tp>
+ struct is_void
+ : public integral_constant<bool, (__is_void_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ template<typename>
+ struct __is_integral_helper
+ : public false_type { };
+ _DEFINE_SPEC(0, __is_integral_helper, bool, true)
+ _DEFINE_SPEC(0, __is_integral_helper, char, true)
+ _DEFINE_SPEC(0, __is_integral_helper, signed char, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned char, true)
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _DEFINE_SPEC(0, __is_integral_helper, wchar_t, true)
+#endif
+ _DEFINE_SPEC(0, __is_integral_helper, short, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned short, true)
+ _DEFINE_SPEC(0, __is_integral_helper, int, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned int, true)
+ _DEFINE_SPEC(0, __is_integral_helper, long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, long long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned long long, true)
+
+ /// is_integral
+ template<typename _Tp>
+ struct is_integral
+ : public integral_constant<bool, (__is_integral_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ template<typename>
+ struct __is_floating_point_helper
+ : public false_type { };
+ _DEFINE_SPEC(0, __is_floating_point_helper, float, true)
+ _DEFINE_SPEC(0, __is_floating_point_helper, double, true)
+ _DEFINE_SPEC(0, __is_floating_point_helper, long double, true)
+
+ /// is_floating_point
+ template<typename _Tp>
+ struct is_floating_point
+ : public integral_constant<bool, (__is_floating_point_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ /// is_array
+ template<typename>
+ struct is_array
+ : public false_type { };
+
+ template<typename _Tp, std::size_t _Size>
+ struct is_array<_Tp[_Size]>
+ : public true_type { };
+
+ template<typename _Tp>
+ struct is_array<_Tp[]>
+ : public true_type { };
+
+ template<typename>
+ struct __is_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(1, __is_pointer_helper, _Tp*, true)
+
+ /// is_pointer
+ template<typename _Tp>
+ struct is_pointer
+ : public integral_constant<bool, (__is_pointer_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ /// is_reference
+ template<typename _Tp>
+ struct is_reference;
+
+ /// is_function
+ template<typename _Tp>
+ struct is_function;
+
+ template<typename>
+ struct __is_member_object_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(2, __is_member_object_pointer_helper, _Tp _Cp::*,
+ !is_function<_Tp>::value)
+
+ /// is_member_object_pointer
+ template<typename _Tp>
+ struct is_member_object_pointer
+ : public integral_constant<bool, (__is_member_object_pointer_helper<
+ typename remove_cv<_Tp>::type>::value)>
+ { };
+
+ template<typename>
+ struct __is_member_function_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(2, __is_member_function_pointer_helper, _Tp _Cp::*,
+ is_function<_Tp>::value)
+
+ /// is_member_function_pointer
+ template<typename _Tp>
+ struct is_member_function_pointer
+ : public integral_constant<bool, (__is_member_function_pointer_helper<
+ typename remove_cv<_Tp>::type>::value)>
+ { };
+
+ /// is_enum
+ template<typename _Tp>
+ struct is_enum
+ : public integral_constant<bool, __is_enum(_Tp)>
+ { };
+
+ /// is_union
+ template<typename _Tp>
+ struct is_union
+ : public integral_constant<bool, __is_union(_Tp)>
+ { };
+
+ /// is_class
+ template<typename _Tp>
+ struct is_class
+ : public integral_constant<bool, __is_class(_Tp)>
+ { };
+
+ /// is_function
+ template<typename>
+ struct is_function
+ : public false_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...)>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......)>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...) const>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......) const>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...) volatile>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......) volatile>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...) const volatile>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......) const volatile>
+ : public true_type { };
+
+ // composite type traits [4.5.2].
+
+ /// is_arithmetic
+ template<typename _Tp>
+ struct is_arithmetic
+ : public integral_constant<bool, (is_integral<_Tp>::value
+ || is_floating_point<_Tp>::value)>
+ { };
+
+ /// is_fundamental
+ template<typename _Tp>
+ struct is_fundamental
+ : public integral_constant<bool, (is_arithmetic<_Tp>::value
+ || is_void<_Tp>::value)>
+ { };
+
+ /// is_object
+ template<typename _Tp>
+ struct is_object
+ : public integral_constant<bool, !(is_function<_Tp>::value
+ || is_reference<_Tp>::value
+ || is_void<_Tp>::value)>
+ { };
+
+ /// is_member_pointer
+ template<typename _Tp>
+ struct is_member_pointer;
+
+ /// is_scalar
+ template<typename _Tp>
+ struct is_scalar
+ : public integral_constant<bool, (is_arithmetic<_Tp>::value
+ || is_enum<_Tp>::value
+ || is_pointer<_Tp>::value
+ || is_member_pointer<_Tp>::value)>
+ { };
+
+ /// is_compound
+ template<typename _Tp>
+ struct is_compound
+ : public integral_constant<bool, !is_fundamental<_Tp>::value> { };
+
+ /// is_member_pointer
+ template<typename _Tp>
+ struct __is_member_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(2, __is_member_pointer_helper, _Tp _Cp::*, true)
+
+ template<typename _Tp>
+ struct is_member_pointer
+ : public integral_constant<bool, (__is_member_pointer_helper<
+ typename remove_cv<_Tp>::type>::value)>
+ { };
+
+ // type properties [4.5.3].
+ /// is_const
+ template<typename>
+ struct is_const
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_const<_Tp const>
+ : public true_type { };
+
+ /// is_volatile
+ template<typename>
+ struct is_volatile
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_volatile<_Tp volatile>
+ : public true_type { };
+
+ /// is_empty
+ template<typename _Tp>
+ struct is_empty
+ : public integral_constant<bool, __is_empty(_Tp)>
+ { };
+
+ /// is_polymorphic
+ template<typename _Tp>
+ struct is_polymorphic
+ : public integral_constant<bool, __is_polymorphic(_Tp)>
+ { };
+
+ /// is_abstract
+ template<typename _Tp>
+ struct is_abstract
+ : public integral_constant<bool, __is_abstract(_Tp)>
+ { };
+
+ /// has_virtual_destructor
+ template<typename _Tp>
+ struct has_virtual_destructor
+ : public integral_constant<bool, __has_virtual_destructor(_Tp)>
+ { };
+
+ /// alignment_of
+ template<typename _Tp>
+ struct alignment_of
+ : public integral_constant<std::size_t, __alignof__(_Tp)> { };
+
+ /// rank
+ template<typename>
+ struct rank
+ : public integral_constant<std::size_t, 0> { };
+
+ template<typename _Tp, std::size_t _Size>
+ struct rank<_Tp[_Size]>
+ : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
+
+ template<typename _Tp>
+ struct rank<_Tp[]>
+ : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
+
+ /// extent
+ template<typename, unsigned _Uint = 0>
+ struct extent
+ : public integral_constant<std::size_t, 0> { };
+
+ template<typename _Tp, unsigned _Uint, std::size_t _Size>
+ struct extent<_Tp[_Size], _Uint>
+ : public integral_constant<std::size_t,
+ _Uint == 0 ? _Size : extent<_Tp,
+ _Uint - 1>::value>
+ { };
+
+ template<typename _Tp, unsigned _Uint>
+ struct extent<_Tp[], _Uint>
+ : public integral_constant<std::size_t,
+ _Uint == 0 ? 0 : extent<_Tp,
+ _Uint - 1>::value>
+ { };
+
+ // relationships between types [4.6].
+
+ /// is_same
+ template<typename, typename>
+ struct is_same
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_same<_Tp, _Tp>
: public true_type { };
+ // const-volatile modifications [4.7.1].
+
+ /// remove_const
+ template<typename _Tp>
+ struct remove_const
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_const<_Tp const>
+ { typedef _Tp type; };
+
+ /// remove_volatile
+ template<typename _Tp>
+ struct remove_volatile
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_volatile<_Tp volatile>
+ { typedef _Tp type; };
+
+ /// remove_cv
+ template<typename _Tp>
+ struct remove_cv
+ {
+ typedef typename
+ remove_const<typename remove_volatile<_Tp>::type>::type type;
+ };
+
+ /// add_const
+ template<typename _Tp>
+ struct add_const
+ { typedef _Tp const type; };
+
+ /// add_volatile
+ template<typename _Tp>
+ struct add_volatile
+ { typedef _Tp volatile type; };
+
+ /// add_cv
+ template<typename _Tp>
+ struct add_cv
+ {
+ typedef typename
+ add_const<typename add_volatile<_Tp>::type>::type type;
+ };
+
+ // array modifications [4.7.3].
+
+ /// remove_extent
+ template<typename _Tp>
+ struct remove_extent
+ { typedef _Tp type; };
+
+ template<typename _Tp, std::size_t _Size>
+ struct remove_extent<_Tp[_Size]>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_extent<_Tp[]>
+ { typedef _Tp type; };
+
+ /// remove_all_extents
+ template<typename _Tp>
+ struct remove_all_extents
+ { typedef _Tp type; };
+
+ template<typename _Tp, std::size_t _Size>
+ struct remove_all_extents<_Tp[_Size]>
+ { typedef typename remove_all_extents<_Tp>::type type; };
+
+ template<typename _Tp>
+ struct remove_all_extents<_Tp[]>
+ { typedef typename remove_all_extents<_Tp>::type type; };
+
+ // pointer modifications [4.7.4].
+
+ template<typename _Tp, typename>
+ struct __remove_pointer_helper
+ { typedef _Tp type; };
+
+ template<typename _Tp, typename _Up>
+ struct __remove_pointer_helper<_Tp, _Up*>
+ { typedef _Up type; };
+
+ /// remove_pointer
+ template<typename _Tp>
+ struct remove_pointer
+ : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
+ { };
+
+ template<typename>
+ struct remove_reference;
+
+ /// add_pointer
+ template<typename _Tp>
+ struct add_pointer
+ { typedef typename remove_reference<_Tp>::type* type; };
+
template<typename>
struct is_reference
: public false_type { };
@@ -112,11 +544,11 @@ namespace tr1
template<typename>
struct __is_signed_helper
: public false_type { };
- _DEFINE_SPEC(__is_signed_helper, signed char)
- _DEFINE_SPEC(__is_signed_helper, short)
- _DEFINE_SPEC(__is_signed_helper, int)
- _DEFINE_SPEC(__is_signed_helper, long)
- _DEFINE_SPEC(__is_signed_helper, long long)
+ _DEFINE_SPEC(0, __is_signed_helper, signed char, true)
+ _DEFINE_SPEC(0, __is_signed_helper, short, true)
+ _DEFINE_SPEC(0, __is_signed_helper, int, true)
+ _DEFINE_SPEC(0, __is_signed_helper, long, true)
+ _DEFINE_SPEC(0, __is_signed_helper, long long, true)
template<typename _Tp>
struct is_signed
@@ -127,11 +559,11 @@ namespace tr1
template<typename>
struct __is_unsigned_helper
: public false_type { };
- _DEFINE_SPEC(__is_unsigned_helper, unsigned char)
- _DEFINE_SPEC(__is_unsigned_helper, unsigned short)
- _DEFINE_SPEC(__is_unsigned_helper, unsigned int)
- _DEFINE_SPEC(__is_unsigned_helper, unsigned long)
- _DEFINE_SPEC(__is_unsigned_helper, unsigned long long)
+ _DEFINE_SPEC(0, __is_unsigned_helper, unsigned char, true)
+ _DEFINE_SPEC(0, __is_unsigned_helper, unsigned short, true)
+ _DEFINE_SPEC(0, __is_unsigned_helper, unsigned int, true)
+ _DEFINE_SPEC(0, __is_unsigned_helper, unsigned long, true)
+ _DEFINE_SPEC(0, __is_unsigned_helper, unsigned long long, true)
template<typename _Tp>
struct is_unsigned
@@ -243,6 +675,9 @@ namespace tr1
};
};
+#undef _DEFINE_SPEC_0_HELPER
+#undef _DEFINE_SPEC_1_HELPER
+#undef _DEFINE_SPEC_2_HELPER
#undef _DEFINE_SPEC
}
}
diff --git a/libstdc++-v3/include/tr1/utility b/libstdc++-v3/include/tr1/utility
index 0aac2b2824f..04ff67a3f8f 100644
--- a/libstdc++-v3/include/tr1/utility
+++ b/libstdc++-v3/include/tr1/utility
@@ -1,6 +1,7 @@
// TR1 utility -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007, 2008. 2009, 2010
+// 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
@@ -31,26 +32,74 @@
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
#include <bits/c++config.h>
#include <bits/stl_relops.h>
#include <bits/stl_pair.h>
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1_impl/utility>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-# define _GLIBCXX_TR1 tr1::
-# include <tr1_impl/utility>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
-#endif
+namespace std
+{
+namespace tr1
+{
+ template<class _Tp>
+ class tuple_size;
+
+ template<int _Int, class _Tp>
+ class tuple_element;
+
+ // Various functions which give std::pair a tuple-like interface.
+ template<class _Tp1, class _Tp2>
+ struct tuple_size<std::pair<_Tp1, _Tp2> >
+ { static const int value = 2; };
+
+ template<class _Tp1, class _Tp2>
+ const int
+ tuple_size<std::pair<_Tp1, _Tp2> >::value;
+
+ template<class _Tp1, class _Tp2>
+ struct tuple_element<0, std::pair<_Tp1, _Tp2> >
+ { typedef _Tp1 type; };
+
+ template<class _Tp1, class _Tp2>
+ struct tuple_element<1, std::pair<_Tp1, _Tp2> >
+ { typedef _Tp2 type; };
+
+ template<int _Int>
+ struct __pair_get;
+
+ template<>
+ struct __pair_get<0>
+ {
+ template<typename _Tp1, typename _Tp2>
+ static _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.first; }
+
+ template<typename _Tp1, typename _Tp2>
+ static const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.first; }
+ };
+
+ template<>
+ struct __pair_get<1>
+ {
+ template<typename _Tp1, typename _Tp2>
+ static _Tp2& __get(std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.second; }
+
+ template<typename _Tp1, typename _Tp2>
+ static const _Tp2& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.second; }
+ };
+
+ template<int _Int, class _Tp1, class _Tp2>
+ inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
+ get(std::pair<_Tp1, _Tp2>& __in)
+ { return __pair_get<_Int>::__get(__in); }
+
+ template<int _Int, class _Tp1, class _Tp2>
+ inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
+ get(const std::pair<_Tp1, _Tp2>& __in)
+ { return __pair_get<_Int>::__const_get(__in); }
+}
+}
#endif // _GLIBCXX_TR1_UTILITY
diff --git a/libstdc++-v3/include/tr1_impl/array b/libstdc++-v3/include/tr1_impl/array
deleted file mode 100644
index db0364e5357..00000000000
--- a/libstdc++-v3/include/tr1_impl/array
+++ /dev/null
@@ -1,291 +0,0 @@
-// class template array -*- C++ -*-
-
-// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/array
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
- /**
- * @brief A standard container for storing a fixed size sequence of elements.
- *
- * @ingroup sequences
- *
- * Meets the requirements of a <a href="tables.html#65">container</a>, a
- * <a href="tables.html#66">reversible container</a>, and a
- * <a href="tables.html#67">sequence</a>.
- *
- * Sets support random access iterators.
- *
- * @param Tp Type of element. Required to be a complete type.
- * @param N Number of elements.
- */
- template<typename _Tp, std::size_t _Nm>
- struct array
- {
- typedef _Tp value_type;
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
-#endif
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef value_type* iterator;
- typedef const value_type* const_iterator;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
- // Support for zero-sized arrays mandatory.
- value_type _M_instance[_Nm ? _Nm : 1];
-
- // No explicit construct/copy/destroy for aggregate type.
-
- void
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- // DR 776.
- fill(const value_type& __u)
-#else
- assign(const value_type& __u)
-#endif
- { std::fill_n(begin(), size(), __u); }
-
- void
- swap(array& __other)
- { std::swap_ranges(begin(), end(), __other.begin()); }
-
- // Iterators.
- iterator
- begin()
- { return iterator(std::__addressof(_M_instance[0])); }
-
- const_iterator
- begin() const
- { return const_iterator(std::__addressof(_M_instance[0])); }
-
- iterator
- end()
- { return iterator(std::__addressof(_M_instance[_Nm])); }
-
- const_iterator
- end() const
- { return const_iterator(std::__addressof(_M_instance[_Nm])); }
-
- reverse_iterator
- rbegin()
- { return reverse_iterator(end()); }
-
- const_reverse_iterator
- rbegin() const
- { return const_reverse_iterator(end()); }
-
- reverse_iterator
- rend()
- { return reverse_iterator(begin()); }
-
- const_reverse_iterator
- rend() const
- { return const_reverse_iterator(begin()); }
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- const_iterator
- cbegin() const
- { return const_iterator(std::__addressof(_M_instance[0])); }
-
- const_iterator
- cend() const
- { return const_iterator(std::__addressof(_M_instance[_Nm])); }
-
- const_reverse_iterator
- crbegin() const
- { return const_reverse_iterator(end()); }
-
- const_reverse_iterator
- crend() const
- { return const_reverse_iterator(begin()); }
-#endif
-
- // Capacity.
- size_type
- size() const { return _Nm; }
-
- size_type
- max_size() const { return _Nm; }
-
- bool
- empty() const { return size() == 0; }
-
- // Element access.
- reference
- operator[](size_type __n)
- { return _M_instance[__n]; }
-
- const_reference
- operator[](size_type __n) const
- { return _M_instance[__n]; }
-
- reference
- at(size_type __n)
- {
- if (__n >= _Nm)
- std::__throw_out_of_range(__N("array::at"));
- return _M_instance[__n];
- }
-
- const_reference
- at(size_type __n) const
- {
- if (__n >= _Nm)
- std::__throw_out_of_range(__N("array::at"));
- return _M_instance[__n];
- }
-
- reference
- front()
- { return *begin(); }
-
- const_reference
- front() const
- { return *begin(); }
-
- reference
- back()
- { return _Nm ? *(end() - 1) : *end(); }
-
- const_reference
- back() const
- { return _Nm ? *(end() - 1) : *end(); }
-
- _Tp*
- data()
- { return std::__addressof(_M_instance[0]); }
-
- const _Tp*
- data() const
- { return std::__addressof(_M_instance[0]); }
- };
-
- // Array comparisons.
- template<typename _Tp, std::size_t _Nm>
- inline bool
- operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
- { return std::equal(__one.begin(), __one.end(), __two.begin()); }
-
- template<typename _Tp, std::size_t _Nm>
- inline bool
- operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
- { return !(__one == __two); }
-
- template<typename _Tp, std::size_t _Nm>
- inline bool
- operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
- {
- return std::lexicographical_compare(__a.begin(), __a.end(),
- __b.begin(), __b.end());
- }
-
- template<typename _Tp, std::size_t _Nm>
- inline bool
- operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
- { return __two < __one; }
-
- template<typename _Tp, std::size_t _Nm>
- inline bool
- operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
- { return !(__one > __two); }
-
- template<typename _Tp, std::size_t _Nm>
- inline bool
- operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
- { return !(__one < __two); }
-
- // Specialized algorithms [6.2.2.2].
- template<typename _Tp, std::size_t _Nm>
- inline void
- swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
- { __one.swap(__two); }
-
- // Tuple interface to class template array [6.2.2.5].
-
- /// tuple_size
- template<typename _Tp>
- class tuple_size;
-
- /// tuple_element
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- template<std::size_t _Int, typename _Tp>
-#else
- template<int _Int, typename _Tp>
-#endif
- class tuple_element;
-
- template<typename _Tp, std::size_t _Nm>
- struct tuple_size<array<_Tp, _Nm> >
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- { static const std::size_t value = _Nm; };
-#else
- { static const int value = _Nm; };
-#endif
-
- template<typename _Tp, std::size_t _Nm>
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- const std::size_t
-#else
- const int
-#endif
- tuple_size<array<_Tp, _Nm> >::value;
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- template<std::size_t _Int, typename _Tp, std::size_t _Nm>
-#else
- template<int _Int, typename _Tp, std::size_t _Nm>
-#endif
- struct tuple_element<_Int, array<_Tp, _Nm> >
- { typedef _Tp type; };
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- template<std::size_t _Int, typename _Tp, std::size_t _Nm>
-#else
- template<int _Int, typename _Tp, std::size_t _Nm>
-#endif
- inline _Tp&
- get(array<_Tp, _Nm>& __arr)
- { return __arr[_Int]; }
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- template<std::size_t _Int, typename _Tp, std::size_t _Nm>
-#else
- template<int _Int, typename _Tp, std::size_t _Nm>
-#endif
- inline const _Tp&
- get(const array<_Tp, _Nm>& __arr)
- { return __arr[_Int]; }
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
diff --git a/libstdc++-v3/include/tr1_impl/boost_sp_counted_base.h b/libstdc++-v3/include/tr1_impl/boost_sp_counted_base.h
deleted file mode 100644
index 11a2d052dfc..00000000000
--- a/libstdc++-v3/include/tr1_impl/boost_sp_counted_base.h
+++ /dev/null
@@ -1,254 +0,0 @@
-// <tr1_impl/boost_sp_counted_base.h> -*- C++ -*-
-
-// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// shared_count.hpp
-// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
-
-// shared_ptr.hpp
-// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes.
-// Copyright (C) 2001, 2002, 2003 Peter Dimov
-
-// weak_ptr.hpp
-// Copyright (C) 2001, 2002, 2003 Peter Dimov
-
-// enable_shared_from_this.hpp
-// Copyright (C) 2002 Peter Dimov
-
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// GCC Note: based on version 1.32.0 of the Boost library.
-
-/** @file tr1_impl/boost_sp_counted_base.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
- /**
- * @brief Exception possibly thrown by @c shared_ptr.
- * @ingroup exceptions
- */
- class bad_weak_ptr : public std::exception
- {
- public:
- virtual char const*
- what() const throw()
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- { return "std::bad_weak_ptr"; }
-#else
- { return "tr1::bad_weak_ptr"; }
-#endif
- };
-
- // Substitute for bad_weak_ptr object in the case of -fno-exceptions.
- inline void
- __throw_bad_weak_ptr()
- {
-#if __EXCEPTIONS
- throw bad_weak_ptr();
-#else
- __builtin_abort();
-#endif
- }
-
- using __gnu_cxx::_Lock_policy;
- using __gnu_cxx::__default_lock_policy;
- using __gnu_cxx::_S_single;
- using __gnu_cxx::_S_mutex;
- using __gnu_cxx::_S_atomic;
-
- // Empty helper class except when the template argument is _S_mutex.
- template<_Lock_policy _Lp>
- class _Mutex_base
- {
- protected:
- // The atomic policy uses fully-fenced builtins, single doesn't care.
- enum { _S_need_barriers = 0 };
- };
-
- template<>
- class _Mutex_base<_S_mutex>
- : public __gnu_cxx::__mutex
- {
- protected:
- // This policy is used when atomic builtins are not available.
- // The replacement atomic operations might not have the necessary
- // memory barriers.
- enum { _S_need_barriers = 1 };
- };
-
- template<_Lock_policy _Lp = __default_lock_policy>
- class _Sp_counted_base
- : public _Mutex_base<_Lp>
- {
- public:
- _Sp_counted_base()
- : _M_use_count(1), _M_weak_count(1) { }
-
- virtual
- ~_Sp_counted_base() // nothrow
- { }
-
- // Called when _M_use_count drops to zero, to release the resources
- // managed by *this.
- virtual void
- _M_dispose() = 0; // nothrow
-
- // Called when _M_weak_count drops to zero.
- virtual void
- _M_destroy() // nothrow
- { delete this; }
-
- virtual void*
- _M_get_deleter(const std::type_info&) = 0;
-
- void
- _M_add_ref_copy()
- { __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); }
-
- void
- _M_add_ref_lock();
-
- void
- _M_release() // nothrow
- {
- // Be race-detector-friendly. For more info see bits/c++config.
- _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count);
- if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
- {
- _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
- _M_dispose();
- // There must be a memory barrier between dispose() and destroy()
- // to ensure that the effects of dispose() are observed in the
- // thread that runs destroy().
- // See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html
- if (_Mutex_base<_Lp>::_S_need_barriers)
- {
- _GLIBCXX_READ_MEM_BARRIER;
- _GLIBCXX_WRITE_MEM_BARRIER;
- }
-
- // Be race-detector-friendly. For more info see bits/c++config.
- _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
- if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,
- -1) == 1)
- {
- _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
- _M_destroy();
- }
- }
- }
-
- void
- _M_weak_add_ref() // nothrow
- { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
-
- void
- _M_weak_release() // nothrow
- {
- // Be race-detector-friendly. For more info see bits/c++config.
- _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
- if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)
- {
- _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
- if (_Mutex_base<_Lp>::_S_need_barriers)
- {
- // See _M_release(),
- // destroy() must observe results of dispose()
- _GLIBCXX_READ_MEM_BARRIER;
- _GLIBCXX_WRITE_MEM_BARRIER;
- }
- _M_destroy();
- }
- }
-
- long
- _M_get_use_count() const // nothrow
- {
- // No memory barrier is used here so there is no synchronization
- // with other threads.
- return const_cast<const volatile _Atomic_word&>(_M_use_count);
- }
-
- private:
- _Sp_counted_base(_Sp_counted_base const&);
- _Sp_counted_base& operator=(_Sp_counted_base const&);
-
- _Atomic_word _M_use_count; // #shared
- _Atomic_word _M_weak_count; // #weak + (#shared != 0)
- };
-
- template<>
- inline void
- _Sp_counted_base<_S_single>::
- _M_add_ref_lock()
- {
- if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
- {
- _M_use_count = 0;
- __throw_bad_weak_ptr();
- }
- }
-
- template<>
- inline void
- _Sp_counted_base<_S_mutex>::
- _M_add_ref_lock()
- {
- __gnu_cxx::__scoped_lock sentry(*this);
- if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
- {
- _M_use_count = 0;
- __throw_bad_weak_ptr();
- }
- }
-
- template<>
- inline void
- _Sp_counted_base<_S_atomic>::
- _M_add_ref_lock()
- {
- // Perform lock-free add-if-not-zero operation.
- _Atomic_word __count;
- do
- {
- __count = _M_use_count;
- if (__count == 0)
- __throw_bad_weak_ptr();
-
- // Replace the current counter value with the old value + 1, as
- // long as it's not changed meanwhile.
- }
- while (!__sync_bool_compare_and_swap(&_M_use_count, __count,
- __count + 1));
- }
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
diff --git a/libstdc++-v3/include/tr1_impl/cctype b/libstdc++-v3/include/tr1_impl/cctype
deleted file mode 100644
index c76d38c8782..00000000000
--- a/libstdc++-v3/include/tr1_impl/cctype
+++ /dev/null
@@ -1,43 +0,0 @@
-// TR1 cctype -*- C++ -*-
-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/cctype
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#if _GLIBCXX_USE_C99_CTYPE_TR1
-
-#undef isblank
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
- using ::isblank;
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
-
-#endif
diff --git a/libstdc++-v3/include/tr1_impl/cfenv b/libstdc++-v3/include/tr1_impl/cfenv
deleted file mode 100644
index 3078c7de64a..00000000000
--- a/libstdc++-v3/include/tr1_impl/cfenv
+++ /dev/null
@@ -1,70 +0,0 @@
-// TR1 cfenv -*- C++ -*-
-
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/cfenv
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#if _GLIBCXX_USE_C99_FENV_TR1
-
-#undef feclearexcept
-#undef fegetexceptflag
-#undef feraiseexcept
-#undef fesetexceptflag
-#undef fetestexcept
-#undef fegetround
-#undef fesetround
-#undef fegetenv
-#undef feholdexcept
-#undef fesetenv
-#undef feupdateenv
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
- // types
- using ::fenv_t;
- using ::fexcept_t;
-
- // functions
- using ::feclearexcept;
- using ::fegetexceptflag;
- using ::feraiseexcept;
- using ::fesetexceptflag;
- using ::fetestexcept;
-
- using ::fegetround;
- using ::fesetround;
-
- using ::fegetenv;
- using ::feholdexcept;
- using ::fesetenv;
- using ::feupdateenv;
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
-
-#endif
diff --git a/libstdc++-v3/include/tr1_impl/cinttypes b/libstdc++-v3/include/tr1_impl/cinttypes
deleted file mode 100644
index 4a0f9f19dec..00000000000
--- a/libstdc++-v3/include/tr1_impl/cinttypes
+++ /dev/null
@@ -1,64 +0,0 @@
-// TR1 cinttypes -*- C++ -*-
-
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/cinttypes
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#if _GLIBCXX_USE_C99_INTTYPES_TR1
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
- // types
- using ::imaxdiv_t;
-
- // functions
- using ::imaxabs;
-
- // May collide with _Longlong abs(_Longlong), and is not described
- // anywhere outside the synopsis. Likely, a defect.
- //
- // intmax_t abs(intmax_t)
-
- using ::imaxdiv;
-
- // Likewise, with lldiv_t div(_Longlong, _Longlong).
- //
- // imaxdiv_t div(intmax_t, intmax_t)
-
- using ::strtoimax;
- using ::strtoumax;
-
-#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
- using ::wcstoimax;
- using ::wcstoumax;
-#endif
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
-
-#endif
diff --git a/libstdc++-v3/include/tr1_impl/cmath b/libstdc++-v3/include/tr1_impl/cmath
deleted file mode 100644
index cf460dd7c95..00000000000
--- a/libstdc++-v3/include/tr1_impl/cmath
+++ /dev/null
@@ -1,996 +0,0 @@
-// TR1 cmath -*- C++ -*-
-
-// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/cmath
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#if _GLIBCXX_USE_C99_MATH_TR1
-
-#undef acosh
-#undef acoshf
-#undef acoshl
-#undef asinh
-#undef asinhf
-#undef asinhl
-#undef atanh
-#undef atanhf
-#undef atanhl
-#undef cbrt
-#undef cbrtf
-#undef cbrtl
-#undef copysign
-#undef copysignf
-#undef copysignl
-#undef erf
-#undef erff
-#undef erfl
-#undef erfc
-#undef erfcf
-#undef erfcl
-#undef exp2
-#undef exp2f
-#undef exp2l
-#undef expm1
-#undef expm1f
-#undef expm1l
-#undef fdim
-#undef fdimf
-#undef fdiml
-#undef fma
-#undef fmaf
-#undef fmal
-#undef fmax
-#undef fmaxf
-#undef fmaxl
-#undef fmin
-#undef fminf
-#undef fminl
-#undef hypot
-#undef hypotf
-#undef hypotl
-#undef ilogb
-#undef ilogbf
-#undef ilogbl
-#undef lgamma
-#undef lgammaf
-#undef lgammal
-#undef llrint
-#undef llrintf
-#undef llrintl
-#undef llround
-#undef llroundf
-#undef llroundl
-#undef log1p
-#undef log1pf
-#undef log1pl
-#undef log2
-#undef log2f
-#undef log2l
-#undef logb
-#undef logbf
-#undef logbl
-#undef lrint
-#undef lrintf
-#undef lrintl
-#undef lround
-#undef lroundf
-#undef lroundl
-#undef nan
-#undef nanf
-#undef nanl
-#undef nearbyint
-#undef nearbyintf
-#undef nearbyintl
-#undef nextafter
-#undef nextafterf
-#undef nextafterl
-#undef nexttoward
-#undef nexttowardf
-#undef nexttowardl
-#undef remainder
-#undef remainderf
-#undef remainderl
-#undef remquo
-#undef remquof
-#undef remquol
-#undef rint
-#undef rintf
-#undef rintl
-#undef round
-#undef roundf
-#undef roundl
-#undef scalbln
-#undef scalblnf
-#undef scalblnl
-#undef scalbn
-#undef scalbnf
-#undef scalbnl
-#undef tgamma
-#undef tgammaf
-#undef tgammal
-#undef trunc
-#undef truncf
-#undef truncl
-
-#endif
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
-#if _GLIBCXX_USE_C99_MATH_TR1
-
- // types
- using ::double_t;
- using ::float_t;
-
- // functions
- using ::acosh;
- using ::acoshf;
- using ::acoshl;
-
- using ::asinh;
- using ::asinhf;
- using ::asinhl;
-
- using ::atanh;
- using ::atanhf;
- using ::atanhl;
-
- using ::cbrt;
- using ::cbrtf;
- using ::cbrtl;
-
- using ::copysign;
- using ::copysignf;
- using ::copysignl;
-
- using ::erf;
- using ::erff;
- using ::erfl;
-
- using ::erfc;
- using ::erfcf;
- using ::erfcl;
-
- using ::exp2;
- using ::exp2f;
- using ::exp2l;
-
- using ::expm1;
- using ::expm1f;
- using ::expm1l;
-
- using ::fdim;
- using ::fdimf;
- using ::fdiml;
-
- using ::fma;
- using ::fmaf;
- using ::fmal;
-
- using ::fmax;
- using ::fmaxf;
- using ::fmaxl;
-
- using ::fmin;
- using ::fminf;
- using ::fminl;
-
- using ::hypot;
- using ::hypotf;
- using ::hypotl;
-
- using ::ilogb;
- using ::ilogbf;
- using ::ilogbl;
-
- using ::lgamma;
- using ::lgammaf;
- using ::lgammal;
-
- using ::llrint;
- using ::llrintf;
- using ::llrintl;
-
- using ::llround;
- using ::llroundf;
- using ::llroundl;
-
- using ::log1p;
- using ::log1pf;
- using ::log1pl;
-
- using ::log2;
- using ::log2f;
- using ::log2l;
-
- using ::logb;
- using ::logbf;
- using ::logbl;
-
- using ::lrint;
- using ::lrintf;
- using ::lrintl;
-
- using ::lround;
- using ::lroundf;
- using ::lroundl;
-
- using ::nan;
- using ::nanf;
- using ::nanl;
-
- using ::nearbyint;
- using ::nearbyintf;
- using ::nearbyintl;
-
- using ::nextafter;
- using ::nextafterf;
- using ::nextafterl;
-
- using ::nexttoward;
- using ::nexttowardf;
- using ::nexttowardl;
-
- using ::remainder;
- using ::remainderf;
- using ::remainderl;
-
- using ::remquo;
- using ::remquof;
- using ::remquol;
-
- using ::rint;
- using ::rintf;
- using ::rintl;
-
- using ::round;
- using ::roundf;
- using ::roundl;
-
- using ::scalbln;
- using ::scalblnf;
- using ::scalblnl;
-
- using ::scalbn;
- using ::scalbnf;
- using ::scalbnl;
-
- using ::tgamma;
- using ::tgammaf;
- using ::tgammal;
-
- using ::trunc;
- using ::truncf;
- using ::truncl;
-
-#endif
-
-#if _GLIBCXX_USE_C99_MATH
-#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
-
- /// Function template definitions [8.16.3].
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- fpclassify(_Tp __f)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
- FP_SUBNORMAL, FP_ZERO, __type(__f));
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- isfinite(_Tp __f)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_isfinite(__type(__f));
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- isinf(_Tp __f)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_isinf(__type(__f));
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- isnan(_Tp __f)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_isnan(__type(__f));
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- isnormal(_Tp __f)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_isnormal(__type(__f));
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- signbit(_Tp __f)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_signbit(__type(__f));
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- isgreater(_Tp __f1, _Tp __f2)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_isgreater(__type(__f1), __type(__f2));
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- isgreaterequal(_Tp __f1, _Tp __f2)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_isgreaterequal(__type(__f1), __type(__f2));
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- isless(_Tp __f1, _Tp __f2)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_isless(__type(__f1), __type(__f2));
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- islessequal(_Tp __f1, _Tp __f2)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_islessequal(__type(__f1), __type(__f2));
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- islessgreater(_Tp __f1, _Tp __f2)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_islessgreater(__type(__f1), __type(__f2));
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
- int>::__type
- isunordered(_Tp __f1, _Tp __f2)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __builtin_isunordered(__type(__f1), __type(__f2));
- }
-
-#endif
-#endif
-
-#if _GLIBCXX_USE_C99_MATH_TR1
-
- /// Additional overloads [8.16.4].
- using std::acos;
-
- inline float
- acosh(float __x)
- { return __builtin_acoshf(__x); }
-
- inline long double
- acosh(long double __x)
- { return __builtin_acoshl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- acosh(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return acosh(__type(__x));
- }
-
- using std::asin;
-
- inline float
- asinh(float __x)
- { return __builtin_asinhf(__x); }
-
- inline long double
- asinh(long double __x)
- { return __builtin_asinhl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- asinh(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return asinh(__type(__x));
- }
-
- using std::atan;
- using std::atan2;
-
- inline float
- atanh(float __x)
- { return __builtin_atanhf(__x); }
-
- inline long double
- atanh(long double __x)
- { return __builtin_atanhl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- atanh(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return atanh(__type(__x));
- }
-
- inline float
- cbrt(float __x)
- { return __builtin_cbrtf(__x); }
-
- inline long double
- cbrt(long double __x)
- { return __builtin_cbrtl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- cbrt(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return cbrt(__type(__x));
- }
-
- using std::ceil;
-
- inline float
- copysign(float __x, float __y)
- { return __builtin_copysignf(__x, __y); }
-
- inline long double
- copysign(long double __x, long double __y)
- { return __builtin_copysignl(__x, __y); }
-
- template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
- copysign(_Tp __x, _Up __y)
- {
- typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return copysign(__type(__x), __type(__y));
- }
-
- using std::cos;
- using std::cosh;
-
- inline float
- erf(float __x)
- { return __builtin_erff(__x); }
-
- inline long double
- erf(long double __x)
- { return __builtin_erfl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- erf(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return erf(__type(__x));
- }
-
- inline float
- erfc(float __x)
- { return __builtin_erfcf(__x); }
-
- inline long double
- erfc(long double __x)
- { return __builtin_erfcl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- erfc(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return erfc(__type(__x));
- }
-
- using std::exp;
-
- inline float
- exp2(float __x)
- { return __builtin_exp2f(__x); }
-
- inline long double
- exp2(long double __x)
- { return __builtin_exp2l(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- exp2(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return exp2(__type(__x));
- }
-
- inline float
- expm1(float __x)
- { return __builtin_expm1f(__x); }
-
- inline long double
- expm1(long double __x)
- { return __builtin_expm1l(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- expm1(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return expm1(__type(__x));
- }
-
- using std::fabs;
-
- inline float
- fdim(float __x, float __y)
- { return __builtin_fdimf(__x, __y); }
-
- inline long double
- fdim(long double __x, long double __y)
- { return __builtin_fdiml(__x, __y); }
-
- template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
- fdim(_Tp __x, _Up __y)
- {
- typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return fdim(__type(__x), __type(__y));
- }
-
- using std::floor;
-
- inline float
- fma(float __x, float __y, float __z)
- { return __builtin_fmaf(__x, __y, __z); }
-
- inline long double
- fma(long double __x, long double __y, long double __z)
- { return __builtin_fmal(__x, __y, __z); }
-
- template<typename _Tp, typename _Up, typename _Vp>
- inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
- fma(_Tp __x, _Up __y, _Vp __z)
- {
- typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
- return fma(__type(__x), __type(__y), __type(__z));
- }
-
- inline float
- fmax(float __x, float __y)
- { return __builtin_fmaxf(__x, __y); }
-
- inline long double
- fmax(long double __x, long double __y)
- { return __builtin_fmaxl(__x, __y); }
-
- template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
- fmax(_Tp __x, _Up __y)
- {
- typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return fmax(__type(__x), __type(__y));
- }
-
- inline float
- fmin(float __x, float __y)
- { return __builtin_fminf(__x, __y); }
-
- inline long double
- fmin(long double __x, long double __y)
- { return __builtin_fminl(__x, __y); }
-
- template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
- fmin(_Tp __x, _Up __y)
- {
- typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return fmin(__type(__x), __type(__y));
- }
-
- using std::fmod;
- using std::frexp;
-
- inline float
- hypot(float __x, float __y)
- { return __builtin_hypotf(__x, __y); }
-
- inline long double
- hypot(long double __x, long double __y)
- { return __builtin_hypotl(__x, __y); }
-
- template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
- hypot(_Tp __x, _Up __y)
- {
- typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return hypot(__type(__x), __type(__y));
- }
-
- inline int
- ilogb(float __x)
- { return __builtin_ilogbf(__x); }
-
- inline int
- ilogb(long double __x)
- { return __builtin_ilogbl(__x); }
-
- template<typename _Tp>
- inline int
- ilogb(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return ilogb(__type(__x));
- }
-
- using std::ldexp;
-
- inline float
- lgamma(float __x)
- { return __builtin_lgammaf(__x); }
-
- inline long double
- lgamma(long double __x)
- { return __builtin_lgammal(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- lgamma(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return lgamma(__type(__x));
- }
-
- inline long long
- llrint(float __x)
- { return __builtin_llrintf(__x); }
-
- inline long long
- llrint(long double __x)
- { return __builtin_llrintl(__x); }
-
- template<typename _Tp>
- inline long long
- llrint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return llrint(__type(__x));
- }
-
- inline long long
- llround(float __x)
- { return __builtin_llroundf(__x); }
-
- inline long long
- llround(long double __x)
- { return __builtin_llroundl(__x); }
-
- template<typename _Tp>
- inline long long
- llround(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return llround(__type(__x));
- }
-
- using std::log;
- using std::log10;
-
- inline float
- log1p(float __x)
- { return __builtin_log1pf(__x); }
-
- inline long double
- log1p(long double __x)
- { return __builtin_log1pl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- log1p(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return log1p(__type(__x));
- }
-
- // DR 568.
- inline float
- log2(float __x)
- { return __builtin_log2f(__x); }
-
- inline long double
- log2(long double __x)
- { return __builtin_log2l(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- log2(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return log2(__type(__x));
- }
-
- inline float
- logb(float __x)
- { return __builtin_logbf(__x); }
-
- inline long double
- logb(long double __x)
- { return __builtin_logbl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- logb(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return logb(__type(__x));
- }
-
- inline long
- lrint(float __x)
- { return __builtin_lrintf(__x); }
-
- inline long
- lrint(long double __x)
- { return __builtin_lrintl(__x); }
-
- template<typename _Tp>
- inline long
- lrint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return lrint(__type(__x));
- }
-
- inline long
- lround(float __x)
- { return __builtin_lroundf(__x); }
-
- inline long
- lround(long double __x)
- { return __builtin_lroundl(__x); }
-
- template<typename _Tp>
- inline long
- lround(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return lround(__type(__x));
- }
-
- inline float
- nearbyint(float __x)
- { return __builtin_nearbyintf(__x); }
-
- inline long double
- nearbyint(long double __x)
- { return __builtin_nearbyintl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- nearbyint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return nearbyint(__type(__x));
- }
-
- inline float
- nextafter(float __x, float __y)
- { return __builtin_nextafterf(__x, __y); }
-
- inline long double
- nextafter(long double __x, long double __y)
- { return __builtin_nextafterl(__x, __y); }
-
- template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
- nextafter(_Tp __x, _Up __y)
- {
- typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return nextafter(__type(__x), __type(__y));
- }
-
- inline float
- nexttoward(float __x, long double __y)
- { return __builtin_nexttowardf(__x, __y); }
-
- inline long double
- nexttoward(long double __x, long double __y)
- { return __builtin_nexttowardl(__x, __y); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- nexttoward(_Tp __x, long double __y)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return nexttoward(__type(__x), __y);
- }
-
- // DR 550. What should the return type of pow(float,int) be?
- // NB: C++0x and TR1 != C++03.
- // using std::pow;
-
- inline float
- remainder(float __x, float __y)
- { return __builtin_remainderf(__x, __y); }
-
- inline long double
- remainder(long double __x, long double __y)
- { return __builtin_remainderl(__x, __y); }
-
- template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
- remainder(_Tp __x, _Up __y)
- {
- typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return remainder(__type(__x), __type(__y));
- }
-
- inline float
- remquo(float __x, float __y, int* __pquo)
- { return __builtin_remquof(__x, __y, __pquo); }
-
- inline long double
- remquo(long double __x, long double __y, int* __pquo)
- { return __builtin_remquol(__x, __y, __pquo); }
-
- template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
- remquo(_Tp __x, _Up __y, int* __pquo)
- {
- typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return remquo(__type(__x), __type(__y), __pquo);
- }
-
- inline float
- rint(float __x)
- { return __builtin_rintf(__x); }
-
- inline long double
- rint(long double __x)
- { return __builtin_rintl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- rint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return rint(__type(__x));
- }
-
- inline float
- round(float __x)
- { return __builtin_roundf(__x); }
-
- inline long double
- round(long double __x)
- { return __builtin_roundl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- round(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return round(__type(__x));
- }
-
- inline float
- scalbln(float __x, long __ex)
- { return __builtin_scalblnf(__x, __ex); }
-
- inline long double
- scalbln(long double __x, long __ex)
- { return __builtin_scalblnl(__x, __ex); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- scalbln(_Tp __x, long __ex)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return scalbln(__type(__x), __ex);
- }
-
- inline float
- scalbn(float __x, int __ex)
- { return __builtin_scalbnf(__x, __ex); }
-
- inline long double
- scalbn(long double __x, int __ex)
- { return __builtin_scalbnl(__x, __ex); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- scalbn(_Tp __x, int __ex)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return scalbn(__type(__x), __ex);
- }
-
- using std::sin;
- using std::sinh;
- using std::sqrt;
- using std::tan;
- using std::tanh;
-
- inline float
- tgamma(float __x)
- { return __builtin_tgammaf(__x); }
-
- inline long double
- tgamma(long double __x)
- { return __builtin_tgammal(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- tgamma(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return tgamma(__type(__x));
- }
-
- inline float
- trunc(float __x)
- { return __builtin_truncf(__x); }
-
- inline long double
- trunc(long double __x)
- { return __builtin_truncl(__x); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- trunc(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return trunc(__type(__x));
- }
-
-#endif
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
diff --git a/libstdc++-v3/include/tr1_impl/complex b/libstdc++-v3/include/tr1_impl/complex
deleted file mode 100644
index aae4a1381ad..00000000000
--- a/libstdc++-v3/include/tr1_impl/complex
+++ /dev/null
@@ -1,370 +0,0 @@
-// TR1 complex -*- C++ -*-
-
-// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/complex
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
- /**
- * @addtogroup complex_numbers
- * @{
- */
-
- // Forward declarations.
- template<typename _Tp> std::complex<_Tp> acos(const std::complex<_Tp>&);
- template<typename _Tp> std::complex<_Tp> asin(const std::complex<_Tp>&);
- template<typename _Tp> std::complex<_Tp> atan(const std::complex<_Tp>&);
-
- template<typename _Tp> std::complex<_Tp> acosh(const std::complex<_Tp>&);
- template<typename _Tp> std::complex<_Tp> asinh(const std::complex<_Tp>&);
- template<typename _Tp> std::complex<_Tp> atanh(const std::complex<_Tp>&);
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- // DR 595.
- template<typename _Tp> _Tp fabs(const std::complex<_Tp>&);
-#else
- template<typename _Tp> std::complex<_Tp> fabs(const std::complex<_Tp>&);
-#endif
-
- template<typename _Tp>
- inline std::complex<_Tp>
- __complex_acos(const std::complex<_Tp>& __z)
- {
- const std::complex<_Tp> __t = std::_GLIBCXX_TR1 asin(__z);
- const _Tp __pi_2 = 1.5707963267948966192313216916397514L;
- return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag());
- }
-
-#if _GLIBCXX_USE_C99_COMPLEX_TR1
- inline __complex__ float
- __complex_acos(__complex__ float __z)
- { return __builtin_cacosf(__z); }
-
- inline __complex__ double
- __complex_acos(__complex__ double __z)
- { return __builtin_cacos(__z); }
-
- inline __complex__ long double
- __complex_acos(const __complex__ long double& __z)
- { return __builtin_cacosl(__z); }
-
- template<typename _Tp>
- inline std::complex<_Tp>
- acos(const std::complex<_Tp>& __z)
- { return __complex_acos(__z.__rep()); }
-#else
- /// acos(__z) [8.1.2].
- // Effects: Behaves the same as C99 function cacos, defined
- // in subclause 7.3.5.1.
- template<typename _Tp>
- inline std::complex<_Tp>
- acos(const std::complex<_Tp>& __z)
- { return __complex_acos(__z); }
-#endif
-
- template<typename _Tp>
- inline std::complex<_Tp>
- __complex_asin(const std::complex<_Tp>& __z)
- {
- std::complex<_Tp> __t(-__z.imag(), __z.real());
- __t = std::_GLIBCXX_TR1 asinh(__t);
- return std::complex<_Tp>(__t.imag(), -__t.real());
- }
-
-#if _GLIBCXX_USE_C99_COMPLEX_TR1
- inline __complex__ float
- __complex_asin(__complex__ float __z)
- { return __builtin_casinf(__z); }
-
- inline __complex__ double
- __complex_asin(__complex__ double __z)
- { return __builtin_casin(__z); }
-
- inline __complex__ long double
- __complex_asin(const __complex__ long double& __z)
- { return __builtin_casinl(__z); }
-
- template<typename _Tp>
- inline std::complex<_Tp>
- asin(const std::complex<_Tp>& __z)
- { return __complex_asin(__z.__rep()); }
-#else
- /// asin(__z) [8.1.3].
- // Effects: Behaves the same as C99 function casin, defined
- // in subclause 7.3.5.2.
- template<typename _Tp>
- inline std::complex<_Tp>
- asin(const std::complex<_Tp>& __z)
- { return __complex_asin(__z); }
-#endif
-
- template<typename _Tp>
- std::complex<_Tp>
- __complex_atan(const std::complex<_Tp>& __z)
- {
- const _Tp __r2 = __z.real() * __z.real();
- const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();
-
- _Tp __num = __z.imag() + _Tp(1.0);
- _Tp __den = __z.imag() - _Tp(1.0);
-
- __num = __r2 + __num * __num;
- __den = __r2 + __den * __den;
-
- return std::complex<_Tp>(_Tp(0.5) * atan2(_Tp(2.0) * __z.real(), __x),
- _Tp(0.25) * log(__num / __den));
- }
-
-#if _GLIBCXX_USE_C99_COMPLEX_TR1
- inline __complex__ float
- __complex_atan(__complex__ float __z)
- { return __builtin_catanf(__z); }
-
- inline __complex__ double
- __complex_atan(__complex__ double __z)
- { return __builtin_catan(__z); }
-
- inline __complex__ long double
- __complex_atan(const __complex__ long double& __z)
- { return __builtin_catanl(__z); }
-
- template<typename _Tp>
- inline std::complex<_Tp>
- atan(const std::complex<_Tp>& __z)
- { return __complex_atan(__z.__rep()); }
-#else
- /// atan(__z) [8.1.4].
- // Effects: Behaves the same as C99 function catan, defined
- // in subclause 7.3.5.3.
- template<typename _Tp>
- inline std::complex<_Tp>
- atan(const std::complex<_Tp>& __z)
- { return __complex_atan(__z); }
-#endif
-
- template<typename _Tp>
- std::complex<_Tp>
- __complex_acosh(const std::complex<_Tp>& __z)
- {
- std::complex<_Tp> __t((__z.real() - __z.imag())
- * (__z.real() + __z.imag()) - _Tp(1.0),
- _Tp(2.0) * __z.real() * __z.imag());
- __t = std::sqrt(__t);
-
- return std::log(__t + __z);
- }
-
-#if _GLIBCXX_USE_C99_COMPLEX_TR1
- inline __complex__ float
- __complex_acosh(__complex__ float __z)
- { return __builtin_cacoshf(__z); }
-
- inline __complex__ double
- __complex_acosh(__complex__ double __z)
- { return __builtin_cacosh(__z); }
-
- inline __complex__ long double
- __complex_acosh(const __complex__ long double& __z)
- { return __builtin_cacoshl(__z); }
-
- template<typename _Tp>
- inline std::complex<_Tp>
- acosh(const std::complex<_Tp>& __z)
- { return __complex_acosh(__z.__rep()); }
-#else
- /// acosh(__z) [8.1.5].
- // Effects: Behaves the same as C99 function cacosh, defined
- // in subclause 7.3.6.1.
- template<typename _Tp>
- inline std::complex<_Tp>
- acosh(const std::complex<_Tp>& __z)
- { return __complex_acosh(__z); }
-#endif
-
- template<typename _Tp>
- std::complex<_Tp>
- __complex_asinh(const std::complex<_Tp>& __z)
- {
- std::complex<_Tp> __t((__z.real() - __z.imag())
- * (__z.real() + __z.imag()) + _Tp(1.0),
- _Tp(2.0) * __z.real() * __z.imag());
- __t = std::sqrt(__t);
-
- return std::log(__t + __z);
- }
-
-#if _GLIBCXX_USE_C99_COMPLEX_TR1
- inline __complex__ float
- __complex_asinh(__complex__ float __z)
- { return __builtin_casinhf(__z); }
-
- inline __complex__ double
- __complex_asinh(__complex__ double __z)
- { return __builtin_casinh(__z); }
-
- inline __complex__ long double
- __complex_asinh(const __complex__ long double& __z)
- { return __builtin_casinhl(__z); }
-
- template<typename _Tp>
- inline std::complex<_Tp>
- asinh(const std::complex<_Tp>& __z)
- { return __complex_asinh(__z.__rep()); }
-#else
- /// asinh(__z) [8.1.6].
- // Effects: Behaves the same as C99 function casin, defined
- // in subclause 7.3.6.2.
- template<typename _Tp>
- inline std::complex<_Tp>
- asinh(const std::complex<_Tp>& __z)
- { return __complex_asinh(__z); }
-#endif
-
- template<typename _Tp>
- std::complex<_Tp>
- __complex_atanh(const std::complex<_Tp>& __z)
- {
- const _Tp __i2 = __z.imag() * __z.imag();
- const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();
-
- _Tp __num = _Tp(1.0) + __z.real();
- _Tp __den = _Tp(1.0) - __z.real();
-
- __num = __i2 + __num * __num;
- __den = __i2 + __den * __den;
-
- return std::complex<_Tp>(_Tp(0.25) * (log(__num) - log(__den)),
- _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
- }
-
-#if _GLIBCXX_USE_C99_COMPLEX_TR1
- inline __complex__ float
- __complex_atanh(__complex__ float __z)
- { return __builtin_catanhf(__z); }
-
- inline __complex__ double
- __complex_atanh(__complex__ double __z)
- { return __builtin_catanh(__z); }
-
- inline __complex__ long double
- __complex_atanh(const __complex__ long double& __z)
- { return __builtin_catanhl(__z); }
-
- template<typename _Tp>
- inline std::complex<_Tp>
- atanh(const std::complex<_Tp>& __z)
- { return __complex_atanh(__z.__rep()); }
-#else
- /// atanh(__z) [8.1.7].
- // Effects: Behaves the same as C99 function catanh, defined
- // in subclause 7.3.6.3.
- template<typename _Tp>
- inline std::complex<_Tp>
- atanh(const std::complex<_Tp>& __z)
- { return __complex_atanh(__z); }
-#endif
-
- template<typename _Tp>
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- inline _Tp
-#else
- inline std::complex<_Tp>
-#endif
- /// fabs(__z) [8.1.8].
- // Effects: Behaves the same as C99 function cabs, defined
- // in subclause 7.3.8.1.
- fabs(const std::complex<_Tp>& __z)
- { return std::abs(__z); }
-
- /// Additional overloads [8.1.9].
-#if (defined(_GLIBCXX_INCLUDE_AS_CXX0X) \
- || (defined(_GLIBCXX_INCLUDE_AS_TR1) \
- && !defined(__GXX_EXPERIMENTAL_CXX0X__)))
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- arg(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
-#if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
- return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
- : __type();
-#else
- return std::arg(std::complex<__type>(__x));
-#endif
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- imag(_Tp)
- { return _Tp(); }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- norm(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return __type(__x) * __type(__x);
- }
-
- template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
- real(_Tp __x)
- { return __x; }
-
-#endif
-
- template<typename _Tp, typename _Up>
- inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
- pow(const std::complex<_Tp>& __x, const _Up& __y)
- {
- typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return std::pow(std::complex<__type>(__x), __type(__y));
- }
-
- template<typename _Tp, typename _Up>
- inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
- pow(const _Tp& __x, const std::complex<_Up>& __y)
- {
- typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return std::pow(__type(__x), std::complex<__type>(__y));
- }
-
- template<typename _Tp, typename _Up>
- inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
- pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
- {
- typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return std::pow(std::complex<__type>(__x),
- std::complex<__type>(__y));
- }
-
- // @} group complex_numbers
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
diff --git a/libstdc++-v3/include/tr1_impl/cstdint b/libstdc++-v3/include/tr1_impl/cstdint
deleted file mode 100644
index d1403887a71..00000000000
--- a/libstdc++-v3/include/tr1_impl/cstdint
+++ /dev/null
@@ -1,75 +0,0 @@
-// TR1 cstdint -*- C++ -*-
-
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/cstdint
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#if _GLIBCXX_USE_C99_STDINT_TR1
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
- using ::int8_t;
- using ::int16_t;
- using ::int32_t;
- using ::int64_t;
-
- using ::int_fast8_t;
- using ::int_fast16_t;
- using ::int_fast32_t;
- using ::int_fast64_t;
-
- using ::int_least8_t;
- using ::int_least16_t;
- using ::int_least32_t;
- using ::int_least64_t;
-
- using ::intmax_t;
- using ::intptr_t;
-
- using ::uint8_t;
- using ::uint16_t;
- using ::uint32_t;
- using ::uint64_t;
-
- using ::uint_fast8_t;
- using ::uint_fast16_t;
- using ::uint_fast32_t;
- using ::uint_fast64_t;
-
- using ::uint_least8_t;
- using ::uint_least16_t;
- using ::uint_least32_t;
- using ::uint_least64_t;
-
- using ::uintmax_t;
- using ::uintptr_t;
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
-
-#endif
diff --git a/libstdc++-v3/include/tr1_impl/cstdio b/libstdc++-v3/include/tr1_impl/cstdio
deleted file mode 100644
index 8b100ccebc6..00000000000
--- a/libstdc++-v3/include/tr1_impl/cstdio
+++ /dev/null
@@ -1,44 +0,0 @@
-// TR1 cstdio -*- C++ -*-
-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/cstdio
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
-#if _GLIBCXX_USE_C99
- using std::snprintf;
- using std::vsnprintf;
-
- using std::vfscanf;
- using std::vscanf;
- using std::vsscanf;
-#endif
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
diff --git a/libstdc++-v3/include/tr1_impl/cstdlib b/libstdc++-v3/include/tr1_impl/cstdlib
deleted file mode 100644
index e9a590f0b58..00000000000
--- a/libstdc++-v3/include/tr1_impl/cstdlib
+++ /dev/null
@@ -1,65 +0,0 @@
-// TR1 cstdlib -*- C++ -*-
-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/cstdlib
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#if _GLIBCXX_HOSTED
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
-#if _GLIBCXX_USE_C99
-
-#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
- // types
- using std::lldiv_t;
-
- // functions
- using std::llabs;
- using std::lldiv;
-#endif
-
- using std::atoll;
- using std::strtoll;
- using std::strtoull;
-
- using std::strtof;
- using std::strtold;
-
- // overloads
- using std::abs;
-#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
- using std::div;
-#endif
-
-#endif
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
-
-#endif
diff --git a/libstdc++-v3/include/tr1_impl/cwchar b/libstdc++-v3/include/tr1_impl/cwchar
deleted file mode 100644
index 2a9004d40d4..00000000000
--- a/libstdc++-v3/include/tr1_impl/cwchar
+++ /dev/null
@@ -1,58 +0,0 @@
-// TR1 cwchar -*- C++ -*-
-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/cwchar
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#if _GLIBCXX_USE_WCHAR_T
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
-#if _GLIBCXX_HAVE_WCSTOF
- using std::wcstof;
-#endif
-#if _GLIBCXX_HAVE_VFWSCANF
- using std::vfwscanf;
-#endif
-#if _GLIBCXX_HAVE_VSWSCANF
- using std::vswscanf;
-#endif
-#if _GLIBCXX_HAVE_VWSCANF
- using std::vwscanf;
-#endif
-
-#if _GLIBCXX_USE_C99
- using std::wcstold;
- using std::wcstoll;
- using std::wcstoull;
-#endif
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
-
-#endif
diff --git a/libstdc++-v3/include/tr1_impl/cwctype b/libstdc++-v3/include/tr1_impl/cwctype
deleted file mode 100644
index 3135d364119..00000000000
--- a/libstdc++-v3/include/tr1_impl/cwctype
+++ /dev/null
@@ -1,43 +0,0 @@
-// TR1 cwctype -*- C++ -*-
-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/cwctype
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#if _GLIBCXX_USE_WCHAR_T
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
-#if _GLIBCXX_HAVE_ISWBLANK
- using std::iswblank;
-#endif
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
-
-#endif
diff --git a/libstdc++-v3/include/tr1_impl/regex b/libstdc++-v3/include/tr1_impl/regex
deleted file mode 100644
index efe79e95477..00000000000
--- a/libstdc++-v3/include/tr1_impl/regex
+++ /dev/null
@@ -1,2710 +0,0 @@
-// class template regex -*- C++ -*-
-
-// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/**
- * @file tr1_impl/regex
- * @brief The common implementation file for tr1 and std regular expressions.
- *
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
-/**
- * @defgroup tr1_regex Regular Expressions
- * A facility for performing regular expression pattern matching.
- */
- //@{
-
-/** @namespace std::regex_constants
- * @brief ISO C++ 0x entities sub namespace for regex.
- */
-namespace regex_constants
-{
- /**
- * @name 5.1 Regular Expression Syntax Options
- */
- //@{
- enum __syntax_option
- {
- _S_icase,
- _S_nosubs,
- _S_optimize,
- _S_collate,
- _S_ECMAScript,
- _S_basic,
- _S_extended,
- _S_awk,
- _S_grep,
- _S_egrep,
- _S_syntax_last
- };
-
- /**
- * @brief This is a bitmask type indicating how to interpret the regex.
- *
- * The @c syntax_option_type is implementation defined but it is valid to
- * perform bitwise operations on these values and expect the right thing to
- * happen.
- *
- * A valid value of type syntax_option_type shall have exactly one of the
- * elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep
- * %set.
- */
- typedef unsigned int syntax_option_type;
-
- /**
- * Specifies that the matching of regular expressions against a character
- * sequence shall be performed without regard to case.
- */
- static const syntax_option_type icase = 1 << _S_icase;
-
- /**
- * Specifies that when a regular expression is matched against a character
- * container sequence, no sub-expression matches are to be stored in the
- * supplied match_results structure.
- */
- static const syntax_option_type nosubs = 1 << _S_nosubs;
-
- /**
- * Specifies that the regular expression engine should pay more attention to
- * the speed with which regular expressions are matched, and less to the
- * speed with which regular expression objects are constructed. Otherwise
- * it has no detectable effect on the program output.
- */
- static const syntax_option_type optimize = 1 << _S_optimize;
-
- /**
- * Specifies that character ranges of the form [a-b] should be locale
- * sensitive.
- */
- static const syntax_option_type collate = 1 << _S_collate;
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
- * Language Specification, Standard Ecma-262, third edition, 1999], as
- * modified in tr1 section [7.13]. This grammar is similar to that defined
- * in the PERL scripting language but extended with elements found in the
- * POSIX regular expression grammar.
- */
- static const syntax_option_type ECMAScript = 1 << _S_ECMAScript;
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
- * Portable Operating System Interface (POSIX), Base Definitions and
- * Headers, Section 9, Regular Expressions [IEEE, Information Technology --
- * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
- */
- static const syntax_option_type basic = 1 << _S_basic;
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
- * Portable Operating System Interface (POSIX), Base Definitions and Headers,
- * Section 9, Regular Expressions.
- */
- static const syntax_option_type extended = 1 << _S_extended;
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
- * identical to syntax_option_type extended, except that C-style escape
- * sequences are supported. These sequences are:
- * \\\\, \\a, \\b, \\f,
- * \\n, \\r, \\t , \\v,
- * \\&apos;, &apos;, and \\ddd
- * (where ddd is one, two, or three octal digits).
- */
- static const syntax_option_type awk = 1 << _S_awk;
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
- * identical to syntax_option_type basic, except that newlines are treated
- * as whitespace.
- */
- static const syntax_option_type grep = 1 << _S_grep;
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX utility grep when given the -E option in
- * IEEE Std 1003.1-2001. This option is identical to syntax_option_type
- * extended, except that newlines are treated as whitespace.
- */
- static const syntax_option_type egrep = 1 << _S_egrep;
-
- //@}
-
- /**
- * @name 5.2 Matching Rules
- *
- * Matching a regular expression against a sequence of characters [first,
- * last) proceeds according to the rules of the grammar specified for the
- * regular expression object, modified according to the effects listed
- * below for any bitmask elements set.
- *
- */
- //@{
-
- enum __match_flag
- {
- _S_not_bol,
- _S_not_eol,
- _S_not_bow,
- _S_not_eow,
- _S_any,
- _S_not_null,
- _S_continuous,
- _S_prev_avail,
- _S_sed,
- _S_no_copy,
- _S_first_only,
- _S_match_flag_last
- };
-
- /**
- * @brief This is a bitmask type indicating regex matching rules.
- *
- * The @c match_flag_type is implementation defined but it is valid to
- * perform bitwise operations on these values and expect the right thing to
- * happen.
- */
- typedef std::bitset<_S_match_flag_last> match_flag_type;
-
- /**
- * The default matching rules.
- */
- static const match_flag_type match_default = 0;
-
- /**
- * The first character in the sequence [first, last) is treated as though it
- * is not at the beginning of a line, so the character (^) in the regular
- * expression shall not match [first, first).
- */
- static const match_flag_type match_not_bol = 1 << _S_not_bol;
-
- /**
- * The last character in the sequence [first, last) is treated as though it
- * is not at the end of a line, so the character ($) in the regular
- * expression shall not match [last, last).
- */
- static const match_flag_type match_not_eol = 1 << _S_not_eol;
-
- /**
- * The expression \\b is not matched against the sub-sequence
- * [first,first).
- */
- static const match_flag_type match_not_bow = 1 << _S_not_bow;
-
- /**
- * The expression \\b should not be matched against the sub-sequence
- * [last,last).
- */
- static const match_flag_type match_not_eow = 1 << _S_not_eow;
-
- /**
- * If more than one match is possible then any match is an acceptable
- * result.
- */
- static const match_flag_type match_any = 1 << _S_any;
-
- /**
- * The expression does not match an empty sequence.
- */
- static const match_flag_type match_not_null = 1 << _S_not_null;
-
- /**
- * The expression only matches a sub-sequence that begins at first .
- */
- static const match_flag_type match_continuous = 1 << _S_continuous;
-
- /**
- * --first is a valid iterator position. When this flag is set then the
- * flags match_not_bol and match_not_bow are ignored by the regular
- * expression algorithms 7.11 and iterators 7.12.
- */
- static const match_flag_type match_prev_avail = 1 << _S_prev_avail;
-
- /**
- * When a regular expression match is to be replaced by a new string, the
- * new string is constructed using the rules used by the ECMAScript replace
- * function in ECMA- 262 [Ecma International, ECMAScript Language
- * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
- * String.prototype.replace. In addition, during search and replace
- * operations all non-overlapping occurrences of the regular expression
- * are located and replaced, and sections of the input that did not match
- * the expression are copied unchanged to the output string.
- *
- * Format strings (from ECMA-262 [15.5.4.11]):
- * @li $$ The dollar-sign itself ($)
- * @li $& The matched substring.
- * @li $` The portion of @a string that precedes the matched substring.
- * This would be match_results::prefix().
- * @li $' The portion of @a string that follows the matched substring.
- * This would be match_results::suffix().
- * @li $n The nth capture, where n is in [1,9] and $n is not followed by a
- * decimal digit. If n <= match_results::size() and the nth capture
- * is undefined, use the empty string instead. If n >
- * match_results::size(), the result is implementation-defined.
- * @li $nn The nnth capture, where nn is a two-digit decimal number on
- * [01, 99]. If nn <= match_results::size() and the nth capture is
- * undefined, use the empty string instead. If
- * nn > match_results::size(), the result is implementation-defined.
- */
- static const match_flag_type format_default = 0;
-
- /**
- * When a regular expression match is to be replaced by a new string, the
- * new string is constructed using the rules used by the POSIX sed utility
- * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
- * Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
- */
- static const match_flag_type format_sed = 1 << _S_sed;
-
- /**
- * During a search and replace operation, sections of the character
- * container sequence being searched that do not match the regular
- * expression shall not be copied to the output string.
- */
- static const match_flag_type format_no_copy = 1 << _S_no_copy;
-
- /**
- * When specified during a search and replace operation, only the first
- * occurrence of the regular expression shall be replaced.
- */
- static const match_flag_type format_first_only = 1 << _S_first_only;
-
- //@}
-
- /**
- * @name 5.3 Error Types
- */
- //@{
-
- enum error_type
- {
- _S_error_collate,
- _S_error_ctype,
- _S_error_escape,
- _S_error_backref,
- _S_error_brack,
- _S_error_paren,
- _S_error_brace,
- _S_error_badbrace,
- _S_error_range,
- _S_error_space,
- _S_error_badrepeat,
- _S_error_complexity,
- _S_error_stack,
- _S_error_last
- };
-
- /** The expression contained an invalid collating element name. */
- static const error_type error_collate(_S_error_collate);
-
- /** The expression contained an invalid character class name. */
- static const error_type error_ctype(_S_error_ctype);
-
- /**
- * The expression contained an invalid escaped character, or a trailing
- * escape.
- */
- static const error_type error_escape(_S_error_escape);
-
- /** The expression contained an invalid back reference. */
- static const error_type error_backref(_S_error_backref);
-
- /** The expression contained mismatched [ and ]. */
- static const error_type error_brack(_S_error_brack);
-
- /** The expression contained mismatched ( and ). */
- static const error_type error_paren(_S_error_paren);
-
- /** The expression contained mismatched { and } */
- static const error_type error_brace(_S_error_brace);
-
- /** The expression contained an invalid range in a {} expression. */
- static const error_type error_badbrace(_S_error_badbrace);
-
- /**
- * The expression contained an invalid character range,
- * such as [b-a] in most encodings.
- */
- static const error_type error_range(_S_error_range);
-
- /**
- * There was insufficient memory to convert the expression into a
- * finite state machine.
- */
- static const error_type error_space(_S_error_space);
-
- /**
- * One of <em>*?+{</em> was not preceded by a valid regular expression.
- */
- static const error_type error_badrepeat(_S_error_badrepeat);
-
- /**
- * The complexity of an attempted match against a regular expression
- * exceeded a pre-set level.
- */
- static const error_type error_complexity(_S_error_complexity);
-
- /**
- * There was insufficient memory to determine whether the
- * regular expression could match the specified character sequence.
- */
- static const error_type error_stack(_S_error_stack);
-
- //@}
-}
-
-
- // [7.8] Class regex_error
- /**
- * @brief A regular expression exception class.
- * @ingroup exceptions
- *
- * The regular expression library throws objects of this class on error.
- */
- class regex_error
- : public std::runtime_error
- {
- public:
- /**
- * @brief Constructs a regex_error object.
- *
- * @param ecode the regex error code.
- */
- explicit
- regex_error(regex_constants::error_type __ecode)
- : std::runtime_error("regex_error"), _M_code(__ecode)
- { }
-
- /**
- * @brief Gets the regex error code.
- *
- * @returns the regex error code.
- */
- regex_constants::error_type
- code() const
- { return _M_code; }
-
- protected:
- regex_constants::error_type _M_code;
- };
-
- // [7.7] Class regex_traits
- /**
- * @brief Describes aspects of a regular expression.
- *
- * A regular expression traits class that satisfies the requirements of tr1
- * section [7.2].
- *
- * The class %regex is parameterized around a set of related types and
- * functions used to complete the definition of its semantics. This class
- * satisfies the requirements of such a traits class.
- */
- template<typename _Ch_type>
- struct regex_traits
- {
- public:
- typedef _Ch_type char_type;
- typedef std::basic_string<char_type> string_type;
- typedef std::locale locale_type;
- typedef std::ctype_base::mask char_class_type;
-
- public:
- /**
- * @brief Constructs a default traits object.
- */
- regex_traits()
- { }
-
- /**
- * @brief Gives the length of a C-style string starting at @p __p.
- *
- * @param __p a pointer to the start of a character sequence.
- *
- * @returns the number of characters between @p *__p and the first
- * default-initialized value of type @p char_type. In other words, uses
- * the C-string algorithm for determining the length of a sequence of
- * characters.
- */
- static std::size_t
- length(const char_type* __p)
- { return string_type::traits_type::length(__p); }
-
- /**
- * @brief Performs the identity translation.
- *
- * @param c A character to the locale-specific character set.
- *
- * @returns c.
- */
- char_type
- translate(char_type __c) const
- { return __c; }
-
- /**
- * @brief Translates a character into a case-insensitive equivalent.
- *
- * @param c A character to the locale-specific character set.
- *
- * @returns the locale-specific lower-case equivalent of c.
- * @throws std::bad_cast if the imbued locale does not support the ctype
- * facet.
- */
- char_type
- translate_nocase(char_type __c) const
- {
- using std::ctype;
- using std::use_facet;
- return use_facet<ctype<char_type> >(_M_locale).tolower(__c);
- }
-
- /**
- * @brief Gets a sort key for a character sequence.
- *
- * @param first beginning of the character sequence.
- * @param last one-past-the-end of the character sequence.
- *
- * Returns a sort key for the character sequence designated by the
- * iterator range [F1, F2) such that if the character sequence [G1, G2)
- * sorts before the character sequence [H1, H2) then
- * v.transform(G1, G2) < v.transform(H1, H2).
- *
- * What this really does is provide a more efficient way to compare a
- * string to multiple other strings in locales with fancy collation
- * rules and equivalence classes.
- *
- * @returns a locale-specific sort key equivalent to the input range.
- *
- * @throws std::bad_cast if the current locale does not have a collate
- * facet.
- */
- template<typename _Fwd_iter>
- string_type
- transform(_Fwd_iter __first, _Fwd_iter __last) const
- {
- using std::collate;
- using std::use_facet;
- const collate<_Ch_type>& __c(use_facet<
- collate<_Ch_type> >(_M_locale));
- string_type __s(__first, __last);
- return __c.transform(__s.data(), __s.data() + __s.size());
- }
-
- /**
- * @brief Dunno.
- *
- * @param first beginning of the character sequence.
- * @param last one-past-the-end of the character sequence.
- *
- * Effects: if typeid(use_facet<collate<_Ch_type> >) ==
- * typeid(collate_byname<_Ch_type>) and the form of the sort key
- * returned by collate_byname<_Ch_type>::transform(first, last) is known
- * and can be converted into a primary sort key then returns that key,
- * otherwise returns an empty string. WTF??
- *
- * @todo Implement this function.
- */
- template<typename _Fwd_iter>
- string_type
- transform_primary(_Fwd_iter __first, _Fwd_iter __last) const;
-
- /**
- * @brief Gets a collation element by name.
- *
- * @param first beginning of the collation element name.
- * @param last one-past-the-end of the collation element name.
- *
- * @returns a sequence of one or more characters that represents the
- * collating element consisting of the character sequence designated by
- * the iterator range [first, last). Returns an empty string if the
- * character sequence is not a valid collating element.
- *
- * @todo Implement this function.
- */
- template<typename _Fwd_iter>
- string_type
- lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const;
-
- /**
- * @brief Maps one or more characters to a named character
- * classification.
- *
- * @param first beginning of the character sequence.
- * @param last one-past-the-end of the character sequence.
- *
- * @returns an unspecified value that represents the character
- * classification named by the character sequence designated by the
- * iterator range [first, last). The value returned shall be independent
- * of the case of the characters in the character sequence. If the name
- * is not recognized then returns a value that compares equal to 0.
- *
- * At least the following names (or their wide-character equivalent) are
- * supported.
- * - d
- * - w
- * - s
- * - alnum
- * - alpha
- * - blank
- * - cntrl
- * - digit
- * - graph
- * - lower
- * - print
- * - punct
- * - space
- * - upper
- * - xdigit
- *
- * @todo Implement this function.
- */
- template<typename _Fwd_iter>
- char_class_type
- lookup_classname(_Fwd_iter __first, _Fwd_iter __last) const;
-
- /**
- * @brief Determines if @p c is a member of an identified class.
- *
- * @param c a character.
- * @param f a class type (as returned from lookup_classname).
- *
- * @returns true if the character @p c is a member of the classification
- * represented by @p f, false otherwise.
- *
- * @throws std::bad_cast if the current locale does not have a ctype
- * facet.
- */
- bool
- isctype(_Ch_type __c, char_class_type __f) const;
-
- /**
- * @brief Converts a digit to an int.
- *
- * @param ch a character representing a digit.
- * @param radix the radix if the numeric conversion (limited to 8, 10,
- * or 16).
- *
- * @returns the value represented by the digit ch in base radix if the
- * character ch is a valid digit in base radix; otherwise returns -1.
- */
- int
- value(_Ch_type __ch, int __radix) const;
-
- /**
- * @brief Imbues the regex_traits object with a copy of a new locale.
- *
- * @param loc A locale.
- *
- * @returns a copy of the previous locale in use by the regex_traits
- * object.
- *
- * @note Calling imbue with a different locale than the one currently in
- * use invalidates all cached data held by *this.
- */
- locale_type
- imbue(locale_type __loc)
- {
- std::swap(_M_locale, __loc);
- return __loc;
- }
-
- /**
- * @brief Gets a copy of the current locale in use by the regex_traits
- * object.
- */
- locale_type
- getloc() const
- { return _M_locale; }
-
- protected:
- locale_type _M_locale;
- };
-
- template<typename _Ch_type>
- bool regex_traits<_Ch_type>::
- isctype(_Ch_type __c, char_class_type __f) const
- {
- using std::ctype;
- using std::use_facet;
- const ctype<_Ch_type>& __ctype(use_facet<
- ctype<_Ch_type> >(_M_locale));
-
- if (__ctype.is(__c, __f))
- return true;
-
- // special case of underscore in [[:w:]]
- if (__c == __ctype.widen('_'))
- {
- const char* const __wb[] = "w";
- char_class_type __wt = this->lookup_classname(__wb,
- __wb + sizeof(__wb));
- if (__f | __wt)
- return true;
- }
-
- // special case of [[:space:]] in [[:blank:]]
- if (__c == __ctype.isspace(__c))
- {
- const char* const __bb[] = "blank";
- char_class_type __bt = this->lookup_classname(__bb,
- __bb + sizeof(__bb));
- if (__f | __bt)
- return true;
- }
-
- return false;
- }
-
- template<typename _Ch_type>
- int regex_traits<_Ch_type>::
- value(_Ch_type __ch, int __radix) const
- {
- std::basic_istringstream<_Ch_type> __is(string_type(1, __ch));
- int __v;
- if (__radix == 8)
- __is >> std::oct;
- else if (__radix == 16)
- __is >> std::hex;
- __is >> __v;
- return __is.fail() ? -1 : __v;
- }
-
- // [7.8] Class basic_regex
- /**
- * Objects of specializations of this class represent regular expressions
- * constructed from sequences of character type @p _Ch_type.
- *
- * Storage for the regular expression is allocated and deallocated as
- * necessary by the member functions of this class.
- */
- template<typename _Ch_type, typename _Rx_traits = regex_traits<_Ch_type> >
- class basic_regex
- {
- public:
- // types:
- typedef _Ch_type value_type;
- typedef regex_constants::syntax_option_type flag_type;
- typedef typename _Rx_traits::locale_type locale_type;
- typedef typename _Rx_traits::string_type string_type;
-
- /**
- * @name Constants
- * tr1 [7.8.1] std [28.8.1]
- */
- //@{
- static const regex_constants::syntax_option_type icase
- = regex_constants::icase;
- static const regex_constants::syntax_option_type nosubs
- = regex_constants::nosubs;
- static const regex_constants::syntax_option_type optimize
- = regex_constants::optimize;
- static const regex_constants::syntax_option_type collate
- = regex_constants::collate;
- static const regex_constants::syntax_option_type ECMAScript
- = regex_constants::ECMAScript;
- static const regex_constants::syntax_option_type basic
- = regex_constants::basic;
- static const regex_constants::syntax_option_type extended
- = regex_constants::extended;
- static const regex_constants::syntax_option_type awk
- = regex_constants::awk;
- static const regex_constants::syntax_option_type grep
- = regex_constants::grep;
- static const regex_constants::syntax_option_type egrep
- = regex_constants::egrep;
- //@}
-
- // [7.8.2] construct/copy/destroy
- /**
- * Constructs a basic regular expression that does not match any
- * character sequence.
- */
- basic_regex()
- : _M_flags(regex_constants::ECMAScript), _M_pattern(), _M_mark_count(0)
- { _M_compile(); }
-
- /**
- * @brief Constructs a basic regular expression from the sequence
- * [p, p + char_traits<_Ch_type>::length(p)) interpreted according to the
- * flags in @p f.
- *
- * @param p A pointer to the start of a C-style null-terminated string
- * containing a regular expression.
- * @param f Flags indicating the syntax rules and options.
- *
- * @throws regex_error if @p p is not a valid regular expression.
- */
- explicit
- basic_regex(const _Ch_type* __p,
- flag_type __f = regex_constants::ECMAScript)
- : _M_flags(__f), _M_pattern(__p), _M_mark_count(0)
- { _M_compile(); }
-
- /**
- * @brief Constructs a basic regular expression from the sequence
- * [p, p + len) interpreted according to the flags in @p f.
- *
- * @param p A pointer to the start of a string containing a regular
- * expression.
- * @param len The length of the string containing the regular expression.
- * @param f Flags indicating the syntax rules and options.
- *
- * @throws regex_error if @p p is not a valid regular expression.
- */
- basic_regex(const _Ch_type* __p, std::size_t __len, flag_type __f)
- : _M_flags(__f) , _M_pattern(__p, __len), _M_mark_count(0)
- { _M_compile(); }
-
- /**
- * @brief Copy-constructs a basic regular expression.
- *
- * @param rhs A @p regex object.
- */
- basic_regex(const basic_regex& __rhs)
- : _M_flags(__rhs._M_flags), _M_pattern(__rhs._M_pattern),
- _M_mark_count(__rhs._M_mark_count)
- { _M_compile(); }
-
- /**
- * @brief Constructs a basic regular expression from the string
- * @p s interpreted according to the flags in @p f.
- *
- * @param s A string containing a regular expression.
- * @param f Flags indicating the syntax rules and options.
- *
- * @throws regex_error if @p s is not a valid regular expression.
- */
- template<typename _Ch_traits, typename _Ch_alloc>
- explicit
- basic_regex(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
- flag_type __f = regex_constants::ECMAScript)
- : _M_flags(__f), _M_pattern(__s.begin(), __s.end()), _M_mark_count(0)
- { _M_compile(); }
-
- /**
- * @brief Constructs a basic regular expression from the range
- * [first, last) interpreted according to the flags in @p f.
- *
- * @param first The start of a range containing a valid regular
- * expression.
- * @param last The end of a range containing a valid regular
- * expression.
- * @param f The format flags of the regular expression.
- *
- * @throws regex_error if @p [first, last) is not a valid regular
- * expression.
- */
- template<typename _InputIterator>
- basic_regex(_InputIterator __first, _InputIterator __last,
- flag_type __f = regex_constants::ECMAScript)
- : _M_flags(__f), _M_pattern(__first, __last), _M_mark_count(0)
- { _M_compile(); }
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- /**
- * @brief Constructs a basic regular expression from an initializer list.
- *
- * @param l The initializer list.
- * @param f The format flags of the regular expression.
- *
- * @throws regex_error if @p l is not a valid regular expression.
- */
- basic_regex(initializer_list<_Ch_type> __l,
- flag_type __f = regex_constants::ECMAScript)
- : _M_flags(__f), _M_pattern(__l.begin(), __l.end()), _M_mark_count(0)
- { _M_compile(); }
-#endif
-
- /**
- * @brief Destroys a basic regular expression.
- */
- ~basic_regex()
- { }
-
- /**
- * @brief Assigns one regular expression to another.
- */
- basic_regex&
- operator=(const basic_regex& __rhs)
- { return this->assign(__rhs); }
-
- /**
- * @brief Replaces a regular expression with a new one constructed from
- * a C-style null-terminated string.
- *
- * @param A pointer to the start of a null-terminated C-style string
- * containing a regular expression.
- */
- basic_regex&
- operator=(const _Ch_type* __p)
- { return this->assign(__p, flags()); }
-
- /**
- * @brief Replaces a regular expression with a new one constructed from
- * a string.
- *
- * @param A pointer to a string containing a regular expression.
- */
- template<typename _Ch_typeraits, typename _Allocator>
- basic_regex&
- operator=(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s)
- { return this->assign(__s, flags()); }
-
- // [7.8.3] assign
- /**
- * @brief the real assignment operator.
- *
- * @param that Another regular expression object.
- */
- basic_regex&
- assign(const basic_regex& __that)
- {
- basic_regex __tmp(__that);
- this->swap(__tmp);
- return *this;
- }
-
- /**
- * @brief Assigns a new regular expression to a regex object from a
- * C-style null-terminated string containing a regular expression
- * pattern.
- *
- * @param p A pointer to a C-style null-terminated string containing
- * a regular expression pattern.
- * @param flags Syntax option flags.
- *
- * @throws regex_error if p does not contain a valid regular expression
- * pattern interpreted according to @p flags. If regex_error is thrown,
- * *this remains unchanged.
- */
- basic_regex&
- assign(const _Ch_type* __p,
- flag_type __flags = regex_constants::ECMAScript)
- { return this->assign(string_type(__p), __flags); }
-
- /**
- * @brief Assigns a new regular expression to a regex object from a
- * C-style string containing a regular expression pattern.
- *
- * @param p A pointer to a C-style string containing a
- * regular expression pattern.
- * @param len The length of the regular expression pattern string.
- * @param flags Syntax option flags.
- *
- * @throws regex_error if p does not contain a valid regular expression
- * pattern interpreted according to @p flags. If regex_error is thrown,
- * *this remains unchanged.
- */
- basic_regex&
- assign(const _Ch_type* __p, std::size_t __len, flag_type __flags)
- { return this->assign(string_type(__p, __len), __flags); }
-
- /**
- * @brief Assigns a new regular expression to a regex object from a
- * string containing a regular expression pattern.
- *
- * @param s A string containing a regular expression pattern.
- * @param flags Syntax option flags.
- *
- * @throws regex_error if p does not contain a valid regular expression
- * pattern interpreted according to @p flags. If regex_error is thrown,
- * *this remains unchanged.
- */
- template<typename _Ch_typeraits, typename _Allocator>
- basic_regex&
- assign(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s,
- flag_type __f = regex_constants::ECMAScript)
- {
- basic_regex __tmp(__s, __f);
- this->swap(__tmp);
- return *this;
- }
-
- /**
- * @brief Assigns a new regular expression to a regex object.
- *
- * @param first The start of a range containing a valid regular
- * expression.
- * @param last The end of a range containing a valid regular
- * expression.
- * @param flags Syntax option flags.
- *
- * @throws regex_error if p does not contain a valid regular expression
- * pattern interpreted according to @p flags. If regex_error is thrown,
- * the object remains unchanged.
- */
- template<typename _InputIterator>
- basic_regex&
- assign(_InputIterator __first, _InputIterator __last,
- flag_type __flags = regex_constants::ECMAScript)
- { return this->assign(string_type(__first, __last), __flags); }
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- /**
- * @brief Assigns a new regular expression to a regex object.
- *
- * @param l An initializer list representing a regular expression.
- * @param flags Syntax option flags.
- *
- * @throws regex_error if @p l does not contain a valid regular
- * expression pattern interpreted according to @p flags. If regex_error
- * is thrown, the object remains unchanged.
- */
- basic_regex&
- assign(initializer_list<_Ch_type> __l,
- flag_type __f = regex_constants::ECMAScript)
- { return this->assign(__l.begin(), __l.end(), __f); }
-#endif
-
- // [7.8.4] const operations
- /**
- * @brief Gets the number of marked subexpressions within the regular
- * expression.
- */
- unsigned int
- mark_count() const
- { return _M_mark_count; }
-
- /**
- * @brief Gets the flags used to construct the regular expression
- * or in the last call to assign().
- */
- flag_type
- flags() const
- { return _M_flags; }
-
- // [7.8.5] locale
- /**
- * @brief Imbues the regular expression object with the given locale.
- *
- * @param loc A locale.
- */
- locale_type
- imbue(locale_type __loc)
- { return _M_traits.imbue(__loc); }
-
- /**
- * @brief Gets the locale currently imbued in the regular expression
- * object.
- */
- locale_type
- getloc() const
- { return _M_traits.getloc(); }
-
- // [7.8.6] swap
- /**
- * @brief Swaps the contents of two regular expression objects.
- *
- * @param rhs Another regular expression object.
- */
- void
- swap(basic_regex& __rhs)
- {
- std::swap(_M_flags, __rhs._M_flags);
- std::swap(_M_pattern, __rhs._M_pattern);
- std::swap(_M_mark_count, __rhs._M_mark_count);
- std::swap(_M_traits, __rhs._M_traits);
- }
-
- private:
- /**
- * @brief Compiles a regular expression pattern into a NFA.
- * @todo Implement this function.
- */
- void _M_compile();
-
- protected:
- flag_type _M_flags;
- string_type _M_pattern;
- unsigned int _M_mark_count;
- _Rx_traits _M_traits;
- };
-
- /** @brief Standard regular expressions. */
- typedef basic_regex<char> regex;
-#ifdef _GLIBCXX_USE_WCHAR_T
- /** @brief Standard wide-character regular expressions. */
- typedef basic_regex<wchar_t> wregex;
-#endif
-
-
- // [7.8.6] basic_regex swap
- /**
- * @brief Swaps the contents of two regular expression objects.
- * @param lhs First regular expression.
- * @param rhs Second regular expression.
- */
- template<typename _Ch_type, typename _Rx_traits>
- inline void
- swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
- basic_regex<_Ch_type, _Rx_traits>& __rhs)
- { __lhs.swap(__rhs); }
-
-
- // [7.9] Class template sub_match
- /**
- * A sequence of characters matched by a particular marked sub-expression.
- *
- * An object of this class is essentially a pair of iterators marking a
- * matched subexpression within a regular expression pattern match. Such
- * objects can be converted to and compared with std::basic_string objects
- * of a similar base character type as the pattern matched by the regular
- * expression.
- *
- * The iterators that make up the pair are the usual half-open interval
- * referencing the actual original pattern matched.
- */
- template<typename _BiIter>
- class sub_match : public std::pair<_BiIter, _BiIter>
- {
- public:
- typedef typename iterator_traits<_BiIter>::value_type value_type;
- typedef typename iterator_traits<_BiIter>::difference_type
- difference_type;
- typedef _BiIter iterator;
-
- public:
- bool matched;
-
- /**
- * Gets the length of the matching sequence.
- */
- difference_type
- length() const
- { return this->matched ? std::distance(this->first, this->second) : 0; }
-
- /**
- * @brief Gets the matching sequence as a string.
- *
- * @returns the matching sequence as a string.
- *
- * This is the implicit conversion operator. It is identical to the
- * str() member function except that it will want to pop up in
- * unexpected places and cause a great deal of confusion and cursing
- * from the unwary.
- */
- operator basic_string<value_type>() const
- {
- return this->matched
- ? std::basic_string<value_type>(this->first, this->second)
- : std::basic_string<value_type>();
- }
-
- /**
- * @brief Gets the matching sequence as a string.
- *
- * @returns the matching sequence as a string.
- */
- basic_string<value_type>
- str() const
- {
- return this->matched
- ? std::basic_string<value_type>(this->first, this->second)
- : std::basic_string<value_type>();
- }
-
- /**
- * @brief Compares this and another matched sequence.
- *
- * @param s Another matched sequence to compare to this one.
- *
- * @retval <0 this matched sequence will collate before @p s.
- * @retval =0 this matched sequence is equivalent to @p s.
- * @retval <0 this matched sequence will collate after @p s.
- */
- int
- compare(const sub_match& __s) const
- { return this->str().compare(__s.str()); }
-
- /**
- * @brief Compares this sub_match to a string.
- *
- * @param s A string to compare to this sub_match.
- *
- * @retval <0 this matched sequence will collate before @p s.
- * @retval =0 this matched sequence is equivalent to @p s.
- * @retval <0 this matched sequence will collate after @p s.
- */
- int
- compare(const basic_string<value_type>& __s) const
- { return this->str().compare(__s); }
-
- /**
- * @brief Compares this sub_match to a C-style string.
- *
- * @param s A C-style string to compare to this sub_match.
- *
- * @retval <0 this matched sequence will collate before @p s.
- * @retval =0 this matched sequence is equivalent to @p s.
- * @retval <0 this matched sequence will collate after @p s.
- */
- int
- compare(const value_type* __s) const
- { return this->str().compare(__s); }
- };
-
-
- /** @brief Standard regex submatch over a C-style null-terminated string. */
- typedef sub_match<const char*> csub_match;
- /** @brief Standard regex submatch over a standard string. */
- typedef sub_match<string::const_iterator> ssub_match;
-#ifdef _GLIBCXX_USE_WCHAR_T
- /** @brief Regex submatch over a C-style null-terminated wide string. */
- typedef sub_match<const wchar_t*> wcsub_match;
- /** @brief Regex submatch over a standard wide string. */
- typedef sub_match<wstring::const_iterator> wssub_match;
-#endif
-
- // [7.9.2] sub_match non-member operators
-
- /**
- * @brief Tests the equivalence of two regular expression submatches.
- * @param lhs First regular expression submatch.
- * @param rhs Second regular expression submatch.
- * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
- */
- template<typename _BiIter>
- inline bool
- operator==(const sub_match<_BiIter>& __lhs,
- const sub_match<_BiIter>& __rhs)
- { return __lhs.compare(__rhs) == 0; }
-
- /**
- * @brief Tests the inequivalence of two regular expression submatches.
- * @param lhs First regular expression submatch.
- * @param rhs Second regular expression submatch.
- * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
- */
- template<typename _BiIter>
- inline bool
- operator!=(const sub_match<_BiIter>& __lhs,
- const sub_match<_BiIter>& __rhs)
- { return __lhs.compare(__rhs) != 0; }
-
- /**
- * @brief Tests the ordering of two regular expression submatches.
- * @param lhs First regular expression submatch.
- * @param rhs Second regular expression submatch.
- * @returns true if @a lhs precedes @a rhs, false otherwise.
- */
- template<typename _BiIter>
- inline bool
- operator<(const sub_match<_BiIter>& __lhs,
- const sub_match<_BiIter>& __rhs)
- { return __lhs.compare(__rhs) < 0; }
-
- /**
- * @brief Tests the ordering of two regular expression submatches.
- * @param lhs First regular expression submatch.
- * @param rhs Second regular expression submatch.
- * @returns true if @a lhs does not succeed @a rhs, false otherwise.
- */
- template<typename _BiIter>
- inline bool
- operator<=(const sub_match<_BiIter>& __lhs,
- const sub_match<_BiIter>& __rhs)
- { return __lhs.compare(__rhs) <= 0; }
-
- /**
- * @brief Tests the ordering of two regular expression submatches.
- * @param lhs First regular expression submatch.
- * @param rhs Second regular expression submatch.
- * @returns true if @a lhs does not precede @a rhs, false otherwise.
- */
- template<typename _BiIter>
- inline bool
- operator>=(const sub_match<_BiIter>& __lhs,
- const sub_match<_BiIter>& __rhs)
- { return __lhs.compare(__rhs) >= 0; }
-
- /**
- * @brief Tests the ordering of two regular expression submatches.
- * @param lhs First regular expression submatch.
- * @param rhs Second regular expression submatch.
- * @returns true if @a lhs succeeds @a rhs, false otherwise.
- */
- template<typename _BiIter>
- inline bool
- operator>(const sub_match<_BiIter>& __lhs,
- const sub_match<_BiIter>& __rhs)
- { return __lhs.compare(__rhs) > 0; }
-
- /**
- * @brief Tests the equivalence of a string and a regular expression
- * submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
- inline bool
- operator==(const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs == __rhs.str(); }
-
- /**
- * @brief Tests the inequivalence of a string and a regular expression
- * submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
- inline bool
- operator!=(const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
- { return __lhs != __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs precedes @a rhs, false otherwise.
- */
- template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
- inline bool
- operator<(const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
- { return __lhs < __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs succeeds @a rhs, false otherwise.
- */
- template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
- inline bool
- operator>(const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
- { return __lhs > __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs does not precede @a rhs, false otherwise.
- */
- template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
- inline bool
- operator>=(const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
- { return __lhs >= __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs does not succeed @a rhs, false otherwise.
- */
- template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
- inline bool
- operator<=(const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
- { return __lhs <= __rhs.str(); }
-
- /**
- * @brief Tests the equivalence of a regular expression submatch and a
- * string.
- * @param lhs A regular expression submatch.
- * @param rhs A string.
- * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
- inline bool
- operator==(const sub_match<_Bi_iter>& __lhs,
- const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __rhs)
- { return __lhs.str() == __rhs; }
-
- /**
- * @brief Tests the inequivalence of a regular expression submatch and a
- * string.
- * @param lhs A regular expression submatch.
- * @param rhs A string.
- * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
- inline bool
- operator!=(const sub_match<_Bi_iter>& __lhs,
- const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __rhs)
- { return __lhs.str() != __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A string.
- * @returns true if @a lhs precedes @a rhs, false otherwise.
- */
- template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
- inline bool
- operator<(const sub_match<_Bi_iter>& __lhs,
- const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __rhs)
- { return __lhs.str() < __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A string.
- * @returns true if @a lhs succeeds @a rhs, false otherwise.
- */
- template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
- inline bool
- operator>(const sub_match<_Bi_iter>& __lhs,
- const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __rhs)
- { return __lhs.str() > __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A string.
- * @returns true if @a lhs does not precede @a rhs, false otherwise.
- */
- template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
- inline bool
- operator>=(const sub_match<_Bi_iter>& __lhs,
- const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __rhs)
- { return __lhs.str() >= __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A string.
- * @returns true if @a lhs does not succeed @a rhs, false otherwise.
- */
- template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
- inline bool
- operator<=(const sub_match<_Bi_iter>& __lhs,
- const basic_string<
- typename iterator_traits<_Bi_iter>::value_type,
- _Ch_traits, _Ch_alloc>& __rhs)
- { return __lhs.str() <= __rhs; }
-
- /**
- * @brief Tests the equivalence of a C string and a regular expression
- * submatch.
- * @param lhs A C string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs == __rhs.str(); }
-
- /**
- * @brief Tests the inequivalence of an iterator value and a regular
- * expression submatch.
- * @param lhs A regular expression submatch.
- * @param rhs A string.
- * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs != __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs precedes @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs < __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs succeeds @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs > __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs does not precede @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs >= __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs does not succeed @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs <= __rhs.str(); }
-
- /**
- * @brief Tests the equivalence of a regular expression submatch and a
- * string.
- * @param lhs A regular expression submatch.
- * @param rhs A pointer to a string?
- * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator==(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const* __rhs)
- { return __lhs.str() == __rhs; }
-
- /**
- * @brief Tests the inequivalence of a regular expression submatch and a
- * string.
- * @param lhs A regular expression submatch.
- * @param rhs A pointer to a string.
- * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator!=(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const* __rhs)
- { return __lhs.str() != __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A string.
- * @returns true if @a lhs precedes @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator<(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const* __rhs)
- { return __lhs.str() < __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A string.
- * @returns true if @a lhs succeeds @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator>(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const* __rhs)
- { return __lhs.str() > __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A string.
- * @returns true if @a lhs does not precede @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator>=(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const* __rhs)
- { return __lhs.str() >= __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A string.
- * @returns true if @a lhs does not succeed @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator<=(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const* __rhs)
- { return __lhs.str() <= __rhs; }
-
- /**
- * @brief Tests the equivalence of a string and a regular expression
- * submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs == __rhs.str(); }
-
- /**
- * @brief Tests the inequivalence of a string and a regular expression
- * submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs != __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs precedes @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs < __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs succeeds @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs > __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs does not precede @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs >= __rhs.str(); }
-
- /**
- * @brief Tests the ordering of a string and a regular expression submatch.
- * @param lhs A string.
- * @param rhs A regular expression submatch.
- * @returns true if @a lhs does not succeed @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
- const sub_match<_Bi_iter>& __rhs)
- { return __lhs <= __rhs.str(); }
-
- /**
- * @brief Tests the equivalence of a regular expression submatch and a
- * string.
- * @param lhs A regular expression submatch.
- * @param rhs A const string reference.
- * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator==(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const& __rhs)
- { return __lhs.str() == __rhs; }
-
- /**
- * @brief Tests the inequivalence of a regular expression submatch and a
- * string.
- * @param lhs A regular expression submatch.
- * @param rhs A const string reference.
- * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator!=(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const& __rhs)
- { return __lhs.str() != __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A const string reference.
- * @returns true if @a lhs precedes @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator<(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const& __rhs)
- { return __lhs.str() < __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A const string reference.
- * @returns true if @a lhs succeeds @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator>(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const& __rhs)
- { return __lhs.str() > __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A const string reference.
- * @returns true if @a lhs does not precede @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator>=(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const& __rhs)
- { return __lhs.str() >= __rhs; }
-
- /**
- * @brief Tests the ordering of a regular expression submatch and a string.
- * @param lhs A regular expression submatch.
- * @param rhs A const string reference.
- * @returns true if @a lhs does not succeed @a rhs, false otherwise.
- */
- template<typename _Bi_iter>
- inline bool
- operator<=(const sub_match<_Bi_iter>& __lhs,
- typename iterator_traits<_Bi_iter>::value_type const& __rhs)
- { return __lhs.str() <= __rhs; }
-
- /**
- * @brief Inserts a matched string into an output stream.
- *
- * @param os The output stream.
- * @param m A submatch string.
- *
- * @returns the output stream with the submatch string inserted.
- */
- template<typename _Ch_type, typename _Ch_traits, typename _Bi_iter>
- inline
- basic_ostream<_Ch_type, _Ch_traits>&
- operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
- const sub_match<_Bi_iter>& __m)
- { return __os << __m.str(); }
-
- // [7.10] Class template match_results
- /**
- * @brief The results of a match or search operation.
- *
- * A collection of character sequences representing the result of a regular
- * expression match. Storage for the collection is allocated and freed as
- * necessary by the member functions of class template match_results.
- *
- * This class satisfies the Sequence requirements, with the exception that
- * only the operations defined for a const-qualified Sequence are supported.
- *
- * The sub_match object stored at index 0 represents sub-expression 0, i.e.
- * the whole match. In this case the sub_match member matched is always true.
- * The sub_match object stored at index n denotes what matched the marked
- * sub-expression n within the matched expression. If the sub-expression n
- * participated in a regular expression match then the sub_match member
- * matched evaluates to true, and members first and second denote the range
- * of characters [first, second) which formed that match. Otherwise matched
- * is false, and members first and second point to the end of the sequence
- * that was searched.
- *
- * @nosubgrouping
- */
- template<typename _Bi_iter,
- typename _Allocator = allocator<sub_match<_Bi_iter> > >
- class match_results
- : private std::vector<std::_GLIBCXX_TR1 sub_match<_Bi_iter>, _Allocator>
- {
- private:
- typedef std::vector<std::_GLIBCXX_TR1 sub_match<_Bi_iter>, _Allocator>
- _Base_type;
-
- public:
- /**
- * @name 10.? Public Types
- */
- //@{
- typedef sub_match<_Bi_iter> value_type;
- typedef typename _Allocator::const_reference const_reference;
- typedef const_reference reference;
- typedef typename _Base_type::const_iterator const_iterator;
- typedef const_iterator iterator;
- typedef typename iterator_traits<_Bi_iter>::difference_type
- difference_type;
- typedef typename _Allocator::size_type size_type;
- typedef _Allocator allocator_type;
- typedef typename iterator_traits<_Bi_iter>::value_type char_type;
- typedef basic_string<char_type> string_type;
- //@}
-
- public:
- /**
- * @name 10.1 Construction, Copying, and Destruction
- */
- //@{
-
- /**
- * @brief Constructs a default %match_results container.
- * @post size() returns 0 and str() returns an empty string.
- */
- explicit
- match_results(const _Allocator& __a = _Allocator())
- : _Base_type(__a), _M_matched(false)
- { }
-
- /**
- * @brief Copy constructs a %match_results.
- */
- match_results(const match_results& __rhs)
- : _Base_type(__rhs), _M_matched(__rhs._M_matched),
- _M_prefix(__rhs._M_prefix), _M_suffix(__rhs._M_suffix)
- { }
-
- /**
- * @brief Assigns rhs to *this.
- */
- match_results&
- operator=(const match_results& __rhs)
- {
- match_results __tmp(__rhs);
- this->swap(__tmp);
- return *this;
- }
-
- /**
- * @brief Destroys a %match_results object.
- */
- ~match_results()
- { }
-
- //@}
-
- /**
- * @name 10.2 Size
- */
- //@{
-
- /**
- * @brief Gets the number of matches and submatches.
- *
- * The number of matches for a given regular expression will be either 0
- * if there was no match or mark_count() + 1 if a match was successful.
- * Some matches may be empty.
- *
- * @returns the number of matches found.
- */
- size_type
- size() const
- { return _M_matched ? _Base_type::size() + 1 : 0; }
-
- //size_type
- //max_size() const;
- using _Base_type::max_size;
-
- /**
- * @brief Indicates if the %match_results contains no results.
- * @retval true The %match_results object is empty.
- * @retval false The %match_results object is not empty.
- */
- bool
- empty() const
- { return size() == 0; }
-
- //@}
-
- /**
- * @name 10.3 Element Access
- */
- //@{
-
- /**
- * @brief Gets the length of the indicated submatch.
- * @param sub indicates the submatch.
- *
- * This function returns the length of the indicated submatch, or the
- * length of the entire match if @p sub is zero (the default).
- */
- difference_type
- length(size_type __sub = 0) const
- { return _M_matched ? this->str(__sub).length() : 0; }
-
- /**
- * @brief Gets the offset of the beginning of the indicated submatch.
- * @param sub indicates the submatch.
- *
- * This function returns the offset from the beginning of the target
- * sequence to the beginning of the submatch, unless the value of @p sub
- * is zero (the default), in which case this function returns the offset
- * from the beginning of the target sequence to the beginning of the
- * match.
- */
- difference_type
- position(size_type __sub = 0) const
- {
- return _M_matched ? std::distance(this->prefix().first,
- (*this)[__sub].first) : 0;
- }
-
- /**
- * @brief Gets the match or submatch converted to a string type.
- * @param sub indicates the submatch.
- *
- * This function gets the submatch (or match, if @p sub is zero) extracted
- * from the target range and converted to the associated string type.
- */
- string_type
- str(size_type __sub = 0) const
- { return _M_matched ? (*this)[__sub].str() : string_type(); }
-
- /**
- * @brief Gets a %sub_match reference for the match or submatch.
- * @param sub indicates the submatch.
- *
- * This function gets a reference to the indicated submatch, or the entire
- * match if @p sub is zero.
- *
- * If @p sub >= size() then this function returns a %sub_match with a
- * special value indicating no submatch.
- */
- const_reference
- operator[](size_type __sub) const
- { return _Base_type::operator[](__sub); }
-
- /**
- * @brief Gets a %sub_match representing the match prefix.
- *
- * This function gets a reference to a %sub_match object representing the
- * part of the target range between the start of the target range and the
- * start of the match.
- */
- const_reference
- prefix() const
- { return _M_prefix; }
-
- /**
- * @brief Gets a %sub_match representing the match suffix.
- *
- * This function gets a reference to a %sub_match object representing the
- * part of the target range between the end of the match and the end of
- * the target range.
- */
- const_reference
- suffix() const
- { return _M_suffix; }
-
- /**
- * @brief Gets an iterator to the start of the %sub_match collection.
- */
- const_iterator
- begin() const
- { return _Base_type::begin(); }
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- /**
- * @brief Gets an iterator to the start of the %sub_match collection.
- */
- const_iterator
- cbegin() const
- { return _Base_type::begin(); }
-#endif
-
- /**
- * @brief Gets an iterator to one-past-the-end of the collection.
- */
- const_iterator
- end() const
- { return _Base_type::end(); }
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- /**
- * @brief Gets an iterator to one-past-the-end of the collection.
- */
- const_iterator
- cend() const
- { return _Base_type::end(); }
-#endif
-
- //@}
-
- /**
- * @name 10.4 Formatting
- *
- * These functions perform formatted substitution of the matched character
- * sequences into their target. The format specifiers and escape sequences
- * accepted by these functions are determined by their @p flags parameter
- * as documented above.
- */
- //@{
-
- /**
- * @todo Implement this function.
- */
- template<typename _Out_iter>
- _Out_iter
- format(_Out_iter __out, const string_type& __fmt,
- regex_constants::match_flag_type __flags
- = regex_constants::format_default) const;
-
- /**
- * @todo Implement this function.
- */
- string_type
- format(const string_type& __fmt,
- regex_constants::match_flag_type __flags
- = regex_constants::format_default) const;
-
- //@}
-
- /**
- * @name 10.5 Allocator
- */
- //@{
-
- /**
- * @brief Gets a copy of the allocator.
- */
- //allocator_type
- //get_allocator() const;
- using _Base_type::get_allocator;
-
- //@}
-
- /**
- * @name 10.6 Swap
- */
- //@{
-
- /**
- * @brief Swaps the contents of two match_results.
- */
- void
- swap(match_results& __that)
- {
- _Base_type::swap(__that);
- std::swap(_M_matched, __that._M_matched);
- std::swap(_M_prefix, __that._M_prefix);
- std::swap(_M_suffix, __that._M_suffix);
- }
- //@}
-
- private:
- bool _M_matched;
- value_type _M_prefix;
- value_type _M_suffix;
- };
-
- typedef match_results<const char*> cmatch;
- typedef match_results<string::const_iterator> smatch;
-#ifdef _GLIBCXX_USE_WCHAR_T
- typedef match_results<const wchar_t*> wcmatch;
- typedef match_results<wstring::const_iterator> wsmatch;
-#endif
-
- // match_results comparisons
- /**
- * @brief Compares two match_results for equality.
- * @returns true if the two objects refer to the same match,
- * false otherwise.
- * @todo Implement this function.
- */
- template<typename _Bi_iter, typename _Allocator>
- inline bool
- operator==(const match_results<_Bi_iter, _Allocator>& __m1,
- const match_results<_Bi_iter, _Allocator>& __m2);
-
- /**
- * @brief Compares two match_results for inequality.
- * @returns true if the two objects do not refer to the same match,
- * false otherwise.
- */
- template<typename _Bi_iter, class _Allocator>
- inline bool
- operator!=(const match_results<_Bi_iter, _Allocator>& __m1,
- const match_results<_Bi_iter, _Allocator>& __m2)
- { return !(__m1 == __m2); }
-
- // [7.10.6] match_results swap
- /**
- * @brief Swaps two match results.
- * @param lhs A match result.
- * @param rhs A match result.
- *
- * The contents of the two match_results objects are swapped.
- */
- template<typename _Bi_iter, typename _Allocator>
- inline void
- swap(match_results<_Bi_iter, _Allocator>& __lhs,
- match_results<_Bi_iter, _Allocator>& __rhs)
- { __lhs.swap(__rhs); }
-
- // [7.11.2] Function template regex_match
- /**
- * @name Matching, Searching, and Replacing
- */
- //@{
-
- /**
- * @brief Determines if there is a match between the regular expression @p e
- * and all of the character sequence [first, last).
- *
- * @param first Beginning of the character sequence to match.
- * @param last One-past-the-end of the character sequence to match.
- * @param m The match results.
- * @param re The regular expression.
- * @param flags Controls how the regular expression is matched.
- *
- * @retval true A match exists.
- * @retval false Otherwise.
- *
- * @throws an exception of type regex_error.
- *
- * @todo Implement this function.
- */
- template<typename _Bi_iter, typename _Allocator,
- typename _Ch_type, typename _Rx_traits>
- bool
- regex_match(_Bi_iter __first, _Bi_iter __last,
- match_results<_Bi_iter, _Allocator>& __m,
- const basic_regex<_Ch_type, _Rx_traits>& __re,
- regex_constants::match_flag_type __flags
- = regex_constants::match_default);
-
- /**
- * @brief Indicates if there is a match between the regular expression @p e
- * and all of the character sequence [first, last).
- *
- * @param first Beginning of the character sequence to match.
- * @param last One-past-the-end of the character sequence to match.
- * @param re The regular expression.
- * @param flags Controls how the regular expression is matched.
- *
- * @retval true A match exists.
- * @retval false Otherwise.
- *
- * @throws an exception of type regex_error.
- */
- template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
- bool
- regex_match(_Bi_iter __first, _Bi_iter __last,
- const basic_regex<_Ch_type, _Rx_traits>& __re,
- regex_constants::match_flag_type __flags
- = regex_constants::match_default)
- {
- match_results<_Bi_iter> __what;
- return regex_match(__first, __last, __what, __re, __flags);
- }
-
- /**
- * @brief Determines if there is a match between the regular expression @p e
- * and a C-style null-terminated string.
- *
- * @param s The C-style null-terminated string to match.
- * @param m The match results.
- * @param re The regular expression.
- * @param f Controls how the regular expression is matched.
- *
- * @retval true A match exists.
- * @retval false Otherwise.
- *
- * @throws an exception of type regex_error.
- */
- template<typename _Ch_type, typename _Allocator, typename _Rx_traits>
- inline bool
- regex_match(const _Ch_type* __s,
- match_results<const _Ch_type*, _Allocator>& __m,
- const basic_regex<_Ch_type, _Rx_traits>& __re,
- regex_constants::match_flag_type __f
- = regex_constants::match_default)
- { return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
-
- /**
- * @brief Determines if there is a match between the regular expression @p e
- * and a string.
- *
- * @param s The string to match.
- * @param m The match results.
- * @param re The regular expression.
- * @param flags Controls how the regular expression is matched.
- *
- * @retval true A match exists.
- * @retval false Otherwise.
- *
- * @throws an exception of type regex_error.
- */
- template<typename _Ch_traits, typename _Ch_alloc,
- typename _Allocator, typename _Ch_type, typename _Rx_traits>
- inline bool
- regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
- match_results<typename basic_string<_Ch_type,
- _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
- const basic_regex<_Ch_type, _Rx_traits>& __re,
- regex_constants::match_flag_type __flags
- = regex_constants::match_default)
- { return regex_match(__s.begin(), __s.end(), __m, __re, __flags); }
-
- /**
- * @brief Indicates if there is a match between the regular expression @p e
- * and a C-style null-terminated string.
- *
- * @param s The C-style null-terminated string to match.
- * @param re The regular expression.
- * @param f Controls how the regular expression is matched.
- *
- * @retval true A match exists.
- * @retval false Otherwise.
- *
- * @throws an exception of type regex_error.
- */
- template<typename _Ch_type, class _Rx_traits>
- inline bool
- regex_match(const _Ch_type* __s,
- const basic_regex<_Ch_type, _Rx_traits>& __re,
- regex_constants::match_flag_type __f
- = regex_constants::match_default)
- { return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
-
- /**
- * @brief Indicates if there is a match between the regular expression @p e
- * and a string.
- *
- * @param s [IN] The string to match.
- * @param re [IN] The regular expression.
- * @param flags [IN] Controls how the regular expression is matched.
- *
- * @retval true A match exists.
- * @retval false Otherwise.
- *
- * @throws an exception of type regex_error.
- */
- template<typename _Ch_traits, typename _Str_allocator,
- typename _Ch_type, typename _Rx_traits>
- inline bool
- regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s,
- const basic_regex<_Ch_type, _Rx_traits>& __re,
- regex_constants::match_flag_type __flags
- = regex_constants::match_default)
- { return regex_match(__s.begin(), __s.end(), __re, __flags); }
-
- // [7.11.3] Function template regex_search
- /**
- * Searches for a regular expression within a range.
- * @param first [IN] The start of the string to search.
- * @param last [IN] One-past-the-end of the string to search.
- * @param m [OUT] The match results.
- * @param re [IN] The regular expression to search for.
- * @param flags [IN] Search policy flags.
- * @retval true A match was found within the string.
- * @retval false No match was found within the string, the content of %m is
- * undefined.
- *
- * @throws an exception of type regex_error.
- *
- * @todo Implement this function.
- */
- template<typename _Bi_iter, typename _Allocator,
- typename _Ch_type, typename _Rx_traits>
- inline bool
- regex_search(_Bi_iter __first, _Bi_iter __last,
- match_results<_Bi_iter, _Allocator>& __m,
- const basic_regex<_Ch_type, _Rx_traits>& __re,
- regex_constants::match_flag_type __flags
- = regex_constants::match_default);
-
- /**
- * Searches for a regular expression within a range.
- * @param first [IN] The start of the string to search.
- * @param last [IN] One-past-the-end of the string to search.
- * @param re [IN] The regular expression to search for.
- * @param flags [IN] Search policy flags.
- * @retval true A match was found within the string.
- * @retval false No match was found within the string.
- * @doctodo
- *
- * @throws an exception of type regex_error.
- */
- template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
- inline bool
- regex_search(_Bi_iter __first, _Bi_iter __last,
- const basic_regex<_Ch_type, _Rx_traits>& __re,
- regex_constants::match_flag_type __flags
- = regex_constants::match_default)
- {
- match_results<_Bi_iter> __what;
- return regex_search(__first, __last, __what, __re, __flags);
- }
-
- /**
- * @brief Searches for a regular expression within a C-string.
- * @param s [IN] A C-string to search for the regex.
- * @param m [OUT] The set of regex matches.
- * @param e [IN] The regex to search for in @p s.
- * @param f [IN] The search flags.
- * @retval true A match was found within the string.
- * @retval false No match was found within the string, the content of %m is
- * undefined.
- * @doctodo
- *
- * @throws an exception of type regex_error.
- */
- template<typename _Ch_type, class _Allocator, class _Rx_traits>
- inline bool
- regex_search(const _Ch_type* __s,
- match_results<const _Ch_type*, _Allocator>& __m,
- const basic_regex<_Ch_type, _Rx_traits>& __e,
- regex_constants::match_flag_type __f
- = regex_constants::match_default)
- { return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
-
- /**
- * @brief Searches for a regular expression within a C-string.
- * @param s [IN] The C-string to search.
- * @param e [IN] The regular expression to search for.
- * @param f [IN] Search policy flags.
- * @retval true A match was found within the string.
- * @retval false No match was found within the string.
- * @doctodo
- *
- * @throws an exception of type regex_error.
- */
- template<typename _Ch_type, typename _Rx_traits>
- inline bool
- regex_search(const _Ch_type* __s,
- const basic_regex<_Ch_type, _Rx_traits>& __e,
- regex_constants::match_flag_type __f
- = regex_constants::match_default)
- { return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
-
- /**
- * @brief Searches for a regular expression within a string.
- * @param s [IN] The string to search.
- * @param e [IN] The regular expression to search for.
- * @param flags [IN] Search policy flags.
- * @retval true A match was found within the string.
- * @retval false No match was found within the string.
- * @doctodo
- *
- * @throws an exception of type regex_error.
- */
- template<typename _Ch_traits, typename _String_allocator,
- typename _Ch_type, typename _Rx_traits>
- inline bool
- regex_search(const basic_string<_Ch_type, _Ch_traits,
- _String_allocator>& __s,
- const basic_regex<_Ch_type, _Rx_traits>& __e,
- regex_constants::match_flag_type __flags
- = regex_constants::match_default)
- { return regex_search(__s.begin(), __s.end(), __e, __flags); }
-
- /**
- * @brief Searches for a regular expression within a string.
- * @param s [IN] A C++ string to search for the regex.
- * @param m [OUT] The set of regex matches.
- * @param e [IN] The regex to search for in @p s.
- * @param f [IN] The search flags.
- * @retval true A match was found within the string.
- * @retval false No match was found within the string, the content of %m is
- * undefined.
- *
- * @throws an exception of type regex_error.
- */
- template<typename _Ch_traits, typename _Ch_alloc,
- typename _Allocator, typename _Ch_type,
- typename _Rx_traits>
- inline bool
- regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
- match_results<typename basic_string<_Ch_type,
- _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
- const basic_regex<_Ch_type, _Rx_traits>& __e,
- regex_constants::match_flag_type __f
- = regex_constants::match_default)
- { return regex_search(__s.begin(), __s.end(), __m, __e, __f); }
-
- // tr1 [7.11.4] std [28.11.4] Function template regex_replace
- /**
- * @doctodo
- * @param out
- * @param first
- * @param last
- * @param e
- * @param fmt
- * @param flags
- *
- * @returns out
- * @throws an exception of type regex_error.
- *
- * @todo Implement this function.
- */
- template<typename _Out_iter, typename _Bi_iter,
- typename _Rx_traits, typename _Ch_type>
- inline _Out_iter
- regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
- const basic_regex<_Ch_type, _Rx_traits>& __e,
- const basic_string<_Ch_type>& __fmt,
- regex_constants::match_flag_type __flags
- = regex_constants::match_default);
-
- /**
- * @doctodo
- * @param s
- * @param e
- * @param fmt
- * @param flags
- *
- * @returns a copy of string @p s with replacements.
- *
- * @throws an exception of type regex_error.
- */
- template<typename _Rx_traits, typename _Ch_type>
- inline basic_string<_Ch_type>
- regex_replace(const basic_string<_Ch_type>& __s,
- const basic_regex<_Ch_type, _Rx_traits>& __e,
- const basic_string<_Ch_type>& __fmt,
- regex_constants::match_flag_type __flags
- = regex_constants::match_default)
- {
- std::string __result;
- regex_replace(std::back_inserter(__result),
- __s.begin(), __s.end(), __e, __fmt, __flags);
- return __result;
- }
-
- //@}
-
- // tr1 [7.12.1] std [28.12] Class template regex_iterator
- /**
- * An iterator adaptor that will provide repeated calls of regex_search over
- * a range until no more matches remain.
- */
- template<typename _Bi_iter,
- typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
- typename _Rx_traits = regex_traits<_Ch_type> >
- class regex_iterator
- {
- public:
- typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
- typedef match_results<_Bi_iter> value_type;
- typedef std::ptrdiff_t difference_type;
- typedef const value_type* pointer;
- typedef const value_type& reference;
- typedef std::forward_iterator_tag iterator_category;
-
- public:
- /**
- * @brief Provides a singular iterator, useful for indicating
- * one-past-the-end of a range.
- * @todo Implement this function.
- * @doctodo
- */
- regex_iterator();
-
- /**
- * Constructs a %regex_iterator...
- * @param a [IN] The start of a text range to search.
- * @param b [IN] One-past-the-end of the text range to search.
- * @param re [IN] The regular expression to match.
- * @param m [IN] Policy flags for match rules.
- * @todo Implement this function.
- * @doctodo
- */
- regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
- regex_constants::match_flag_type __m
- = regex_constants::match_default);
-
- /**
- * Copy constructs a %regex_iterator.
- * @todo Implement this function.
- * @doctodo
- */
- regex_iterator(const regex_iterator& __rhs);
-
- /**
- * @todo Implement this function.
- * @doctodo
- */
- regex_iterator&
- operator=(const regex_iterator& __rhs);
-
- /**
- * @todo Implement this function.
- * @doctodo
- */
- bool
- operator==(const regex_iterator& __rhs);
-
- /**
- * @todo Implement this function.
- * @doctodo
- */
- bool
- operator!=(const regex_iterator& __rhs);
-
- /**
- * @todo Implement this function.
- * @doctodo
- */
- const value_type&
- operator*();
-
- /**
- * @todo Implement this function.
- * @doctodo
- */
- const value_type*
- operator->();
-
- /**
- * @todo Implement this function.
- * @doctodo
- */
- regex_iterator&
- operator++();
-
- /**
- * @todo Implement this function.
- * @doctodo
- */
- regex_iterator
- operator++(int);
-
- private:
- // these members are shown for exposition only:
- _Bi_iter begin;
- _Bi_iter end;
- const regex_type* pregex;
- regex_constants::match_flag_type flags;
- match_results<_Bi_iter> match;
- };
-
- typedef regex_iterator<const char*> cregex_iterator;
- typedef regex_iterator<string::const_iterator> sregex_iterator;
-#ifdef _GLIBCXX_USE_WCHAR_T
- typedef regex_iterator<const wchar_t*> wcregex_iterator;
- typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
-#endif
-
- // [7.12.2] Class template regex_token_iterator
- /**
- * Iterates over submatches in a range (or @a splits a text string).
- *
- * The purpose of this iterator is to enumerate all, or all specified,
- * matches of a regular expression within a text range. The dereferenced
- * value of an iterator of this class is a std::tr1::sub_match object.
- */
- template<typename _Bi_iter,
- typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
- typename _Rx_traits = regex_traits<_Ch_type> >
- class regex_token_iterator
- {
- public:
- typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
- typedef sub_match<_Bi_iter> value_type;
- typedef std::ptrdiff_t difference_type;
- typedef const value_type* pointer;
- typedef const value_type& reference;
- typedef std::forward_iterator_tag iterator_category;
-
- public:
- /**
- * @brief Default constructs a %regex_token_iterator.
- * @todo Implement this function.
- *
- * A default-constructed %regex_token_iterator is a singular iterator
- * that will compare equal to the one-past-the-end value for any
- * iterator of the same type.
- */
- regex_token_iterator();
-
- /**
- * Constructs a %regex_token_iterator...
- * @param a [IN] The start of the text to search.
- * @param b [IN] One-past-the-end of the text to search.
- * @param re [IN] The regular expression to search for.
- * @param submatch [IN] Which submatch to return. There are some
- * special values for this parameter:
- * - -1 each enumerated subexpression does NOT
- * match the regular expression (aka field
- * splitting)
- * - 0 the entire string matching the
- * subexpression is returned for each match
- * within the text.
- * - >0 enumerates only the indicated
- * subexpression from a match within the text.
- * @param m [IN] Policy flags for match rules.
- *
- * @todo Implement this function.
- * @doctodo
- */
- regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
- int __submatch = 0,
- regex_constants::match_flag_type __m
- = regex_constants::match_default);
-
- /**
- * Constructs a %regex_token_iterator...
- * @param a [IN] The start of the text to search.
- * @param b [IN] One-past-the-end of the text to search.
- * @param re [IN] The regular expression to search for.
- * @param submatches [IN] A list of subexpressions to return for each
- * regular expression match within the text.
- * @param m [IN] Policy flags for match rules.
- *
- * @todo Implement this function.
- * @doctodo
- */
- regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
- const regex_type& __re,
- const std::vector<int>& __submatches,
- regex_constants::match_flag_type __m
- = regex_constants::match_default);
-
- /**
- * Constructs a %regex_token_iterator...
- * @param a [IN] The start of the text to search.
- * @param b [IN] One-past-the-end of the text to search.
- * @param re [IN] The regular expression to search for.
- * @param submatches [IN] A list of subexpressions to return for each
- * regular expression match within the text.
- * @param m [IN] Policy flags for match rules.
-
- * @todo Implement this function.
- * @doctodo
- */
- template<std::size_t _Nm>
- regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
- const regex_type& __re,
- const int (&__submatches)[_Nm],
- regex_constants::match_flag_type __m
- = regex_constants::match_default);
-
- /**
- * @brief Copy constructs a %regex_token_iterator.
- * @param rhs [IN] A %regex_token_iterator to copy.
- * @todo Implement this function.
- */
- regex_token_iterator(const regex_token_iterator& __rhs);
-
- /**
- * @brief Assigns a %regex_token_iterator to another.
- * @param rhs [IN] A %regex_token_iterator to copy.
- * @todo Implement this function.
- */
- regex_token_iterator&
- operator=(const regex_token_iterator& __rhs);
-
- /**
- * @brief Compares a %regex_token_iterator to another for equality.
- * @todo Implement this function.
- */
- bool
- operator==(const regex_token_iterator& __rhs);
-
- /**
- * @brief Compares a %regex_token_iterator to another for inequality.
- * @todo Implement this function.
- */
- bool
- operator!=(const regex_token_iterator& __rhs);
-
- /**
- * @brief Dereferences a %regex_token_iterator.
- * @todo Implement this function.
- */
- const value_type&
- operator*();
-
- /**
- * @brief Selects a %regex_token_iterator member.
- * @todo Implement this function.
- */
- const value_type*
- operator->();
-
- /**
- * @brief Increments a %regex_token_iterator.
- * @todo Implement this function.
- */
- regex_token_iterator&
- operator++();
-
- /**
- * @brief Postincrements a %regex_token_iterator.
- * @todo Implement this function.
- */
- regex_token_iterator
- operator++(int);
-
- private: // data members for exposition only:
- typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> position_iterator;
-
- position_iterator __position;
- const value_type* __result;
- value_type __suffix;
- std::size_t __n;
- std::vector<int> __subs;
- };
-
- /** @brief Token iterator for C-style NULL-terminated strings. */
- typedef regex_token_iterator<const char*> cregex_token_iterator;
- /** @brief Token iterator for standard strings. */
- typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
-#ifdef _GLIBCXX_USE_WCHAR_T
- /** @brief Token iterator for C-style NULL-terminated wide strings. */
- typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
- /** @brief Token iterator for standard wide-character strings. */
- typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
-#endif
-
- //@}
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
diff --git a/libstdc++-v3/include/tr1_impl/type_traits b/libstdc++-v3/include/tr1_impl/type_traits
deleted file mode 100644
index 47f5e8f7e60..00000000000
--- a/libstdc++-v3/include/tr1_impl/type_traits
+++ /dev/null
@@ -1,502 +0,0 @@
-// TR1 type_traits -*- C++ -*-
-
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/type_traits
-* This is an internal header file, included by other library headers.
-* You should not attempt to use it directly.
-*/
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
- /**
- * @defgroup metaprogramming Type Traits
- * @ingroup utilities
- *
- * Compile time type transformation and information.
- * @{
- */
-
- // For use in __is_convertible_simple.
- struct __sfinae_types
- {
- typedef char __one;
- typedef struct { char __arr[2]; } __two;
- };
-
-#define _DEFINE_SPEC_0_HELPER \
- template<>
-
-#define _DEFINE_SPEC_1_HELPER \
- template<typename _Tp>
-
-#define _DEFINE_SPEC_2_HELPER \
- template<typename _Tp, typename _Cp>
-
-#define _DEFINE_SPEC(_Order, _Trait, _Type, _Value) \
- _DEFINE_SPEC_##_Order##_HELPER \
- struct _Trait<_Type> \
- : public integral_constant<bool, _Value> { };
-
- // helper classes [4.3].
-
- /// integral_constant
- template<typename _Tp, _Tp __v>
- struct integral_constant
- {
- static const _Tp value = __v;
- typedef _Tp value_type;
- typedef integral_constant<_Tp, __v> type;
- };
-
- /// typedef for true_type
- typedef integral_constant<bool, true> true_type;
-
- /// typedef for false_type
- typedef integral_constant<bool, false> false_type;
-
- template<typename _Tp, _Tp __v>
- const _Tp integral_constant<_Tp, __v>::value;
-
- /// remove_cv
- template<typename>
- struct remove_cv;
-
- template<typename>
- struct __is_void_helper
- : public false_type { };
- _DEFINE_SPEC(0, __is_void_helper, void, true)
-
- // primary type categories [4.5.1].
-
- /// is_void
- template<typename _Tp>
- struct is_void
- : public integral_constant<bool, (__is_void_helper<typename
- remove_cv<_Tp>::type>::value)>
- { };
-
- template<typename>
- struct __is_integral_helper
- : public false_type { };
- _DEFINE_SPEC(0, __is_integral_helper, bool, true)
- _DEFINE_SPEC(0, __is_integral_helper, char, true)
- _DEFINE_SPEC(0, __is_integral_helper, signed char, true)
- _DEFINE_SPEC(0, __is_integral_helper, unsigned char, true)
-#ifdef _GLIBCXX_USE_WCHAR_T
- _DEFINE_SPEC(0, __is_integral_helper, wchar_t, true)
-#endif
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- _DEFINE_SPEC(0, __is_integral_helper, char16_t, true)
- _DEFINE_SPEC(0, __is_integral_helper, char32_t, true)
-#endif
- _DEFINE_SPEC(0, __is_integral_helper, short, true)
- _DEFINE_SPEC(0, __is_integral_helper, unsigned short, true)
- _DEFINE_SPEC(0, __is_integral_helper, int, true)
- _DEFINE_SPEC(0, __is_integral_helper, unsigned int, true)
- _DEFINE_SPEC(0, __is_integral_helper, long, true)
- _DEFINE_SPEC(0, __is_integral_helper, unsigned long, true)
- _DEFINE_SPEC(0, __is_integral_helper, long long, true)
- _DEFINE_SPEC(0, __is_integral_helper, unsigned long long, true)
-
- /// is_integral
- template<typename _Tp>
- struct is_integral
- : public integral_constant<bool, (__is_integral_helper<typename
- remove_cv<_Tp>::type>::value)>
- { };
-
- template<typename>
- struct __is_floating_point_helper
- : public false_type { };
- _DEFINE_SPEC(0, __is_floating_point_helper, float, true)
- _DEFINE_SPEC(0, __is_floating_point_helper, double, true)
- _DEFINE_SPEC(0, __is_floating_point_helper, long double, true)
-
- /// is_floating_point
- template<typename _Tp>
- struct is_floating_point
- : public integral_constant<bool, (__is_floating_point_helper<typename
- remove_cv<_Tp>::type>::value)>
- { };
-
- /// is_array
- template<typename>
- struct is_array
- : public false_type { };
-
- template<typename _Tp, std::size_t _Size>
- struct is_array<_Tp[_Size]>
- : public true_type { };
-
- template<typename _Tp>
- struct is_array<_Tp[]>
- : public true_type { };
-
- template<typename>
- struct __is_pointer_helper
- : public false_type { };
- _DEFINE_SPEC(1, __is_pointer_helper, _Tp*, true)
-
- /// is_pointer
- template<typename _Tp>
- struct is_pointer
- : public integral_constant<bool, (__is_pointer_helper<typename
- remove_cv<_Tp>::type>::value)>
- { };
-
- /// is_reference
- template<typename _Tp>
- struct is_reference;
-
- /// is_function
- template<typename _Tp>
- struct is_function;
-
- template<typename>
- struct __is_member_object_pointer_helper
- : public false_type { };
- _DEFINE_SPEC(2, __is_member_object_pointer_helper, _Tp _Cp::*,
- !is_function<_Tp>::value)
-
- /// is_member_object_pointer
- template<typename _Tp>
- struct is_member_object_pointer
- : public integral_constant<bool, (__is_member_object_pointer_helper<
- typename remove_cv<_Tp>::type>::value)>
- { };
-
- template<typename>
- struct __is_member_function_pointer_helper
- : public false_type { };
- _DEFINE_SPEC(2, __is_member_function_pointer_helper, _Tp _Cp::*,
- is_function<_Tp>::value)
-
- /// is_member_function_pointer
- template<typename _Tp>
- struct is_member_function_pointer
- : public integral_constant<bool, (__is_member_function_pointer_helper<
- typename remove_cv<_Tp>::type>::value)>
- { };
-
- /// is_enum
- template<typename _Tp>
- struct is_enum
- : public integral_constant<bool, __is_enum(_Tp)>
- { };
-
- /// is_union
- template<typename _Tp>
- struct is_union
- : public integral_constant<bool, __is_union(_Tp)>
- { };
-
- /// is_class
- template<typename _Tp>
- struct is_class
- : public integral_constant<bool, __is_class(_Tp)>
- { };
-
- /// is_function
- template<typename>
- struct is_function
- : public false_type { };
- template<typename _Res, typename... _ArgTypes>
- struct is_function<_Res(_ArgTypes...)>
- : public true_type { };
- template<typename _Res, typename... _ArgTypes>
- struct is_function<_Res(_ArgTypes......)>
- : public true_type { };
- template<typename _Res, typename... _ArgTypes>
- struct is_function<_Res(_ArgTypes...) const>
- : public true_type { };
- template<typename _Res, typename... _ArgTypes>
- struct is_function<_Res(_ArgTypes......) const>
- : public true_type { };
- template<typename _Res, typename... _ArgTypes>
- struct is_function<_Res(_ArgTypes...) volatile>
- : public true_type { };
- template<typename _Res, typename... _ArgTypes>
- struct is_function<_Res(_ArgTypes......) volatile>
- : public true_type { };
- template<typename _Res, typename... _ArgTypes>
- struct is_function<_Res(_ArgTypes...) const volatile>
- : public true_type { };
- template<typename _Res, typename... _ArgTypes>
- struct is_function<_Res(_ArgTypes......) const volatile>
- : public true_type { };
-
- // composite type traits [4.5.2].
-
- /// is_arithmetic
- template<typename _Tp>
- struct is_arithmetic
- : public integral_constant<bool, (is_integral<_Tp>::value
- || is_floating_point<_Tp>::value)>
- { };
-
- /// is_fundamental
- template<typename _Tp>
- struct is_fundamental
- : public integral_constant<bool, (is_arithmetic<_Tp>::value
- || is_void<_Tp>::value)>
- { };
-
- /// is_object
- template<typename _Tp>
- struct is_object
- : public integral_constant<bool, !(is_function<_Tp>::value
- || is_reference<_Tp>::value
- || is_void<_Tp>::value)>
- { };
-
- /// is_member_pointer
- template<typename _Tp>
- struct is_member_pointer;
-
- /// is_scalar
- template<typename _Tp>
- struct is_scalar
- : public integral_constant<bool, (is_arithmetic<_Tp>::value
- || is_enum<_Tp>::value
- || is_pointer<_Tp>::value
- || is_member_pointer<_Tp>::value)>
- { };
-
- /// is_compound
- template<typename _Tp>
- struct is_compound
- : public integral_constant<bool, !is_fundamental<_Tp>::value> { };
-
- /// is_member_pointer
- template<typename _Tp>
- struct __is_member_pointer_helper
- : public false_type { };
- _DEFINE_SPEC(2, __is_member_pointer_helper, _Tp _Cp::*, true)
-
- template<typename _Tp>
- struct is_member_pointer
- : public integral_constant<bool, (__is_member_pointer_helper<
- typename remove_cv<_Tp>::type>::value)>
- { };
-
- // type properties [4.5.3].
- /// is_const
- template<typename>
- struct is_const
- : public false_type { };
-
- template<typename _Tp>
- struct is_const<_Tp const>
- : public true_type { };
-
- /// is_volatile
- template<typename>
- struct is_volatile
- : public false_type { };
-
- template<typename _Tp>
- struct is_volatile<_Tp volatile>
- : public true_type { };
-
- /// is_empty
- template<typename _Tp>
- struct is_empty
- : public integral_constant<bool, __is_empty(_Tp)>
- { };
-
- /// is_polymorphic
- template<typename _Tp>
- struct is_polymorphic
- : public integral_constant<bool, __is_polymorphic(_Tp)>
- { };
-
- /// is_abstract
- template<typename _Tp>
- struct is_abstract
- : public integral_constant<bool, __is_abstract(_Tp)>
- { };
-
- /// has_virtual_destructor
- template<typename _Tp>
- struct has_virtual_destructor
- : public integral_constant<bool, __has_virtual_destructor(_Tp)>
- { };
-
- /// alignment_of
- template<typename _Tp>
- struct alignment_of
- : public integral_constant<std::size_t, __alignof__(_Tp)> { };
-
- /// rank
- template<typename>
- struct rank
- : public integral_constant<std::size_t, 0> { };
-
- template<typename _Tp, std::size_t _Size>
- struct rank<_Tp[_Size]>
- : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
-
- template<typename _Tp>
- struct rank<_Tp[]>
- : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
-
- /// extent
- template<typename, unsigned _Uint = 0>
- struct extent
- : public integral_constant<std::size_t, 0> { };
-
- template<typename _Tp, unsigned _Uint, std::size_t _Size>
- struct extent<_Tp[_Size], _Uint>
- : public integral_constant<std::size_t,
- _Uint == 0 ? _Size : extent<_Tp,
- _Uint - 1>::value>
- { };
-
- template<typename _Tp, unsigned _Uint>
- struct extent<_Tp[], _Uint>
- : public integral_constant<std::size_t,
- _Uint == 0 ? 0 : extent<_Tp,
- _Uint - 1>::value>
- { };
-
- // relationships between types [4.6].
-
- /// is_same
- template<typename, typename>
- struct is_same
- : public false_type { };
-
- template<typename _Tp>
- struct is_same<_Tp, _Tp>
- : public true_type { };
-
- // const-volatile modifications [4.7.1].
-
- /// remove_const
- template<typename _Tp>
- struct remove_const
- { typedef _Tp type; };
-
- template<typename _Tp>
- struct remove_const<_Tp const>
- { typedef _Tp type; };
-
- /// remove_volatile
- template<typename _Tp>
- struct remove_volatile
- { typedef _Tp type; };
-
- template<typename _Tp>
- struct remove_volatile<_Tp volatile>
- { typedef _Tp type; };
-
- /// remove_cv
- template<typename _Tp>
- struct remove_cv
- {
- typedef typename
- remove_const<typename remove_volatile<_Tp>::type>::type type;
- };
-
- /// add_const
- template<typename _Tp>
- struct add_const
- { typedef _Tp const type; };
-
- /// add_volatile
- template<typename _Tp>
- struct add_volatile
- { typedef _Tp volatile type; };
-
- /// add_cv
- template<typename _Tp>
- struct add_cv
- {
- typedef typename
- add_const<typename add_volatile<_Tp>::type>::type type;
- };
-
- // array modifications [4.7.3].
-
- /// remove_extent
- template<typename _Tp>
- struct remove_extent
- { typedef _Tp type; };
-
- template<typename _Tp, std::size_t _Size>
- struct remove_extent<_Tp[_Size]>
- { typedef _Tp type; };
-
- template<typename _Tp>
- struct remove_extent<_Tp[]>
- { typedef _Tp type; };
-
- /// remove_all_extents
- template<typename _Tp>
- struct remove_all_extents
- { typedef _Tp type; };
-
- template<typename _Tp, std::size_t _Size>
- struct remove_all_extents<_Tp[_Size]>
- { typedef typename remove_all_extents<_Tp>::type type; };
-
- template<typename _Tp>
- struct remove_all_extents<_Tp[]>
- { typedef typename remove_all_extents<_Tp>::type type; };
-
- // pointer modifications [4.7.4].
-
- template<typename _Tp, typename>
- struct __remove_pointer_helper
- { typedef _Tp type; };
-
- template<typename _Tp, typename _Up>
- struct __remove_pointer_helper<_Tp, _Up*>
- { typedef _Up type; };
-
- /// remove_pointer
- template<typename _Tp>
- struct remove_pointer
- : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
- { };
-
- template<typename>
- struct remove_reference;
-
- /// add_pointer
- template<typename _Tp>
- struct add_pointer
- { typedef typename remove_reference<_Tp>::type* type; };
-
-#undef _DEFINE_SPEC_0_HELPER
-#undef _DEFINE_SPEC_1_HELPER
-#undef _DEFINE_SPEC_2_HELPER
-#undef _DEFINE_SPEC
-
- // @} group metaprogramming
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
diff --git a/libstdc++-v3/include/tr1_impl/utility b/libstdc++-v3/include/tr1_impl/utility
deleted file mode 100644
index 71b8719f5ff..00000000000
--- a/libstdc++-v3/include/tr1_impl/utility
+++ /dev/null
@@ -1,120 +0,0 @@
-// TR1 utility -*- C++ -*-
-
-// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file tr1_impl/utility
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
- template<class _Tp>
- class tuple_size;
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- template<std::size_t _Int, class _Tp>
-#else
- template<int _Int, class _Tp>
-#endif
- class tuple_element;
-
- // Various functions which give std::pair a tuple-like interface.
- template<class _Tp1, class _Tp2>
- struct tuple_size<std::pair<_Tp1, _Tp2> >
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- { static const std::size_t value = 2; };
-#else
- { static const int value = 2; };
-#endif
-
- template<class _Tp1, class _Tp2>
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- const std::size_t
-#else
- const int
-#endif
- tuple_size<std::pair<_Tp1, _Tp2> >::value;
-
- template<class _Tp1, class _Tp2>
- struct tuple_element<0, std::pair<_Tp1, _Tp2> >
- { typedef _Tp1 type; };
-
- template<class _Tp1, class _Tp2>
- struct tuple_element<1, std::pair<_Tp1, _Tp2> >
- { typedef _Tp2 type; };
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- template<std::size_t _Int>
-#else
- template<int _Int>
-#endif
- struct __pair_get;
-
- template<>
- struct __pair_get<0>
- {
- template<typename _Tp1, typename _Tp2>
- static _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair)
- { return __pair.first; }
-
- template<typename _Tp1, typename _Tp2>
- static const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
- { return __pair.first; }
- };
-
- template<>
- struct __pair_get<1>
- {
- template<typename _Tp1, typename _Tp2>
- static _Tp2& __get(std::pair<_Tp1, _Tp2>& __pair)
- { return __pair.second; }
-
- template<typename _Tp1, typename _Tp2>
- static const _Tp2& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
- { return __pair.second; }
- };
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- template<std::size_t _Int, class _Tp1, class _Tp2>
-#else
- template<int _Int, class _Tp1, class _Tp2>
-#endif
- inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
- get(std::pair<_Tp1, _Tp2>& __in)
- { return __pair_get<_Int>::__get(__in); }
-
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- template<std::size_t _Int, class _Tp1, class _Tp2>
-#else
- template<int _Int, class _Tp1, class _Tp2>
-#endif
- inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
- get(const std::pair<_Tp1, _Tp2>& __in)
- { return __pair_get<_Int>::__const_get(__in); }
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
-
diff --git a/libstdc++-v3/libsupc++/initializer_list b/libstdc++-v3/libsupc++/initializer_list
index 0006b70f40a..1048d44de07 100644
--- a/libstdc++-v3/libsupc++/initializer_list
+++ b/libstdc++-v3/libsupc++/initializer_list
@@ -57,23 +57,23 @@ namespace std
size_type _M_len;
// The compiler can call a private constructor.
- initializer_list(const_iterator __a, size_type __l)
+ constexpr initializer_list(const_iterator __a, size_type __l)
: _M_array(__a), _M_len(__l) { }
public:
- initializer_list() : _M_array(0), _M_len(0) { }
+ constexpr initializer_list() : _M_array(0), _M_len(0) { }
// Number of elements.
- size_type
- size() const { return _M_len; }
+ constexpr size_type
+ size() { return _M_len; }
// First element.
- const_iterator
- begin() const { return _M_array; }
+ constexpr const_iterator
+ begin() { return _M_array; }
// One past the last element.
- const_iterator
- end() const { return begin() + size(); }
+ constexpr const_iterator
+ end() { return begin() + size(); }
};
/**
@@ -82,7 +82,7 @@ namespace std
* @param il Initializer list.
*/
template<class _Tp>
- inline const _Tp*
+ constexpr const _Tp*
begin(initializer_list<_Tp> __ils)
{ return __ils.begin(); }
@@ -92,7 +92,7 @@ namespace std
* @param il Initializer list.
*/
template<class _Tp>
- inline const _Tp*
+ constexpr const _Tp*
end(initializer_list<_Tp> __ils)
{ return __ils.end(); }
}
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index bf3689bb707..fb999bf5257 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -177,7 +177,10 @@ class StdVectorPrinter:
if self.item == self.finish and self.so >= self.fo:
raise StopIteration
elt = self.item.dereference()
- obit = 1 if elt & (1 << self.so) else 0
+ if elt & (1 << self.so):
+ obit = 1
+ else:
+ obit = 0
self.so = self.so + 1
if self.so >= self.isize:
self.item = self.item + 1
diff --git a/libstdc++-v3/src/atomic.cc b/libstdc++-v3/src/atomic.cc
index 906b0884e2c..822e022b7e5 100644
--- a/libstdc++-v3/src/atomic.cc
+++ b/libstdc++-v3/src/atomic.cc
@@ -49,8 +49,8 @@ namespace
};
} // anonymous namespace
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
namespace __atomic0
{
bool
@@ -72,48 +72,51 @@ namespace std
#endif
_M_i = false;
}
+
+ _GLIBCXX_BEGIN_EXTERN_C
+
+ bool
+ atomic_flag_test_and_set_explicit(__atomic_flag_base* __a,
+ memory_order __m) _GLIBCXX_NOTHROW
+ {
+ atomic_flag* d = static_cast<atomic_flag*>(__a);
+ return d->test_and_set(__m);
}
- extern "C"
+ void
+ atomic_flag_clear_explicit(__atomic_flag_base* __a,
+ memory_order __m) _GLIBCXX_NOTHROW
{
- bool
- atomic_flag_test_and_set_explicit(__atomic_flag_base* __a,
- memory_order __m) throw()
- {
- atomic_flag* d = static_cast<volatile atomic_flag*>(__a);
- return d->test_and_set(__m);
- }
+ atomic_flag* d = static_cast<atomic_flag*>(__a);
+ return d->clear(__m);
+ }
- void
- atomic_flag_clear_explicit(__atomic_flag_base* __a,
- memory_order __m) throw()
- {
- atomic_flag* d = static_cast<volatile atomic_flag*>(__a);
- return d->clear(__m);
- }
+ void
+ __atomic_flag_wait_explicit(__atomic_flag_base* __a,
+ memory_order __x) _GLIBCXX_NOTHROW
+ {
+ while (atomic_flag_test_and_set_explicit(__a, __x))
+ { };
+ }
- void
- __atomic_flag_wait_explicit(__atomic_flag_base* __a,
- memory_order __x) throw()
- {
- while (atomic_flag_test_and_set_explicit(__a, __x))
- { };
- }
+ _GLIBCXX_CONST __atomic_flag_base*
+ __atomic_flag_for_address(const volatile void* __z) _GLIBCXX_NOTHROW
+ {
+ uintptr_t __u = reinterpret_cast<uintptr_t>(__z);
+ __u += (__u >> 2) + (__u << 4);
+ __u += (__u >> 7) + (__u << 5);
+ __u += (__u >> 17) + (__u << 13);
+ if (sizeof(uintptr_t) > 4)
+ __u += (__u >> 31);
+ __u &= ~((~uintptr_t(0)) << LOGSIZE);
+ return flag_table + __u;
+ }
- __atomic_flag_base*
- __atomic_flag_for_address(const void* __z) throw()
- {
- uintptr_t __u = reinterpret_cast<uintptr_t>(__z);
- __u += (__u >> 2) + (__u << 4);
- __u += (__u >> 7) + (__u << 5);
- __u += (__u >> 17) + (__u << 13);
- if (sizeof(uintptr_t) > 4)
- __u += (__u >> 31);
- __u &= ~((~uintptr_t(0)) << LOGSIZE);
- return flag_table + __u;
- }
- } // extern "C"
-} // namespace std
+ _GLIBCXX_END_EXTERN_C
+
+ } // namespace __atomic0
+
+_GLIBCXX_END_NAMESPACE
// XXX GLIBCXX_ABI Deprecated
diff --git a/libstdc++-v3/src/chrono.cc b/libstdc++-v3/src/chrono.cc
index 6d7a64d0080..699a10a7253 100644
--- a/libstdc++-v3/src/chrono.cc
+++ b/libstdc++-v3/src/chrono.cc
@@ -33,8 +33,8 @@
#include <sys/time.h>
#endif
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
namespace chrono
{
const bool system_clock::is_monotonic;
@@ -74,6 +74,7 @@ namespace std
}
#endif
}
-}
+
+_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/src/condition_variable.cc b/libstdc++-v3/src/condition_variable.cc
index d3f29f657f4..e7adb5251be 100644
--- a/libstdc++-v3/src/condition_variable.cc
+++ b/libstdc++-v3/src/condition_variable.cc
@@ -26,8 +26,8 @@
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
condition_variable::condition_variable() throw ()
{
#ifdef __GTHREAD_COND_INIT
@@ -84,6 +84,7 @@ namespace std
condition_variable_any::~condition_variable_any() throw ()
{ }
-}
+
+_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/src/future.cc b/libstdc++-v3/src/future.cc
index d9289487bab..ed3088d87d6 100644
--- a/libstdc++-v3/src/future.cc
+++ b/libstdc++-v3/src/future.cc
@@ -64,12 +64,14 @@ namespace
}
}
-namespace std
-{
- const error_category* const future_category = &__future_category_instance();
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ const error_category& future_category()
+ { return __future_category_instance(); }
future_error::~future_error() throw() { }
const char*
future_error::what() const throw() { return _M_code.message().c_str(); }
-}
+
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/src/limits.cc b/libstdc++-v3/src/limits.cc
index 9c953c96afd..ac46cf03a60 100644
--- a/libstdc++-v3/src/limits.cc
+++ b/libstdc++-v3/src/limits.cc
@@ -34,6 +34,8 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
+#define const _GLIBCXX_USE_CONSTEXPR
+
const bool __numeric_limits_base::is_specialized;
const int __numeric_limits_base::digits;
const int __numeric_limits_base::digits10;
@@ -510,6 +512,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const bool numeric_limits<char32_t>::tinyness_before;
const float_round_style numeric_limits<char32_t>::round_style;
+#undef const
+
_GLIBCXX_END_NAMESPACE
// XXX GLIBCXX_ABI Deprecated
diff --git a/libstdc++-v3/src/mutex.cc b/libstdc++-v3/src/mutex.cc
index 74a82c8aa82..e6eb6d28a72 100644
--- a/libstdc++-v3/src/mutex.cc
+++ b/libstdc++-v3/src/mutex.cc
@@ -1,6 +1,6 @@
// mutex -*- C++ -*-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 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
@@ -37,11 +37,7 @@ namespace
}
#endif
-namespace std
-{
- const defer_lock_t defer_lock = defer_lock_t();
- const try_to_lock_t try_to_lock = try_to_lock_t();
- const adopt_lock_t adopt_lock = adopt_lock_t();
+_GLIBCXX_BEGIN_NAMESPACE(std)
#ifdef _GLIBCXX_HAVE_TLS
__thread void* __once_callable;
@@ -92,6 +88,31 @@ namespace std
__once_call();
}
}
+
+_GLIBCXX_END_NAMESPACE
+
+// XXX GLIBCXX_ABI Deprecated
+// gcc-4.6.0
+// <mutex> export changes
+#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \
+ && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
+ && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
+
+namespace __gnu_cxx
+{
+ std::defer_lock_t defer_lock;
+ std::try_to_lock_t try_to_lock;
+ std::adopt_lock_t adopt_lock;
}
+#define _GLIBCXX_ASM_SYMVER(cur, old, version) \
+ asm (".symver " #cur "," #old "@@" #version);
+
+_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx10adopt_lockE, _ZSt10adopt_lock, GLIBCXX_3.4.11)
+_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx10defer_lockE, _ZSt10defer_lock, GLIBCXX_3.4.11)
+_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx11try_to_lockE, _ZSt11try_to_lock, GLIBCXX_3.4.11)
+
+
+#endif
+
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/src/thread.cc b/libstdc++-v3/src/thread.cc
index 2ea6a490735..acc6c038531 100644
--- a/libstdc++-v3/src/thread.cc
+++ b/libstdc++-v3/src/thread.cc
@@ -28,8 +28,8 @@
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
namespace
{
extern "C" void*
@@ -95,6 +95,7 @@ namespace std
__throw_system_error(__e);
}
}
-}
+
+_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc
index f3e19f5003b..357373a0a82 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc
@@ -3,7 +3,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010 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
@@ -44,7 +44,6 @@
#include <math.h>
#include <setjmp.h>
#include <signal.h>
-#include <stdatomic.h>
#include <stdarg.h>
#ifdef _GLIBCXX_HAVE_STDBOOL_H
#include <stdbool.h>
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c b/libstdc++-v3/testsuite/18_support/initializer_list/constexpr.cc
index 025fdcb08e5..76e6f4dd641 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c
+++ b/libstdc++-v3/testsuite/18_support/initializer_list/constexpr.cc
@@ -1,6 +1,7 @@
-// { dg-options "-x c -shared-libgcc -lstdc++" }
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2010 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
@@ -17,14 +18,13 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <stdatomic.h>
+#include <initializer_list>
+#include <testsuite_common_types.h>
int main()
{
- atomic_flag af = ATOMIC_FLAG_INIT;
-
- if (!atomic_flag_test_and_set_explicit(&af, memory_order_acquire))
- atomic_flag_clear_explicit(&af, memory_order_release);
+ __gnu_test::constexpr_default_constructible test1;
+ test1.operator()<std::initializer_list<long>>();
return 0;
}
diff --git a/libstdc++-v3/testsuite/18_support/initializer_list/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/18_support/initializer_list/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..0cfd46e0305
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/initializer_list/requirements/constexpr_functions.cc
@@ -0,0 +1,57 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <initializer_list>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr _Ttesttype obj;
+ constexpr auto v4 __attribute__((unused))
+ = obj.size();
+ constexpr auto v5 __attribute__((unused))
+ = obj.begin();
+ constexpr auto v6 __attribute__((unused))
+ = obj.end();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ test.operator()<std::initializer_list<int>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c b/libstdc++-v3/testsuite/18_support/numeric_limits/cons/default.cc
index 1ab92948416..6b492569c3d 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/cons/default.cc
@@ -1,6 +1,4 @@
-// { dg-options "-x c -shared-libgcc -lstdc++" }
-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 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
@@ -17,14 +15,12 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <stdatomic.h>
+#include <limits>
+#include <testsuite_common_types.h>
int main()
{
- atomic_flag af = ATOMIC_FLAG_INIT;
-
- if (!atomic_flag_test_and_set(&af))
- atomic_flag_clear(&af);
-
+ __gnu_test::default_constructible test;
+ __gnu_cxx::typelist::apply_generator(test, __gnu_test::limits_tl());
return 0;
}
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/cons/default_c++0x.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/cons/default_c++0x.cc
new file mode 100644
index 00000000000..17ee4c79e87
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/cons/default_c++0x.cc
@@ -0,0 +1,28 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <limits>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::default_constructible test;
+ __gnu_cxx::typelist::apply_generator(test, __gnu_test::limits_tl());
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_data.cc
new file mode 100644
index 00000000000..0b82a75db55
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_data.cc
@@ -0,0 +1,98 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <limits>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_data
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ using std::float_denorm_style;
+ using std::float_round_style;
+ constexpr bool v1 __attribute__((unused))
+ = _Ttesttype::is_specialized;
+ constexpr int v2 __attribute__((unused))
+ = _Ttesttype::digits;
+ constexpr int v3 __attribute__((unused))
+ = _Ttesttype::digits10;
+ constexpr int v4 __attribute__((unused))
+ = _Ttesttype::max_digits10;
+ constexpr bool v5 __attribute__((unused))
+ = _Ttesttype::is_signed;
+ constexpr bool v6 __attribute__((unused))
+ = _Ttesttype::is_integer;
+ constexpr bool v7 __attribute__((unused))
+ = _Ttesttype::is_exact;
+ constexpr int v8 __attribute__((unused))
+ = _Ttesttype::radix;
+ constexpr int v9 __attribute__((unused))
+ = _Ttesttype::min_exponent;
+ constexpr int v10 __attribute__((unused))
+ = _Ttesttype::min_exponent10;
+ constexpr int v11 __attribute__((unused))
+ = _Ttesttype::max_exponent;
+ constexpr int v12 __attribute__((unused))
+ = _Ttesttype::max_exponent10;
+ constexpr bool v13 __attribute__((unused))
+ = _Ttesttype::has_infinity;
+ constexpr bool v14 __attribute__((unused))
+ = _Ttesttype::has_quiet_NaN;
+ constexpr bool v15 __attribute__((unused))
+ = _Ttesttype::has_signaling_NaN;
+ constexpr float_denorm_style v16 __attribute__((unused))
+ = _Ttesttype::has_denorm;
+ constexpr bool v17 __attribute__((unused))
+ = _Ttesttype::has_denorm_loss;
+ constexpr bool v18 __attribute__((unused))
+ = _Ttesttype::is_iec559;
+ constexpr bool v19 __attribute__((unused))
+ = _Ttesttype::is_bounded;
+ constexpr bool v20 __attribute__((unused))
+ = _Ttesttype::is_modulo;
+ constexpr bool v21 __attribute__((unused))
+ = _Ttesttype::traps;
+ constexpr bool v22 __attribute__((unused))
+ = _Ttesttype::tinyness_before;
+ constexpr float_round_style v23 __attribute__((unused))
+ = _Ttesttype::round_style;
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_data test;
+ __gnu_cxx::typelist::apply_generator(test, __gnu_test::limits_tl());
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..f1848f218c2
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_functions.cc
@@ -0,0 +1,70 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <limits>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype, typename _Tbasetype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr _Tbasetype v1 __attribute__((unused))
+ = _Ttesttype::min();
+ constexpr _Tbasetype v2 __attribute__((unused))
+ = _Ttesttype::max();
+ constexpr _Tbasetype v3 __attribute__((unused))
+ = _Ttesttype::lowest();
+ constexpr _Tbasetype v4 __attribute__((unused))
+ = _Ttesttype::epsilon();
+ constexpr _Tbasetype v5 __attribute__((unused))
+ = _Ttesttype::round_error();
+ constexpr _Tbasetype v6 __attribute__((unused))
+ = _Ttesttype::infinity();
+ constexpr _Tbasetype v7 __attribute__((unused))
+ = _Ttesttype::quiet_NaN();
+ constexpr _Tbasetype v8 __attribute__((unused))
+ = _Ttesttype::signaling_NaN();
+ constexpr _Tbasetype v9 __attribute__((unused))
+ = _Ttesttype::denorm_min();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ __gnu_cxx::typelist::apply_generator(test,
+ __gnu_test::limits_tl(),
+ __gnu_test::integral_types::type());
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
index f0c65468909..65516cca230 100644
--- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
@@ -19,7 +19,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-error "static assertion failed" "" { target *-*-* } 682 }
+// { dg-error "static assertion failed" "" { target *-*-* } 1119 }
#include <utility>
diff --git a/libstdc++-v3/testsuite/20_util/default_delete/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/default_delete/cons/constexpr.cc
new file mode 100644
index 00000000000..897394a57b2
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/default_delete/cons/constexpr.cc
@@ -0,0 +1,29 @@
+// { dg-do compile { xfail *-*-* } }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <memory>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<std::default_delete<int>>(); // { dg-excess-errors "" }
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/duration/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/duration/cons/constexpr.cc
new file mode 100644
index 00000000000..6f78dbb37e3
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/cons/constexpr.cc
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <chrono>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test1;
+ test1.operator()<std::chrono::seconds>();
+
+ __gnu_test::constexpr_single_value_constructible test2;
+ test2.operator()<std::chrono::seconds, std::chrono::seconds::rep>();
+ test2.operator()<std::chrono::minutes, std::chrono::hours>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..faeab3b93ec
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/constexpr_functions.cc
@@ -0,0 +1,64 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <chrono>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::min();
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::max();
+ constexpr auto v3 __attribute__((unused))
+ = _Ttesttype::zero();
+
+ constexpr _Ttesttype obj { };
+ constexpr auto v4 __attribute__((unused))
+ = obj.count();
+ constexpr auto v5 __attribute__((unused))
+ = -obj;
+ constexpr auto v6 __attribute__((unused))
+ = +obj;
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ test.operator()<std::chrono::nanoseconds>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
index 98a35f10539..e33c5131f4a 100644
--- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// 2008-07-31 Chris Fairles <chris.fairles@gmail.com>
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 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
@@ -31,5 +31,5 @@ void test01()
test_type d;
}
-// { dg-error "rep cannot be a duration" "" { target *-*-* } 203 }
+// { dg-error "rep cannot be a duration" "" { target *-*-* } 218 }
// { dg-error "instantiated from here" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
index b83bf494db5..a865effb6dd 100644
--- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// 2008-07-31 Chris Fairles <chris.fairles@gmail.com>
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 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
@@ -32,6 +32,6 @@ void test01()
test_type d;
}
-// { dg-error "must be a specialization of ratio" "" { target *-*-* } 204 }
+// { dg-error "must be a specialization of ratio" "" { target *-*-* } 219 }
// { dg-error "instantiated from here" "" { target *-*-* } 32 }
// { dg-excess-errors "In instantiation of" }
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
index 86f349319f0..c168357edd1 100644
--- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// 2008-07-31 Chris Fairles <chris.fairles@gmail.com>
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 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,5 +33,5 @@ void test01()
test_type d;
}
-// { dg-error "period must be positive" "" { target *-*-* } 206 }
+// { dg-error "period must be positive" "" { target *-*-* } 221 }
// { dg-error "instantiated from here" "" { target *-*-* } 33 }
diff --git a/libstdc++-v3/testsuite/20_util/duration_cast/constexpr.cc b/libstdc++-v3/testsuite/20_util/duration_cast/constexpr.cc
new file mode 100644
index 00000000000..b8a89aee935
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration_cast/constexpr.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <chrono>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ using namespace std::chrono;
+
+ // non-constexpr
+ minutes mn1(6000);
+ hours hr1 __attribute__((unused)) = duration_cast<hours>(mn1);
+
+ // constexpr
+ constexpr minutes mn2(6000);
+ constexpr hours hr2 __attribute__((unused)) = duration_cast<hours>(mn2);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/clear/1.c b/libstdc++-v3/testsuite/20_util/enable_shared_from_this/cons/constexpr.cc
index 3fd2f2c799d..0df6dcf3896 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/clear/1.c
+++ b/libstdc++-v3/testsuite/20_util/enable_shared_from_this/cons/constexpr.cc
@@ -1,6 +1,7 @@
-// { dg-options "-x c -shared-libgcc -lstdc++" }
+// { dg-do compile { xfail *-*-* } }
+// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2010 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
@@ -17,18 +18,18 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <cassert>
-#include <stdatomic.h>
+#include <memory>
+#include <testsuite_common_types.h>
-// libstdc++/40826
-// libstdc++/40654
-int main()
+struct derived : public std::enable_shared_from_this<int>
{
- atomic_flag f = ATOMIC_FLAG_INIT;
-
- atomic_flag_clear(&f); // set to false
- assert( false == atomic_flag_test_and_set(&f) ); // return previous false, set to true
- assert( true == atomic_flag_test_and_set(&f) ); // return true
+ constexpr derived() { }
+};
+int main()
+{
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<derived>(); // { dg-excess-errors "" }
+ derived d;
return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/hash/chi2_quality.cc b/libstdc++-v3/testsuite/20_util/hash/chi2_quality.cc
index 4c2f09e3ce7..a105f4b45d0 100644
--- a/libstdc++-v3/testsuite/20_util/hash/chi2_quality.cc
+++ b/libstdc++-v3/testsuite/20_util/hash/chi2_quality.cc
@@ -91,10 +91,8 @@ test_uniform_random()
while (set.size() < N)
{
s.clear();
- for (int i = 0; i < len; ++i)
- {
- s.push_back(rand() % 128);
- }
+ for (unsigned int i = 0; i < len; ++i)
+ s.push_back(rand() % 128);
set.insert(s);
}
@@ -122,7 +120,7 @@ test_bit_flip_set()
while (set.size() < N)
{
std::string s(base, base+len);
- for (int i = 0; i < bits_to_flip; ++i)
+ for (unsigned int i = 0; i < bits_to_flip; ++i)
{
int bit = rand() % bitlen;
s[bit/8] ^= (1 << (bit%8));
@@ -168,7 +166,7 @@ test_bit_string_set()
for (unsigned long i = 0; i < N; ++i)
{
s.clear();
- for (int j = 0; j < sizeof(unsigned long) * 8; ++j)
+ for (unsigned int j = 0; j < sizeof(unsigned long) * 8; ++j)
{
const bool bit = (1UL << j) & i;
s.push_back(bit ? '1' : '0');
diff --git a/libstdc++-v3/testsuite/20_util/hash/quality.cc b/libstdc++-v3/testsuite/20_util/hash/quality.cc
index 3e3951f00ed..8a6edac1687 100644
--- a/libstdc++-v3/testsuite/20_util/hash/quality.cc
+++ b/libstdc++-v3/testsuite/20_util/hash/quality.cc
@@ -37,12 +37,12 @@ using namespace std;
#define STRSIZE 42
#endif
-const int num_quality_tests = NTESTS;
-const int num_strings_for_quality_tests = NSTRINGS;
-const int string_size = STRSIZE;
+const unsigned int num_quality_tests = NTESTS;
+const unsigned int num_strings_for_quality_tests = NSTRINGS;
+const unsigned int string_size = STRSIZE;
vector<string>
-random_strings(int n, int len)
+random_strings(unsigned int n, unsigned int len)
{
string s(len, '\0');
unordered_set<string> result_set;
@@ -57,10 +57,10 @@ random_strings(int n, int len)
}
double
-score_from_varying_position(string s, int index)
+score_from_varying_position(string s, unsigned int index)
{
bool test __attribute__((unused)) = true;
- int bits_in_hash_code = sizeof(size_t) * 8;
+ unsigned int bits_in_hash_code = sizeof(size_t) * 8;
// We'll iterate through all 256 vals for s[index], leaving the rest
// of s fixed. Then, for example, out of the 128 times that
@@ -71,9 +71,9 @@ score_from_varying_position(string s, int index)
// count the number of times each output position (of which there are
// bits_in_hash_code) is 1 for each bit position within s[index] (of
// which there are 8) and value of that bit (of which there are 2).
- const int jj = 2;
- const int kk = jj * bits_in_hash_code;
- const int array_size = 8 * kk;
+ const unsigned int jj = 2;
+ const unsigned int kk = jj * bits_in_hash_code;
+ const unsigned int array_size = 8 * kk;
vector<int> ones(array_size, 0);
for (int i = 0; i < 256; i++)
@@ -99,7 +99,7 @@ score_from_varying_position(string s, int index)
int good = 0, bad = 0;
for (int bit = 0; bit <= 1; bit++)
{
- for (int j = 0; j < bits_in_hash_code; j++)
+ for (unsigned int j = 0; j < bits_in_hash_code; j++)
{
for (int bitpos = 0; bitpos < 8; bitpos++)
{
@@ -121,21 +121,21 @@ score_from_varying_position(string s, int index)
}
double
-score_from_varying_position(const vector<string>& v, int index)
+score_from_varying_position(const vector<string>& v, unsigned int index)
{
double score = 0;
- for (int i = 0; i < v.size(); i++)
+ for (unsigned int i = 0; i < v.size(); i++)
score += score_from_varying_position(v[i], index);
return score / v.size();
}
double
-quality_test(int num_strings, int string_size)
+quality_test(unsigned int num_strings, unsigned int string_size)
{
// Construct random strings.
vector<string> v = random_strings(num_strings, string_size);
double sum_of_scores = 0;
- for (int i = 0; i < string_size; i++)
+ for (unsigned int i = 0; i < string_size; i++)
sum_of_scores += score_from_varying_position(v, i);
// A good hash function should have a score very close to 1, and a bad
@@ -149,7 +149,7 @@ quality_test()
bool test __attribute__((unused)) = true;
srand(137);
double sum_of_scores = 0;
- for (int i = 0; i < num_quality_tests; i++)
+ for (unsigned int i = 0; i < num_quality_tests; i++)
{
double score = quality_test(num_strings_for_quality_tests,
string_size);
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
index 8a09c65d84b..fc5744083c9 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
@@ -48,5 +48,5 @@ void test01()
// { dg-error "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 645 }
-// { dg-error "declaration of" "" { target *-*-* } 609 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1082 }
+// { dg-error "declaration of" "" { target *-*-* } 1046 }
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
index ba684144fc7..abbaefd65a7 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
@@ -48,5 +48,5 @@ void test01()
// { dg-error "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 568 }
-// { dg-error "declaration of" "" { target *-*-* } 532 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1005 }
+// { dg-error "declaration of" "" { target *-*-* } 969 }
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c b/libstdc++-v3/testsuite/20_util/pair/cons/constexpr.cc
index d56937678e2..7bf6b71162d 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c
+++ b/libstdc++-v3/testsuite/20_util/pair/cons/constexpr.cc
@@ -1,7 +1,7 @@
-// { dg-options "-x c" }
// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2010 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,19 +18,12 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <stdatomic.h>
+#include <memory>
+#include <testsuite_common_types.h>
int main()
{
- atomic_flag f;
- atomic_flag* p = &f;
- memory_order m = memory_order_relaxed;
-
- // For position only.
- atomic_flag_test_and_set(p);
- atomic_flag_test_and_set_explicit(p, m);
- atomic_flag_clear(p);
- atomic_flag_clear_explicit(p, m);
-
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<std::pair<int, int>>();
return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
index 252265c8d41..fa4c85ee77e 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
@@ -51,3 +51,7 @@ test04()
// { dg-error "instantiated from here" "" { target *-*-* } 46 }
// { dg-error "denominator cannot be zero" "" { target *-*-* } 153 }
// { dg-error "out of range" "" { target *-*-* } 154 }
+// { dg-error "non-constant expression" "" { target *-*-* } 59 }
+// { dg-error "is not a constant expression" "" { target *-*-* } 59 }
+// { dg-error "not a member" "" { target *-*-* } 162 }
+// { dg-error "not a valid template argument" "" { target *-*-* } 164 }
diff --git a/libstdc++-v3/testsuite/20_util/ratio/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/20_util/ratio/requirements/constexpr_data.cc
new file mode 100644
index 00000000000..d3a1543deca
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/ratio/requirements/constexpr_data.cc
@@ -0,0 +1,60 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <ratio>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_data
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr intmax_t v1 __attribute__((unused))
+ = _Ttesttype::num;
+ constexpr intmax_t v2 __attribute__((unused))
+ = _Ttesttype::den;
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_data test;
+ typedef std::ratio<600, 900> R1;
+ typedef std::ratio<700, 200> R2;
+ test.operator()<R1>();
+ test.operator()<std::ratio_add<R1, R2>>();
+ test.operator()<std::ratio_subtract<R1, R2>>();
+ test.operator()<std::ratio_multiply<R1, R2>>();
+ test.operator()<std::ratio_divide<R1, R2>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc
index adc005d0c50..fb6cc8f5b72 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc
@@ -32,9 +32,9 @@ void test01()
{
X* px = 0;
std::shared_ptr<X> p1(px); // { dg-error "here" }
- // { dg-error "incomplete" "" { target *-*-* } 566 }
+ // { dg-error "incomplete" "" { target *-*-* } 762 }
std::shared_ptr<X> p9(ap()); // { dg-error "here" }
- // { dg-error "incomplete" "" { target *-*-* } 658 }
+ // { dg-error "incomplete" "" { target *-*-* } 854 }
}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/constexpr.cc
new file mode 100644
index 00000000000..d040ea49666
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/constexpr.cc
@@ -0,0 +1,33 @@
+// { dg-do compile { xfail *-*-* } }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <memory>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test1;
+ test1.operator()<std::shared_ptr<int>>(); // { dg-excess-errors "" }
+
+ __gnu_test::constexpr_single_value_constructible test2;
+ test2.operator()<std::shared_ptr<int>, std::nullptr_t>(); // { dg-excess-errors "" }
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/time_point/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/time_point/cons/constexpr.cc
new file mode 100644
index 00000000000..d12d2f164c9
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/time_point/cons/constexpr.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <chrono>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ using namespace std::chrono;
+
+ __gnu_test::constexpr_default_constructible test1;
+ test1.operator()<time_point<system_clock>>();
+
+ __gnu_test::constexpr_single_value_constructible test2;
+ test2.operator()<time_point<system_clock>, seconds>();
+ test2.operator()<time_point<system_clock, seconds>,
+ time_point<system_clock, minutes>>();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/time_point/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/20_util/time_point/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..2beccd4fff6
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/time_point/requirements/constexpr_functions.cc
@@ -0,0 +1,59 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <chrono>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::min();
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::max();
+
+ constexpr _Ttesttype obj;
+ constexpr auto v3 __attribute__((unused))
+ = obj.time_since_epoch();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ using namespace std::chrono;
+ __gnu_test::constexpr_member_functions test;
+ test.operator()<time_point<system_clock>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/time_point_cast/constexpr.cc b/libstdc++-v3/testsuite/20_util/time_point_cast/constexpr.cc
new file mode 100644
index 00000000000..436a4fbfc6c
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/time_point_cast/constexpr.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <chrono>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ using namespace std::chrono;
+ typedef time_point<system_clock, hours> to_type;
+ typedef time_point<system_clock, minutes> from_type;
+
+ // constexpr
+ constexpr minutes m(6000);
+ constexpr hours h(19);
+ constexpr to_type tpm(h); // time_point object with minutes
+ constexpr from_type tph(m); // time_point object with hours
+
+ constexpr auto res(time_point_cast<hours>(tpm));
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr.cc
new file mode 100644
index 00000000000..a4666e5d5cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr.cc
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <memory>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<std::tuple<int, int>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/constexpr.cc
new file mode 100644
index 00000000000..20db7615ba8
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/constexpr.cc
@@ -0,0 +1,32 @@
+// { dg-do compile { xfail *-*-* } }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <memory>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test1;
+ test1.operator()<std::unique_ptr<int>>(); // { dg-excess-errors "" }
+
+ __gnu_test::constexpr_single_value_constructible test2;
+ test2.operator()<std::unique_ptr<int>, std::nullptr_t>(); // { dg-excess-errors "" }
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
index fbb24c002f4..42a4da992a4 100644
--- a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
@@ -42,10 +42,10 @@ main()
}
// { dg-warning "note" "" { target *-*-* } 347 }
-// { dg-warning "note" "" { target *-*-* } 466 }
-// { dg-warning "note" "" { target *-*-* } 883 }
+// { dg-warning "note" "" { target *-*-* } 1079 }
+// { dg-warning "note" "" { target *-*-* } 465 }
// { dg-warning "note" "" { target *-*-* } 580 }
// { dg-warning "note" "" { target *-*-* } 1027 }
// { dg-warning "note" "" { target *-*-* } 340 }
// { dg-warning "note" "" { target *-*-* } 290 }
-// { dg-warning "note" "" { target *-*-* } 200 }
+// { dg-warning "note" "" { target *-*-* } 201 }
diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/cons/constexpr.cc
new file mode 100644
index 00000000000..3b43769bff3
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/weak_ptr/cons/constexpr.cc
@@ -0,0 +1,32 @@
+// { dg-do compile { xfail *-*-* } }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <memory>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<std::weak_ptr<int>>(); // { dg-excess-errors "" }
+ // test.operator()<std::__weak_ptr<int>>();
+ // test.operator()<std::__weak_count<__gnu_cxx::__default_lock_policy>>();
+ // test.operator()<std::_Sp_counted_base<__gnu_cxx::__default_lock_policy>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..df6c52dd45f
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc
@@ -0,0 +1,74 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ typedef typename _Ttesttype::char_type char_type;
+ typedef typename _Ttesttype::int_type int_type;
+ const char_type c1(0);
+ const char_type c2 = c1;
+ const int_type i(0);
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::eq(c1, c2);
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::lt(c1, c2);
+ constexpr auto v3 __attribute__((unused))
+ = _Ttesttype::to_char_type(i);
+ constexpr auto v4 __attribute__((unused))
+ = _Ttesttype::to_int_type(c1);
+ constexpr auto v5 __attribute__((unused))
+ = _Ttesttype::eq_int_type(i, i);
+ constexpr auto v6 __attribute__((unused))
+ = _Ttesttype::eof();
+ constexpr auto v7 __attribute__((unused))
+ = _Ttesttype::not_eof(i);
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ test.operator()<std::char_traits<char>>();
+#ifdef _GLIBCXX_USE_WCHAR_T
+ test.operator()<std::char_traits<wchar_t>>();
+#endif
+ test.operator()<std::char_traits<char16_t>>();
+ test.operator()<std::char_traits<char32_t>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..ef8c5aac723
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_functions.cc
@@ -0,0 +1,54 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <array>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr _Ttesttype a = { };
+ constexpr auto v1 __attribute__((unused)) = a.size();
+ constexpr auto v2 __attribute__((unused)) = a.max_size();
+ constexpr auto v3 __attribute__((unused)) = a.empty();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ test.operator()<std::array<long, 60>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc
new file mode 100644
index 00000000000..aea50301375
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <bitset>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test1;
+ test1.operator()<std::bitset<0>>();
+ test1.operator()<std::bitset<1>>();
+ test1.operator()<std::bitset<256>>();
+
+ __gnu_test::constexpr_single_value_constructible test2;
+ test2.operator()<std::bitset<0>, unsigned long long>();
+ test2.operator()<std::bitset<1>, unsigned long long>();
+ test2.operator()<std::bitset<256>, unsigned long long>();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc
index e58565136da..e261ce5e6e0 100644
--- a/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc
@@ -45,7 +45,7 @@ void test01()
VERIFY( bitset<4>(s1, 4) == test01_ref<4>(s1, 4) );
const char s2[3] = { '1', '1', '0' };
- VERIFY( bitset<6>(s1, 3) == test01_ref<6>(s1, 3) );
+ VERIFY( bitset<6>(s2, 3) == test01_ref<6>(s2, 3) );
const char* s3 = "1110110";
VERIFY( bitset<7>(s3) == test01_ref<7>(s3) );
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/23_containers/bitset/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..d5b8b478c4d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/requirements/constexpr_functions.cc
@@ -0,0 +1,55 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <bitset>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr _Ttesttype obj;
+ constexpr auto v1 __attribute__((unused)) = obj.size();
+ // constexpr auto v2 = obj[4];
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ test.operator()<std::bitset<0>>();
+ test.operator()<std::bitset<1>>();
+ test.operator()<std::bitset<64>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax.cc
index 11fddbb39dd..91f58799a58 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax.cc
@@ -29,25 +29,24 @@ void test01()
bool test __attribute__((unused)) = true;
typedef std::unordered_map<std::string, int> Map;
- typedef std::pair<const std::string, int> Pair;
Map m;
- VERIFY(m.empty());
+ VERIFY( m.empty() );
m["red"] = 17;
- VERIFY(m.size() == 1);
- VERIFY(m.begin()->first == "red");
- VERIFY(m.begin()->second == 17);
- VERIFY(m["red"] == 17);
+ VERIFY( m.size() == 1 );
+ VERIFY( m.begin()->first == "red" );
+ VERIFY( m.begin()->second == 17 );
+ VERIFY( m["red"] == 17 );
m["blue"] = 9;
- VERIFY(m.size() == 2);
- VERIFY(m["blue"] == 9);
+ VERIFY( m.size() == 2 );
+ VERIFY( m["blue"] == 9 );
m["red"] = 5;
- VERIFY(m.size() == 2);
- VERIFY(m["red"] == 5);
- VERIFY(m["blue"] == 9);
+ VERIFY( m.size() == 2 );
+ VERIFY( m["red"] == 5 );
+ VERIFY( m["blue"] == 9 );
}
int main()
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax_move.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax_move.cc
new file mode 100644
index 00000000000..b0729e32712
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax_move.cc
@@ -0,0 +1,59 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-10-27 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Array version of insert
+
+#include <iterator>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_map<rvalstruct, rvalstruct> Map;
+
+ Map m;
+ VERIFY( m.empty() );
+
+ m[rvalstruct(1)] = rvalstruct(17);
+ VERIFY( m.size() == 1 );
+ VERIFY( (m.begin()->first).val == 1 );
+ VERIFY( (m.begin()->second).val == 17 );
+ VERIFY( m[rvalstruct(1)].val == 17 );
+
+ m[rvalstruct(2)] = rvalstruct(9);
+ VERIFY( m.size() == 2 );
+ VERIFY( m[rvalstruct(2)].val == 9 );
+
+ m[rvalstruct(1)] = rvalstruct(5);
+ VERIFY( m.size() == 2 );
+ VERIFY( m[rvalstruct(1)].val == 5 );
+ VERIFY( m[rvalstruct(2)].val == 9 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-1.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-1.cc
new file mode 100644
index 00000000000..45186ce459b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-1.cc
@@ -0,0 +1,76 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-10-27 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Single-element insert
+
+#include <iterator>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_map<int, rvalstruct> Map;
+ typedef std::pair<const int, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty());
+
+ std::pair<Map::iterator, bool> p = m.insert(Pair(1, rvalstruct(3)));
+ VERIFY( p.second );
+ VERIFY( m.size() == 1 );
+ VERIFY( std::distance(m.begin(), m.end()) == 1 );
+ VERIFY( p.first == m.begin() );
+ VERIFY( p.first->first == 1 );
+ VERIFY( (p.first->second).val == 3 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_map<int, rvalstruct> Map;
+ typedef std::pair<const int, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty() );
+
+ std::pair<Map::iterator, bool> p1 = m.insert(Pair(2, rvalstruct(3)));
+ std::pair<Map::iterator, bool> p2 = m.insert(Pair(2, rvalstruct(7)));
+
+ VERIFY( p1.second );
+ VERIFY( !p2.second );
+ VERIFY( m.size() == 1 );
+ VERIFY( p1.first == p2.first );
+ VERIFY( p1.first->first == 2 );
+ VERIFY( (p2.first->second).val == 3 );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-2.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-2.cc
new file mode 100644
index 00000000000..76b6bba0077
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-2.cc
@@ -0,0 +1,79 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-10-27 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Single-element insert
+
+#include <iterator>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_map<rvalstruct, rvalstruct> Map;
+ typedef std::pair<rvalstruct, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty());
+
+ std::pair<Map::iterator, bool> p = m.insert(Pair(rvalstruct(1),
+ rvalstruct(3)));
+ VERIFY( p.second );
+ VERIFY( m.size() == 1 );
+ VERIFY( std::distance(m.begin(), m.end()) == 1 );
+ VERIFY( p.first == m.begin() );
+ VERIFY( (p.first->first).val == 1 );
+ VERIFY( (p.first->second).val == 3 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_map<rvalstruct, rvalstruct> Map;
+ typedef std::pair<rvalstruct, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty() );
+
+ std::pair<Map::iterator, bool> p1 = m.insert(Pair(rvalstruct(2),
+ rvalstruct(3)));
+ std::pair<Map::iterator, bool> p2 = m.insert(Pair(rvalstruct(2),
+ rvalstruct(7)));
+
+ VERIFY( p1.second );
+ VERIFY( !p2.second );
+ VERIFY( m.size() == 1 );
+ VERIFY( p1.first == p2.first );
+ VERIFY( (p1.first->first).val == 2 );
+ VERIFY( (p2.first->second).val == 3 );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-1.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-1.cc
new file mode 100644
index 00000000000..4c933069c46
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-1.cc
@@ -0,0 +1,80 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-10-27 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Single-element insert
+
+#include <iterator>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_multimap<int, rvalstruct> Map;
+ typedef std::pair<const int, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty() );
+
+ Map::iterator i = m.insert(Pair(1, rvalstruct(3)));
+ VERIFY( m.size() == 1 );
+ VERIFY( std::distance(m.begin(), m.end()) == 1 );
+ VERIFY( i == m.begin() );
+ VERIFY( i->first == 1 );
+ VERIFY( (i->second).val == 3 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_multimap<int, rvalstruct> Map;
+ typedef std::pair<const int, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty() );
+
+ m.insert(Pair(2, rvalstruct(3)));
+ m.insert(Pair(2, rvalstruct(7)));
+
+ VERIFY( m.size() == 2 );
+ VERIFY( std::distance(m.begin(), m.end()) == 2 );
+
+ Map::iterator i1 = m.begin();
+ Map::iterator i2 = i1;
+ ++i2;
+
+ VERIFY( i1->first == 2 );
+ VERIFY( i2->first == 2 );
+ VERIFY( ((i1->second).val == 3 && (i2->second).val == 7)
+ || ((i1->second).val == 7 && (i2->second).val == 3) );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-2.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-2.cc
new file mode 100644
index 00000000000..e9008b46156
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/multimap_single_move-2.cc
@@ -0,0 +1,80 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-10-27 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Single-element insert
+
+#include <iterator>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_multimap<rvalstruct, rvalstruct> Map;
+ typedef std::pair<rvalstruct, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty() );
+
+ Map::iterator i = m.insert(Pair(rvalstruct(1), rvalstruct(3)));
+ VERIFY( m.size() == 1 );
+ VERIFY( std::distance(m.begin(), m.end()) == 1 );
+ VERIFY( i == m.begin() );
+ VERIFY( (i->first).val == 1 );
+ VERIFY( (i->second).val == 3 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_multimap<rvalstruct, rvalstruct> Map;
+ typedef std::pair<rvalstruct, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty() );
+
+ m.insert(Pair(rvalstruct(2), rvalstruct(3)));
+ m.insert(Pair(rvalstruct(2), rvalstruct(7)));
+
+ VERIFY( m.size() == 2 );
+ VERIFY( std::distance(m.begin(), m.end()) == 2 );
+
+ Map::iterator i1 = m.begin();
+ Map::iterator i2 = i1;
+ ++i2;
+
+ VERIFY( (i1->first).val == 2 );
+ VERIFY( (i2->first).val == 2 );
+ VERIFY( ((i1->second).val == 3 && (i2->second).val == 7)
+ || ((i1->second).val == 7 && (i2->second).val == 3) );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_single_move.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_single_move.cc
new file mode 100644
index 00000000000..14b8e16817a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_single_move.cc
@@ -0,0 +1,71 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-10-27 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Single-element insert
+
+#include <iterator>
+#include <unordered_set>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_multiset<rvalstruct> Set;
+ Set s;
+ VERIFY( s.empty() );
+
+ Set::iterator i = s.insert(rvalstruct(1));
+ VERIFY( s.size() == 1 );
+ VERIFY( std::distance(s.begin(), s.end()) == 1 );
+ VERIFY( i == s.begin() );
+ VERIFY( (*i).val == 1 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_multiset<rvalstruct> Set;
+ Set s;
+ VERIFY( s.empty() );
+
+ s.insert(rvalstruct(2));
+ Set::iterator i = s.insert(rvalstruct(2));
+ VERIFY( s.size() == 2 );
+ VERIFY( std::distance(s.begin(), s.end()) == 2 );
+ VERIFY( (*i).val == 2 );
+
+ Set::iterator i2 = s.begin();
+ ++i2;
+ VERIFY( i == s.begin() || i == i2 );
+ VERIFY( (*(s.begin())).val == 2 && (*i2).val == 2 );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/insert/set_single_move.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/insert/set_single_move.cc
new file mode 100644
index 00000000000..0b9ad173b0f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/insert/set_single_move.cc
@@ -0,0 +1,69 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-10-27 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Single-element insert
+
+#include <iterator>
+#include <unordered_set>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_set<rvalstruct> Set;
+ Set s;
+ VERIFY( s.empty() );
+
+ std::pair<Set::iterator, bool> p = s.insert(rvalstruct(1));
+ VERIFY( p.second );
+ VERIFY( s.size() == 1 );
+ VERIFY( std::distance(s.begin(), s.end()) == 1 );
+ VERIFY( p.first == s.begin() );
+ VERIFY( (*p.first).val == 1 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_set<rvalstruct> Set;
+ Set s;
+ VERIFY( s.empty() );
+
+ std::pair<Set::iterator, bool> p1 = s.insert(rvalstruct(2));
+ std::pair<Set::iterator, bool> p2 = s.insert(rvalstruct(2));
+ VERIFY( p1.second );
+ VERIFY( !p2.second );
+ VERIFY( s.size() == 1 );
+ VERIFY( p1.first == p2.first );
+ VERIFY( (*p1.first).val == 2 );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc b/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc
new file mode 100644
index 00000000000..20b41997303
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iterator>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<std::istream_iterator<char>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc
new file mode 100644
index 00000000000..0a6980ec1f0
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iterator>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<std::istreambuf_iterator<char, std::char_traits<char>>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr.cc b/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr.cc
new file mode 100644
index 00000000000..13d3c81685f
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <complex>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test1;
+ test1.operator()<std::complex<float>>();
+ test1.operator()<std::complex<double>>();
+ test1.operator()<std::complex<long double>>();
+
+ __gnu_test::constexpr_single_value_constructible test2;
+ test2.operator()<std::complex<float>, float>();
+ test2.operator()<std::complex<double>, double>();
+ test2.operator()<std::complex<long double>, long double>();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/complex/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..eae5ee7e89e
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/complex/requirements/constexpr_functions.cc
@@ -0,0 +1,57 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <complex>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ typedef typename _Ttesttype::_ComplexT _ComplexT;
+ const _ComplexT cc = { 1.1 };
+ constexpr _Ttesttype a(cc);
+ constexpr auto v1 __attribute__((unused)) = a.real();
+ constexpr auto v2 __attribute__((unused)) = a.imag();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ test.operator()<std::complex<float>>();
+ test.operator()<std::complex<double>>();
+ test.operator()<std::complex<long double>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_data.cc
new file mode 100644
index 00000000000..1c70881fc7c
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_data.cc
@@ -0,0 +1,59 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <random>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_data
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::block_size;
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::used_block;
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_data test;
+ typedef std::discard_block_engine
+ <
+ std::subtract_with_carry_engine<unsigned long, 24, 10, 24>,
+ 389, 24
+ > type;
+ test.operator()<type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..77f4fb5786d
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_functions.cc
@@ -0,0 +1,59 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <random>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::min();
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::max();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ typedef std::discard_block_engine
+ <
+ std::subtract_with_carry_engine<unsigned long, 24, 10, 24>,
+ 389, 24
+ > type;
+ test.operator()<type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..b10d36fb758
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/constexpr_functions.cc
@@ -0,0 +1,62 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <random>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::min();
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::max();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ typedef std::independent_bits_engine
+ <
+ std::subtract_with_carry_engine
+ <
+ uint_fast64_t, 48, 5, 12
+ >,
+ 48, uint_fast64_t
+ > type;
+ test.operator()<type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc
new file mode 100644
index 00000000000..1e8171b5c21
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc
@@ -0,0 +1,59 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <random>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_data
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::multiplier;
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::increment;
+ constexpr auto v3 __attribute__((unused))
+ = _Ttesttype::modulus;
+ constexpr auto v4 __attribute__((unused))
+ = _Ttesttype::default_seed;
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_data test;
+ typedef std::linear_congruential_engine<unsigned int, 41, 0, 2147483647> type;
+ test.operator()<type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..7917a99066a
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc
@@ -0,0 +1,55 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <random>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::min();
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::max();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ typedef std::linear_congruential_engine<unsigned int, 41, 0, 2147483647> type;
+ test.operator()<type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_data.cc
new file mode 100644
index 00000000000..4a27982b4f5
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_data.cc
@@ -0,0 +1,79 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <random>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_data
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::word_size;
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::state_size;
+ constexpr auto v3 __attribute__((unused))
+ = _Ttesttype::shift_size;
+ constexpr auto v4 __attribute__((unused))
+ = _Ttesttype::mask_bits;
+ constexpr auto v5 __attribute__((unused))
+ = _Ttesttype::xor_mask;
+ constexpr auto v6 __attribute__((unused))
+ = _Ttesttype::tempering_u;
+ constexpr auto v7 __attribute__((unused))
+ = _Ttesttype::tempering_d;
+ constexpr auto v8 __attribute__((unused))
+ = _Ttesttype::tempering_s;
+ constexpr auto v9 __attribute__((unused))
+ = _Ttesttype::tempering_b;
+ constexpr auto v10 __attribute__((unused))
+ = _Ttesttype::tempering_t;
+ constexpr auto v11 __attribute__((unused))
+ = _Ttesttype::tempering_c;
+ constexpr auto v12 __attribute__((unused))
+ = _Ttesttype::tempering_l;
+ constexpr auto v13 __attribute__((unused))
+ = _Ttesttype::initialization_multiplier;
+ constexpr auto v14 __attribute__((unused))
+ = _Ttesttype::default_seed;
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_data test;
+ typedef std::mt19937 type;
+ test.operator()<type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..03513acf8fb
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_functions.cc
@@ -0,0 +1,55 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <random>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::min();
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::max();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ typedef std::mt19937 type;
+ test.operator()<type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_data.cc
new file mode 100644
index 00000000000..dde00063e66
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_data.cc
@@ -0,0 +1,60 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <random>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_data
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::table_size;
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_data test;
+ typedef std::shuffle_order_engine
+ <
+ std::linear_congruential_engine
+ <
+ uint_fast32_t,16807UL, 0UL, 2147483647UL
+ >,
+ 256
+ > type;
+ test.operator()<type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..8829898ff46
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_functions.cc
@@ -0,0 +1,62 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <random>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::min();
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::max();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ typedef std::shuffle_order_engine
+ <
+ std::linear_congruential_engine
+ <
+ uint_fast32_t,16807UL, 0UL, 2147483647UL
+ >,
+ 256
+ > type;
+ test.operator()<type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_data.cc
new file mode 100644
index 00000000000..c22dae0bb7c
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_data.cc
@@ -0,0 +1,59 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <random>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_data
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::word_size;
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::short_lag;
+ constexpr auto v3 __attribute__((unused))
+ = _Ttesttype::long_lag;
+ constexpr auto v4 __attribute__((unused))
+ = _Ttesttype::default_seed;
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_data test;
+ typedef std::ranlux24_base type;
+ test.operator()<type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_functions.cc
new file mode 100644
index 00000000000..39a3177ab67
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_functions.cc
@@ -0,0 +1,55 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <random>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::min();
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::max();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ typedef std::ranlux24_base type;
+ test.operator()<type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc
index a7adff4d3f4..8e97d329942 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc
@@ -34,5 +34,5 @@ void test01()
}
// { dg-error "synthesized" "" { target *-*-* } 33 }
// { dg-error "within this context" "" { target *-*-* } 26 }
-// { dg-error "is private" "" { target *-*-* } 788 }
+// { dg-error "is private" "" { target *-*-* } 789 }
// { dg-error "operator=" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc
index 44f7af87da8..6e527cdc262 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc
@@ -34,5 +34,5 @@ void test02()
}
// { dg-error "within this context" "" { target *-*-* } 26 }
// { dg-error "synthesized" "" { target *-*-* } 33 }
-// { dg-error "is private" "" { target *-*-* } 785 }
+// { dg-error "is private" "" { target *-*-* } 786 }
// { dg-error "copy constructor" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc
new file mode 100644
index 00000000000..349f7f9f2d0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <ios>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_bitwise_operators<std::ios_base::fmtflags>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc
index a8abfbe929f..fd3ce10553b 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc
@@ -1,7 +1,7 @@
-// { dg-options "-x c -D_GLIBCXX_DEBUG" }
// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2010 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,5 +18,11 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// libstdc++/36130
-#include <stdatomic.h>
+#include <ios>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_bitwise_operators<std::ios_base::iostate>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc
new file mode 100644
index 00000000000..66041b87e1f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <ios>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_bitwise_operators<std::ios_base::openmode>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc b/libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc
index 2aebf46d19e..1f9876cac12 100644
--- a/libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc
+++ b/libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc
@@ -23,29 +23,69 @@
// 28.5.1
#include <regex>
-#include <testsuite_hooks.h>
void
test01()
{
- bool test __attribute__((unused)) = true;
+ std::regex_constants::syntax_option_type option { };
+ option = option | std::regex_constants::icase;
+ option = option | std::regex_constants::nosubs;
+ option = option | std::regex_constants::optimize;
+ option = option | std::regex_constants::collate;
+ option = option | std::regex_constants::ECMAScript;
+ option = option | std::regex_constants::basic;
+ option = option | std::regex_constants::extended;
+ option = option | std::regex_constants::awk;
+ option = option | std::regex_constants::grep;
+ option = option | std::regex_constants::egrep;
+}
+
+void
+test02()
+{
+ std::regex_constants::syntax_option_type option { };
+ option = option & std::regex_constants::icase;
+ option = option & std::regex_constants::nosubs;
+ option = option & std::regex_constants::optimize;
+ option = option & std::regex_constants::collate;
+ option = option & std::regex_constants::ECMAScript;
+ option = option & std::regex_constants::basic;
+ option = option & std::regex_constants::extended;
+ option = option & std::regex_constants::awk;
+ option = option & std::regex_constants::grep;
+ option = option & std::regex_constants::egrep;
+}
- std::regex_constants::syntax_option_type option = 0;
+void
+test03()
+{
+ std::regex_constants::syntax_option_type option { };
+ option = ~std::regex_constants::icase;
+ option = ~std::regex_constants::nosubs;
+ option = ~std::regex_constants::optimize;
+ option = ~std::regex_constants::collate;
+ option = ~std::regex_constants::ECMAScript;
+ option = ~std::regex_constants::basic;
+ option = ~std::regex_constants::extended;
+ option = ~std::regex_constants::awk;
+ option = ~std::regex_constants::grep;
+ option = ~std::regex_constants::egrep;
+ option = option;
+}
- option |= std::regex_constants::icase;
- option |= std::regex_constants::nosubs;
- option |= std::regex_constants::optimize;
- option |= std::regex_constants::collate;
- option |= std::regex_constants::ECMAScript;
- option |= std::regex_constants::basic;
- option |= std::regex_constants::extended;
- option |= std::regex_constants::awk;
- option |= std::regex_constants::grep;
- option |= std::regex_constants::egrep;
+void
+test04_constexpr()
+{
+ using namespace std::regex_constants;
+ constexpr auto a1 __attribute__((unused)) = icase | awk;
+ constexpr auto a2 __attribute__((unused)) = icase & awk;
+ constexpr auto a3 __attribute__((unused)) = ~grep;
}
int main()
{
test01();
+ test02();
+ test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc
new file mode 100644
index 00000000000..82d5c6ff4e2
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc
@@ -0,0 +1,71 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <regex>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_data
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr auto v1 __attribute__((unused))
+ = _Ttesttype::icase;
+ constexpr auto v2 __attribute__((unused))
+ = _Ttesttype::nosubs;
+ constexpr auto v3 __attribute__((unused))
+ = _Ttesttype::optimize;
+ constexpr auto v4 __attribute__((unused))
+ = _Ttesttype::collate;
+ constexpr auto v5 __attribute__((unused))
+ = _Ttesttype::ECMAScript;
+ constexpr auto v6 __attribute__((unused))
+ = _Ttesttype::basic;
+ constexpr auto v7 __attribute__((unused))
+ = _Ttesttype::extended;
+ constexpr auto v8 __attribute__((unused))
+ = _Ttesttype::awk;
+ constexpr auto v9 __attribute__((unused))
+ = _Ttesttype::grep;
+ constexpr auto v10 __attribute__((unused))
+ = _Ttesttype::egrep;
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_data test;
+ test.operator()<std::regex>();
+ test.operator()<std::wregex>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
index 66f5a81a5e5..9272c7eb3da 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
@@ -28,5 +28,5 @@ int main()
return 0;
}
-// { dg-error "ambiguous" "" { target *-*-* } 522 }
+// { dg-error "deleted" "" { target *-*-* } 544 }
// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/constexpr.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/constexpr.cc
new file mode 100644
index 00000000000..875c5490053
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/constexpr.cc
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <atomic>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_single_value_constructible test;
+
+ // test.operator()<std::atomic<int>, int>();
+ __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(),
+ __gnu_test::integral_types::type());
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
index 69b1eff1297..19b3a150c19 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
@@ -28,5 +28,5 @@ int main()
return 0;
}
-// { dg-error "deleted" "" { target *-*-* } 561 }
+// { dg-error "deleted" "" { target *-*-* } 583 }
// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
index 9405e459bf8..fad25935446 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
@@ -26,6 +26,6 @@ void test01()
typedef std::atomic_address test_type;
test_type t1;
test_type t2;
- t1 = t2; // { dg-error "ambiguous" }
+ t1 = t2; // { dg-error "deleted" }
}
// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/constexpr.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/constexpr.cc
new file mode 100644
index 00000000000..6b4963512a4
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/constexpr.cc
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <atomic>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_single_value_constructible test;
+ test.operator()<std::atomic_address, void*>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc
index b7724403412..b91de112650 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <stdatomic.h>
+#include <atomic>
void test01()
{
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc
index 751c6cdc696..12da321abd8 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc
@@ -29,5 +29,5 @@ int main()
return 0;
}
-// { dg-error "ambiguous" "" { target *-*-* } 522 }
+// { dg-error "deleted" "" { target *-*-* } 544 }
// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/constexpr.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/constexpr.cc
new file mode 100644
index 00000000000..a91db8d66a0
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/constexpr.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <atomic>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_single_value_constructible test;
+ __gnu_cxx::typelist::apply_generator(test,
+ __gnu_test::atomic_integrals::type(),
+ __gnu_test::integral_types::type());
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc
index 976a6991d43..e334f1b0447 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc
@@ -29,5 +29,5 @@ int main()
return 0;
}
-// { dg-error "deleted" "" { target *-*-* } 561 }
+// { dg-error "deleted" "" { target *-*-* } 583 }
// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc
index 2a112c95838..b2f1ea4e3bf 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc
@@ -27,7 +27,7 @@ int main()
return 0;
}
-// { dg-error "operator" "" { target *-*-* } 405 }
-// { dg-error "operator" "" { target *-*-* } 406 }
-// { dg-error "operator" "" { target *-*-* } 407 }
+// { dg-error "operator" "" { target *-*-* } 427 }
+// { dg-error "operator" "" { target *-*-* } 428 }
+// { dg-error "operator" "" { target *-*-* } 429 }
// { dg-excess-errors "In file included from" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc
index 974c947e664..dd84c836d9b 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc
@@ -28,6 +28,6 @@ int main()
return 0;
}
-// { dg-error "operator" "" { target *-*-* } 376 }
-// { dg-error "operator" "" { target *-*-* } 377 }
-// { dg-error "operator" "" { target *-*-* } 378 }
+// { dg-error "operator" "" { target *-*-* } 384 }
+// { dg-error "operator" "" { target *-*-* } 385 }
+// { dg-error "operator" "" { target *-*-* } 386 }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc
index 4927fcf1854..90b75556d18 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc
@@ -28,6 +28,6 @@ int main()
return 0;
}
-// { dg-error "operator" "" { target *-*-* } 354 }
-// { dg-error "operator" "" { target *-*-* } 355 }
-// { dg-error "operator" "" { target *-*-* } 356 }
+// { dg-error "operator" "" { target *-*-* } 362 }
+// { dg-error "operator" "" { target *-*-* } 363 }
+// { dg-error "operator" "" { target *-*-* } 364 }
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc
index c0419c9b8d8..022cd90b250 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 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
@@ -22,24 +22,91 @@
namespace gnu
{
-#ifndef ATOMIC_INTEGRAL_LOCK_FREE
-# error "ATOMIC_INTEGRAL_LOCK_FREE must be a macro"
+#ifndef ATOMIC_CHAR_LOCK_FREE
+# error "ATOMIC_CHAR_LOCK_FREE must be a macro"
#else
-# if ATOMIC_INTEGRAL_LOCK_FREE != 0 \
- && ATOMIC_INTEGRAL_LOCK_FREE != 1 && ATOMIC_INTEGRAL_LOCK_FREE != 2
-# error "ATOMIC_INTEGRAL_LOCK_FREE must be 0, 1, or 2"
+# if ATOMIC_CHAR_LOCK_FREE != 0 \
+ && ATOMIC_CHAR_LOCK_FREE != 1 && ATOMIC_CHAR_LOCK_FREE != 2
+# error "ATOMIC_CHAR_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_CHAR16_T_LOCK_FREE
+# error "ATOMIC_CHAR16_T_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_CHAR16_T_LOCK_FREE != 0 \
+ && ATOMIC_CHAR16_T_LOCK_FREE != 1 && ATOMIC_CHAR16_T_LOCK_FREE != 2
+# error "ATOMIC_CHAR16_T_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_CHAR32_T_LOCK_FREE
+# error "ATOMIC_CHAR32_T_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_CHAR32_T_LOCK_FREE != 0 \
+ && ATOMIC_CHAR32_T_LOCK_FREE != 1 && ATOMIC_CHAR32_T_LOCK_FREE != 2
+# error "ATOMIC_CHAR32_T_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_WCHAR_T_LOCK_FREE
+# error "ATOMIC_WCHAR_T_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_WCHAR_T_LOCK_FREE != 0 \
+ && ATOMIC_WCHAR_T_LOCK_FREE != 1 && ATOMIC_WCHAR_T_LOCK_FREE != 2
+# error "ATOMIC_WCHAR_T_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_SHORT_LOCK_FREE
+# error "ATOMIC_SHORT_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_SHORT_LOCK_FREE != 0 \
+ && ATOMIC_SHORT_LOCK_FREE != 1 && ATOMIC_SHORT_LOCK_FREE != 2
+# error "ATOMIC_SHORT_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_INT_LOCK_FREE
+# error "ATOMIC_INT_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_INT_LOCK_FREE != 0 \
+ && ATOMIC_INT_LOCK_FREE != 1 && ATOMIC_INT_LOCK_FREE != 2
+# error "ATOMIC_INT_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_LONG_LOCK_FREE
+# error "ATOMIC_LONG_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_LONG_LOCK_FREE != 0 \
+ && ATOMIC_LONG_LOCK_FREE != 1 && ATOMIC_LONG_LOCK_FREE != 2
+# error "ATOMIC_LONG_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_LLONG_LOCK_FREE
+# error "ATOMIC_LLONG_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_LLONG_LOCK_FREE != 0 \
+ && ATOMIC_LLONG_LOCK_FREE != 1 && ATOMIC_LLONG_LOCK_FREE != 2
+# error "ATOMIC_LLONG_LOCK_FREE must be 0, 1, or 2"
# endif
#endif
#ifndef ATOMIC_ADDRESS_LOCK_FREE
# error "ATOMIC_ADDRESS_LOCK_FREE must be a macro"
-# if ATOMIC_INTEGRAL_LOCK_FREE != 0 \
- && ATOMIC_INTEGRAL_LOCK_FREE != 1 && ATOMIC_INTEGRAL_LOCK_FREE != 2
-# error "ATOMIC_INTEGRAL_LOCK_FREE must be 0, 1, or 2"
+# if ATOMIC_ADDRESS_LOCK_FREE != 0 \
+ && ATOMIC_ADDRESS_LOCK_FREE != 1 && ATOMIC_ADDRESS_LOCK_FREE != 2
+# error "ATOMIC_ADDRESS_LOCK_FREE must be 0, 1, or 2"
# endif
#endif
#ifndef ATOMIC_FLAG_INIT
#error "ATOMIC_FLAG_INIT_must_be_a_macro"
#endif
+
+#ifndef ATOMIC_VAR_INIT
+ #error "ATOMIC_VAR_INIT_must_be_a_macro"
+#endif
}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
index ce1e04359ad..13e4949e9b1 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 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
@@ -69,7 +69,6 @@ void test01()
using std::atomic_intptr_t;
using std::atomic_uintptr_t;
using std::atomic_size_t;
- using std::atomic_ssize_t;
using std::atomic_ptrdiff_t;
using std::atomic_intmax_t;
using std::atomic_uintmax_t;
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc
index cbdb5e6fcb2..57907734304 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 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
@@ -49,6 +49,29 @@ void test01()
using atomic_char16_t;
using atomic_char32_t;
+ using atomic_int_least8_t;
+ using atomic_uint_least8_t;
+ using atomic_int_least16_t;
+ using atomic_uint_least16_t;
+ using atomic_int_least32_t;
+ using atomic_uint_least32_t;
+ using atomic_int_least64_t;
+ using atomic_uint_least64_t;
+ using atomic_int_fast8_t;
+ using atomic_uint_fast8_t;
+ using atomic_int_fast16_t;
+ using atomic_uint_fast16_t;
+ using atomic_int_fast32_t;
+ using atomic_uint_fast32_t;
+ using atomic_int_fast64_t;
+ using atomic_uint_fast64_t;
+ using atomic_intptr_t;
+ using atomic_uintptr_t;
+ using atomic_size_t;
+ using atomic_ptrdiff_t;
+ using atomic_intmax_t;
+ using atomic_uintmax_t;
+
using atomic_address;
}
@@ -76,3 +99,72 @@ void test01()
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 49 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 50 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 52 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 53 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 54 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 55 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 56 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 57 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 58 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 59 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 60 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 61 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 62 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 63 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 64 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 65 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 66 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 67 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 68 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 69 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 70 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 71 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 72 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 73 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 75 }
+
+// { dg-error "declared" "" { target *-*-* } 26 }
+// { dg-error "declared" "" { target *-*-* } 27 }
+// { dg-error "declared" "" { target *-*-* } 28 }
+// { dg-error "declared" "" { target *-*-* } 29 }
+// { dg-error "declared" "" { target *-*-* } 30 }
+// { dg-error "declared" "" { target *-*-* } 31 }
+// { dg-error "declared" "" { target *-*-* } 32 }
+// { dg-error "declared" "" { target *-*-* } 34 }
+// { dg-error "declared" "" { target *-*-* } 36 }
+// { dg-error "declared" "" { target *-*-* } 37 }
+// { dg-error "declared" "" { target *-*-* } 38 }
+// { dg-error "declared" "" { target *-*-* } 39 }
+// { dg-error "declared" "" { target *-*-* } 40 }
+// { dg-error "declared" "" { target *-*-* } 41 }
+// { dg-error "declared" "" { target *-*-* } 42 }
+// { dg-error "declared" "" { target *-*-* } 43 }
+// { dg-error "declared" "" { target *-*-* } 44 }
+// { dg-error "declared" "" { target *-*-* } 45 }
+// { dg-error "declared" "" { target *-*-* } 46 }
+// { dg-error "declared" "" { target *-*-* } 47 }
+// { dg-error "declared" "" { target *-*-* } 48 }
+// { dg-error "declared" "" { target *-*-* } 49 }
+// { dg-error "declared" "" { target *-*-* } 50 }
+// { dg-error "declared" "" { target *-*-* } 52 }
+// { dg-error "declared" "" { target *-*-* } 53 }
+// { dg-error "declared" "" { target *-*-* } 54 }
+// { dg-error "declared" "" { target *-*-* } 55 }
+// { dg-error "declared" "" { target *-*-* } 56 }
+// { dg-error "declared" "" { target *-*-* } 57 }
+// { dg-error "declared" "" { target *-*-* } 58 }
+// { dg-error "declared" "" { target *-*-* } 59 }
+// { dg-error "declared" "" { target *-*-* } 60 }
+// { dg-error "declared" "" { target *-*-* } 61 }
+// { dg-error "declared" "" { target *-*-* } 62 }
+// { dg-error "declared" "" { target *-*-* } 63 }
+// { dg-error "declared" "" { target *-*-* } 64 }
+// { dg-error "declared" "" { target *-*-* } 65 }
+// { dg-error "declared" "" { target *-*-* } 66 }
+// { dg-error "declared" "" { target *-*-* } 67 }
+// { dg-error "declared" "" { target *-*-* } 68 }
+// { dg-error "declared" "" { target *-*-* } 69 }
+// { dg-error "declared" "" { target *-*-* } 70 }
+// { dg-error "declared" "" { target *-*-* } 71 }
+// { dg-error "declared" "" { target *-*-* } 72 }
+// { dg-error "declared" "" { target *-*-* } 73 }
+// { dg-error "declared" "" { target *-*-* } 75 }
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
deleted file mode 100644
index 7d6992e4a38..00000000000
--- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
+++ /dev/null
@@ -1,114 +0,0 @@
-// { dg-options "-x c" }
-// { dg-do compile }
-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <stdatomic.h>
-
-int main()
-{
-#ifndef ATOMIC_INTEGRAL_LOCK_FREE
- #error "ATOMIC_INTEGRAL_LOCK_FREE_must_be_a_macro"
-#endif
-
-#ifndef ATOMIC_ADDRESS_LOCK_FREE
- #error "ATOMIC_ADDRESS_LOCK_FREE_must_be_a_macro"
-#endif
-
-#ifndef ATOMIC_FLAG_INIT
- #error "ATOMIC_FLAG_INIT_must_be_a_macro"
-#endif
-
-#ifndef atomic_is_lock_free
- #error "atomic_is_lock_free_must_be_a_macro"
-#endif
-
-#ifndef atomic_load
- #error "atomic_load_must_be_a_macro"
-#endif
-
-#ifndef atomic_load_explicit
- #error "atomic_load_explicit_must_be_a_macro"
-#endif
-
-#ifndef atomic_store_explicit
- #error "atomic_store_explicit_must_be_a_macro"
-#endif
-
-#ifndef atomic_store
- #error "atomic_store_must_be_a_macro"
-#endif
-
-#ifndef atomic_exchange_explicit
- #error "atomic_exchange_explicit_must_be_a_macro"
-#endif
-
-#ifndef atomic_exchange
- #error "atomic_exchange_must_be_a_macro"
-#endif
-
-#ifndef atomic_compare_exchange
- #error "atomic_compare_exchange_must_be_a_macro"
-#endif
-
-#ifndef atomic_compare_exchange_explicit
- #error "atomic_compare_exchange_explicit_must_be_a_macro"
-#endif
-
-#ifndef atomic_fetch_add_explicit
- #error "atomic_fetch_add_explicit_must_be_a_macro"
-#endif
-
-#ifndef atomic_fetch_add
- #error "atomic_fetch_add_must_be_a_macro"
-#endif
-
-#ifndef atomic_fetch_sub_explicit
- #error "atomic_fetch_sub_explicit_must_be_a_macro"
-#endif
-
-#ifndef atomic_fetch_sub
- #error "atomic_fetch_sub_must_be_a_macro"
-#endif
-
-#ifndef atomic_fetch_and_explicit
- #error "atomic_fetch_and_explicit_must_be_a_macro"
-#endif
-
-#ifndef atomic_fetch_and
- #error "atomic_fetch_and_must_be_a_macro"
-#endif
-
-#ifndef atomic_fetch_or_explicit
- #error "atomic_fetch_or_explicit_must_be_a_macro"
-#endif
-
-#ifndef atomic_fetch_or
- #error "atomic_fetch_or_must_be_a_macro"
-#endif
-
-#ifndef atomic_fetch_xor_explicit
- #error "atomic_fetch_xor_explicit_must_be_a_macro"
-#endif
-
-#ifndef atomic_fetch_xor
- #error "atomic_fetch_xor_must_be_a_macro"
-#endif
-
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c
deleted file mode 100644
index 48d6d926759..00000000000
--- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c
+++ /dev/null
@@ -1,77 +0,0 @@
-// { dg-options "-x c" }
-// { dg-do compile }
-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <stdatomic.h>
-
-void test01()
-{
- typedef memory_order t_01;
- memory_order t_02 __attribute__((unused)) = memory_order_relaxed;
- memory_order t_03 __attribute__((unused)) = memory_order_acquire;
- memory_order t_04 __attribute__((unused)) = memory_order_release;
- memory_order t_05 __attribute__((unused)) = memory_order_acq_rel;
- memory_order t_06 __attribute__((unused)) = memory_order_seq_cst;
-
- typedef atomic_flag t_07;
-
- // atomics for builtins types
- typedef atomic_bool t_08;
- typedef atomic_char t_09;
- typedef atomic_schar t_10;
- typedef atomic_uchar t_11;
- typedef atomic_short t_12;
- typedef atomic_ushort t_13;
- typedef atomic_int t_14;
- typedef atomic_uint t_15;
- typedef atomic_long t_16;
- typedef atomic_ulong t_17;
- typedef atomic_llong t_18;
- typedef atomic_ullong t_19;
- typedef atomic_wchar_t t_20;
- typedef atomic_char16_t t_21;
- typedef atomic_char32_t t_22;
-
- // atomics for standard typedefs
- typedef atomic_int_least8_t t_23;
- typedef atomic_uint_least8_t t_24;
- typedef atomic_int_least16_t t_25;
- typedef atomic_uint_least16_t t_26;
- typedef atomic_int_least32_t t_27;
- typedef atomic_uint_least32_t t_28;
- typedef atomic_int_least64_t t_29;
- typedef atomic_uint_least64_t t_30;
- typedef atomic_int_fast8_t t_31;
- typedef atomic_uint_fast8_t t_32;
- typedef atomic_int_fast16_t t_33;
- typedef atomic_uint_fast16_t t_34;
- typedef atomic_int_fast32_t t_35;
- typedef atomic_uint_fast32_t t_36;
- typedef atomic_int_fast64_t t_37;
- typedef atomic_uint_fast64_t t_38;
- typedef atomic_intptr_t t_39;
- typedef atomic_uintptr_t t_40;
- typedef atomic_size_t t_41;
- typedef atomic_ssize_t t_42;
- typedef atomic_ptrdiff_t t_43;
- typedef atomic_intmax_t t_44;
- typedef atomic_uintmax_t t_45;
-
- typedef atomic_address t_46;
-}
diff --git a/libstdc++-v3/testsuite/30_threads/call_once/constexpr.cc b/libstdc++-v3/testsuite/30_threads/call_once/constexpr.cc
new file mode 100644
index 00000000000..56efa06146b
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/call_once/constexpr.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <mutex>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<std::mutex>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/cons/constexpr.cc b/libstdc++-v3/testsuite/30_threads/mutex/cons/constexpr.cc
new file mode 100644
index 00000000000..56efa06146b
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/mutex/cons/constexpr.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <mutex>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<std::mutex>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/once_flag/cons/constexpr.cc b/libstdc++-v3/testsuite/30_threads/once_flag/cons/constexpr.cc
new file mode 100644
index 00000000000..4f238de9b3c
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/once_flag/cons/constexpr.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <mutex>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<std::once_flag>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc b/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc
index 471c4482b2d..7f8072427ca 100644
--- a/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc
+++ b/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc
@@ -22,4 +22,4 @@
#include <vector>
-// { dg-error "Cannot use -D_GLIBCXX_PROFILE with " "" { target *-*-* } 196 }
+// { dg-error "Cannot use -D_GLIBCXX_PROFILE with " "" { target *-*-* } 223 }
diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc
index a80a2eec85f..73a0f9e276b 100644
--- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc
+++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc
@@ -30,9 +30,9 @@ void test01()
{
X* px = 0;
std::tr1::shared_ptr<X> p1(px); // { dg-error "here" }
- // { dg-error "incomplete" "" { target *-*-* } 370 }
+ // { dg-error "incomplete" "" { target *-*-* } 561 }
std::tr1::shared_ptr<X> p9(ap()); // { dg-error "here" }
- // { dg-error "incomplete" "" { target *-*-* } 409 }
+ // { dg-error "incomplete" "" { target *-*-* } 600 }
}
diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc
index 4921716b75c..91f4aefde61 100644
--- a/libstdc++-v3/testsuite/util/testsuite_abi.cc
+++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc
@@ -193,6 +193,7 @@ check_version(symbol& test, bool added)
known_versions.push_back("GLIBCXX_3.4.13");
known_versions.push_back("GLIBCXX_3.4.14");
known_versions.push_back("GLIBCXX_3.4.15");
+ known_versions.push_back("GLIBCXX_3.4.16");
known_versions.push_back("GLIBCXX_LDBL_3.4");
known_versions.push_back("GLIBCXX_LDBL_3.4.7");
known_versions.push_back("GLIBCXX_LDBL_3.4.10");
diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h
index 1db0ca08c79..a402bcf6b48 100644
--- a/libstdc++-v3/testsuite/util/testsuite_common_types.h
+++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h
@@ -339,6 +339,14 @@ namespace __gnu_test
typedef transform<integral_types::type, atomics>::type atomics_tl;
#endif
+ template<typename Tp>
+ struct numeric_limits
+ {
+ typedef Tp value_type;
+ typedef std::numeric_limits<value_type> type;
+ };
+
+ typedef transform<integral_types::type, numeric_limits>::type limits_tl;
struct has_increment_operators
{
@@ -384,6 +392,20 @@ namespace __gnu_test
}
};
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp>
+ void
+ constexpr_bitwise_operators()
+ {
+ constexpr _Tp a = _Tp();
+ constexpr _Tp b = _Tp();
+ constexpr _Tp c1 __attribute__((unused)) = a | b;
+ constexpr _Tp c2 __attribute__((unused)) = a & b;
+ constexpr _Tp c3 __attribute__((unused)) = a ^ b;
+ constexpr _Tp c4 __attribute__((unused)) = ~b;
+ }
+#endif
+
template<typename _Tp>
void
bitwise_operators()
@@ -540,7 +562,7 @@ namespace __gnu_test
struct _Concept
{
void __constraint()
- { _Tp __v; }
+ { _Tp __v __attribute__((unused)); }
};
void (_Concept::*__x)() __attribute__((unused))
@@ -588,6 +610,53 @@ namespace __gnu_test
}
};
+ // Generator to test constexpr constructor
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // Generator to test default constructor.
+ struct constexpr_default_constructible
+ {
+ template<typename _Tp>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ // Have to have user-defined default ctor for this to work.
+ void __constraint()
+ { constexpr _Tp __v; }
+ };
+
+ void (_Concept::*__x)() __attribute__((unused))
+ = &_Concept::__constraint;
+ }
+ };
+
+ struct constexpr_single_value_constructible
+ {
+ template<typename _Ttesttype, typename _Tbasetype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ // Additional constraint on _Tbasetype needed.
+ // Either assume user-defined default ctor as per
+ // constexpr_default_constructible and provide no
+ // initializer, provide an initializer, or assume empty-list
+ // init-able. Choose the latter.
+ void __constraint()
+ {
+ constexpr _Tbasetype __v { };
+ constexpr _Ttesttype __t(__v);
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+#endif
+
// Generator to test direct list initialization
#ifdef __GXX_EXPERIMENTAL_CXX0X__
struct direct_list_initializable
diff --git a/libstdc++-v3/testsuite/util/testsuite_rvalref.h b/libstdc++-v3/testsuite/util/testsuite_rvalref.h
index b44d6ddd12d..5610b77cc43 100644
--- a/libstdc++-v3/testsuite/util/testsuite_rvalref.h
+++ b/libstdc++-v3/testsuite/util/testsuite_rvalref.h
@@ -1,7 +1,8 @@
// -*- C++ -*-
// Testing utilities for the rvalue reference.
//
-// Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// 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
@@ -27,35 +28,30 @@
namespace __gnu_test
{
- // This class is designed to test libstdc++'s template-based rvalue
- // reference support. It should fail at compile-time if there is an attempt
- // to copy it (although see note just below).
- class rvalstruct
+ // This class is designed to test libstdc++'s template-based rvalue
+ // reference support. It should fail at compile-time if there is an
+ // attempt to copy it.
+ struct rvalstruct
{
- bool
- operator=(const rvalstruct&);
-
- rvalstruct(const rvalstruct&);
-
- public:
int val;
bool valid;
- rvalstruct() : valid(false)
+ rvalstruct() : val(0), valid(true)
{ }
rvalstruct(int inval) : val(inval), valid(true)
{ }
-
+
rvalstruct&
operator=(int newval)
{
- VERIFY(valid == false);
- val = newval;
+ val = newval;
valid = true;
return *this;
}
+ rvalstruct(const rvalstruct&) = delete;
+
rvalstruct(rvalstruct&& in)
{
VERIFY(in.valid == true);
@@ -65,6 +61,9 @@ namespace __gnu_test
}
rvalstruct&
+ operator=(const rvalstruct&) = delete;
+
+ rvalstruct&
operator=(rvalstruct&& in)
{
VERIFY(in.valid == true);
@@ -75,11 +74,11 @@ namespace __gnu_test
}
};
- bool
+ inline bool
operator==(const rvalstruct& lhs, const rvalstruct& rhs)
{ return lhs.val == rhs.val; }
- bool
+ inline bool
operator<(const rvalstruct& lhs, const rvalstruct& rhs)
{ return lhs.val < rhs.val; }
@@ -156,15 +155,15 @@ namespace __gnu_test
int copycounter::copycount = 0;
- bool
+ inline bool
operator==(const copycounter& lhs, const copycounter& rhs)
{ return lhs.val == rhs.val; }
- bool
+ inline bool
operator<(const copycounter& lhs, const copycounter& rhs)
{ return lhs.val < rhs.val; }
- void
+ inline void
swap(copycounter& lhs, copycounter& rhs)
{
VERIFY(lhs.valid && rhs.valid);
@@ -175,4 +174,21 @@ namespace __gnu_test
} // namespace __gnu_test
+namespace std
+{
+ template<typename _Tp> struct hash;
+
+ /// std::hash specialization for type_index.
+ template<>
+ struct hash<__gnu_test::rvalstruct>
+ {
+ typedef size_t result_type;
+ typedef __gnu_test::rvalstruct argument_type;
+
+ size_t
+ operator()(const __gnu_test::rvalstruct& __rvs) const
+ { return __rvs.val; }
+ };
+}
+
#endif // _GLIBCXX_TESTSUITE_TR1_H