aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog210
-rw-r--r--libstdc++-v3/docs/html/test.html13
-rw-r--r--libstdc++-v3/include/Makefile.am76
-rw-r--r--libstdc++-v3/include/Makefile.in90
-rw-r--r--libstdc++-v3/include/bits/locale_facets.tcc66
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp124
-rw-r--r--libstdc++-v3/include/ext/rc_string_base.h18
-rw-r--r--libstdc++-v3/include/ext/sso_string_base.h11
-rw-r--r--libstdc++-v3/include/ext/typelist.h73
-rw-r--r--libstdc++-v3/include/precompiled/extc++.h61
-rw-r--r--libstdc++-v3/include/precompiled/stdc++.h (renamed from libstdc++-v3/include/stdc++.h)0
-rw-r--r--libstdc++-v3/include/precompiled/stdtr1c++.h54
-rw-r--r--libstdc++-v3/include/tr1/random595
-rw-r--r--libstdc++-v3/include/tr1/random.tcc547
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc2
-rw-r--r--libstdc++-v3/testsuite/lib/libstdc++.exp11
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/create/map.cc4
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/create_from_sorted/set.cc4
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/create_sort/list.cc4
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/find/map.cc4
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/index/map.cc4
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/insert/associative.cc4
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/insert/sequence.cc4
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/insert_erase/associative.cc4
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/insert_from_sorted/set.cc4
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/producer_consumer/associative.cc6
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/producer_consumer/sequence.cc4
-rw-r--r--libstdc++-v3/testsuite/performance/23_containers/sort_search/list.cc4
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/bernoulli_distribution/requirements/typedefs.cc37
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/exponential_distribution/requirements/typedefs.cc37
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/gamma_distribution/requirements/typedefs.cc37
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/geometric_distribution/requirements/typedefs.cc37
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/normal_distribution/requirements/typedefs.cc37
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_real/requirements/typedefs.cc2
-rw-r--r--libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp261
-rw-r--r--libstdc++-v3/testsuite/util/regression/basic_type.hpp85
-rw-r--r--libstdc++-v3/testsuite/util/regression/priority_queue/common_type.hpp27
-rw-r--r--libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp608
-rw-r--r--libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp10
-rw-r--r--libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp4
-rw-r--r--libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp360
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_common_types.h10
50 files changed, 2369 insertions, 1200 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 1a150eeb873..153eb820657 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,213 @@
+2006-07-10 Benjamin Kosnik <bkoz@redhat.com>
+
+ PR libstdc++/15448
+ * include/Makefile.am: Clean up pch rules.
+ * include/Makefile.in: Regenerate.
+
+2006-07-09 Paolo Carlini <pcarlini@suse.de>
+
+ * include/bits/locale_facets.tcc (__int_to_char<>(_CharT*,
+ long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*,
+ unsigned long, const _CharT*, ios_base::fmtflags),
+ __int_to_char<>(_CharT*, long long, const _CharT*, ios_base::fmtflags),
+ __int_to_char<>(_CharT*, unsigned long long, const _CharT*,
+ ios_base::fmtflags)): Remove.
+ (__int_to_char<>(_CharT*, _ValueT, const _CharT*, ios_base::fmtflags,
+ bool)): Adjust.
+ (num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)):
+ Likewise.
+
+2006-07-06 Paolo Carlini <pcarlini@suse.de>
+
+ * include/tr1/random (class gamma_distribution<>): Add.
+ * include/tr1/random.tcc (gamma_distribution<>::operator(),
+ operator<<(std::basic_ostream<>&, const gamma_distribution<>&)):
+ Define.
+ * testsuite/tr1/5_numerical_facilities/random/gamma_distribution/
+ requirements/typedefs.cc: New.
+
+2006-07-06 Benjamin Kosnik <bkoz@redhat.com>
+
+ * testsuite/util/regression/trait/assoc/trait.hpp: Format.
+ * testsuite/util/regression/rand/priority_queue/
+ rand_regression_test.hpp: Same.
+ * testsuite/util/regression/rand/assoc/rand_regression_test.hpp: Same.
+ * testsuite/util/regression/rand/
+ assoc/container_rand_regression_test.hpp: Same.
+ * testsuite/util/regression/priority_queue/common_type.hpp: Same.
+ * testsuite/util/regression/assoc/common_type.hpp: Same.
+ * testsuite/util/regression/basic_type.hpp: Same.
+
+2006-07-05 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/Makefile.am (pch_output): New.
+ (clean-local): Use it.
+ * include/Makefile.in: Regenerate.
+
+2006-07-04 Paolo Carlini <pcarlini@suse.de>
+
+ * include/tr1/random (_Adaptor<>::operator()()): Cast 1 to
+ result_type.
+ (variate_generator<>::operator()(),
+ variate_generator<>::operator()(_Tp)): Inline.
+
+ * include/tr1/random: Minor cosmetic changes.
+
+2006-07-03 Paolo Carlini <pcarlini@suse.de>
+
+ * include/ext/rc_string_base.h (__rc_string_base::_S_max_size):
+ Adjust, take into account rounding in _M_create.
+ (__rc_string_base::_M_create): Add early _S_max_size check.
+
+2006-07-03 Ian Lance Taylor <ian@airs.com>
+ Paolo Carlini <pcarlini@suse.de>
+
+ * include/ext/rc_string_base.h (__rc_string_base::_S_max_size):
+ Increase by a factor of two.
+ * include/ext/sso_string_base.h (__sso_string_base::_S_max_size):
+ Likewise.
+
+2006-07-03 Paolo Carlini <pcarlini@suse.de>
+
+ * include/ext/sso_string_base.h (__sso_string_base::_M_create): Never
+ allocate a string bigger than _S_max_size.
+
+2006-06-29 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/Makefile.am (pch1_input, pch1_output_builddir,
+ pch1_outputj_installdir, pch1_source): Move from pch_*.
+ (pch2_input, pch2_output_builddir,
+ pch2_output_installdir, pch2_source): Clone for ext.
+ (pch3_input, pch3_output_builddir,
+ pch3_output_installdir, pch3_source): Clone for tr1.
+ (install-pch): Same.
+ * include/Makefile.in: Regenerate.
+
+ * include/precompiled: New directory.
+ * include/stdc++.h: Move...
+ * include/precompiled/stdc++.h: ... here.
+ * include/precompiled/stdtr1c++.h: New.
+ * include/precompiled/extc++.h: New.
+
+ * testsuite/lib/libstdc++.exp (libstdc++_init): Set PCH_CXXFLAGS
+ to -include bits/stdtr1c++.h.
+
+2006-06-29 Benjamin Kosnik <bkoz@redhat.com>
+
+ * testsuite/lib/libstdc++.exp (v3_target_compile): Set timeout to
+ 600.
+
+2006-06-27 Benjamin Kosnik <bkoz@redhat.com>
+
+ * testsuite/util/regression/rand/priority_queue/
+ rand_regression_test.hpp: Revert.
+
+2006-06-27 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/ext/typelist.h (typelist_append): To append_typelist.
+ (typelist): To node.
+ Enclose in namespace typelist.
+ * testsuite/util/testsuite_common_types.h: Adjust names, namespaces.
+ * testsuite/performance/23_containers/find/map.cc: Same.
+ * testsuite/performance/23_containers/create/map.cc: Same.
+ * testsuite/performance/23_containers/insert_erase/associative.cc:
+ Same.
+ * testsuite/performance/23_containers/insert/sequence.cc: Same.
+ * testsuite/performance/23_containers/insert/associative.cc: Same.
+ * testsuite/performance/23_containers/create_from_sorted/set.cc: Same.
+ * testsuite/performance/23_containers/index/map.cc: Same.
+ * testsuite/performance/23_containers/insert_from_sorted/set.cc: Same.
+ * testsuite/performance/23_containers/create_sort/list.cc: Same.
+ * testsuite/performance/23_containers/sort_search/list.cc: Same.
+ * testsuite/performance/23_containers/producer_consumer/sequence.cc:
+ Same.
+ * testsuite/performance/23_containers/producer_consumer/associative.cc:
+ Same.
+
+2006-06-26 Benjamin Kosnik <bkoz@redhat.com>
+
+ * testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc:
+ Reduce iterations by half.
+ * testsuite/ext/pb_ds/regression/hash_data_map_rand.cc: Same.
+ * testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc: Same.
+ * testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc: Same.
+ * testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc: Same.
+ * testsuite/ext/pb_ds/regression/priority_queue_rand.cc: Same.
+ * testsuite/ext/pb_ds/regression/tree_data_map_rand.cc: Same.
+ * testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc: Same.
+ * testsuite/ext/pb_ds/regression/trie_data_map_rand.cc: Same.
+
+ * testsuite/util/regression/rand/assoc/rand_regression_test.hpp:
+ Set probability of compare from 1 to 0.25.
+ * testsuite/util/regression/rand/priority_queue/
+ rand_regression_test.hpp: Same.
+
+2006-06-25 Paolo Carlini <pcarlini@suse.de>
+
+ * include/tr1/random (operator<<(std::basic_ostream<>&,
+ const linear_congruential<>&), operator>>(std::basic_istream<>&,
+ linear_congruential<>&), operator<<(std::basic_ostream<>&,
+ const mersenne_twister<>&), operator>>(std::basic_istream<>&,
+ mersenne_twister<>&), operator<<(std::basic_ostream<>&,
+ const subtract_with_carry<>&), operator>>(std::basic_istream<>&,
+ subtract_with_carry<>&), operator<<(std::basic_ostream<>&,
+ const discard_block<>&), operator>>(std::basic_istream<>&,
+ discard_block<>&), operator<<(std::basic_ostream<>&,
+ const xor_combine<>&), operator>>(std::basic_istream<>&,
+ xor_combine<>&), operator<<(std::basic_ostream<>&,
+ const uniform_int<>&), operator>>(std::basic_istream<>&,
+ uniform_int<>&), operator<<(std::basic_ostream<>&,
+ const bernoulli_distribution&), operator<<(std::basic_ostream<>&,
+ const geometric_distribution<>&), operator<<(std::basic_ostream<>&,
+ const uniform_real<>&), operator>>(std::basic_istream<>&,
+ uniform_real<>&), operator<<(std::basic_ostream<>&,
+ const exponential_distribution<>&), operator<<(std::basic_ostream<>&,
+ const normal_distribution<>&), operator>>(std::basic_istream<>&,
+ normal_distribution<>&)): Redo per TR1 specs; move out of line...
+ * include/tr1/random.tcc: ... here.
+
+2006-06-24 Paolo Carlini <pcarlini@suse.de>
+
+ * include/tr1/random (class normal_distribution<>): Add.
+ * include/tr1/random.tcc (normal_distribution<>::operator()): Define.
+
+ * include/tr1/random.tcc (struct _Max): Remove, "inline" in the
+ only user, mersenne_twister<>::max().
+
+ * include/tr1/random.tcc (struct _Shift): Move...
+ * include/tr1/random: ... here.
+
+ * include/tr1/random.tcc (linear_congruential<>::
+ linear_congruential(unsigned long), linear_congruential<>::
+ linear_congruential(_Gen&), mersenne_twister<>::max())): Move inline...
+ * include/tr1/random: ... here.
+
+ * include/tr1/random (exponential_distribution<>::
+ exponential_distribution(const result_type&)): Add missing
+ _GLIBCXX_DEBUG_ASSERT.
+
+ * testsuite/tr1/5_numerical_facilities/random/
+ exponential_distribution/requirements/typedefs.cc: New.
+ * testsuite/tr1/5_numerical_facilities/random/
+ normal_distribution/requirements/typedefs.cc: Likewise.
+ * testsuite/tr1/5_numerical_facilities/random/
+ bernoulli_distribution/requirements/typedefs.cc: Likewise.
+ * testsuite/tr1/5_numerical_facilities/random/
+ geometric_distribution/requirements/typedefs.cc: Likewise.
+
+2006-06-23 Benjamin Kosnik <bkoz@redhat.com>
+
+ PR libstdc++/27984
+ * testsuite/lib/libstdc++.exp (libstdc++_init): Adjust
+ testing includes.
+ * docs/html/test.html: Adjust for testsuite changes.
+
+2006-06-22 Jonathan Lennox <lennox@cs.columbia.edu>
+ Paolo Carlini <pcarlini@suse.de>
+
+ * include/ext/pb_ds/detail/resize_policy/
+ hash_prime_size_policy_imp.hpp: Cast to size_t instead.
+
2006-06-22 Ami Tavory <atavory@gmail.com>
* include/ext/pb_ds/detail/resize_policy/
diff --git a/libstdc++-v3/docs/html/test.html b/libstdc++-v3/docs/html/test.html
index 41e0529e6c6..0465503a457 100644
--- a/libstdc++-v3/docs/html/test.html
+++ b/libstdc++-v3/docs/html/test.html
@@ -31,7 +31,7 @@
<h2>Contents</h2>
<ul>
<li><a href="#org">Testsuite organization and naming conventions</a></li>
- <li><a href="#util">Utilities: abicheck and libv3test</a></li>
+ <li><a href="#util">Utilities: abicheck and libtestc++</a></li>
<li><a href="#new">How to write a new test case</a></li>
<li><a href="#check">Options for running the tests</a></li>
<li><a href="#debug">Running debug-mode tests</a></li>
@@ -93,6 +93,7 @@ config Files for the dejagnu test harness.
lib Files for the dejagnu test harness.
libstdc++* Files for the dejagnu test harness.
data Sample text files for testing input and output.
+util Files for libtestc++, utilities and testing routines.
</pre>
<p>
@@ -207,14 +208,14 @@ cat 27_io/objects/char/3_xin.in | a.out
</ul>
<hr />
-<h2><a name="util">Utilities: abi_check and libv3test</a></h2>
+<h2><a name="util">Utilities: abi_check and libtestc++</a></h2>
<p>
The testsuite directory also contains some files that implement
functionality that is intended to make writing test cases easier,
or to avoid duplication, or to provide error checking in a way that
is consistent across platforms and test harnesses. A stand-alone
executable, called <em>abi_check</em>, and a static library called
- <em>libv3test</em> are constructed. Both of these items are not
+ <em>libtestc++</em> are constructed. Both of these items are not
installed, and only used during testing.
</p>
@@ -329,9 +330,9 @@ cat 27_io/objects/char/3_xin.in | a.out
<p>
A bunch of utility functions and classes have already been
abstracted out into the testsuite utility library, <code>
- libv3test</code>. To use this functionality, just include the
- appropriate header file: the library will automatically be linked
- in as part of the testsuite run.
+ libtestc++</code>. To use this functionality, just include the
+ appropriate header file: the library or specific object files will
+ automatically be linked in as part of the testsuite run.
</p>
<p>
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 23a4120fda5..2f9ee2ef588 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -763,13 +763,31 @@ thread_host_headers = \
${host_builddir}/gthr-tpf.h \
${host_builddir}/gthr-default.h
-pch_input = ${host_builddir}/stdc++.h
-pch_output_builddir = ${host_builddir}/stdc++.h.gch
-pch_output_installdir = ${host_installdir}/stdc++.h.gch
-pch_source = ${glibcxx_srcdir}/include/stdc++.h
+
+pch1_source = ${glibcxx_srcdir}/include/precompiled/stdc++.h
+pch1_output_builddir = ${host_builddir}/stdc++.h.gch
+pch1_output_installdir = ${host_installdir}/stdc++.h.gch
+pch1a_output = ${pch1_output_builddir}/O0g.gch
+pch1b_output = ${pch1_output_builddir}/O2g.gch
+pch1_output = ${pch1a_output} ${pch1b_output}
+
+pch2_source = ${glibcxx_srcdir}/include/precompiled/stdtr1c++.h
+pch2_output_builddir = ${host_builddir}/stdtr1c++.h.gch
+pch2_output_installdir = ${host_installdir}/stdtr1c++.h.gch
+pch2_output = ${pch2_output_builddir}/O2g.gch
+
+pch3_source = ${glibcxx_srcdir}/include/precompiled/extc++.h
+pch3_output_builddir = ${host_builddir}/extc++.h.gch
+pch3_output_installdir = ${host_installdir}/extc++.h.gch
+pch3_output = ${pch3_output_builddir}/O2g.gch
+
+
+pch_output = ${pch1_output} ${pch2_output} ${pch3_output}
+pch_output_dirs = \
+ ${pch1_output_builddir} ${pch2_output_builddir} ${pch3_output_builddir}
PCHFLAGS=-Winvalid-pch -Wno-deprecated -x c++-header $(CXXFLAGS)
if GLIBCXX_BUILD_PCH
-pch_build = ${pch_input}
+pch_build = ${pch_output}
pch_install = install-pch
else
pch_build =
@@ -1025,14 +1043,33 @@ ${host_builddir}/gthr-default.h: ${toplevel_srcdir}/gcc/${glibcxx_thread_h} \
-e 's,^#include "\(.*\)",#include <bits/\1>,g' \
< ${toplevel_srcdir}/gcc/${glibcxx_thread_h} > $@
-# Build a precompiled C++ include, stdc++.h.gch.
-${pch_input}: ${allstamped} ${host_builddir}/c++config.h ${pch_source}
- touch ${pch_input}; \
- if [ ! -d "${pch_output_builddir}" ]; then \
- mkdir -p ${pch_output_builddir}; \
+# Build two precompiled C++ includes, stdc++.h.gch/*.gch
+${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
+ if [ ! -d "${pch1_output_builddir}" ]; then \
+ mkdir -p ${pch1_output_builddir}; \
+ fi; \
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O0 -g ${pch1_source} -o $@
+
+${pch1b_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
+ if [ ! -d "${pch1_output_builddir}" ]; then \
+ mkdir -p ${pch1_output_builddir}; \
fi; \
- $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) ${pch_source} -O0 -g -o ${pch_output_builddir}/O0g.gch; \
- $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) ${pch_source} -O2 -g -o ${pch_output_builddir}/O2g.gch;
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch1_source} -o $@
+
+# Build a precompiled TR1 include, stdtr1c++.h.gch/O2.gch
+${pch2_output}: ${pch2_source} ${pch1_output}
+ if [ ! -d "${pch2_output_builddir}" ]; then \
+ mkdir -p ${pch2_output_builddir}; \
+ fi; \
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch2_source} -o $@
+
+# Build a precompiled extension include, extc++.h.gch/O2.gch
+${pch3_output}: ${pch3_source} ${pch2_output}
+ if [ ! -d "${pch3_output_builddir}" ]; then \
+ mkdir -p ${pch3_output_builddir}; \
+ fi; \
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
+
# For robustness sake (in light of junk files or in-source
# configuration), copy from the build or source tree to the install
@@ -1132,12 +1169,19 @@ install-headers:
$(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}; done
install-pch:
- $(mkinstalldirs) $(DESTDIR)${pch_output_installdir}
- for file in ${pch_output_builddir}/*; do \
- $(INSTALL_DATA) $$file $(DESTDIR)${pch_output_installdir}; done
+ $(mkinstalldirs) $(DESTDIR)${pch1_output_installdir}
+ for file in ${pch1_output_builddir}/*; do \
+ $(INSTALL_DATA) $$file $(DESTDIR)${pch1_output_installdir}; done
+ $(mkinstalldirs) $(DESTDIR)${pch2_output_installdir}
+ for file in ${pch2_output_builddir}/*; do \
+ $(INSTALL_DATA) $$file $(DESTDIR)${pch2_output_installdir}; done
# By adding these files here, automake will remove them for 'make clean'
-CLEANFILES = ${pch_input} ${pch_output_builddir}/*
+CLEANFILES = ${pch_output}
+
+# To remove directories.
+clean-local:
+ rm -rf ${pch_output_dirs}
# Stop implicit '.o' make rules from ever stomping on extensionless
# headers, in the improbable case where some foolish, crack-addled
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index d389b1d1700..9c6e532ea42 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -978,13 +978,27 @@ thread_host_headers = \
${host_builddir}/gthr-tpf.h \
${host_builddir}/gthr-default.h
-pch_input = ${host_builddir}/stdc++.h
-pch_output_builddir = ${host_builddir}/stdc++.h.gch
-pch_output_installdir = ${host_installdir}/stdc++.h.gch
-pch_source = ${glibcxx_srcdir}/include/stdc++.h
+pch1_source = ${glibcxx_srcdir}/include/precompiled/stdc++.h
+pch1_output_builddir = ${host_builddir}/stdc++.h.gch
+pch1_output_installdir = ${host_installdir}/stdc++.h.gch
+pch1a_output = ${pch1_output_builddir}/O0g.gch
+pch1b_output = ${pch1_output_builddir}/O2g.gch
+pch1_output = ${pch1a_output} ${pch1b_output}
+pch2_source = ${glibcxx_srcdir}/include/precompiled/stdtr1c++.h
+pch2_output_builddir = ${host_builddir}/stdtr1c++.h.gch
+pch2_output_installdir = ${host_installdir}/stdtr1c++.h.gch
+pch2_output = ${pch2_output_builddir}/O2g.gch
+pch3_source = ${glibcxx_srcdir}/include/precompiled/extc++.h
+pch3_output_builddir = ${host_builddir}/extc++.h.gch
+pch3_output_installdir = ${host_installdir}/extc++.h.gch
+pch3_output = ${pch3_output_builddir}/O2g.gch
+pch_output = ${pch1_output} ${pch2_output} ${pch3_output}
+pch_output_dirs = \
+ ${pch1_output_builddir} ${pch2_output_builddir} ${pch3_output_builddir}
+
PCHFLAGS = -Winvalid-pch -Wno-deprecated -x c++-header $(CXXFLAGS)
@GLIBCXX_BUILD_PCH_FALSE@pch_build =
-@GLIBCXX_BUILD_PCH_TRUE@pch_build = ${pch_input}
+@GLIBCXX_BUILD_PCH_TRUE@pch_build = ${pch_output}
@GLIBCXX_BUILD_PCH_FALSE@pch_install =
@GLIBCXX_BUILD_PCH_TRUE@pch_install = install-pch
@@ -1007,7 +1021,7 @@ allcreated = \
uppercase = [ABCDEFGHIJKLMNOPQRSTUVWXYZ_]
# By adding these files here, automake will remove them for 'make clean'
-CLEANFILES = ${pch_input} ${pch_output_builddir}/*
+CLEANFILES = ${pch_output}
all: all-am
.SUFFIXES:
@@ -1115,7 +1129,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool mostlyclean-am
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
distclean: distclean-am
-rm -f Makefile
@@ -1160,14 +1174,15 @@ ps-am:
uninstall-am: uninstall-info-am
.PHONY: all all-am all-local check check-am clean clean-generic \
- clean-libtool distclean distclean-generic distclean-libtool \
- distdir dvi dvi-am html html-am info info-am install \
- install-am install-data install-data-am install-data-local \
- install-exec install-exec-am install-info install-info-am \
- install-man install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
- ps ps-am uninstall uninstall-am uninstall-info-am
+ clean-libtool clean-local distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-data-local install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
# Here are the rules for building the headers
@@ -1400,14 +1415,32 @@ ${host_builddir}/gthr-default.h: ${toplevel_srcdir}/gcc/${glibcxx_thread_h} \
-e 's,^#include "\(.*\)",#include <bits/\1>,g' \
< ${toplevel_srcdir}/gcc/${glibcxx_thread_h} > $@
-# Build a precompiled C++ include, stdc++.h.gch.
-${pch_input}: ${allstamped} ${host_builddir}/c++config.h ${pch_source}
- touch ${pch_input}; \
- if [ ! -d "${pch_output_builddir}" ]; then \
- mkdir -p ${pch_output_builddir}; \
+# Build two precompiled C++ includes, stdc++.h.gch/*.gch
+${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
+ if [ ! -d "${pch1_output_builddir}" ]; then \
+ mkdir -p ${pch1_output_builddir}; \
+ fi; \
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O0 -g ${pch1_source} -o $@
+
+${pch1b_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
+ if [ ! -d "${pch1_output_builddir}" ]; then \
+ mkdir -p ${pch1_output_builddir}; \
+ fi; \
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch1_source} -o $@
+
+# Build a precompiled TR1 include, stdtr1c++.h.gch/O2.gch
+${pch2_output}: ${pch2_source} ${pch1_output}
+ if [ ! -d "${pch2_output_builddir}" ]; then \
+ mkdir -p ${pch2_output_builddir}; \
+ fi; \
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch2_source} -o $@
+
+# Build a precompiled extension include, extc++.h.gch/O2.gch
+${pch3_output}: ${pch3_source} ${pch2_output}
+ if [ ! -d "${pch3_output_builddir}" ]; then \
+ mkdir -p ${pch3_output_builddir}; \
fi; \
- $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) ${pch_source} -O0 -g -o ${pch_output_builddir}/O0g.gch; \
- $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) ${pch_source} -O2 -g -o ${pch_output_builddir}/O2g.gch;
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
# For robustness sake (in light of junk files or in-source
# configuration), copy from the build or source tree to the install
@@ -1504,9 +1537,16 @@ install-headers:
$(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}; done
install-pch:
- $(mkinstalldirs) $(DESTDIR)${pch_output_installdir}
- for file in ${pch_output_builddir}/*; do \
- $(INSTALL_DATA) $$file $(DESTDIR)${pch_output_installdir}; done
+ $(mkinstalldirs) $(DESTDIR)${pch1_output_installdir}
+ for file in ${pch1_output_builddir}/*; do \
+ $(INSTALL_DATA) $$file $(DESTDIR)${pch1_output_installdir}; done
+ $(mkinstalldirs) $(DESTDIR)${pch2_output_installdir}
+ for file in ${pch2_output_builddir}/*; do \
+ $(INSTALL_DATA) $$file $(DESTDIR)${pch2_output_installdir}; done
+
+# To remove directories.
+clean-local:
+ rm -rf ${pch_output_dirs}
# Stop implicit '.o' make rules from ever stomping on extensionless
# headers, in the improbable case where some foolish, crack-addled
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index fd9b0bd1ed1..a889e0134ec 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -925,60 +925,13 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
_GLIBCXX_END_LDBL_NAMESPACE
- // Forwarding functions to peel signed from unsigned integer types and
- // either cast or compute the absolute value for the former, depending
- // on __basefield.
- template<typename _CharT>
- inline int
- __int_to_char(_CharT* __bufend, long __v, const _CharT* __lit,
- ios_base::fmtflags __flags)
- {
- unsigned long __ul = __v;
- const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
- if (__builtin_expect(__basefield != ios_base::oct
- && __basefield != ios_base::hex, true))
- __ul = __v < 0 ? -__v : __ul;
- return __int_to_char(__bufend, __ul, __lit, __flags, false);
- }
-
- template<typename _CharT>
- inline int
- __int_to_char(_CharT* __bufend, unsigned long __v, const _CharT* __lit,
- ios_base::fmtflags __flags)
- { return __int_to_char(__bufend, __v, __lit, __flags, false); }
-
-#ifdef _GLIBCXX_USE_LONG_LONG
- template<typename _CharT>
- inline int
- __int_to_char(_CharT* __bufend, long long __v, const _CharT* __lit,
- ios_base::fmtflags __flags)
- {
- unsigned long long __ull = __v;
- const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
- if (__builtin_expect(__basefield != ios_base::oct
- && __basefield != ios_base::hex, true))
- __ull = __v < 0 ? -__v : __ull;
- return __int_to_char(__bufend, __ull, __lit, __flags, false);
- }
-
- template<typename _CharT>
- inline int
- __int_to_char(_CharT* __bufend, unsigned long long __v,
- const _CharT* __lit, ios_base::fmtflags __flags)
- { return __int_to_char(__bufend, __v, __lit, __flags, false); }
-#endif
-
- // N.B. The last argument is currently unused (see libstdc++/20914).
template<typename _CharT, typename _ValueT>
int
__int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit,
- ios_base::fmtflags __flags, bool)
+ ios_base::fmtflags __flags, bool __dec)
{
- const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
_CharT* __buf = __bufend;
-
- if (__builtin_expect(__basefield != ios_base::oct
- && __basefield != ios_base::hex, true))
+ if (__builtin_expect(__dec, true))
{
// Decimal.
do
@@ -988,7 +941,7 @@ _GLIBCXX_END_LDBL_NAMESPACE
}
while (__v != 0);
}
- else if (__basefield == ios_base::oct)
+ else if ((__flags & ios_base::basefield) == ios_base::oct)
{
// Octal.
do
@@ -1034,7 +987,8 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
_M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill,
_ValueT __v) const
{
- typedef __numpunct_cache<_CharT> __cache_type;
+ typedef typename __to_unsigned_type<_ValueT>::__type __unsigned_type;
+ typedef __numpunct_cache<_CharT> __cache_type;
__use_cache<__cache_type> __uc;
const locale& __loc = __io._M_getloc();
const __cache_type* __lc = __uc(__loc);
@@ -1048,7 +1002,11 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
// [22.2.2.2.2] Stage 1, numeric conversion to character.
// Result is returned right-justified in the buffer.
- int __len = __int_to_char(__cs + __ilen, __v, __lit, __flags);
+ const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
+ const bool __dec = (__basefield != ios_base::oct
+ && __basefield != ios_base::hex);
+ const __unsigned_type __u = (__v > 0 || !__dec) ? __v : -__v;
+ int __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec);
__cs += __ilen - __len;
// Add grouping, if necessary.
@@ -1065,9 +1023,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
}
// Complete Stage 1, prepend numeric base or sign.
- const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
- if (__builtin_expect(__basefield != ios_base::oct
- && __basefield != ios_base::hex, true))
+ if (__builtin_expect(__dec, true))
{
// Decimal.
if (__v > 0)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
index 40958ccda7c..fea534ccbc1 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
@@ -60,68 +60,68 @@ namespace detail
static const std::size_t g_a_sizes[num_distinct_sizes_64_bit] =
{
- /* 0 */ 5ul,
- /* 1 */ 11ul,
- /* 2 */ 23ul,
- /* 3 */ 47ul,
- /* 4 */ 97ul,
- /* 5 */ 199ul,
- /* 6 */ 409ul,
- /* 7 */ 823ul,
- /* 8 */ 1741ul,
- /* 9 */ 3469ul,
- /* 10 */ 6949ul,
- /* 11 */ 14033ul,
- /* 12 */ 28411ul,
- /* 13 */ 57557ul,
- /* 14 */ 116731ul,
- /* 15 */ 236897ul,
- /* 16 */ 480881ul,
- /* 17 */ 976369ul,
- /* 18 */ 1982627ul,
- /* 19 */ 4026031ul,
- /* 20 */ 8175383ul,
- /* 21 */ 16601593ul,
- /* 22 */ 33712729ul,
- /* 23 */ 68460391ul,
- /* 24 */ 139022417ul,
- /* 25 */ 282312799ul,
- /* 26 */ 573292817ul,
- /* 27 */ 1164186217ul,
- /* 28 */ 2364114217ul,
- /* 29 */ 4294967291ul,
- /* 30 */ (unsigned long)8589934583ull,
- /* 31 */ (unsigned long)17179869143ull,
- /* 32 */ (unsigned long)34359738337ull,
- /* 33 */ (unsigned long)68719476731ull,
- /* 34 */ (unsigned long)137438953447ull,
- /* 35 */ (unsigned long)274877906899ull,
- /* 36 */ (unsigned long)549755813881ull,
- /* 37 */ (unsigned long)1099511627689ull,
- /* 38 */ (unsigned long)2199023255531ull,
- /* 39 */ (unsigned long)4398046511093ull,
- /* 40 */ (unsigned long)8796093022151ull,
- /* 41 */ (unsigned long)17592186044399ull,
- /* 42 */ (unsigned long)35184372088777ull,
- /* 43 */ (unsigned long)70368744177643ull,
- /* 44 */ (unsigned long)140737488355213ull,
- /* 45 */ (unsigned long)281474976710597ull,
- /* 46 */ (unsigned long)562949953421231ull,
- /* 47 */ (unsigned long)1125899906842597ull,
- /* 48 */ (unsigned long)2251799813685119ull,
- /* 49 */ (unsigned long)4503599627370449ull,
- /* 50 */ (unsigned long)9007199254740881ull,
- /* 51 */ (unsigned long)18014398509481951ull,
- /* 52 */ (unsigned long)36028797018963913ull,
- /* 53 */ (unsigned long)72057594037927931ull,
- /* 54 */ (unsigned long)144115188075855859ull,
- /* 55 */ (unsigned long)288230376151711717ull,
- /* 56 */ (unsigned long)576460752303423433ull,
- /* 57 */ (unsigned long)1152921504606846883ull,
- /* 58 */ (unsigned long)2305843009213693951ull,
- /* 59 */ (unsigned long)4611686018427387847ull,
- /* 60 */ (unsigned long)9223372036854775783ull,
- /* 61 */ (unsigned long)18446744073709551557ull,
+ /* 0 */ 5ul,
+ /* 1 */ 11ul,
+ /* 2 */ 23ul,
+ /* 3 */ 47ul,
+ /* 4 */ 97ul,
+ /* 5 */ 199ul,
+ /* 6 */ 409ul,
+ /* 7 */ 823ul,
+ /* 8 */ 1741ul,
+ /* 9 */ 3469ul,
+ /* 10 */ 6949ul,
+ /* 11 */ 14033ul,
+ /* 12 */ 28411ul,
+ /* 13 */ 57557ul,
+ /* 14 */ 116731ul,
+ /* 15 */ 236897ul,
+ /* 16 */ 480881ul,
+ /* 17 */ 976369ul,
+ /* 18 */ 1982627ul,
+ /* 19 */ 4026031ul,
+ /* 20 */ 8175383ul,
+ /* 21 */ 16601593ul,
+ /* 22 */ 33712729ul,
+ /* 23 */ 68460391ul,
+ /* 24 */ 139022417ul,
+ /* 25 */ 282312799ul,
+ /* 26 */ 573292817ul,
+ /* 27 */ 1164186217ul,
+ /* 28 */ 2364114217ul,
+ /* 29 */ 4294967291ul,
+ /* 30 */ (std::size_t)8589934583ull,
+ /* 31 */ (std::size_t)17179869143ull,
+ /* 32 */ (std::size_t)34359738337ull,
+ /* 33 */ (std::size_t)68719476731ull,
+ /* 34 */ (std::size_t)137438953447ull,
+ /* 35 */ (std::size_t)274877906899ull,
+ /* 36 */ (std::size_t)549755813881ull,
+ /* 37 */ (std::size_t)1099511627689ull,
+ /* 38 */ (std::size_t)2199023255531ull,
+ /* 39 */ (std::size_t)4398046511093ull,
+ /* 40 */ (std::size_t)8796093022151ull,
+ /* 41 */ (std::size_t)17592186044399ull,
+ /* 42 */ (std::size_t)35184372088777ull,
+ /* 43 */ (std::size_t)70368744177643ull,
+ /* 44 */ (std::size_t)140737488355213ull,
+ /* 45 */ (std::size_t)281474976710597ull,
+ /* 46 */ (std::size_t)562949953421231ull,
+ /* 47 */ (std::size_t)1125899906842597ull,
+ /* 48 */ (std::size_t)2251799813685119ull,
+ /* 49 */ (std::size_t)4503599627370449ull,
+ /* 50 */ (std::size_t)9007199254740881ull,
+ /* 51 */ (std::size_t)18014398509481951ull,
+ /* 52 */ (std::size_t)36028797018963913ull,
+ /* 53 */ (std::size_t)72057594037927931ull,
+ /* 54 */ (std::size_t)144115188075855859ull,
+ /* 55 */ (std::size_t)288230376151711717ull,
+ /* 56 */ (std::size_t)576460752303423433ull,
+ /* 57 */ (std::size_t)1152921504606846883ull,
+ /* 58 */ (std::size_t)2305843009213693951ull,
+ /* 59 */ (std::size_t)4611686018427387847ull,
+ /* 60 */ (std::size_t)9223372036854775783ull,
+ /* 61 */ (std::size_t)18446744073709551557ull,
};
} // namespace detail
diff --git a/libstdc++-v3/include/ext/rc_string_base.h b/libstdc++-v3/include/ext/rc_string_base.h
index c8bb9f3edca..eec6f2dcf0d 100644
--- a/libstdc++-v3/include/ext/rc_string_base.h
+++ b/libstdc++-v3/include/ext/rc_string_base.h
@@ -175,11 +175,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// with a terminating character and m _CharT elements, it'd
// look like this:
// npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT)
+ // + sizeof(_Rep) - 1
+ // (NB: last two terms for rounding reasons, see _M_create below)
// Solving for m:
- // m = ((npos - sizeof(_Rep)) / sizeof(_CharT)) - 1
- // In addition, this implementation quarters this amount.
- enum { _S_max_size = (((static_cast<size_type>(-1) - sizeof(_Rep))
- / sizeof(_CharT)) - 1) / 4 };
+ // m = ((npos - 2 * sizeof(_Rep) + 1) / sizeof(_CharT)) - 1
+ // In addition, this implementation halfs this amount.
+ enum { _S_max_size = (((static_cast<size_type>(-1) - 2 * sizeof(_Rep)
+ + 1) / sizeof(_CharT)) - 1) / 2 };
// Data Member (private):
mutable typename _Util_Base::template _Alloc_hider<_Alloc> _M_dataplus;
@@ -386,7 +388,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// meet amortized linear time requirements of the library: see
// http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.
if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
- __capacity = 2 * __old_capacity;
+ {
+ __capacity = 2 * __old_capacity;
+ // Never allocate a string bigger than _S_max_size.
+ if (__capacity > size_type(_S_max_size))
+ __capacity = size_type(_S_max_size);
+ }
// NB: Need an array of char_type[__capacity], plus a terminating
// null char_type() element, plus enough for the _Rep data structure,
@@ -401,7 +408,6 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{
const size_type __extra = __pagesize - __adj_size % __pagesize;
__capacity += __extra / sizeof(_CharT);
- // Never allocate a string bigger than _S_max_size.
if (__capacity > size_type(_S_max_size))
__capacity = size_type(_S_max_size);
__size = (__capacity + 1) * sizeof(_CharT) + 2 * sizeof(_Rep) - 1;
diff --git a/libstdc++-v3/include/ext/sso_string_base.h b/libstdc++-v3/include/ext/sso_string_base.h
index 0bf99cad53f..1282eb6e53e 100644
--- a/libstdc++-v3/include/ext/sso_string_base.h
+++ b/libstdc++-v3/include/ext/sso_string_base.h
@@ -61,9 +61,9 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// npos = m * sizeof(_CharT) + sizeof(_CharT)
// Solving for m:
// m = npos / sizeof(_CharT) - 1
- // In addition, this implementation quarters this amount.
+ // In addition, this implementation halfs this amount.
enum { _S_max_size = (((static_cast<size_type>(-1)
- / sizeof(_CharT)) - 1) / 4) };
+ / sizeof(_CharT)) - 1) / 2) };
// Data Members (private):
typename _Util_Base::template _Alloc_hider<_CharT_alloc_type>
@@ -325,7 +325,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// meet amortized linear time requirements of the library: see
// http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.
if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
- __capacity = 2 * __old_capacity;
+ {
+ __capacity = 2 * __old_capacity;
+ // Never allocate a string bigger than _S_max_size.
+ if (__capacity > size_type(_S_max_size))
+ __capacity = size_type(_S_max_size);
+ }
// NB: Need an array of char_type[__capacity], plus a terminating
// null char_type() element.
diff --git a/libstdc++-v3/include/ext/typelist.h b/libstdc++-v3/include/ext/typelist.h
index 143efc02cdf..11913e3aa22 100644
--- a/libstdc++-v3/include/ext/typelist.h
+++ b/libstdc++-v3/include/ext/typelist.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -48,13 +48,12 @@
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
- // XXX namespace typelist
- // struct typelist -> struct node
-
+namespace typelist
+{
struct null_type { };
template<typename Root>
- struct typelist
+ struct node
{
typedef Root root;
};
@@ -71,7 +70,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
struct append;
template<typename Typelist_Typelist>
- struct typelist_append;
+ struct append_typelist;
template<typename Typelist, typename T>
struct contains;
@@ -87,12 +86,15 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
template<typename Typelist, template<typename T> class Transform>
struct transform;
+} // namespace typelist
_GLIBCXX_END_NAMESPACE
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+namespace typelist
+{
namespace detail
{
// #include <ext/detail/type_utils.h>
@@ -245,32 +247,35 @@ namespace detail
typedef chain<transform_type, rest_type> type;
};
- // #include <ext/detail/typelist_append.h>
+ // #include <ext/detail/append_typelist.h>
template<typename Typelist_Typelist_Chain>
- struct typelist_append_;
+ struct append_typelist_;
template<typename Hd>
- struct typelist_append_<chain<Hd, null_type> >
+ struct append_typelist_<chain<Hd, null_type> >
{
typedef chain<Hd, null_type> type;
};
template<typename Hd, typename Tl>
- struct typelist_append_<chain< Hd, Tl> >
+ struct append_typelist_<chain< Hd, Tl> >
{
private:
- typedef typename typelist_append_<Tl>::type rest;
+ typedef typename append_typelist_<Tl>::type rest;
public:
- typedef typename append<Hd, typelist<rest> >::type::root type;
+ typedef typename append<Hd, node<rest> >::type::root type;
};
} // namespace detail
+} // namespace typelist
_GLIBCXX_END_NAMESPACE
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+namespace typelist
+{
template<typename Fn, typename Typelist>
struct apply
{
@@ -292,18 +297,18 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef detail::append_<root0_type, root1_type> append_type;
public:
- typedef typelist<typename append_type::type> type;
+ typedef node<typename append_type::type> type;
};
template<typename Typelist_Typelist>
- struct typelist_append
+ struct append_typelist
{
private:
typedef typename Typelist_Typelist::root root_type;
- typedef detail::typelist_append_<root_type> append_type;
+ typedef detail::append_typelist_<root_type> append_type;
public:
- typedef typelist<typename append_type::type> type;
+ typedef node<typename append_type::type> type;
};
template<typename Typelist, typename T>
@@ -325,7 +330,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef detail::chain_filter_<root_type, Pred> filter_type;
public:
- typedef typelist<typename filter_type::type> type;
+ typedef node<typename filter_type::type> type;
};
template<typename Typelist, int i>
@@ -345,27 +350,27 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef detail::chain_transform_<root_type, Transform> transform_type;
public:
- typedef typelist<typename transform_type::type> type;
+ typedef node<typename transform_type::type> type;
};
-
+} // namespace typelist
_GLIBCXX_END_NAMESPACE
-#define _GLIBCXX_TYPELIST_CHAIN1(X0) __gnu_cxx::chain<X0, __gnu_cxx::null_type>
-#define _GLIBCXX_TYPELIST_CHAIN2(X0, X1) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN1(X1) >
-#define _GLIBCXX_TYPELIST_CHAIN3(X0, X1, X2) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN2(X1, X2) >
-#define _GLIBCXX_TYPELIST_CHAIN4(X0, X1, X2, X3) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN3(X1, X2, X3) >
-#define _GLIBCXX_TYPELIST_CHAIN5(X0, X1, X2, X3, X4) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN4(X1, X2, X3, X4) >
-#define _GLIBCXX_TYPELIST_CHAIN6(X0, X1, X2, X3, X4, X5) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN5(X1, X2, X3, X4, X5) >
-#define _GLIBCXX_TYPELIST_CHAIN7(X0, X1, X2, X3, X4, X5, X6) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN6(X1, X2, X3, X4, X5, X6) >
-#define _GLIBCXX_TYPELIST_CHAIN8(X0, X1, X2, X3, X4, X5, X6, X7) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN7(X1, X2, X3, X4, X5, X6, X7) >
-#define _GLIBCXX_TYPELIST_CHAIN9(X0, X1, X2, X3, X4, X5, X6, X7, X8) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN8(X1, X2, X3, X4, X5, X6, X7, X8) >
-#define _GLIBCXX_TYPELIST_CHAIN10(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN9(X1, X2, X3, X4, X5, X6, X7, X8, X9) >
-#define _GLIBCXX_TYPELIST_CHAIN11(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN10(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) >
-#define _GLIBCXX_TYPELIST_CHAIN12(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN11(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) >
-#define _GLIBCXX_TYPELIST_CHAIN13(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN12(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) >
-#define _GLIBCXX_TYPELIST_CHAIN14(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN13(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) >
-#define _GLIBCXX_TYPELIST_CHAIN15(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN14(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) >
+#define _GLIBCXX_TYPELIST_CHAIN1(X0) __gnu_cxx::typelist::chain<X0, __gnu_cxx::typelist::null_type>
+#define _GLIBCXX_TYPELIST_CHAIN2(X0, X1) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN1(X1) >
+#define _GLIBCXX_TYPELIST_CHAIN3(X0, X1, X2) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN2(X1, X2) >
+#define _GLIBCXX_TYPELIST_CHAIN4(X0, X1, X2, X3) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN3(X1, X2, X3) >
+#define _GLIBCXX_TYPELIST_CHAIN5(X0, X1, X2, X3, X4) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN4(X1, X2, X3, X4) >
+#define _GLIBCXX_TYPELIST_CHAIN6(X0, X1, X2, X3, X4, X5) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN5(X1, X2, X3, X4, X5) >
+#define _GLIBCXX_TYPELIST_CHAIN7(X0, X1, X2, X3, X4, X5, X6) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN6(X1, X2, X3, X4, X5, X6) >
+#define _GLIBCXX_TYPELIST_CHAIN8(X0, X1, X2, X3, X4, X5, X6, X7) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN7(X1, X2, X3, X4, X5, X6, X7) >
+#define _GLIBCXX_TYPELIST_CHAIN9(X0, X1, X2, X3, X4, X5, X6, X7, X8) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN8(X1, X2, X3, X4, X5, X6, X7, X8) >
+#define _GLIBCXX_TYPELIST_CHAIN10(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN9(X1, X2, X3, X4, X5, X6, X7, X8, X9) >
+#define _GLIBCXX_TYPELIST_CHAIN11(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN10(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) >
+#define _GLIBCXX_TYPELIST_CHAIN12(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN11(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) >
+#define _GLIBCXX_TYPELIST_CHAIN13(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN12(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) >
+#define _GLIBCXX_TYPELIST_CHAIN14(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN13(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) >
+#define _GLIBCXX_TYPELIST_CHAIN15(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN14(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) >
#endif
diff --git a/libstdc++-v3/include/precompiled/extc++.h b/libstdc++-v3/include/precompiled/extc++.h
new file mode 100644
index 00000000000..2d716927668
--- /dev/null
+++ b/libstdc++-v3/include/precompiled/extc++.h
@@ -0,0 +1,61 @@
+// C++ includes used for precompiling extensions -*- C++ -*-
+
+// Copyright (C) 2006 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <bits/stdtr1c++.h>
+
+#include <ext/algorithm>
+#include <ext/array_allocator.h>
+#include <ext/bitmap_allocator.h>
+#include <ext/codecvt_specializations.h>
+#include <ext/debug_allocator.h>
+#include <ext/functional>
+#include <ext/hash_map>
+#include <ext/hash_set>
+#include <ext/iterator>
+#include <ext/malloc_allocator.h>
+#include <ext/memory>
+#include <ext/mt_allocator.h>
+#include <ext/new_allocator.h>
+#include <ext/numeric>
+#include <ext/pod_char_traits.h>
+#include <ext/pool_allocator.h>
+#include <ext/rb_tree>
+#include <ext/rope>
+#include <ext/slist>
+#include <ext/stdio_filebuf.h>
+#include <ext/stdio_sync_filebuf.h>
+#include <ext/typelist.h>
+#include <ext/vstring.h>
+#include <ext/pb_ds/assoc_container.hpp>
+#include <ext/pb_ds/priority_queue.hpp>
+#include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/hash_policy.hpp>
+#include <ext/pb_ds/list_update_policy.hpp>
+#include <ext/pb_ds/tree_policy.hpp>
+#include <ext/pb_ds/trie_policy.hpp>
diff --git a/libstdc++-v3/include/stdc++.h b/libstdc++-v3/include/precompiled/stdc++.h
index c2816792938..c2816792938 100644
--- a/libstdc++-v3/include/stdc++.h
+++ b/libstdc++-v3/include/precompiled/stdc++.h
diff --git a/libstdc++-v3/include/precompiled/stdtr1c++.h b/libstdc++-v3/include/precompiled/stdtr1c++.h
new file mode 100644
index 00000000000..08822a011d2
--- /dev/null
+++ b/libstdc++-v3/include/precompiled/stdtr1c++.h
@@ -0,0 +1,54 @@
+// C++ includes used for precompiling TR1 -*- C++ -*-
+
+// Copyright (C) 2006 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <bits/stdc++.h>
+
+#include <tr1/array>
+#include <tr1/cctype>
+#include <tr1/cfenv>
+#include <tr1/cfloat>
+#include <tr1/cinttypes>
+#include <tr1/climits>
+#include <tr1/cmath>
+#include <tr1/complex>
+#include <tr1/cstdarg>
+#include <tr1/cstdbool>
+#include <tr1/cstdint>
+#include <tr1/cstdio>
+#include <tr1/cstdlib>
+#include <tr1/ctgmath>
+#include <tr1/ctime>
+#include <tr1/cwchar>
+#include <tr1/cwctype>
+#include <tr1/functional>
+#include <tr1/random>
+#include <tr1/tuple>
+#include <tr1/unordered_map>
+#include <tr1/unordered_set>
+#include <tr1/utility>
diff --git a/libstdc++-v3/include/tr1/random b/libstdc++-v3/include/tr1/random
index 69bda57b663..897d871a5be 100644
--- a/libstdc++-v3/include/tr1/random
+++ b/libstdc++-v3/include/tr1/random
@@ -80,21 +80,21 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* An adaptor class for converting the output of any Generator into
* the input for a specific Distribution.
*/
- template<typename _Generator, typename _Distribution>
+ template<typename _Engine, typename _Distribution>
struct _Adaptor
{
- typedef typename _Generator::result_type generated_type;
- typedef typename _Distribution::input_type result_type;
+ typedef typename _Engine::result_type _Engine_result_type;
+ typedef typename _Distribution::input_type result_type;
public:
- _Adaptor(const _Generator& __g)
+ _Adaptor(const _Engine& __g)
: _M_g(__g) { }
result_type
operator()();
private:
- _Generator _M_g;
+ _Engine _M_g;
};
/*
@@ -104,26 +104,35 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* Because the type traits are compile time constants only the appropriate
* clause of the if statements will actually be emitted by the compiler.
*/
- template<typename _Generator, typename _Distribution>
- typename _Adaptor<_Generator, _Distribution>::result_type
- _Adaptor<_Generator, _Distribution>::
+ template<typename _Engine, typename _Distribution>
+ typename _Adaptor<_Engine, _Distribution>::result_type
+ _Adaptor<_Engine, _Distribution>::
operator()()
{
result_type __return_value = 0;
- if (is_integral<generated_type>::value
+ if (is_integral<_Engine_result_type>::value
&& is_integral<result_type>::value)
__return_value = _M_g();
- else if (is_integral<generated_type>::value
+ else if (is_integral<_Engine_result_type>::value
&& !is_integral<result_type>::value)
__return_value = result_type(_M_g())
- / result_type(_M_g.max() - _M_g.min() + 1);
- else if (!is_integral<generated_type>::value
+ / result_type(_M_g.max() - _M_g.min() + result_type(1));
+ else if (!is_integral<_Engine_result_type>::value
&& !is_integral<result_type>::value)
__return_value = result_type(_M_g())
/ result_type(_M_g.max() - _M_g.min());
return __return_value;
}
+ template<typename _UIntType, int __w, bool =
+ __w != std::numeric_limits<_UIntType>::digits>
+ struct _Shift
+ { static const _UIntType __value = 0; };
+
+ template<typename _UIntType, int __w>
+ struct _Shift<_UIntType, __w, true>
+ { static const _UIntType __value = _UIntType(1) << __w; };
+
} // namespace std::tr1::_Private
@@ -133,17 +142,17 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
*
* @todo the engine_value_type needs to be studied more carefully.
*/
- template<typename _Generator, typename _Dist>
+ template<typename _Engine, typename _Dist>
class variate_generator
{
// Concept requirements.
- __glibcxx_class_requires(_Generator, _CopyConstructibleConcept)
- // __glibcxx_class_requires(_Generator, _GeneratorConcept)
- // __glibcxx_class_requires(_Dist, _GeneratorConcept)
+ __glibcxx_class_requires(_Engine, _CopyConstructibleConcept)
+ // __glibcxx_class_requires(_Engine, _EngineConcept)
+ // __glibcxx_class_requires(_Dist, _EngineConcept)
public:
- typedef _Generator engine_type;
- typedef _Private::_Adaptor<_Generator, _Dist> engine_value_type;
+ typedef _Engine engine_type;
+ typedef _Private::_Adaptor<_Engine, _Dist> engine_value_type;
typedef _Dist distribution_type;
typedef typename _Dist::result_type result_type;
@@ -158,7 +167,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* generator @p __eng for the random distribution @p __dist.
*
* @throws Any exceptions which may thrown by the copy constructors of
- * the @p _Generator or @p _Dist objects.
+ * the @p _Engine or @p _Dist objects.
*/
variate_generator(engine_type __eng, distribution_type __dist)
: _M_engine(__eng), _M_dist(__dist) { }
@@ -167,11 +176,16 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* Gets the next generated value on the distribution.
*/
result_type
- operator()();
+ operator()()
+ { return _M_dist(_M_engine); }
+ /**
+ * WTF?
+ */
template<typename _Tp>
result_type
- operator()(_Tp __value);
+ operator()(_Tp __value)
+ { return _M_dist(_M_engine, __value); }
/**
* Gets a reference to the underlying uniform random number generator
@@ -222,25 +236,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
distribution_type _M_dist;
};
- /**
- * Gets the next random value on the given distribution.
- */
- template<typename _Generator, typename _Dist>
- typename variate_generator<_Generator, _Dist>::result_type
- variate_generator<_Generator, _Dist>::
- operator()()
- { return _M_dist(_M_engine); }
-
- /**
- * WTF?
- */
- template<typename _Generator, typename _Dist>
- template<typename _Tp>
- typename variate_generator<_Generator, _Dist>::result_type
- variate_generator<_Generator, _Dist>::
- operator()(_Tp __value)
- { return _M_dist(_M_engine, __value); }
-
/**
* @addtogroup tr1_random_generators Random Number Generators
@@ -279,6 +274,21 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* The size of the state is @f$ 1 @f$.
*/
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+ class linear_congruential;
+
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const linear_congruential<_UIntType, __a, __c, __m>& __lcr);
+
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ linear_congruential<_UIntType, __a, __c, __m>& __lcr);
+
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class linear_congruential
{
__glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)
@@ -301,7 +311,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
*
* @param __s The initial seed value.
*/
- explicit linear_congruential(unsigned long __s = 1);
+ explicit
+ linear_congruential(unsigned long __x0 = 1)
+ { this->seed(__x0); }
/**
* Constructs a %linear_congruential random number generator engine
@@ -310,7 +322,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @param __g The seed generator function.
*/
template<class _Gen>
- linear_congruential(_Gen& __g);
+ linear_congruential(_Gen& __g)
+ { this->seed(__g); }
/**
* Reseeds the %linear_congruential random number generator engine
@@ -382,14 +395,16 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* Writes the textual representation of the state x(i) of x to @p __os.
*
* @param __os The output stream.
- * @param __lcr A linear_congruential random number generator.
+ * @param __lcr A % linear_congruential random number generator.
* @returns __os.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
+ _UIntType1 __m1,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const linear_congruential& __lcr)
- { return __os << __lcr._M_x; }
+ const linear_congruential<_UIntType1, __a1, __c1,
+ __m1>& __lcr);
/**
* Sets the state of the engine by reading its textual
@@ -401,14 +416,15 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @p __is.
*
* @param __is The input stream.
- * @param __lcr A linear_congruential random number generator.
+ * @param __lcr A % linear_congruential random number generator.
* @returns __is.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
+ _UIntType1 __m1,
+ typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- linear_congruential& __lcr)
- { return __is >> __lcr._M_x; }
+ linear_congruential<_UIntType1, __a1, __c1, __m1>& __lcr);
private:
template<class _Gen>
@@ -463,13 +479,36 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s, _UIntType __b, int __t,
_UIntType __c, int __l>
+ class mersenne_twister;
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const mersenne_twister<_UIntType, __w, __n, __m,
+ __r, __a, __u, __s, __b, __t, __c, __l>& __x);
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ mersenne_twister<_UIntType, __w, __n, __m,
+ __r, __a, __u, __s, __b, __t, __c, __l>& __x);
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l>
class mersenne_twister
{
__glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)
public:
// types
- typedef _UIntType result_type ;
+ typedef _UIntType result_type;
// parameter values
static const int word_size = __w;
@@ -513,7 +552,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
{ return 0; };
result_type
- max() const;
+ max() const
+ { return _Private::_Shift<_UIntType, __w>::__value - 1; }
result_type
operator()();
@@ -558,15 +598,14 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UIntType1, int __w1, int __n1, int __m1, int __r1,
+ _UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1,
+ _UIntType1 __c1, int __l1,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister& __x)
- {
- std::copy(__x._M_x, __x._M_x + state_size,
- std::ostream_iterator<_UIntType>(__os, " "));
- return __os;
- }
+ const mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1,
+ __a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x);
/**
* Extracts the current state of a % mersenne_twister random number
@@ -578,15 +617,14 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UIntType1, int __w1, int __n1, int __m1, int __r1,
+ _UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1,
+ _UIntType1 __c1, int __l1,
+ typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- mersenne_twister& __x)
- {
- for (int __i = 0; __i < state_size; ++__i)
- __is >> __x._M_x[__i];
- return __is;
- }
+ mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1,
+ __a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x);
private:
template<class _Gen>
@@ -641,6 +679,21 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @endif
*/
template<typename _IntType, _IntType __m, int __s, int __r>
+ class subtract_with_carry;
+
+ template<typename _IntType, _IntType __m, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const subtract_with_carry<_IntType, __m, __s, __r>& __x);
+
+ template<typename _IntType, _IntType __m, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ subtract_with_carry<_IntType, __m, __s, __r>& __x);
+
+ template<typename _IntType, _IntType __m, int __s, int __r>
class subtract_with_carry
{
__glibcxx_class_requires(_IntType, _IntegerConcept)
@@ -767,15 +820,12 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _IntType1, _IntType1 __m1, int __s1, int __r1,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry& __x)
- {
- std::copy(__x._M_x, __x._M_x + long_lag,
- std::ostream_iterator<_IntType>(__os, " "));
- return __os << __x._M_carry;
- }
+ const subtract_with_carry<_IntType1, __m1, __s1,
+ __r1>& __x);
/**
* Extracts the current state of a % subtract_with_carry random number
@@ -787,16 +837,11 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _IntType1, _IntType1 __m1, int __s1, int __r1,
+ typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry& __x)
- {
- for (int __i = 0; __i < long_lag; ++__i)
- __is >> __x._M_x[__i];
- __is >> __x._M_carry;
- return __is;
- }
+ subtract_with_carry<_IntType1, __m1, __s1, __r1>& __x);
private:
template<class _Gen>
@@ -822,6 +867,22 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* 0 <= @p __r <= @p __p
*/
template<class _UniformRandomNumberGenerator, int __p, int __r>
+ class discard_block;
+
+ template<class _UniformRandomNumberGenerator, int __p, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const discard_block<_UniformRandomNumberGenerator,
+ __p, __r>& __x);
+
+ template<class _UniformRandomNumberGenerator, int __p, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ discard_block<_UniformRandomNumberGenerator, __p, __r>& __x);
+
+ template<class _UniformRandomNumberGenerator, int __p, int __r>
class discard_block
{
// __glibcxx_class_requires(typename base_type::result_type,
@@ -961,11 +1022,12 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UniformRandomNumberGenerator1, int __p1, int __r1,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const discard_block& __x)
- { return __os << __x._M_b << " " << __x._M_n; }
+ const discard_block<_UniformRandomNumberGenerator1,
+ __p1, __r1>& __x);
/**
* Extracts the current state of a % subtract_with_carry random number
@@ -977,11 +1039,12 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UniformRandomNumberGenerator1, int __p1, int __r1,
+ typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- discard_block& __x)
- { return __is >> __x._M_b >> __x._M_n; }
+ discard_block<_UniformRandomNumberGenerator1,
+ __p1, __r1>& __x);
private:
base_type _M_b;
@@ -1014,6 +1077,26 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
*/
template<class _UniformRandomNumberGenerator1, int __s1,
class _UniformRandomNumberGenerator2, int __s2>
+ class xor_combine;
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>& __x);
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>& __x);
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2>
class xor_combine
{
// __glibcxx_class_requires(typename _UniformRandomNumberGenerator1::
@@ -1133,11 +1216,13 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UniformRandomNumberGenerator11, int __s11,
+ class _UniformRandomNumberGenerator21, int __s21,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const xor_combine& __x)
- { return __os << __x.base1() << " " << __x.base2(); }
+ const xor_combine<_UniformRandomNumberGenerator11, __s11,
+ _UniformRandomNumberGenerator21, __s21>& __x);
/**
* Extracts the current state of a %xor_combine random number
@@ -1149,11 +1234,13 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UniformRandomNumberGenerator11, int __s11,
+ class _UniformRandomNumberGenerator21, int __s21,
+ typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- xor_combine& __x)
- { return __is >> __x._M_b1 >> __x._M_b2; }
+ xor_combine<_UniformRandomNumberGenerator11, __s11,
+ _UniformRandomNumberGenerator21, __s21>& __x);
private:
base1_type _M_b1;
@@ -1270,6 +1357,19 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* probability throughout the range.
*/
template<typename _IntType = int>
+ class uniform_int;
+
+ template<typename _IntType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_int<_IntType>& __x);
+
+ template<typename _IntType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_int<_IntType>& __x);
+
+ template<typename _IntType>
class uniform_int
{
__glibcxx_class_requires(_IntType, _IntegerConcept)
@@ -1342,25 +1442,24 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _IntType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const uniform_int& __x)
- { return __os << __x.min() << " " << __x.max(); }
+ const uniform_int<_IntType1>& __x);
/**
* Extracts a %unform_int random number distribution
- * @p __u from the input stream @p __is.
+ * @p __x from the input stream @p __is.
*
* @param __is An input stream.
- * @param __u A %uniform_int random number generator engine.
+ * @param __x A %uniform_int random number generator engine.
*
- * @returns The input stream with @p __u extracted or in an error state.
+ * @returns The input stream with @p __x extracted or in an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _IntType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
- operator>>(std::basic_istream<_CharT, _Traits>& __is, uniform_int& __u)
- { return __is >> __u._M_min >> __u._M_max; }
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_int<_IntType1>& __x);
private:
_IntType _M_min;
@@ -1374,6 +1473,13 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* Generates a sequence of true and false values with likelihood @f$ p @f$
* that true will come up and @f$ (1 - p) @f$ that false will appear.
*/
+ class bernoulli_distribution;
+
+ template<typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const bernoulli_distribution& __x);
+
class bernoulli_distribution
{
public:
@@ -1434,23 +1540,22 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
template<typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const bernoulli_distribution& __x)
- { return __os << __x.p(); }
+ const bernoulli_distribution& __x);
/**
* Extracts a %bernoulli_distribution random number distribution
- * @p __u from the input stream @p __is.
+ * @p __x from the input stream @p __is.
*
* @param __is An input stream.
- * @param __u A %bernoulli_distribution random number generator engine.
+ * @param __x A %bernoulli_distribution random number generator engine.
*
- * @returns The input stream with @p __u extracted or in an error state.
+ * @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- bernoulli_distribution& __u)
- { return __is >> __u._M_p; }
+ bernoulli_distribution& __x)
+ { return __is >> __x._M_p; }
protected:
double _M_p;
@@ -1465,6 +1570,15 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* distribution.
*/
template<typename _IntType = int, typename _RealType = double>
+ class geometric_distribution;
+
+ template<typename _IntType, typename _RealType,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const geometric_distribution<_IntType, _RealType>& __x);
+
+ template<typename _IntType, typename _RealType>
class geometric_distribution
{
public:
@@ -1506,28 +1620,28 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _IntType1, typename _RealType1,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const geometric_distribution& __x)
- { return __os << __x.p(); }
+ const geometric_distribution<_IntType1, _RealType1>& __x);
/**
* Extracts a %geometric_distribution random number distribution
- * @p __u from the input stream @p __is.
+ * @p __x from the input stream @p __is.
*
* @param __is An input stream.
- * @param __u A %geometric_distribution random number generator engine.
+ * @param __x A %geometric_distribution random number generator engine.
*
- * @returns The input stream with @p __u extracted or in an error state.
+ * @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- geometric_distribution& __u)
+ geometric_distribution& __x)
{
- __is >> __u._M_p;
- __u._M_log_p = std::log(__u._M_p);
+ __is >> __x._M_p;
+ __x._M_log_p = std::log(__x._M_p);
return __is;
}
@@ -1552,6 +1666,19 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* deliver number in the range [0, 1).
*/
template<typename _RealType = double>
+ class uniform_real;
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_real<_RealType>& __x);
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_real<_RealType>& __x);
+
+ template<typename _RealType>
class uniform_real
{
public:
@@ -1600,26 +1727,24 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const uniform_real& __x)
- { return __os << __x.min() << " " << __x.max(); }
+ const uniform_real<_RealType1>& __x);
/**
* Extracts a %unform_real random number distribution
- * @p __u from the input stream @p __is.
+ * @p __x from the input stream @p __is.
*
* @param __is An input stream.
- * @param __u A %uniform_real random number generator engine.
+ * @param __x A %uniform_real random number generator engine.
*
- * @returns The input stream with @p __u extracted or in an error state.
+ * @returns The input stream with @p __x extracted or in an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- uniform_real& __u)
- { return __is >> __u._M_min >> __u._M_max; }
+ uniform_real<_RealType1>& __x);
protected:
_RealType _M_min;
@@ -1643,6 +1768,14 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* </table>
*/
template<typename _RealType = double>
+ class exponential_distribution;
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const exponential_distribution<_RealType>& __x);
+
+ template<typename _RealType>
class exponential_distribution
{
public:
@@ -1657,7 +1790,10 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
*/
explicit
exponential_distribution(const result_type& __lambda = result_type(1))
- : _M_lambda(__lambda) { }
+ : _M_lambda(__lambda)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_lambda > 0);
+ }
/**
* Gets the inverse scale parameter of the distribution.
@@ -1689,31 +1825,218 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const exponential_distribution& __x)
- { return __os << __x.lambda(); }
+ const exponential_distribution<_RealType1>& __x);
/**
* Extracts a %exponential_distribution random number distribution
- * @p __u from the input stream @p __is.
+ * @p __x from the input stream @p __is.
*
* @param __is An input stream.
- * @param __u A %exponential_distribution random number generator engine.
+ * @param __x A %exponential_distribution random number generator engine.
*
- * @returns The input stream with @p __u extracted or in an error state.
+ * @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- exponential_distribution& __u)
- { return __is >> __u._M_lambda; }
+ exponential_distribution& __x)
+ { return __is >> __x._M_lambda; }
private:
result_type _M_lambda;
};
+
+ /**
+ * @brief A normal continuous distribution for random numbers.
+ *
+ * The formula for the normal probability mass function is
+ * @f$ p(x) = \frac{1}{\sigma \sqrt{2 \pi}}
+ * e^{- \frac{{x - mean}^ {2}}{2 \sigma ^ {2}} } @f$.
+ */
+ template<typename _RealType = double>
+ class normal_distribution;
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const normal_distribution<_RealType>& __x);
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ normal_distribution<_RealType>& __x);
+
+ template<typename _RealType>
+ class normal_distribution
+ {
+ public:
+ // types
+ typedef _RealType input_type;
+ typedef _RealType result_type;
+
+ public:
+ /**
+ * Constructs a normal distribution with parameters @f$ mean @f$ and
+ * @f$ \sigma @f$.
+ */
+ explicit
+ normal_distribution(const result_type& __mean = result_type(0),
+ const result_type& __sigma = result_type(1))
+ : _M_mean(__mean), _M_sigma(__sigma), _M_saved_available(false)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_sigma > 0);
+ }
+
+ /**
+ * Gets the mean of the distribution.
+ */
+ _RealType
+ mean() const
+ { return _M_mean; }
+
+ /**
+ * Gets the @f$ \sigma @f$ of the distribution.
+ */
+ _RealType
+ sigma() const
+ { return _M_sigma; }
+
+ /**
+ * Resets the distribution.
+ */
+ void
+ reset()
+ { _M_saved_available = false; }
+
+ template<class _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng);
+
+ /**
+ * Inserts a %normal_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %normal_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const normal_distribution<_RealType1>& __x);
+
+ /**
+ * Extracts a %normal_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %normal_distribution random number generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ normal_distribution<_RealType1>& __x);
+
+ private:
+ result_type _M_mean;
+ result_type _M_sigma;
+ result_type _M_saved;
+ bool _M_saved_available;
+ };
+
+
+ /**
+ * @brief A gamma continuous distribution for random numbers.
+ *
+ * The formula for the gamma probability mass function is
+ * @f$ p(x) = \frac{1}{\Gamma(\alpha)} x^{\alpha - 1} e^{-x} } @f$.
+ */
+ template<typename _RealType = double>
+ class gamma_distribution;
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const gamma_distribution<_RealType>& __x);
+
+ template<typename _RealType>
+ class gamma_distribution
+ {
+ public:
+ // types
+ typedef _RealType input_type;
+ typedef _RealType result_type;
+
+ public:
+ /**
+ * Constructs a gamma distribution with parameters @f$ \alpha @f$.
+ */
+ explicit
+ gamma_distribution(const result_type& __alpha = result_type(1))
+ : _M_alpha(__alpha)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_alpha > 0);
+ }
+
+ /**
+ * Gets the @f$ \alpha @f$ of the distribution.
+ */
+ _RealType
+ alpha() const
+ { return _M_alpha; }
+
+ /**
+ * Resets the distribution.
+ */
+ void
+ reset() { }
+
+ template<class _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng);
+
+ /**
+ * Inserts a %gamma_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %gamma_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const gamma_distribution<_RealType1>& __x);
+
+ /**
+ * Extracts a %gamma_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %gamma_distribution random number generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ gamma_distribution<_RealType1>& __x)
+ { return __is >> __x._M_alpha; }
+
+ private:
+ result_type _M_alpha;
+ };
+
/* @} */ // group tr1_random_distributions_continuous
/* @} */ // group tr1_random_distributions
/* @} */ // group tr1_random
diff --git a/libstdc++-v3/include/tr1/random.tcc b/libstdc++-v3/include/tr1/random.tcc
index 93bc498c67e..fe77abb021c 100644
--- a/libstdc++-v3/include/tr1/random.tcc
+++ b/libstdc++-v3/include/tr1/random.tcc
@@ -27,8 +27,6 @@
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
-#include <limits>
-
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(tr1)
@@ -96,41 +94,18 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
__mod(_Tp __x)
{ return _Mod<_Tp, __a, __c, __m, __m == 0>::__calc(__x); }
- template<typename _UIntType, int __w, bool =
- __w != std::numeric_limits<_UIntType>::digits>
- struct _Shift
- { static const _UIntType __value = 0; };
-
- template<typename _UIntType, int __w>
- struct _Shift<_UIntType, __w, true>
- { static const _UIntType __value = _UIntType(1) << __w; };
-
- // The maximum value that will fit in @p __w bits of @p _UIntType.
- template<typename _UIntType, int __w>
- struct _Max
- { static const _UIntType __value = _Shift<_UIntType, __w>::__value - 1; };
+ // See N1822.
+ template<typename _RealType>
+ struct _Max_digits10
+ {
+ static const std::streamsize __value =
+ 2 + std::numeric_limits<_RealType>::digits * 3010/10000;
+ };
} // namespace _Private
/**
- * Constructs the LCR engine with integral seed @p __x0.
- */
- template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- linear_congruential<_UIntType, __a, __c, __m>::
- linear_congruential(unsigned long __x0)
- { this->seed(__x0); }
-
- /**
- * Constructs the LCR engine with seed generated from @p __g.
- */
- template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- template<class _Gen>
- linear_congruential<_UIntType, __a, __c, __m>::
- linear_congruential(_Gen& __g)
- { this->seed(__g); }
-
- /**
* Seeds the LCR with integral value @p __x0, adjusted so that the
* ring identity is never a member of the convergence set.
*/
@@ -200,6 +175,40 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
return _M_x;
}
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const linear_congruential<_UIntType, __a, __c, __m>& __lcr)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ __os.flags(std::ios_base::dec | std::ios_base::fixed
+ | std::ios_base::left);
+ __os.fill(__os.widen(' '));
+
+ __os << __lcr._M_x;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ linear_congruential<_UIntType, __a, __c, __m>& __lcr)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec);
+
+ __is >> __lcr._M_x;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
@@ -247,17 +256,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
__b, __t, __c, __l>::result_type
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::
- max() const
- { return _Private::_Max<_UIntType, __w>::__value; }
-
- template<class _UIntType, int __w, int __n, int __m, int __r,
- _UIntType __a, int __u, int __s,
- _UIntType __b, int __t, _UIntType __c, int __l>
- typename
- mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
- __b, __t, __c, __l>::result_type
- mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
- __b, __t, __c, __l>::
operator()()
{
// Reload the vector - cost is O(n) amortized over n calls.
@@ -299,6 +297,50 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
return __z;
}
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const mersenne_twister<_UIntType, __w, __n, __m,
+ __r, __a, __u, __s, __b, __t, __c, __l>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::dec | std::ios_base::fixed
+ | std::ios_base::left);
+ __os.fill(__space);
+
+ for (int __i = 0; __i < __n - 1; ++__i)
+ __os << __x._M_x[__i] << __space;
+ __os << __x._M_x[__n - 1];
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ mersenne_twister<_UIntType, __w, __n, __m,
+ __r, __a, __u, __s, __b, __t, __c, __l>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec | std::ios_base::skipws);
+
+ for (int __i = 0; __i < __n; ++__i)
+ __is >> __x._M_x[__i];
+
+ __is.flags(__flags);
+ return __is;
+ }
+
template<typename _IntType, _IntType __m, int __s, int __r>
void
@@ -376,6 +418,45 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
return __xi;
}
+ template<typename _IntType, _IntType __m, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const subtract_with_carry<_IntType, __m, __s, __r>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::dec | std::ios_base::fixed
+ | std::ios_base::left);
+ __os.fill(__space);
+
+ for (int __i = 0; __i < __r; ++__i)
+ __os << __x._M_x[__i] << __space;
+ __os << __x._M_carry;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<typename _IntType, _IntType __m, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ subtract_with_carry<_IntType, __m, __s, __r>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec | std::ios_base::skipws);
+
+ for (int __i = 0; __i < __r; ++__i)
+ __is >> __x._M_x[__i];
+ __is >> __x._M_carry;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
template<class _UniformRandomNumberGenerator, int __p, int __r>
typename discard_block<_UniformRandomNumberGenerator,
@@ -396,5 +477,385 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
return _M_b();
}
+ template<class _UniformRandomNumberGenerator, int __p, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const discard_block<_UniformRandomNumberGenerator,
+ __p, __r>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::dec | std::ios_base::fixed
+ | std::ios_base::left);
+ __os.fill(__space);
+
+ __os << __x._M_b << __space << __x._M_n;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UniformRandomNumberGenerator, int __p, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ discard_block<_UniformRandomNumberGenerator, __p, __r>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec | std::ios_base::skipws);
+
+ __is >> __x._M_b >> __x._M_n;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::dec | std::ios_base::fixed
+ | std::ios_base::left);
+ __os.fill(__space);
+
+ __os << __x.base1() << __space << __x.base2();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::skipws);
+
+ __is >> __x._M_b1 >> __x._M_b2;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _IntType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_int<_IntType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__space);
+
+ __os << __x.min() << __space << __x.max();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<typename _IntType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_int<_IntType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec | std::ios_base::skipws);
+
+ __is >> __x._M_min >> __x._M_max;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const bernoulli_distribution& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__os.widen(' '));
+ __os.precision(_Private::_Max_digits10<double>::__value);
+
+ __os << __x.p();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+
+ template<typename _IntType, typename _RealType,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const geometric_distribution<_IntType, _RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__os.widen(' '));
+ __os.precision(_Private::_Max_digits10<_RealType>::__value);
+
+ __os << __x.p();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_real<_RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__space);
+ __os.precision(_Private::_Max_digits10<_RealType>::__value);
+
+ __os << __x.min() << __space << __x.max();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_real<_RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::skipws);
+
+ __is >> __x._M_min >> __x._M_max;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const exponential_distribution<_RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__os.widen(' '));
+ __os.precision(_Private::_Max_digits10<_RealType>::__value);
+
+ __os << __x.lambda();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+
+ /**
+ * Classic Box-Muller method.
+ *
+ * Reference:
+ * Box, G. E. P. and Muller, M. E. "A Note on the Generation of
+ * Random Normal Deviates." Ann. Math. Stat. 29, 610-611, 1958.
+ */
+ template<typename _RealType>
+ template<class _UniformRandomNumberGenerator>
+ typename normal_distribution<_RealType>::result_type
+ normal_distribution<_RealType>::
+ operator()(_UniformRandomNumberGenerator& __urng)
+ {
+ result_type __ret;
+
+ if (_M_saved_available)
+ {
+ _M_saved_available = false;
+ __ret = _M_saved;
+ }
+ else
+ {
+ result_type __x, __y, __r2;
+ do
+ {
+ __x = result_type(2.0) * __urng() - result_type(1.0);
+ __y = result_type(2.0) * __urng() - result_type(1.0);
+ __r2 = __x * __x + __y * __y;
+ }
+ while (__r2 > result_type(1.0) || __r2 == result_type(0));
+
+ const result_type __mult = std::sqrt(-result_type(2.0)
+ * std::log(__r2) / __r2);
+ _M_saved = __x * __mult;
+ _M_saved_available = true;
+ __ret = __y * __mult;
+ }
+
+ return __ret * _M_sigma + _M_mean;
+ }
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const normal_distribution<_RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__space);
+ __os.precision(_Private::_Max_digits10<_RealType>::__value);
+
+ __os << __x.mean() << __space
+ << __x.sigma() << __space
+ << __x._M_saved << __space
+ << __x._M_saved_available;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ normal_distribution<_RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec | std::ios_base::skipws);
+
+ __is >> __x._M_mean >> __x._M_sigma
+ >> __x._M_saved >> __x._M_saved_available;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ /**
+ * Cheng's rejection algorithm GB for alpha >= 1 and a modification
+ * of Vaduva's rejection from Weibull algorithm due to Devroye for
+ * alpha < 1.
+ *
+ * References:
+ * Cheng, R. C. "The Generation of Gamma Random Variables with Non-integral
+ * Shape Parameter." Applied Statistics, 26, 71-75, 1977.
+ *
+ * Vaduva, I. "Computer Generation of Gamma Gandom Variables by Rejection
+ * and Composition Procedures." Math. Operationsforschung and Statistik,
+ * Series in Statistics, 8, 545-576, 1977.
+ *
+ * Devroye, L. "Non-Uniform Random Variates Generation." Springer-Verlag,
+ * New York, 1986, Sect. 3.4.
+ */
+ template<typename _RealType>
+ template<class _UniformRandomNumberGenerator>
+ typename gamma_distribution<_RealType>::result_type
+ gamma_distribution<_RealType>::
+ operator()(_UniformRandomNumberGenerator& __urng)
+ {
+ result_type __x;
+
+ if (_M_alpha >= 1)
+ {
+ // alpha - log(4)
+ const result_type __b = _M_alpha
+ - result_type(1.3862943611198906188344642429163531L);
+ const result_type __c = _M_alpha + std::sqrt(2 * _M_alpha - 1);
+
+ // 1 + log(9 / 2)
+ const result_type __k = 2.5040773967762740733732583523868748L;
+
+ result_type __z, __r;
+ do
+ {
+ const result_type __u = __urng();
+ const result_type __v = __urng();
+
+ const result_type __y = _M_alpha * std::log(__v / (1 - __v));
+ __x = _M_alpha * std::exp(__v);
+
+ __z = __u * __v * __v;
+ __r = __b + __c * __y - __x;
+ }
+ while (__r < result_type(4.5) * __z - __k
+ && __r < std::log(__z));
+ }
+ else
+ {
+ const result_type __c = 1 / _M_alpha;
+ const result_type __d =
+ std::pow(_M_alpha, _M_alpha / (1 - _M_alpha)) * (1 - _M_alpha);
+
+ result_type __z, __e;
+ do
+ {
+ __z = -std::log(__urng());
+ __e = -std::log(__urng());
+
+ __x = std::pow(__z, __c);
+ }
+ while (__z + __e > __d + __x);
+ }
+
+ return __x;
+ }
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const gamma_distribution<_RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__os.widen(' '));
+ __os.precision(_Private::_Max_digits10<_RealType>::__value);
+
+ __os << __x.alpha();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
_GLIBCXX_END_NAMESPACE
}
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc
index 06c51f53d1c..d9814830b7e 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc
@@ -54,7 +54,7 @@ main(int argc, char* a_p_argv[])
using namespace pb_ds::test;
typedef hash_map_tl_t map_tl_t;
- return rand_regression_test(10000, 10000,
+ return rand_regression_test(5000, 10000,
"hash_data_map_rand_regression_test",
map_tl_t());
}
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc
index 50bf33344cd..76753ad0114 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc
@@ -54,7 +54,7 @@ main(int argc, char* a_p_argv[])
using namespace pb_ds::test;
typedef hash_set_tl_t map_tl_t;
- return rand_regression_test(10000, 10000,
+ return rand_regression_test(5000, 10000,
"hash_no_data_map_rand_regression_test",
map_tl_t());
}
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc
index d184844f1ae..98bbf59cf55 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc
@@ -54,7 +54,7 @@ main(int argc, char* a_p_argv[])
using namespace pb_ds::test;
typedef lu_map_tl_t map_tl_t;
- return rand_regression_test(100, 10,
+ return rand_regression_test(50, 10,
"lu_data_map_rand_regression_test",
map_tl_t());
}
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc
index ae70c1ea6a3..90e0de038c2 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc
@@ -54,7 +54,7 @@ main(int argc, char* a_p_argv[])
using namespace pb_ds::test;
typedef lu_set_tl_t map_tl_t;
- return rand_regression_test(100, 10,
+ return rand_regression_test(50, 10,
"lu_no_data_map_rand_regression_test",
map_tl_t());
}
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc
index 6266e13d0ca..aae3971fa2d 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc
@@ -52,7 +52,7 @@ int
main(int argc, char* a_p_argv[])
{
using namespace pb_ds::test;
- return rand_regression_test(10000, 10000,
+ return rand_regression_test(5000, 10000,
"tree_no_data_map_rand_regression_test",
pq_tl_t());
}
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc
index 4a51facf439..8ffabd22a53 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc
@@ -54,7 +54,7 @@ main(int argc, char* a_p_argv[])
using namespace pb_ds::test;
typedef tree_map_tl_t map_tl_t;
- return rand_regression_test(10000, 10000,
+ return rand_regression_test(5000, 10000,
"tree_data_map_rand_regression_test",
map_tl_t());
}
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc
index 4d3c8ff510f..57fe8dcff9f 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc
@@ -54,7 +54,7 @@ main(int argc, char* a_p_argv[])
using namespace pb_ds::test;
typedef tree_set_tl_t map_tl_t;
- return rand_regression_test(10000, 10000,
+ return rand_regression_test(5000, 10000,
"tree_no_data_map_rand_regression_test",
map_tl_t());
}
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc
index e6841970cbd..fa64607d1a3 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc
@@ -54,7 +54,7 @@ main(int argc, char* a_p_argv[])
using namespace pb_ds::test;
typedef trie_map_tl_t map_tl_t;
- return rand_regression_test(10000, 10000,
+ return rand_regression_test(5000, 10000,
"trie_data_map_rand_regression_test",
map_tl_t());
}
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc
index b8af58cdb8b..eec51dfa017 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc
@@ -54,7 +54,7 @@ main(int argc, char* a_p_argv[])
using namespace pb_ds::test;
typedef trie_set_tl_t map_tl_t;
- return rand_regression_test(10000, 10000,
+ return rand_regression_test(5000, 10000,
"trie_no_data_map_rand_regression_test",
map_tl_t());
}
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index d7da29f77c3..64ce9d18b37 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -172,9 +172,9 @@ proc libstdc++_init { testfile } {
# Do a bunch of handstands and backflips for cross compiling and
# finding simulators...
if [is_remote host] {
- set header [remote_download host ${blddir}/testsuite/testsuite_hooks.h]
+ set header [remote_download host ${blddir}/testsuite/util/testsuite_hooks.h]
if { $header == "" } {
- verbose -log "Unable to download ${blddir}/testsuite/testsuite_hooks.h to host."
+ verbose -log "Unable to download ${blddir}/testsuite/util/testsuite_hooks.h to host."
return "untested"
}
set cxx [transform "g++"]
@@ -190,7 +190,7 @@ proc libstdc++_init { testfile } {
set includes [exec sh $flags_file --build-includes]
} else {
set cxx [transform "g++"]
- set includes "-I${srcdir}"
+ set includes "-I${srcdir}/util"
set cxxldflags ""
set cxxflags "-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0"
}
@@ -213,7 +213,9 @@ proc libstdc++_init { testfile } {
set lines [v3_target_compile $src "config[pid].o" object \
"additional_flags=-include additional_flags=bits/stdc++.h"]
if {$lines == "" } {
- set PCH_CXXFLAGS "-include bits/stdc++.h"
+# set PCH_CXXFLAGS "-include bits/extc++.h"
+ set PCH_CXXFLAGS "-include bits/stdtr1c++.h"
+# set PCH_CXXFLAGS "-include bits/stdc++.h"
} else {
set PCH_CXXFLAGS ""
}
@@ -348,6 +350,7 @@ proc v3_target_compile { source dest type options } {
}
lappend options "compiler=$cxx_final"
+ lappend options "timeout=600"
return [target_compile $source $dest $type $options]
}
diff --git a/libstdc++-v3/testsuite/performance/23_containers/create/map.cc b/libstdc++-v3/testsuite/performance/23_containers/create/map.cc
index baaf5805bec..08009ec7f48 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/create/map.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/create/map.cc
@@ -1,6 +1,6 @@
// 2003-03-01 gp dot bolton at computer dot org
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -54,7 +54,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("create");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/performance/23_containers/create_from_sorted/set.cc b/libstdc++-v3/testsuite/performance/23_containers/create_from_sorted/set.cc
index e7aa6033105..0c6bd709cb2 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/create_from_sorted/set.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/create_from_sorted/set.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -64,7 +64,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("create_from_sorted");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/performance/23_containers/create_sort/list.cc b/libstdc++-v3/testsuite/performance/23_containers/create_sort/list.cc
index cd43f0ddc84..02b25cde17f 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/create_sort/list.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/create_sort/list.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -57,7 +57,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("create_sort");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/performance/23_containers/find/map.cc b/libstdc++-v3/testsuite/performance/23_containers/find/map.cc
index d63501afeb3..f11bda1c8e2 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/find/map.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/find/map.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -60,7 +60,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("find");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/performance/23_containers/index/map.cc b/libstdc++-v3/testsuite/performance/23_containers/index/map.cc
index 7705e53ab58..8682c9070d5 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/index/map.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/index/map.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -63,7 +63,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("index_associative");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/performance/23_containers/insert/associative.cc b/libstdc++-v3/testsuite/performance/23_containers/insert/associative.cc
index 6228a031d98..8be68f6c1ca 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/insert/associative.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/insert/associative.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -65,7 +65,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("insert_associative");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/performance/23_containers/insert/sequence.cc b/libstdc++-v3/testsuite/performance/23_containers/insert/sequence.cc
index 15238ded538..b6cdbf117de 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/insert/sequence.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/insert/sequence.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -61,7 +61,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("insert_sequence");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/performance/23_containers/insert_erase/associative.cc b/libstdc++-v3/testsuite/performance/23_containers/insert_erase/associative.cc
index a13fcfab03e..c0ce6f9aa45 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/insert_erase/associative.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/insert_erase/associative.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -68,7 +68,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("insert_erase_associative");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/performance/23_containers/insert_from_sorted/set.cc b/libstdc++-v3/testsuite/performance/23_containers/insert_from_sorted/set.cc
index c02b636686c..863c7a6dc7c 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/insert_from_sorted/set.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/insert_from_sorted/set.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -81,7 +81,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("insert_from_sorted");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/performance/23_containers/producer_consumer/associative.cc b/libstdc++-v3/testsuite/performance/23_containers/producer_consumer/associative.cc
index 82fab43e0bb..3ccfca92e69 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/producer_consumer/associative.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/producer_consumer/associative.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -246,11 +246,11 @@ main()
typedef __gnu_test::maps<test_type, thread_type>::type map_typelist;
typedef __gnu_test::sets<test_type, thread_type>::type set_typelist;
- typedef __gnu_cxx::append<map_typelist, set_typelist>::type container_types;
+ typedef __gnu_cxx::typelist::append<map_typelist, set_typelist>::type container_types;
typedef test_sequence<thread_type> test_type;
test_type test("producer_consumer_associative");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/performance/23_containers/producer_consumer/sequence.cc b/libstdc++-v3/testsuite/performance/23_containers/producer_consumer/sequence.cc
index 5e71a6a588d..4adccb94654 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/producer_consumer/sequence.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/producer_consumer/sequence.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -249,7 +249,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("producer_consumer_sequence");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/performance/23_containers/sort_search/list.cc b/libstdc++-v3/testsuite/performance/23_containers/sort_search/list.cc
index 7adea2bf1e7..ed48eb9412f 100644
--- a/libstdc++-v3/testsuite/performance/23_containers/sort_search/list.cc
+++ b/libstdc++-v3/testsuite/performance/23_containers/sort_search/list.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -76,7 +76,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("sort_search");
- __gnu_cxx::apply<test_type, container_types> applier;
+ __gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/bernoulli_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/bernoulli_distribution/requirements/typedefs.cc
new file mode 100644
index 00000000000..aca11a43853
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/bernoulli_distribution/requirements/typedefs.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+//
+// 2006-06-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 5.1.7.2 Class template bernoulli_distribution [tr.rand.dist.bern]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef bernoulli_distribution test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/exponential_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/exponential_distribution/requirements/typedefs.cc
new file mode 100644
index 00000000000..1bc5b3f8dff
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/exponential_distribution/requirements/typedefs.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+//
+// 2006-06-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 5.1.7.7 Class template exponential_distribution [tr.rand.dist.exp]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef exponential_distribution<double> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/gamma_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/gamma_distribution/requirements/typedefs.cc
new file mode 100644
index 00000000000..e10944e52d3
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/gamma_distribution/requirements/typedefs.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+//
+// 2006-07-06 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 5.1.7.9 Class template gamma_distribution [tr.rand.dist.gamma]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef gamma_distribution<double> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/geometric_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/geometric_distribution/requirements/typedefs.cc
new file mode 100644
index 00000000000..525ca64556f
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/geometric_distribution/requirements/typedefs.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+//
+// 2006-06-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 5.1.7.3 Class template geometric_distribution [tr.rand.dist.geom]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef geometric_distribution<int, double> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/normal_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/normal_distribution/requirements/typedefs.cc
new file mode 100644
index 00000000000..22094646c37
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/normal_distribution/requirements/typedefs.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+//
+// 2006-06-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 5.1.7.8 Class template normal_distribution [tr.rand.dist.norm]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef normal_distribution<double> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_real/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_real/requirements/typedefs.cc
index b1ca8f4db58..65bcbd7f3ba 100644
--- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_real/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_real/requirements/typedefs.cc
@@ -20,7 +20,7 @@
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
-// 5.1.7.6 Class template uniform_int [tr.rand.dist.runif]
+// 5.1.7.6 Class template uniform_real [tr.rand.dist.runif]
// 5.1.1 [7] Table 17
#include <tr1/random>
diff --git a/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp b/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp
index bc89bd71789..fa34568b3ed 100644
--- a/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp
+++ b/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp
@@ -52,210 +52,93 @@
namespace pb_ds
{
+namespace test
+{
+ typedef dbg_ex_allocator<basic_type> alloc_type;
- namespace test
+ struct hash
{
+ typedef alloc_type::rebind<basic_type>::other::const_reference const_key_reference;
- typedef
- pb_ds::test::dbg_ex_allocator<
- pb_ds::test::basic_type>
- alloc_type;
-
- struct hash
- {
- typedef
- alloc_type::rebind<
- pb_ds::test::basic_type>::other::const_reference
- const_key_reference;
-
- size_t
- operator()(const_key_reference r_key) const
- {
- size_t ret = 0;
-
- for (pb_ds::test::basic_type::const_iterator it = r_key.begin(); it != r_key.end(); ++it)
- ret = ret* 5 + static_cast<size_t>(*it);
-
- return (ret);
- }
- };
-
- typedef
- pb_ds::string_trie_e_access_traits<
- basic_type,
- 'a',
- 'a' + basic_type::distinct_chars - 1,
- false,
- alloc_type>
- e_access_traits_t;
-
- template<typename Data_Type>
- struct tree_types
- {
- private:
- typedef
- typename pb_ds::test::tree_common_types<
- pb_ds::test::basic_type,
- Data_Type,
- std::less<
- pb_ds::test::basic_type>,
- pb_ds::null_tree_node_update,
- alloc_type>::regression_tl
- no_order_statistics_tl_t;
-
- typedef
- typename pb_ds::test::tree_common_types<
- pb_ds::test::basic_type,
- Data_Type,
- std::less<
- pb_ds::test::basic_type>,
- pb_ds::tree_order_statistics_node_update,
- alloc_type>::regression_tl
- order_statistics_tl_t;
-
- public:
-
- typedef
- typename pb_ds::detail::typelist_append<
- no_order_statistics_tl_t,
- order_statistics_tl_t>::type
- tl_t;
-
- typedef no_order_statistics_tl_t min_tl_t;
- };
-
- template<typename Data_Type>
- struct trie_types
+ size_t
+ operator()(const_key_reference r_key) const
{
- private:
- typedef
- typename pb_ds::test::trie_common_types<
- pb_ds::test::basic_type,
- Data_Type,
- e_access_traits_t,
- pb_ds::pat_trie_tag,
- pb_ds::null_trie_node_update,
- alloc_type>::regression_tl
- no_updates_tl_t;
-
- typedef
- typename pb_ds::test::trie_common_types<
- pb_ds::test::basic_type,
- Data_Type,
- e_access_traits_t,
- pb_ds::pat_trie_tag,
- pb_ds::trie_order_statistics_node_update,
- alloc_type>::regression_tl
- order_statistics_tl_t;
-
- typedef
- typename pb_ds::test::trie_common_types<
- pb_ds::test::basic_type,
- Data_Type,
- e_access_traits_t,
- pb_ds::pat_trie_tag,
- pb_ds::trie_prefix_search_node_update,
- alloc_type>::regression_tl
- prefix_search_tl_t;
-
- public:
- typedef
- typename pb_ds::detail::typelist_append<
- no_updates_tl_t,
- typename pb_ds::detail::typelist_append<
- prefix_search_tl_t,
- order_statistics_tl_t>::type>::type
- tl_t;
-
- typedef no_updates_tl_t min_tl_t;
- };
-
- template<typename Data_Type>
- struct hash_types
- {
- typedef
- typename pb_ds::test::hash_common_types<
- pb_ds::test::basic_type,
- Data_Type,
- hash,
- std::equal_to<
- pb_ds::test::basic_type>,
- alloc_type>::regression_tl
- tl_t;
-
- typedef tl_t min_tl_t;
- };
-
- template<typename Data_Type>
- struct lu_types
- {
- typedef
- typename pb_ds::test::lu_common_types<
- pb_ds::test::basic_type,
- Data_Type,
- std::equal_to<
- pb_ds::test::basic_type>,
- alloc_type>::regression_tl
- tl_t;
-
- typedef tl_t min_tl_t;
- };
-
- typedef
- tree_types<
- pb_ds::null_mapped_type>::tl_t
- tree_set_tl_t;
-
- typedef
- tree_types<
- pb_ds::null_mapped_type>::min_tl_t
- min_tree_set_tl_t;
-
- typedef
- hash_types<
- pb_ds::null_mapped_type>::tl_t
- hash_set_tl_t;
-
- typedef
- hash_types<
- pb_ds::null_mapped_type>::min_tl_t
- min_hash_set_tl_t;
-
- typedef lu_types< pb_ds::null_mapped_type>::tl_t lu_set_tl_t;
-
- typedef
- lu_types<
- pb_ds::null_mapped_type>::min_tl_t
- min_lu_set_tl_t;
-
- typedef
- trie_types<
- pb_ds::null_mapped_type>::tl_t
- trie_set_tl_t;
+ size_t ret = 0;
+ typedef basic_type::const_iterator const_iterator;
+ for (const_iterator it = r_key.begin(); it != r_key.end(); ++it)
+ ret = ret * 5 + static_cast<size_t>(*it);
+ return ret;
+ }
+ };
+
+ typedef pb_ds::string_trie_e_access_traits<basic_type, 'a', 'a' + basic_type::distinct_chars - 1, false, alloc_type> e_access_traits_t;
+
+ template<typename Data_Type>
+ struct tree_types
+ {
+ private:
+ typedef typename tree_common_types<basic_type, Data_Type, std::less<basic_type>, pb_ds::null_tree_node_update, alloc_type>::regression_tl no_order_statistics_tl_t;
- typedef
- trie_types<
- pb_ds::null_mapped_type>::min_tl_t
- min_trie_set_tl_t;
+ typedef typename tree_common_types<basic_type, Data_Type, std::less<basic_type>, pb_ds::tree_order_statistics_node_update, alloc_type>::regression_tl order_statistics_tl_t;
- typedef tree_types< basic_type>::tl_t tree_map_tl_t;
+ public:
+ typedef typename pb_ds::detail::typelist_append<no_order_statistics_tl_t, order_statistics_tl_t>::type tl_t;
- typedef tree_types< basic_type>::min_tl_t min_tree_map_tl_t;
+ typedef no_order_statistics_tl_t min_tl_t;
+ };
- typedef hash_types< basic_type>::tl_t hash_map_tl_t;
+ template<typename Data_Type>
+ struct trie_types
+ {
+ private:
+ typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, pb_ds::pat_trie_tag, pb_ds::null_trie_node_update, alloc_type>::regression_tl no_updates_tl_t;
- typedef hash_types< basic_type>::min_tl_t min_hash_map_tl_t;
+ typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, pb_ds::pat_trie_tag, pb_ds::trie_order_statistics_node_update, alloc_type>::regression_tl order_statistics_tl_t;
- typedef lu_types< basic_type>::tl_t lu_map_tl_t;
+ typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, pb_ds::pat_trie_tag, pb_ds::trie_prefix_search_node_update, alloc_type>::regression_tl prefix_search_tl_t;
- typedef lu_types< basic_type>::min_tl_t min_lu_map_tl_t;
+ public:
+ typedef typename pb_ds::detail::typelist_append<no_updates_tl_t, typename pb_ds::detail::typelist_append<prefix_search_tl_t, order_statistics_tl_t>::type>::type tl_t;
- typedef trie_types< basic_type>::tl_t trie_map_tl_t;
+ typedef no_updates_tl_t min_tl_t;
+ };
- typedef trie_types< basic_type>::min_tl_t min_trie_map_tl_t;
+ template<typename Data_Type>
+ struct hash_types
+ {
+ typedef typename hash_common_types<basic_type, Data_Type, hash, std::equal_to<basic_type>, alloc_type>::regression_tl tl_t;
- } // namespace test
+ typedef tl_t min_tl_t;
+ };
+ template<typename Data_Type>
+ struct lu_types
+ {
+ typedef typename lu_common_types<basic_type, Data_Type, std::equal_to<basic_type>, alloc_type>::regression_tl tl_t;
+
+ typedef tl_t min_tl_t;
+ };
+
+ typedef tree_types<null_mapped_type>::tl_t tree_set_tl_t;
+ typedef tree_types<null_mapped_type>::min_tl_t min_tree_set_tl_t;
+ typedef tree_types<basic_type>::tl_t tree_map_tl_t;
+ typedef tree_types<basic_type>::min_tl_t min_tree_map_tl_t;
+
+ typedef hash_types<null_mapped_type>::tl_t hash_set_tl_t;
+ typedef hash_types<null_mapped_type>::min_tl_t min_hash_set_tl_t;
+ typedef hash_types<basic_type>::tl_t hash_map_tl_t;
+ typedef hash_types<basic_type>::min_tl_t min_hash_map_tl_t;
+
+ typedef lu_types<null_mapped_type>::tl_t lu_set_tl_t;
+ typedef lu_types<null_mapped_type>::min_tl_t min_lu_set_tl_t;
+ typedef lu_types<basic_type>::tl_t lu_map_tl_t;
+ typedef lu_types<basic_type>::min_tl_t min_lu_map_tl_t;
+
+ typedef trie_types<null_mapped_type>::tl_t trie_set_tl_t;
+ typedef trie_types<null_mapped_type>::min_tl_t min_trie_set_tl_t;
+ typedef trie_types<basic_type>::tl_t trie_map_tl_t;
+ typedef trie_types<basic_type>::min_tl_t min_trie_map_tl_t;
+} // namespace test
} // namespace pb_ds
#endif // #ifndef PB_DS_RAND_REGRESSION_TEST_COMMON_TYPE_HPP
diff --git a/libstdc++-v3/testsuite/util/regression/basic_type.hpp b/libstdc++-v3/testsuite/util/regression/basic_type.hpp
index 60e970bd471..626f9e6f3a5 100644
--- a/libstdc++-v3/testsuite/util/regression/basic_type.hpp
+++ b/libstdc++-v3/testsuite/util/regression/basic_type.hpp
@@ -52,67 +52,52 @@
namespace pb_ds
{
+namespace test
+{
+#define PB_DS_BASE_C_DEC \
+ std::basic_string<char, std::char_traits<char>, dbg_ex_allocator<char> >
- namespace test
+ struct basic_type : public PB_DS_BASE_C_DEC
{
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
-#define PB_DS_BASE_C_DEC \
- std::basic_string< \
- char, \
- std::char_traits< \
- char>, \
- dbg_ex_allocator< \
- char> >
-
- struct basic_type : public PB_DS_BASE_C_DEC
- {
- public:
- enum
- {
- distinct_chars = 4
- };
-
- public:
- basic_type()
- { }
-
- template<typename Gen>
- basic_type(Gen& r_gen, size_t max)
+ public:
+ enum
{
- size_t rnd =
- r_gen.get_unsigned_long(0, static_cast<unsigned long>(max));
+ distinct_chars = 4
+ };
- while (rnd > 0)
- {
- PB_DS_BASE_C_DEC::push_back('a' +
- static_cast<char>(rnd % distinct_chars));
+ basic_type() { }
- rnd /= distinct_chars;
- }
- }
-
- basic_type(const std::string other)
- {
- std::string::const_iterator it = other.begin();
-
- while (it != other.end())
- {
- PB_DS_BASE_C_DEC::push_back(*it);
+ template<typename Gen>
+ basic_type(Gen& r_gen, size_t max)
+ {
+ size_t rnd = r_gen.get_unsigned_long(0, static_cast<unsigned long>(max));
+ while (rnd > 0)
+ {
+ base_type::push_back('a' + static_cast<char>(rnd % distinct_chars));
+ rnd /= distinct_chars;
+ }
+ }
- ++it;
- }
- }
+ basic_type(const std::string other)
+ {
+ std::string::const_iterator it = other.begin();
+ while (it != other.end())
+ {
+ base_type::push_back(*it);
+ ++it;
+ }
+ }
- operator std::string() const
- {
- return (std::string(PB_DS_BASE_C_DEC::c_str()));
- }
- };
+ operator std::string() const
+ { return std::string(base_type::c_str());}
+ };
#undef PB_DS_BASE_C_DEC
- } // namespace test
-
+} // namespace test
} // namespace pb_ds
#endif // #ifndef PB_DS_BASIC_TYPE_HPP
diff --git a/libstdc++-v3/testsuite/util/regression/priority_queue/common_type.hpp b/libstdc++-v3/testsuite/util/regression/priority_queue/common_type.hpp
index 4c67167a0e2..c8e6b3d92e9 100644
--- a/libstdc++-v3/testsuite/util/regression/priority_queue/common_type.hpp
+++ b/libstdc++-v3/testsuite/util/regression/priority_queue/common_type.hpp
@@ -52,27 +52,14 @@
namespace pb_ds
{
+namespace test
+{
+ typedef dbg_ex_allocator<basic_type> alloc_type;
- namespace test
- {
-
- typedef
- pb_ds::test::dbg_ex_allocator<
- pb_ds::test::basic_type>
- alloc_type;
-
- typedef
- pb_ds::test::pq_common_types<
- pb_ds::test::basic_type,
- std::less<
- pb_ds::test::basic_type>,
- alloc_type>::regression_tl
- pq_tl_t;
-
- typedef pq_tl_t min_pq_tl_t;
-
- } // namespace test
+ typedef pq_common_types<basic_type, std::less<basic_type>, alloc_type>::regression_tl pq_tl_t;
+ typedef pq_tl_t min_pq_tl_t;
+} // namespace test
} // namespace pb_ds
-#endif // #ifndef PB_DS_RAND_REGRESSION_TEST_COMMON_TYPE_HPP
+#endif
diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp
index 4f4c144b8d2..440c349cad9 100644
--- a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp
+++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp
@@ -60,432 +60,432 @@
namespace pb_ds
{
-
- namespace test
- {
-
- namespace detail
- {
+namespace test
+{
+namespace detail
+{
#ifdef PB_DS_REGRESSION_TRACE
#define PB_DS_TRACE(X) std::cerr << X << std::endl
-#else // #ifdef PB_DS_REGRESSION_TRACE
+#else
#define PB_DS_TRACE(X)
-#endif // #ifdef PB_DS_REGRESSION_TRACE
+#endif
-#define PB_DS_CLASS_T_DEC \
- template<typename Cntnr>
+#define PB_DS_CLASS_T_DEC \
+ template<typename Cntnr>
-#define PB_DS_CLASS_C_DEC \
- container_rand_regression_test< \
- Cntnr>
+#define PB_DS_CLASS_C_DEC \
+ container_rand_regression_test<Cntnr>
-#define PB_DS_COND_COMPARE(L, R) \
- if (m_g.get_prob() < m_mp) \
- cmp(L, R, __FUNCTION__);
+#define PB_DS_COND_COMPARE(L, R) \
+ if (m_g.get_prob() < m_mp) \
+ cmp(L, R, __FUNCTION__);
-#define PB_DS_RUN_MTHD(MTHD) \
- { \
- bool done = false; \
+#define PB_DS_RUN_MTHD(MTHD) \
+ { \
+ bool done = false; \
\
- while (!done) \
- done = MTHD(); \
- }
-
-#define PB_DS_THROW_IF_FAILED_(PRED, MORE, P_C, P_NC, F, L) \
- if (!(PRED)) \
- { \
- std::cerr << "Failure at " << F << ": " << L << std::endl; \
- \
- std::cerr << MORE << std::endl; \
- \
- std::cerr << "container:" << std::endl; \
- \
- print_container(*(P_C)); \
- std::cerr << std::endl; \
- \
- std::cerr << "native container:" << std::endl; \
- \
- print_container(*(P_NC)); \
- std::cerr << std::endl; \
- \
- throw std::logic_error("fucked!"); \
- }
+ while (!done) \
+ done = MTHD(); \
+ }
+
+#define PB_DS_THROW_IF_FAILED_(PRED, MORE, P_C, P_NC, F, L) \
+ if (!(PRED)) \
+ { \
+ std::cerr << "Failure at " << F << ": " << L << std::endl; \
+ std::cerr << MORE << std::endl; \
+ std::cerr << "container:" << std::endl; \
+ print_container(*(P_C)); \
+ std::cerr << std::endl; \
+ std::cerr << "native container:" << std::endl; \
+ print_container(*(P_NC)); \
+ std::cerr << std::endl; \
+ throw std::logic_error("fucked!"); \
+ }
#define PB_DS_THROW_IF_FAILED(PRED, MORE, P_C, P_NC) \
- PB_DS_THROW_IF_FAILED_(PRED, MORE, P_C, P_NC, __FILE__, __LINE__)
-
-#define PB_DS_SET_DESTRUCT_PRINT \
- destructor_printer dest_print___(__FUNCTION__);
+ PB_DS_THROW_IF_FAILED_(PRED, MORE, P_C, P_NC, __FILE__, __LINE__)
-#define PB_DS_CANCEL_DESTRUCT_PRINT \
- dest_print___.cancel_print();
-
- // Rand test specialized for a specific container.
- template<typename Cntnr>
- class container_rand_regression_test
- {
+#define PB_DS_SET_DESTRUCT_PRINT \
+ destructor_printer dest_print___(__FUNCTION__);
- public:
+#define PB_DS_CANCEL_DESTRUCT_PRINT \
+ dest_print___.cancel_print();
- container_rand_regression_test(unsigned long seed, size_t n, size_t m, double tp, double ip, double ep, double cp, double mp, bool disp);
+ // Rand test specialized for a specific container.
+ template<typename Cntnr>
+ class container_rand_regression_test
+ {
+ public:
- virtual
- ~container_rand_regression_test();
+ container_rand_regression_test(unsigned long, size_t, size_t, double,
+ double, double, double, double, bool);
- void
- operator()();
+ virtual
+ ~container_rand_regression_test();
- private:
- typedef Cntnr cntnr;
+ void
+ operator()();
- typedef typename cntnr::allocator allocator;
+ private:
+ typedef Cntnr cntnr;
- typedef typename cntnr::size_type size_type;
+ typedef typename cntnr::allocator allocator;
- typedef twister_rand_gen gen;
+ typedef typename cntnr::size_type size_type;
- typedef regression_test_traits< Cntnr> test_traits;
+ typedef twister_rand_gen gen;
- typedef pb_ds::container_traits< Cntnr> container_traits;
+ typedef regression_test_traits<Cntnr> test_traits;
- typedef typename test_traits::key_type key_type;
+ typedef pb_ds::container_traits<Cntnr> container_traits;
- typedef typename test_traits::const_key_reference const_key_reference;
+ typedef typename test_traits::key_type key_type;
- typedef typename test_traits::value_type value_type;
+ typedef typename test_traits::const_key_reference const_key_reference;
- typedef typename test_traits::native_type native_type;
+ typedef typename test_traits::value_type value_type;
- enum op
- {
- insert_op,
- erase_op,
- clear_op,
- other_op
- };
+ typedef typename test_traits::native_type native_type;
- typedef dbg_ex_allocator< char> alloc_t;
+ enum op
+ {
+ insert_op,
+ erase_op,
+ clear_op,
+ other_op
+ };
- private:
+ typedef dbg_ex_allocator<char> alloc_t;
- op
- get_next_op();
+ private:
- size_t
- get_next_sub_op(size_t max);
+ op
+ get_next_op();
- static void
- defs();
+ size_t
+ get_next_sub_op(size_t);
- static void
- key_defs();
+ static void
+ defs();
- static void
- mapped_defs();
+ static void
+ key_defs();
- static void
- value_defs();
+ static void
+ mapped_defs();
- static void
- ds_defs();
+ static void
+ value_defs();
- static void
- iterator_defs();
+ static void
+ ds_defs();
- static void
- node_iterator_defs(pb_ds::detail::false_type);
+ static void
+ iterator_defs();
- static void
- node_iterator_defs(pb_ds::detail::true_type);
+ static void
+ node_iterator_defs(pb_ds::detail::false_type);
- static void
- policy_defs();
+ static void
+ node_iterator_defs(pb_ds::detail::true_type);
- static void
- policy_defs(pb_ds::basic_hash_tag);
+ static void
+ policy_defs();
- static void
- policy_defs(pb_ds::cc_hash_tag);
+ static void
+ policy_defs(pb_ds::basic_hash_tag);
- static void
- policy_defs(pb_ds::gp_hash_tag);
+ static void
+ policy_defs(pb_ds::cc_hash_tag);
- static void
- policy_defs(pb_ds::tree_tag);
+ static void
+ policy_defs(pb_ds::gp_hash_tag);
- static void
- policy_defs(pb_ds::list_update_tag);
+ static void
+ policy_defs(pb_ds::tree_tag);
- static void
- policy_defs(pb_ds::pat_trie_tag);
+ static void
+ policy_defs(pb_ds::list_update_tag);
- void
- policy_access();
+ static void
+ policy_defs(pb_ds::pat_trie_tag);
- void
- policy_access(pb_ds::basic_hash_tag);
+ void
+ policy_access();
- void
- policy_access(pb_ds::cc_hash_tag);
+ void
+ policy_access(pb_ds::basic_hash_tag);
- void
- policy_access(pb_ds::gp_hash_tag);
+ void
+ policy_access(pb_ds::cc_hash_tag);
- void
- policy_access(pb_ds::tree_tag);
+ void
+ policy_access(pb_ds::gp_hash_tag);
- void
- policy_access(pb_ds::list_update_tag);
+ void
+ policy_access(pb_ds::tree_tag);
- void
- policy_access(pb_ds::pat_trie_tag);
+ void
+ policy_access(pb_ds::list_update_tag);
- void
- it_copy();
+ void
+ policy_access(pb_ds::pat_trie_tag);
- void
- it_assign();
+ void
+ it_copy();
- void
- rev_it_copy();
+ void
+ it_assign();
- void
- rev_it_assign();
+ void
+ rev_it_copy();
- void
- rev_it_copy_imp(pb_ds::detail::false_type);
+ void
+ rev_it_assign();
- void
- rev_it_copy_imp(pb_ds::detail::true_type);
+ void
+ rev_it_copy_imp(pb_ds::detail::false_type);
- void
- rev_it_assign_imp(pb_ds::detail::false_type);
+ void
+ rev_it_copy_imp(pb_ds::detail::true_type);
- void
- rev_it_assign_imp(pb_ds::detail::true_type);
+ void
+ rev_it_assign_imp(pb_ds::detail::false_type);
- bool
- default_constructor();
+ void
+ rev_it_assign_imp(pb_ds::detail::true_type);
- void
- swap();
+ bool
+ default_constructor();
- bool
- copy_constructor();
+ void
+ swap();
- bool
- assignment_operator();
+ bool
+ copy_constructor();
- bool
- it_constructor();
+ bool
+ assignment_operator();
- bool
- it_constructor_imp(pb_ds::cc_hash_tag);
+ bool
+ it_constructor();
- bool
- it_constructor_imp(pb_ds::gp_hash_tag);
+ bool
+ it_constructor_imp(pb_ds::cc_hash_tag);
- bool
- it_constructor_imp(pb_ds::tree_tag);
+ bool
+ it_constructor_imp(pb_ds::gp_hash_tag);
- bool
- it_constructor_imp(pb_ds::list_update_tag);
+ bool
+ it_constructor_imp(pb_ds::tree_tag);
- bool
- it_constructor_imp(pb_ds::pat_trie_tag);
+ bool
+ it_constructor_imp(pb_ds::list_update_tag);
- bool
- insert();
+ bool
+ it_constructor_imp(pb_ds::pat_trie_tag);
- bool
- erase();
+ bool
+ insert();
- bool
- erase_it();
+ bool
+ erase();
- bool
- erase_it_imp(pb_ds::detail::false_type);
+ bool
+ erase_it();
- bool
- erase_it_imp(pb_ds::detail::true_type);
+ bool
+ erase_it_imp(pb_ds::detail::false_type);
- bool
- erase_rev_it();
+ bool
+ erase_it_imp(pb_ds::detail::true_type);
- bool
- erase_rev_it_imp(pb_ds::detail::false_type);
+ bool
+ erase_rev_it();
- bool
- erase_rev_it_imp(pb_ds::detail::true_type);
+ bool
+ erase_rev_it_imp(pb_ds::detail::false_type);
- bool
- erase_if();
+ bool
+ erase_rev_it_imp(pb_ds::detail::true_type);
- bool
- clear();
+ bool
+ erase_if();
- bool
- resize();
+ bool
+ clear();
- bool
- resize_imp(pb_ds::detail::true_type);
+ bool
+ resize();
- bool
- resize_imp(pb_ds::detail::false_type);
+ bool
+ resize_imp(pb_ds::detail::true_type);
- bool
- get_set_loads();
+ bool
+ resize_imp(pb_ds::detail::false_type);
- bool
- get_set_loads_imp(pb_ds::detail::true_type);
+ bool
+ get_set_loads();
- bool
- get_set_loads_imp(pb_ds::detail::false_type);
+ bool
+ get_set_loads_imp(pb_ds::detail::true_type);
- void
- get_set_load();
+ bool
+ get_set_loads_imp(pb_ds::detail::false_type);
- void
- get_set_load_imp(pb_ds::detail::true_type);
+ void
+ get_set_load();
- void
- get_set_load_imp(pb_ds::detail::false_type);
+ void
+ get_set_load_imp(pb_ds::detail::true_type);
- bool
- subscript();
+ void
+ get_set_load_imp(pb_ds::detail::false_type);
- bool
- subscript_imp(pb_ds::detail::false_type);
+ bool
+ subscript();
- bool
- subscript_imp(pb_ds::detail::true_type);
+ bool
+ subscript_imp(pb_ds::detail::false_type);
- bool
- split_join();
+ bool
+ subscript_imp(pb_ds::detail::true_type);
- bool
- split_join_imp(pb_ds::detail::false_type);
+ bool
+ split_join();
- bool
- split_join_imp(pb_ds::detail::true_type);
+ bool
+ split_join_imp(pb_ds::detail::false_type);
- void
- cmp(const Cntnr& r_container, const native_type& r_native_c, const std::string& r_call_fn);
+ bool
+ split_join_imp(pb_ds::detail::true_type);
- void
- basic_cmp_(const Cntnr& r_container, const native_type& r_native_c);
+ void
+ cmp(const Cntnr&, const native_type&, const std::string&);
- void
- cmp_(const Cntnr& r_container, const native_type& r_native_c);
+ void
+ basic_cmp_(const Cntnr&, const native_type&);
- void
- order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
+ void
+ cmp_(const Cntnr&, const native_type&);
- void
- order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
+ void
+ order_preserving_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::false_type);
- void
- back_order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
+ void
+ order_preserving_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::true_type);
- void
- back_order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
+ void
+ back_order_preserving_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::false_type);
- void
- reverse_iteration_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
+ void
+ back_order_preserving_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::true_type);
- void
- reverse_iteration_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
+ void
+ reverse_iteration_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::false_type);
- void
- order_statistics_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
+ void
+ reverse_iteration_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::true_type);
- void
- order_statistics_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
+ void
+ order_statistics_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::false_type);
- void
- prefix_search_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
+ void
+ order_statistics_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::true_type);
- void
- prefix_search_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
+ void
+ prefix_search_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::false_type);
- template<typename Const_It, class Const_Native_It>
- void
- it_cmp_imp(Const_It b, Const_It e, Const_Native_It native_b, Const_Native_It native_e);
+ void
+ prefix_search_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::true_type);
- template<typename Const_It, class Const_Native_It>
- void
- back_it_cmp_imp(Const_It b, Const_It e, Const_Native_It native_b, Const_Native_It native_e);
+ template<typename Const_It, class Const_Native_It>
+ void
+ it_cmp_imp(Const_It, Const_It, Const_Native_It, Const_Native_It);
- void
- lower_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
+ template<typename Const_It, class Const_Native_It>
+ void
+ back_it_cmp_imp(Const_It, Const_It, Const_Native_It, Const_Native_It);
- void
- lower_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
+ void
+ lower_bound_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::false_type);
- void
- upper_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
+ void
+ lower_bound_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::true_type);
- void
- upper_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
+ void
+ upper_bound_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::false_type);
- void
- print_container(const native_type& r_cnt, std::ostream& r_os = std::cerr) const;
+ void
+ upper_bound_cmp_imp(const Cntnr&, const native_type&,
+ pb_ds::detail::true_type);
- void
- print_container(const cntnr& r_cnt, std::ostream& r_os = std::cerr) const;
+ void
+ print_container(const native_type&, std::ostream& r_os = std::cerr) const;
- private:
- struct destructor_printer
- {
- destructor_printer(const std::string& r_msg) : m_msg(r_msg),
- m_print(true)
- { }
+ void
+ print_container(const cntnr&, std::ostream& r_os = std::cerr) const;
- void
- cancel_print()
- {
- m_print = false;
- }
+ private:
+ struct destructor_printer
+ {
+ destructor_printer(const std::string& r_msg)
+ : m_msg(r_msg), m_print(true) { }
- ~destructor_printer()
- {
- if (!m_print)
- return;
+ void
+ cancel_print()
+ { m_print = false; }
- std::cerr << std::endl <<
- "Uncaught exception: " << std::endl <<
- m_msg << std::endl;
- }
+ ~destructor_printer()
+ {
+ if (!m_print)
+ return;
- private:
- const std::string m_msg;
+ std::cerr << std::endl << "Uncaught exception: " << std::endl
+ << m_msg << std::endl;
+ }
- bool m_print;
- };
+ private:
+ const std::string m_msg;
+ bool m_print;
+ };
- private:
- const unsigned long m_seed;
+ private:
+ const unsigned long m_seed;
- const size_t m_n;
- const size_t m_m;
- const double m_tp;
- const double m_ip;
- const double m_ep;
- const double m_cp;
- const double m_mp;
- const bool m_disp;
+ const size_t m_n;
+ const size_t m_m;
+ const double m_tp;
+ const double m_ip;
+ const double m_ep;
+ const double m_cp;
+ const double m_mp;
+ const bool m_disp;
- twister_rand_gen m_g;
+ twister_rand_gen m_g;
- Cntnr* m_p_c;
+ Cntnr* m_p_c;
- native_type m_native_c;
+ native_type m_native_c;
- alloc_t m_alloc;
+ alloc_t m_alloc;
- size_t m_i;
- };
+ size_t m_i;
+ };
#include <regression/rand/assoc/detail/constructor_destructor_fn_imps.hpp>
#include <regression/rand/assoc/detail/cmp_fn_imps.hpp>
@@ -504,27 +504,17 @@ namespace pb_ds
#include <regression/rand/assoc/detail/diagnostic_fn_imps.hpp>
#undef PB_DS_COND_COMPARE
-
#undef PB_DS_RUN_MTHD
-
#undef PB_DS_CLASS_T_DEC
-
#undef PB_DS_CLASS_C_DEC
-
#undef PB_DS_THROW_IF_FAILED_
-
#undef PB_DS_THROW_IF_FAILED
-
#undef PB_DS_SET_DESTRUCT_PRINT
-
#undef PB_DS_CANCEL_DESTRUCT_PRINT
-
#undef PB_DS_TRACE
- } // namespace detail
-
- } // namespace test
-
+} // namespace detail
+} // namespace test
} // namespace pb_ds
-#endif // #ifndef PB_DS_CONTAINER_RAND_REGRESSION_TEST_HPP
+#endif
diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp
index 6f6bafa861b..a7c3b7b8b30 100644
--- a/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp
+++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp
@@ -44,6 +44,9 @@
* Contains a random-operation test.
*/
+#ifndef PB_DS_ASSOC_RAND_REGRESSION_TEST_HPP
+#define PB_DS_ASSOC_RAND_REGRESSION_TEST_HPP
+
#include <iostream>
#include <vector>
#include <regression/rand/assoc/container_rand_regression_test.hpp>
@@ -113,19 +116,19 @@ namespace detail
double ip = 0.6;
double ep = 0.2;
double cp = 0.001;
- double mp = 1;
+ double mp = 0.25;
bool disp = false; // show progress
try
{
detail::verify_params(sd, n, m, tp, ip, ep, cp, mp, disp);
}
- catch(pb_ds::test::illegal_input_error&)
+ catch (pb_ds::test::illegal_input_error&)
{
detail::usage(name);
return -1;
}
- catch(...)
+ catch (...)
{
return -2;
};
@@ -204,3 +207,4 @@ namespace detail
} // namespace test
} // namespace pb_ds
+#endif
diff --git a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp
index ebd6d33c8d2..385a2c4dda2 100644
--- a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp
+++ b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp
@@ -44,6 +44,9 @@
* Contains a random-operation test.
*/
+#ifndef PB_DS_PQ_RAND_REGRESSION_TEST_HPP
+#define PB_DS_PQ_RAND_REGRESSION_TEST_HPP
+
#include <iostream>
#include <vector>
#include <regression/rand/priority_queue/container_rand_regression_test.hpp>
@@ -208,3 +211,4 @@ namespace detail
} // namespace test
} // namespace pb_ds
+#endif
diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp
index 8cf8c1271fc..65a63630f6f 100644
--- a/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp
+++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp
@@ -59,231 +59,193 @@
namespace pb_ds
{
+namespace test
+{
+namespace detail
+{
- namespace test
- {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Cntnr>
- namespace detail
- {
+#define PB_DS_CLASS_C_DEC \
+ regression_test_traits<Cntnr>
-#define PB_DS_CLASS_T_DEC \
- template<typename Cntnr>
-
-#define PB_DS_CLASS_C_DEC \
- regression_test_traits< \
- Cntnr>
-
-#define PB_DS_TYPE_TRAITS_C_DEC \
- regression_test_type_traits< \
- Cntnr>
-
-#define PB_DS_NATIVE_TYPE_TRAITS_C_DEC \
- native_type_traits< \
- typename PB_DS_TYPE_TRAITS_C_DEC::key_type, \
- typename PB_DS_TYPE_TRAITS_C_DEC::mapped_type, \
- typename Cntnr::allocator>
-
-#define PB_DS_RESIZE_TRAITS_C_DEC \
- regression_test_resize_traits< \
- Cntnr, \
- typename Cntnr::container_category>
-
-#define PB_DS_SET_LOADS_TRAITS_C_DEC \
- regression_test_get_set_loacontainer_traits< \
- Cntnr, \
- typename Cntnr::container_category>
-
-#define PB_DS_SET_LOAD_TRAITS_C_DEC \
- regression_test_get_set_load_traits< \
- Cntnr, \
- typename Cntnr::container_category>
-
-#define PB_DS_NODE_UPDATOR_TRAITS_C_DEC \
- regression_test_node_update_traits< \
- Cntnr, \
- typename Cntnr::container_category>
-
- template<typename Cntnr>
- struct regression_test_traits : private PB_DS_TYPE_TRAITS_C_DEC,
- private PB_DS_NATIVE_TYPE_TRAITS_C_DEC,
- private PB_DS_RESIZE_TRAITS_C_DEC,
- private PB_DS_NODE_UPDATOR_TRAITS_C_DEC,
- private PB_DS_SET_LOADS_TRAITS_C_DEC,
- private PB_DS_SET_LOAD_TRAITS_C_DEC
- {
+#define PB_DS_TYPE_TRAITS_C_DEC \
+ regression_test_type_traits<Cntnr>
- private:
- typedef PB_DS_NATIVE_TYPE_TRAITS_C_DEC native_type_traits_base;
+#define PB_DS_NATIVE_TYPE_TRAITS_C_DEC \
+ native_type_traits<typename PB_DS_TYPE_TRAITS_C_DEC::key_type, \
+ typename PB_DS_TYPE_TRAITS_C_DEC::mapped_type, \
+ typename Cntnr::allocator>
- typedef PB_DS_TYPE_TRAITS_C_DEC type_traits_base;
+#define PB_DS_RESIZE_TRAITS_C_DEC \
+ regression_test_resize_traits<Cntnr, typename Cntnr::container_category>
- public:
+#define PB_DS_SET_LOADS_TRAITS_C_DEC \
+ regression_test_get_set_loacontainer_traits<Cntnr, \
+ typename Cntnr::container_category>
- typedef typename Cntnr::key_type key_type;
+#define PB_DS_SET_LOAD_TRAITS_C_DEC \
+ regression_test_get_set_load_traits<Cntnr,typename Cntnr::container_category>
- typedef typename Cntnr::const_key_reference const_key_reference;
+#define PB_DS_NODE_UPDATOR_TRAITS_C_DEC \
+ regression_test_node_update_traits<Cntnr, typename Cntnr::container_category>
- typedef typename Cntnr::value_type value_type;
+ template<typename Cntnr>
+ struct regression_test_traits : private PB_DS_TYPE_TRAITS_C_DEC,
+ private PB_DS_NATIVE_TYPE_TRAITS_C_DEC,
+ private PB_DS_RESIZE_TRAITS_C_DEC,
+ private PB_DS_NODE_UPDATOR_TRAITS_C_DEC,
+ private PB_DS_SET_LOADS_TRAITS_C_DEC,
+ private PB_DS_SET_LOAD_TRAITS_C_DEC
+ {
+ private:
+ typedef PB_DS_NATIVE_TYPE_TRAITS_C_DEC native_type_traits_base;
- typedef typename Cntnr::const_reference const_reference;
+ typedef PB_DS_TYPE_TRAITS_C_DEC type_traits_base;
- typedef typename PB_DS_NATIVE_TYPE_TRAITS_C_DEC::type native_type;
+ public:
+ typedef typename Cntnr::key_type key_type;
- typedef typename native_type::key_type native_key_type;
+ typedef typename Cntnr::const_key_reference const_key_reference;
- typedef typename native_type::value_type native_value_type;
+ typedef typename Cntnr::value_type value_type;
- enum
- {
- resize = PB_DS_RESIZE_TRAITS_C_DEC::value,
- get_set_loads = PB_DS_SET_LOADS_TRAITS_C_DEC::value,
- get_set_load = PB_DS_SET_LOAD_TRAITS_C_DEC::value,
- order_statistics =
- PB_DS_NODE_UPDATOR_TRAITS_C_DEC::order_statistics,
- prefix_search =
- PB_DS_NODE_UPDATOR_TRAITS_C_DEC::prefix_search
- };
-
- template<typename T>
- struct erase_if_fn : public regression_test_erase_if_fn<
- T>
- {
-
- };
-
- static size_t
- erase_if(native_type& r_native_c)
- {
- typedef
- regression_test_erase_if_fn<
- typename native_type::value_type>
- erase_if_fn;
-
- typename native_type::iterator it = r_native_c.begin();
-
- size_t num_ersd = 0;
-
- while (it != r_native_c.end())
- if (erase_if_fn()(*it))
- {
- ++num_ersd;
-
- r_native_c.erase(it);
-
- it = r_native_c.begin();
- }
- else
- ++it;
-
- return (num_ersd);
- }
-
- static void
- print_container(const Cntnr& r_c, std::ostream& r_os)
- {
- PB_DS_TYPE_TRAITS_C_DEC::print_container(r_c, r_os);
- }
-
- public:
-
- template<typename Gen>
- static key_type
- generate_key(Gen& r_gen, size_t max)
- {
- return (PB_DS_TYPE_TRAITS_C_DEC::generate_key(r_gen, max));
- }
-
- template<typename Gen>
- static value_type
- generate_value(Gen& r_gen, size_t max)
- {
- return (PB_DS_TYPE_TRAITS_C_DEC::generate_value(r_gen, max));
- }
-
- static const_key_reference
- extract_key(const_reference r_val)
- {
- return type_traits_base::extract_key(r_val);
- }
-
- static native_key_type
- native_key(const_key_reference r_key)
- {
- return (native_type_traits_base::native_key(r_key));
- }
-
- static native_value_type
- native_value(const_reference r_val)
- {
- return (native_type_traits_base::native_value(r_val));
- }
-
- static const native_key_type&
- extract_native_key(const native_value_type& r_val)
- {
- return (native_type_traits_base::extract_key(r_val));
- }
-
- static bool
- cmp(const_reference r_val, const native_value_type& r_native_val)
- {
- return (val_to_string(r_val) ==
- native_val_to_string(r_native_val));
- }
-
- static std::string
- val_to_string(const_reference r_val)
- {
- return (to_string(r_val));
- }
-
- static std::string
- key_to_string(const_key_reference r_key)
- {
- return (to_string(r_key));
- }
-
- static std::string
- native_val_to_string(const native_value_type& r_native_val)
- {
- return (to_string(r_native_val));
- }
-
- static bool
- prefix_match(const_key_reference r_key, const std::string& r_native_key)
- {
- const size_t native_substr_len = std::min(
- r_key.length(),
- r_native_key.length());
-
- const std::string native_substr =
- r_native_key.substr(0, native_substr_len);
-
- return (native_substr == (const std::string& )r_key);
- }
+ typedef typename Cntnr::const_reference const_reference;
+ typedef typename PB_DS_NATIVE_TYPE_TRAITS_C_DEC::type native_type;
+
+ typedef typename native_type::key_type native_key_type;
+
+ typedef typename native_type::value_type native_value_type;
+
+ enum
+ {
+ resize = PB_DS_RESIZE_TRAITS_C_DEC::value,
+ get_set_loads = PB_DS_SET_LOADS_TRAITS_C_DEC::value,
+ get_set_load = PB_DS_SET_LOAD_TRAITS_C_DEC::value,
+ order_statistics = PB_DS_NODE_UPDATOR_TRAITS_C_DEC::order_statistics,
+ prefix_search = PB_DS_NODE_UPDATOR_TRAITS_C_DEC::prefix_search
};
-#undef PB_DS_TYPE_TRAITS_C_DEC
+ template<typename T>
+ struct erase_if_fn : public regression_test_erase_if_fn<T>
+ { };
-#undef PB_DS_NATIVE_TYPE_TRAITS_C_DEC
+ static size_t
+ erase_if(native_type& r_native_c)
+ {
+ typedef regression_test_erase_if_fn<typename native_type::value_type> erase_if_fn;
-#undef PB_DS_RESIZE_TRAITS_C_DEC
+ typename native_type::iterator it = r_native_c.begin();
+ size_t num_ersd = 0;
+ while (it != r_native_c.end())
+ if (erase_if_fn()(*it))
+ {
+ ++num_ersd;
+ r_native_c.erase(it);
+ it = r_native_c.begin();
+ }
+ else
+ ++it;
+ return num_ersd;
+ }
+
+ static void
+ print_container(const Cntnr& r_c, std::ostream& r_os)
+ {
+ PB_DS_TYPE_TRAITS_C_DEC::print_container(r_c, r_os);
+ }
-#undef PB_DS_SET_LOADS_TRAITS_C_DEC
+ public:
-#undef PB_DS_SET_LOAD_TRAITS_C_DEC
+ template<typename Gen>
+ static key_type
+ generate_key(Gen& r_gen, size_t max)
+ {
+ return PB_DS_TYPE_TRAITS_C_DEC::generate_key(r_gen, max);
+ }
-#undef PB_DS_NODE_UPDATOR_TRAITS_C_DEC
+ template<typename Gen>
+ static value_type
+ generate_value(Gen& r_gen, size_t max)
+ {
+ return PB_DS_TYPE_TRAITS_C_DEC::generate_value(r_gen, max);
+ }
-#undef PB_DS_CLASS_T_DEC
+ static const_key_reference
+ extract_key(const_reference r_val)
+ {
+ return type_traits_base::extract_key(r_val);
+ }
-#undef PB_DS_CLASS_C_DEC
+ static native_key_type
+ native_key(const_key_reference r_key)
+ {
+ return native_type_traits_base::native_key(r_key);
+ }
+
+ static native_value_type
+ native_value(const_reference r_val)
+ {
+ return native_type_traits_base::native_value(r_val);
+ }
- } // namespace detail
+ static const native_key_type&
+ extract_native_key(const native_value_type& r_val)
+ {
+ return native_type_traits_base::extract_key(r_val);
+ }
- } // namespace test
+ static bool
+ cmp(const_reference r_val, const native_value_type& r_native_val)
+ {
+ return val_to_string(r_val) == native_val_to_string(r_native_val);
+ }
+
+ static std::string
+ val_to_string(const_reference r_val)
+ {
+ return to_string(r_val);
+ }
+
+ static std::string
+ key_to_string(const_key_reference r_key)
+ {
+ return to_string(r_key);
+ }
+
+ static std::string
+ native_val_to_string(const native_value_type& r_native_val)
+ {
+ return to_string(r_native_val);
+ }
+
+ static bool
+ prefix_match(const_key_reference r_key, const std::string& r_native_key)
+ {
+ const size_t native_substr_len = std::min(r_key.length(),
+ r_native_key.length());
+
+ const std::string native_substr = r_native_key.substr(0,
+ native_substr_len);
+
+ return native_substr == (const std::string&) r_key;
+ }
+
+ };
+
+#undef PB_DS_TYPE_TRAITS_C_DEC
+#undef PB_DS_NATIVE_TYPE_TRAITS_C_DEC
+#undef PB_DS_RESIZE_TRAITS_C_DEC
+#undef PB_DS_SET_LOADS_TRAITS_C_DEC
+#undef PB_DS_SET_LOAD_TRAITS_C_DEC
+#undef PB_DS_NODE_UPDATOR_TRAITS_C_DEC
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+} // namespace detail
+} // namespace test
} // namespace pb_ds
-#endif // #ifndef PB_DS_REGRESSION_TEST_TRAIT_HPP
+#endif
diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h
index e63f5e0e590..c4819109b19 100644
--- a/libstdc++-v3/testsuite/util/testsuite_common_types.h
+++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h
@@ -54,9 +54,9 @@
namespace __gnu_test
{
- using __gnu_cxx::typelist;
- using __gnu_cxx::transform;
- using __gnu_cxx::append;
+ using __gnu_cxx::typelist::node;
+ using __gnu_cxx::typelist::transform;
+ using __gnu_cxx::typelist::append;
// All the allocators to test.
template<typename Tp, bool Thread>
@@ -69,7 +69,7 @@ namespace __gnu_test
typedef __gnu_cxx::__mt_alloc<Tp, pool_policy> a3;
typedef __gnu_cxx::bitmap_allocator<Tp> a4;
typedef __gnu_cxx::__pool_alloc<Tp> a5;
- typedef typelist<_GLIBCXX_TYPELIST_CHAIN5(a1, a2, a3, a4, a5)> type;
+ typedef node<_GLIBCXX_TYPELIST_CHAIN5(a1, a2, a3, a4, a5)> type;
};
// Typelists for vector, string, list, deque.
@@ -385,7 +385,7 @@ template<bool Thread>
template<class Container>
void
- operator()(__gnu_cxx::detail::type_to_type<Container>)
+ operator()(__gnu_cxx::typelist::detail::type_to_type<Container>)
{
const int i = 20000;
test_container<Container, i, Thread>(_M_filename);