gcc/libstdc++-v3/include/std/tuple

1640 lines
55 KiB
Plaintext
Raw Normal View History

acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. * configure.host (c_model): Set default to c_global. * configure: Regenerate. * include/Makefile.am (c_compatibility_headers_extra): Make conditional on GLIBCXX_C_HEADERS_COMPATIBILITY. (c_base_headers_extra): Make conditional on GLIBCXX_C_HEADERS_EXTRA. (c_compatibility_headers): Make conditional on c/c_std/c_global. * include/Makefile.in: Regenerate. * docs/html/configopts.html: Add c_global information to --enable-cheaders. Eventually, "c_std" should mean "C" includes that are in namespace std, with optional C++ "C" compatibility includes to inject into global scope. And "c_global" should mean "C" includes that are in the global namespace, with C++ includes injecting into namespace std and no C++ "C" compatibility includes. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * include/bits/c++config: Add _GLIBCXX_NAMEPACE_C. Add _GLIBCXX_NAMESPACE_ASSOCIATION_CXX200x. Add _GLIBCXX_TR1 as namespace macro. Add namespace associations for std::__cxx200x conditionally. * include/c_compatibility/assert.h: Correct doxygen markup, conditionalize the global injections on _GLIBCXX_NAMESPACE_C. * include/c_compatibility/ctype.h: Same. * include/c_compatibility/errno.h: Same. * include/c_compatibility/float.h: Same. * include/c_compatibility/iso646.h: Same. * include/c_compatibility/limits.h: Same. * include/c_compatibility/locale.h: Same. * include/c_compatibility/math.h: Same. * include/c_compatibility/setjmp.h: Same. * include/c_compatibility/signal.h: Same. * include/c_compatibility/stdarg.h: Same. * include/c_compatibility/stddef.h: Same. * include/c_compatibility/stdio.h: Same. * include/c_compatibility/stdlib.h: Same. * include/c_compatibility/string.h: Same. * include/c_compatibility/time.h: Same. * include/c_compatibility/wchar.h: Same. * include/c_compatibility/wctype.h: Same. * include/c_compatibility/complex.h: Add. * include/c_compatibility/fenv.h: Same. * include/c_compatibility/inttypes.h: Same. * include/c_compatibility/stdbool.h: Same. * include/c_compatibility/stdint.h: Same. * include/c_compatibility/tgmath.h: Same. * include/c_global/cassert: Add, use include_next, use C++0x features if -std=c++0x. * include/c_global/cctype: Same. * include/c_global/cerrno: Same. * include/c_global/cfloat: Same. * include/c_global/ciso646: Same. * include/c_global/climits: Same. * include/c_global/clocale: Same. * include/c_global/cmath: Same. * include/c_global/cmath.tcc: Same. * include/c_global/csetjmp: Same. * include/c_global/csignal: Same. * include/c_global/cstdarg: Same. * include/c_global/cstddef: Same. * include/c_global/cstdio: Same. * include/c_global/cstdlib: Same. * include/c_global/cstring: Same. * include/c_global/ctime: Same. * include/c_global/cwchar: Same. * include/c_global/cwctype: Same. * include/c_global/ccomplex: Add. * include/c_global/cfenv: Add. * include/c_global/cinttypes: Add. * include/c_global/cstdbool: Add. * include/c_global/cstdint: Add. * include/c_global/ctgmath: Add. * include/std/algorithm: Use C++0x features if -std=c++0x. * include/std/bitset: Same. * include/std/complex: Same. * include/std/deque: Same. * include/std/fstream: Same. * include/std/functional: Same. * include/std/iomanip: Same. * include/std/ios: Same. * include/std/iosfwd: Same. * include/std/iostream: Same. * include/std/istream: Same. * include/std/iterator: Same. * include/std/limits: Same. * include/std/list: Same. * include/std/locale: Same. * include/std/map: Same. * include/std/memory: Same. * include/std/numeric: Same. * include/std/ostream: Same. * include/std/queue: Same. * include/std/set: Same. * include/std/sstream: Same. * include/std/stack: Same. * include/std/stdexcept: Same. * include/std/streambuf: Same. * include/std/string: Same. * include/std/utility: Same. * include/std/valarray: Same. * include/std/vector: Same. * include/std/array: Add. * include/std/random: Add. * include/std/regex: Add. * include/std/tuple: Add. * include/std/type_traits: Add. * include/std/unordered_map: Add. * include/std/unordered_set: Add. * include/std/c++0x_warning.h: Add. * include/tr1/array: Switch namespaces based on _GLIBCXX_TR1. * include/tr1/boost_shared_ptr.h: Same. * include/tr1/cctype: Same. * include/tr1/cfenv: Same. * include/tr1/cinttypes: Same. * include/tr1/cmath: Same. * include/tr1/common.h: Same. * include/tr1/complex: Same. * include/tr1/cstdint: Same. * include/tr1/cstdio: Same. * include/tr1/cstdlib: Same. * include/tr1/cwchar: Same. * include/tr1/cwctype: Same. * include/tr1/functional: Same. * include/tr1/functional_hash.h: Same. * include/tr1/functional_iterate.h: Same. * include/tr1/hashtable: Same. * include/tr1/hashtable_policy.h: Same. * include/tr1/math.h: Same. * include/tr1/memory: Same. * include/tr1/random: Same. * include/tr1/random.tcc: Same. * include/tr1/ref_fwd.h: Same. * include/tr1/repeat.h: Same. * include/tr1/stdlib.h: Same. * include/tr1/tuple: Same. * include/tr1/tuple_iterate.h: Same. * include/tr1/type_traits: Same. * include/tr1/type_traits_fwd.h: Same. * include/tr1/unordered_map: Same. * include/tr1/unordered_set: Same. * include/tr1/utility: Same. * include/tr1/ccomplex: Add. * include/tr1/complex.h: Add. * include/tr1/regex: Add. * include/Makefile.am: Add C++0x headers, "C" compatibility headers. * include/Makefile.in: Regenerate. * testsuite/tr1/headers.cc: Add in regex/complex. * testsuite/17_intro/headers/c++200x/all.cc: New. * testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc: Same. * testsuite/17_intro/using_namespace_std_tr1_neg.cc: Same. * testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/types_std_c++0x.cc: Same. * testsuite/20_util/enable_shared_from_this/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/headers/functional/types_std_c++0x.cc: Same. * testsuite/20_util/headers/functional/ using_namespace_std_placeholders.cc: Same. * testsuite/20_util/headers/memory/types_std_c++0x.cc: Same. * testsuite/20_util/headers/type_traits/std_c++0x_neg.cc: Same. * testsuite/20_util/headers/type_traits/types_std_c++0x.cc: Same. * testsuite/20_util/shared_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/weak_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/array/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/hash/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/headers/array/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/types_std_c++0x.cc: Same. * testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc: Same. * testsuite/23_containers/tuple/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation.cc: Same. * testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cmath/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/types_std_c++0x.cc: Same. * testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc: Same. * testsuite/27_io/headers/cinttypes/types_std_c++0x.cc: Same. * testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types.cc: Rename ... * testsuite/tr1/8_c_compatibility/cinttypes/types.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types_std_tr1.cc: ...to this. * testsuite/tr1/8_c_compatibility/cinttypes/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc: Same. From-SVN: r122533
2007-03-04 23:59:49 +01:00
// <tuple> -*- C++ -*-
// Copyright (C) 2007-2019 Free Software Foundation, Inc.
acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. * configure.host (c_model): Set default to c_global. * configure: Regenerate. * include/Makefile.am (c_compatibility_headers_extra): Make conditional on GLIBCXX_C_HEADERS_COMPATIBILITY. (c_base_headers_extra): Make conditional on GLIBCXX_C_HEADERS_EXTRA. (c_compatibility_headers): Make conditional on c/c_std/c_global. * include/Makefile.in: Regenerate. * docs/html/configopts.html: Add c_global information to --enable-cheaders. Eventually, "c_std" should mean "C" includes that are in namespace std, with optional C++ "C" compatibility includes to inject into global scope. And "c_global" should mean "C" includes that are in the global namespace, with C++ includes injecting into namespace std and no C++ "C" compatibility includes. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * include/bits/c++config: Add _GLIBCXX_NAMEPACE_C. Add _GLIBCXX_NAMESPACE_ASSOCIATION_CXX200x. Add _GLIBCXX_TR1 as namespace macro. Add namespace associations for std::__cxx200x conditionally. * include/c_compatibility/assert.h: Correct doxygen markup, conditionalize the global injections on _GLIBCXX_NAMESPACE_C. * include/c_compatibility/ctype.h: Same. * include/c_compatibility/errno.h: Same. * include/c_compatibility/float.h: Same. * include/c_compatibility/iso646.h: Same. * include/c_compatibility/limits.h: Same. * include/c_compatibility/locale.h: Same. * include/c_compatibility/math.h: Same. * include/c_compatibility/setjmp.h: Same. * include/c_compatibility/signal.h: Same. * include/c_compatibility/stdarg.h: Same. * include/c_compatibility/stddef.h: Same. * include/c_compatibility/stdio.h: Same. * include/c_compatibility/stdlib.h: Same. * include/c_compatibility/string.h: Same. * include/c_compatibility/time.h: Same. * include/c_compatibility/wchar.h: Same. * include/c_compatibility/wctype.h: Same. * include/c_compatibility/complex.h: Add. * include/c_compatibility/fenv.h: Same. * include/c_compatibility/inttypes.h: Same. * include/c_compatibility/stdbool.h: Same. * include/c_compatibility/stdint.h: Same. * include/c_compatibility/tgmath.h: Same. * include/c_global/cassert: Add, use include_next, use C++0x features if -std=c++0x. * include/c_global/cctype: Same. * include/c_global/cerrno: Same. * include/c_global/cfloat: Same. * include/c_global/ciso646: Same. * include/c_global/climits: Same. * include/c_global/clocale: Same. * include/c_global/cmath: Same. * include/c_global/cmath.tcc: Same. * include/c_global/csetjmp: Same. * include/c_global/csignal: Same. * include/c_global/cstdarg: Same. * include/c_global/cstddef: Same. * include/c_global/cstdio: Same. * include/c_global/cstdlib: Same. * include/c_global/cstring: Same. * include/c_global/ctime: Same. * include/c_global/cwchar: Same. * include/c_global/cwctype: Same. * include/c_global/ccomplex: Add. * include/c_global/cfenv: Add. * include/c_global/cinttypes: Add. * include/c_global/cstdbool: Add. * include/c_global/cstdint: Add. * include/c_global/ctgmath: Add. * include/std/algorithm: Use C++0x features if -std=c++0x. * include/std/bitset: Same. * include/std/complex: Same. * include/std/deque: Same. * include/std/fstream: Same. * include/std/functional: Same. * include/std/iomanip: Same. * include/std/ios: Same. * include/std/iosfwd: Same. * include/std/iostream: Same. * include/std/istream: Same. * include/std/iterator: Same. * include/std/limits: Same. * include/std/list: Same. * include/std/locale: Same. * include/std/map: Same. * include/std/memory: Same. * include/std/numeric: Same. * include/std/ostream: Same. * include/std/queue: Same. * include/std/set: Same. * include/std/sstream: Same. * include/std/stack: Same. * include/std/stdexcept: Same. * include/std/streambuf: Same. * include/std/string: Same. * include/std/utility: Same. * include/std/valarray: Same. * include/std/vector: Same. * include/std/array: Add. * include/std/random: Add. * include/std/regex: Add. * include/std/tuple: Add. * include/std/type_traits: Add. * include/std/unordered_map: Add. * include/std/unordered_set: Add. * include/std/c++0x_warning.h: Add. * include/tr1/array: Switch namespaces based on _GLIBCXX_TR1. * include/tr1/boost_shared_ptr.h: Same. * include/tr1/cctype: Same. * include/tr1/cfenv: Same. * include/tr1/cinttypes: Same. * include/tr1/cmath: Same. * include/tr1/common.h: Same. * include/tr1/complex: Same. * include/tr1/cstdint: Same. * include/tr1/cstdio: Same. * include/tr1/cstdlib: Same. * include/tr1/cwchar: Same. * include/tr1/cwctype: Same. * include/tr1/functional: Same. * include/tr1/functional_hash.h: Same. * include/tr1/functional_iterate.h: Same. * include/tr1/hashtable: Same. * include/tr1/hashtable_policy.h: Same. * include/tr1/math.h: Same. * include/tr1/memory: Same. * include/tr1/random: Same. * include/tr1/random.tcc: Same. * include/tr1/ref_fwd.h: Same. * include/tr1/repeat.h: Same. * include/tr1/stdlib.h: Same. * include/tr1/tuple: Same. * include/tr1/tuple_iterate.h: Same. * include/tr1/type_traits: Same. * include/tr1/type_traits_fwd.h: Same. * include/tr1/unordered_map: Same. * include/tr1/unordered_set: Same. * include/tr1/utility: Same. * include/tr1/ccomplex: Add. * include/tr1/complex.h: Add. * include/tr1/regex: Add. * include/Makefile.am: Add C++0x headers, "C" compatibility headers. * include/Makefile.in: Regenerate. * testsuite/tr1/headers.cc: Add in regex/complex. * testsuite/17_intro/headers/c++200x/all.cc: New. * testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc: Same. * testsuite/17_intro/using_namespace_std_tr1_neg.cc: Same. * testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/types_std_c++0x.cc: Same. * testsuite/20_util/enable_shared_from_this/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/headers/functional/types_std_c++0x.cc: Same. * testsuite/20_util/headers/functional/ using_namespace_std_placeholders.cc: Same. * testsuite/20_util/headers/memory/types_std_c++0x.cc: Same. * testsuite/20_util/headers/type_traits/std_c++0x_neg.cc: Same. * testsuite/20_util/headers/type_traits/types_std_c++0x.cc: Same. * testsuite/20_util/shared_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/weak_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/array/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/hash/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/headers/array/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/types_std_c++0x.cc: Same. * testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc: Same. * testsuite/23_containers/tuple/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation.cc: Same. * testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cmath/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/types_std_c++0x.cc: Same. * testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc: Same. * testsuite/27_io/headers/cinttypes/types_std_c++0x.cc: Same. * testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types.cc: Rename ... * testsuite/tr1/8_c_compatibility/cinttypes/types.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types_std_tr1.cc: ...to this. * testsuite/tr1/8_c_compatibility/cinttypes/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc: Same. From-SVN: r122533
2007-03-04 23:59:49 +01:00
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. * configure.host (c_model): Set default to c_global. * configure: Regenerate. * include/Makefile.am (c_compatibility_headers_extra): Make conditional on GLIBCXX_C_HEADERS_COMPATIBILITY. (c_base_headers_extra): Make conditional on GLIBCXX_C_HEADERS_EXTRA. (c_compatibility_headers): Make conditional on c/c_std/c_global. * include/Makefile.in: Regenerate. * docs/html/configopts.html: Add c_global information to --enable-cheaders. Eventually, "c_std" should mean "C" includes that are in namespace std, with optional C++ "C" compatibility includes to inject into global scope. And "c_global" should mean "C" includes that are in the global namespace, with C++ includes injecting into namespace std and no C++ "C" compatibility includes. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * include/bits/c++config: Add _GLIBCXX_NAMEPACE_C. Add _GLIBCXX_NAMESPACE_ASSOCIATION_CXX200x. Add _GLIBCXX_TR1 as namespace macro. Add namespace associations for std::__cxx200x conditionally. * include/c_compatibility/assert.h: Correct doxygen markup, conditionalize the global injections on _GLIBCXX_NAMESPACE_C. * include/c_compatibility/ctype.h: Same. * include/c_compatibility/errno.h: Same. * include/c_compatibility/float.h: Same. * include/c_compatibility/iso646.h: Same. * include/c_compatibility/limits.h: Same. * include/c_compatibility/locale.h: Same. * include/c_compatibility/math.h: Same. * include/c_compatibility/setjmp.h: Same. * include/c_compatibility/signal.h: Same. * include/c_compatibility/stdarg.h: Same. * include/c_compatibility/stddef.h: Same. * include/c_compatibility/stdio.h: Same. * include/c_compatibility/stdlib.h: Same. * include/c_compatibility/string.h: Same. * include/c_compatibility/time.h: Same. * include/c_compatibility/wchar.h: Same. * include/c_compatibility/wctype.h: Same. * include/c_compatibility/complex.h: Add. * include/c_compatibility/fenv.h: Same. * include/c_compatibility/inttypes.h: Same. * include/c_compatibility/stdbool.h: Same. * include/c_compatibility/stdint.h: Same. * include/c_compatibility/tgmath.h: Same. * include/c_global/cassert: Add, use include_next, use C++0x features if -std=c++0x. * include/c_global/cctype: Same. * include/c_global/cerrno: Same. * include/c_global/cfloat: Same. * include/c_global/ciso646: Same. * include/c_global/climits: Same. * include/c_global/clocale: Same. * include/c_global/cmath: Same. * include/c_global/cmath.tcc: Same. * include/c_global/csetjmp: Same. * include/c_global/csignal: Same. * include/c_global/cstdarg: Same. * include/c_global/cstddef: Same. * include/c_global/cstdio: Same. * include/c_global/cstdlib: Same. * include/c_global/cstring: Same. * include/c_global/ctime: Same. * include/c_global/cwchar: Same. * include/c_global/cwctype: Same. * include/c_global/ccomplex: Add. * include/c_global/cfenv: Add. * include/c_global/cinttypes: Add. * include/c_global/cstdbool: Add. * include/c_global/cstdint: Add. * include/c_global/ctgmath: Add. * include/std/algorithm: Use C++0x features if -std=c++0x. * include/std/bitset: Same. * include/std/complex: Same. * include/std/deque: Same. * include/std/fstream: Same. * include/std/functional: Same. * include/std/iomanip: Same. * include/std/ios: Same. * include/std/iosfwd: Same. * include/std/iostream: Same. * include/std/istream: Same. * include/std/iterator: Same. * include/std/limits: Same. * include/std/list: Same. * include/std/locale: Same. * include/std/map: Same. * include/std/memory: Same. * include/std/numeric: Same. * include/std/ostream: Same. * include/std/queue: Same. * include/std/set: Same. * include/std/sstream: Same. * include/std/stack: Same. * include/std/stdexcept: Same. * include/std/streambuf: Same. * include/std/string: Same. * include/std/utility: Same. * include/std/valarray: Same. * include/std/vector: Same. * include/std/array: Add. * include/std/random: Add. * include/std/regex: Add. * include/std/tuple: Add. * include/std/type_traits: Add. * include/std/unordered_map: Add. * include/std/unordered_set: Add. * include/std/c++0x_warning.h: Add. * include/tr1/array: Switch namespaces based on _GLIBCXX_TR1. * include/tr1/boost_shared_ptr.h: Same. * include/tr1/cctype: Same. * include/tr1/cfenv: Same. * include/tr1/cinttypes: Same. * include/tr1/cmath: Same. * include/tr1/common.h: Same. * include/tr1/complex: Same. * include/tr1/cstdint: Same. * include/tr1/cstdio: Same. * include/tr1/cstdlib: Same. * include/tr1/cwchar: Same. * include/tr1/cwctype: Same. * include/tr1/functional: Same. * include/tr1/functional_hash.h: Same. * include/tr1/functional_iterate.h: Same. * include/tr1/hashtable: Same. * include/tr1/hashtable_policy.h: Same. * include/tr1/math.h: Same. * include/tr1/memory: Same. * include/tr1/random: Same. * include/tr1/random.tcc: Same. * include/tr1/ref_fwd.h: Same. * include/tr1/repeat.h: Same. * include/tr1/stdlib.h: Same. * include/tr1/tuple: Same. * include/tr1/tuple_iterate.h: Same. * include/tr1/type_traits: Same. * include/tr1/type_traits_fwd.h: Same. * include/tr1/unordered_map: Same. * include/tr1/unordered_set: Same. * include/tr1/utility: Same. * include/tr1/ccomplex: Add. * include/tr1/complex.h: Add. * include/tr1/regex: Add. * include/Makefile.am: Add C++0x headers, "C" compatibility headers. * include/Makefile.in: Regenerate. * testsuite/tr1/headers.cc: Add in regex/complex. * testsuite/17_intro/headers/c++200x/all.cc: New. * testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc: Same. * testsuite/17_intro/using_namespace_std_tr1_neg.cc: Same. * testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/types_std_c++0x.cc: Same. * testsuite/20_util/enable_shared_from_this/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/headers/functional/types_std_c++0x.cc: Same. * testsuite/20_util/headers/functional/ using_namespace_std_placeholders.cc: Same. * testsuite/20_util/headers/memory/types_std_c++0x.cc: Same. * testsuite/20_util/headers/type_traits/std_c++0x_neg.cc: Same. * testsuite/20_util/headers/type_traits/types_std_c++0x.cc: Same. * testsuite/20_util/shared_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/weak_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/array/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/hash/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/headers/array/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/types_std_c++0x.cc: Same. * testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc: Same. * testsuite/23_containers/tuple/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation.cc: Same. * testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cmath/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/types_std_c++0x.cc: Same. * testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc: Same. * testsuite/27_io/headers/cinttypes/types_std_c++0x.cc: Same. * testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types.cc: Rename ... * testsuite/tr1/8_c_compatibility/cinttypes/types.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types_std_tr1.cc: ...to this. * testsuite/tr1/8_c_compatibility/cinttypes/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc: Same. From-SVN: r122533
2007-03-04 23:59:49 +01:00
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. * configure.host (c_model): Set default to c_global. * configure: Regenerate. * include/Makefile.am (c_compatibility_headers_extra): Make conditional on GLIBCXX_C_HEADERS_COMPATIBILITY. (c_base_headers_extra): Make conditional on GLIBCXX_C_HEADERS_EXTRA. (c_compatibility_headers): Make conditional on c/c_std/c_global. * include/Makefile.in: Regenerate. * docs/html/configopts.html: Add c_global information to --enable-cheaders. Eventually, "c_std" should mean "C" includes that are in namespace std, with optional C++ "C" compatibility includes to inject into global scope. And "c_global" should mean "C" includes that are in the global namespace, with C++ includes injecting into namespace std and no C++ "C" compatibility includes. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * include/bits/c++config: Add _GLIBCXX_NAMEPACE_C. Add _GLIBCXX_NAMESPACE_ASSOCIATION_CXX200x. Add _GLIBCXX_TR1 as namespace macro. Add namespace associations for std::__cxx200x conditionally. * include/c_compatibility/assert.h: Correct doxygen markup, conditionalize the global injections on _GLIBCXX_NAMESPACE_C. * include/c_compatibility/ctype.h: Same. * include/c_compatibility/errno.h: Same. * include/c_compatibility/float.h: Same. * include/c_compatibility/iso646.h: Same. * include/c_compatibility/limits.h: Same. * include/c_compatibility/locale.h: Same. * include/c_compatibility/math.h: Same. * include/c_compatibility/setjmp.h: Same. * include/c_compatibility/signal.h: Same. * include/c_compatibility/stdarg.h: Same. * include/c_compatibility/stddef.h: Same. * include/c_compatibility/stdio.h: Same. * include/c_compatibility/stdlib.h: Same. * include/c_compatibility/string.h: Same. * include/c_compatibility/time.h: Same. * include/c_compatibility/wchar.h: Same. * include/c_compatibility/wctype.h: Same. * include/c_compatibility/complex.h: Add. * include/c_compatibility/fenv.h: Same. * include/c_compatibility/inttypes.h: Same. * include/c_compatibility/stdbool.h: Same. * include/c_compatibility/stdint.h: Same. * include/c_compatibility/tgmath.h: Same. * include/c_global/cassert: Add, use include_next, use C++0x features if -std=c++0x. * include/c_global/cctype: Same. * include/c_global/cerrno: Same. * include/c_global/cfloat: Same. * include/c_global/ciso646: Same. * include/c_global/climits: Same. * include/c_global/clocale: Same. * include/c_global/cmath: Same. * include/c_global/cmath.tcc: Same. * include/c_global/csetjmp: Same. * include/c_global/csignal: Same. * include/c_global/cstdarg: Same. * include/c_global/cstddef: Same. * include/c_global/cstdio: Same. * include/c_global/cstdlib: Same. * include/c_global/cstring: Same. * include/c_global/ctime: Same. * include/c_global/cwchar: Same. * include/c_global/cwctype: Same. * include/c_global/ccomplex: Add. * include/c_global/cfenv: Add. * include/c_global/cinttypes: Add. * include/c_global/cstdbool: Add. * include/c_global/cstdint: Add. * include/c_global/ctgmath: Add. * include/std/algorithm: Use C++0x features if -std=c++0x. * include/std/bitset: Same. * include/std/complex: Same. * include/std/deque: Same. * include/std/fstream: Same. * include/std/functional: Same. * include/std/iomanip: Same. * include/std/ios: Same. * include/std/iosfwd: Same. * include/std/iostream: Same. * include/std/istream: Same. * include/std/iterator: Same. * include/std/limits: Same. * include/std/list: Same. * include/std/locale: Same. * include/std/map: Same. * include/std/memory: Same. * include/std/numeric: Same. * include/std/ostream: Same. * include/std/queue: Same. * include/std/set: Same. * include/std/sstream: Same. * include/std/stack: Same. * include/std/stdexcept: Same. * include/std/streambuf: Same. * include/std/string: Same. * include/std/utility: Same. * include/std/valarray: Same. * include/std/vector: Same. * include/std/array: Add. * include/std/random: Add. * include/std/regex: Add. * include/std/tuple: Add. * include/std/type_traits: Add. * include/std/unordered_map: Add. * include/std/unordered_set: Add. * include/std/c++0x_warning.h: Add. * include/tr1/array: Switch namespaces based on _GLIBCXX_TR1. * include/tr1/boost_shared_ptr.h: Same. * include/tr1/cctype: Same. * include/tr1/cfenv: Same. * include/tr1/cinttypes: Same. * include/tr1/cmath: Same. * include/tr1/common.h: Same. * include/tr1/complex: Same. * include/tr1/cstdint: Same. * include/tr1/cstdio: Same. * include/tr1/cstdlib: Same. * include/tr1/cwchar: Same. * include/tr1/cwctype: Same. * include/tr1/functional: Same. * include/tr1/functional_hash.h: Same. * include/tr1/functional_iterate.h: Same. * include/tr1/hashtable: Same. * include/tr1/hashtable_policy.h: Same. * include/tr1/math.h: Same. * include/tr1/memory: Same. * include/tr1/random: Same. * include/tr1/random.tcc: Same. * include/tr1/ref_fwd.h: Same. * include/tr1/repeat.h: Same. * include/tr1/stdlib.h: Same. * include/tr1/tuple: Same. * include/tr1/tuple_iterate.h: Same. * include/tr1/type_traits: Same. * include/tr1/type_traits_fwd.h: Same. * include/tr1/unordered_map: Same. * include/tr1/unordered_set: Same. * include/tr1/utility: Same. * include/tr1/ccomplex: Add. * include/tr1/complex.h: Add. * include/tr1/regex: Add. * include/Makefile.am: Add C++0x headers, "C" compatibility headers. * include/Makefile.in: Regenerate. * testsuite/tr1/headers.cc: Add in regex/complex. * testsuite/17_intro/headers/c++200x/all.cc: New. * testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc: Same. * testsuite/17_intro/using_namespace_std_tr1_neg.cc: Same. * testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/types_std_c++0x.cc: Same. * testsuite/20_util/enable_shared_from_this/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/headers/functional/types_std_c++0x.cc: Same. * testsuite/20_util/headers/functional/ using_namespace_std_placeholders.cc: Same. * testsuite/20_util/headers/memory/types_std_c++0x.cc: Same. * testsuite/20_util/headers/type_traits/std_c++0x_neg.cc: Same. * testsuite/20_util/headers/type_traits/types_std_c++0x.cc: Same. * testsuite/20_util/shared_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/weak_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/array/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/hash/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/headers/array/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/types_std_c++0x.cc: Same. * testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc: Same. * testsuite/23_containers/tuple/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation.cc: Same. * testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cmath/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/types_std_c++0x.cc: Same. * testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc: Same. * testsuite/27_io/headers/cinttypes/types_std_c++0x.cc: Same. * testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types.cc: Rename ... * testsuite/tr1/8_c_compatibility/cinttypes/types.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types_std_tr1.cc: ...to this. * testsuite/tr1/8_c_compatibility/cinttypes/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc: Same. From-SVN: r122533
2007-03-04 23:59:49 +01:00
/** @file include/tuple
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_TUPLE
#define _GLIBCXX_TUPLE 1
acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. * configure.host (c_model): Set default to c_global. * configure: Regenerate. * include/Makefile.am (c_compatibility_headers_extra): Make conditional on GLIBCXX_C_HEADERS_COMPATIBILITY. (c_base_headers_extra): Make conditional on GLIBCXX_C_HEADERS_EXTRA. (c_compatibility_headers): Make conditional on c/c_std/c_global. * include/Makefile.in: Regenerate. * docs/html/configopts.html: Add c_global information to --enable-cheaders. Eventually, "c_std" should mean "C" includes that are in namespace std, with optional C++ "C" compatibility includes to inject into global scope. And "c_global" should mean "C" includes that are in the global namespace, with C++ includes injecting into namespace std and no C++ "C" compatibility includes. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * include/bits/c++config: Add _GLIBCXX_NAMEPACE_C. Add _GLIBCXX_NAMESPACE_ASSOCIATION_CXX200x. Add _GLIBCXX_TR1 as namespace macro. Add namespace associations for std::__cxx200x conditionally. * include/c_compatibility/assert.h: Correct doxygen markup, conditionalize the global injections on _GLIBCXX_NAMESPACE_C. * include/c_compatibility/ctype.h: Same. * include/c_compatibility/errno.h: Same. * include/c_compatibility/float.h: Same. * include/c_compatibility/iso646.h: Same. * include/c_compatibility/limits.h: Same. * include/c_compatibility/locale.h: Same. * include/c_compatibility/math.h: Same. * include/c_compatibility/setjmp.h: Same. * include/c_compatibility/signal.h: Same. * include/c_compatibility/stdarg.h: Same. * include/c_compatibility/stddef.h: Same. * include/c_compatibility/stdio.h: Same. * include/c_compatibility/stdlib.h: Same. * include/c_compatibility/string.h: Same. * include/c_compatibility/time.h: Same. * include/c_compatibility/wchar.h: Same. * include/c_compatibility/wctype.h: Same. * include/c_compatibility/complex.h: Add. * include/c_compatibility/fenv.h: Same. * include/c_compatibility/inttypes.h: Same. * include/c_compatibility/stdbool.h: Same. * include/c_compatibility/stdint.h: Same. * include/c_compatibility/tgmath.h: Same. * include/c_global/cassert: Add, use include_next, use C++0x features if -std=c++0x. * include/c_global/cctype: Same. * include/c_global/cerrno: Same. * include/c_global/cfloat: Same. * include/c_global/ciso646: Same. * include/c_global/climits: Same. * include/c_global/clocale: Same. * include/c_global/cmath: Same. * include/c_global/cmath.tcc: Same. * include/c_global/csetjmp: Same. * include/c_global/csignal: Same. * include/c_global/cstdarg: Same. * include/c_global/cstddef: Same. * include/c_global/cstdio: Same. * include/c_global/cstdlib: Same. * include/c_global/cstring: Same. * include/c_global/ctime: Same. * include/c_global/cwchar: Same. * include/c_global/cwctype: Same. * include/c_global/ccomplex: Add. * include/c_global/cfenv: Add. * include/c_global/cinttypes: Add. * include/c_global/cstdbool: Add. * include/c_global/cstdint: Add. * include/c_global/ctgmath: Add. * include/std/algorithm: Use C++0x features if -std=c++0x. * include/std/bitset: Same. * include/std/complex: Same. * include/std/deque: Same. * include/std/fstream: Same. * include/std/functional: Same. * include/std/iomanip: Same. * include/std/ios: Same. * include/std/iosfwd: Same. * include/std/iostream: Same. * include/std/istream: Same. * include/std/iterator: Same. * include/std/limits: Same. * include/std/list: Same. * include/std/locale: Same. * include/std/map: Same. * include/std/memory: Same. * include/std/numeric: Same. * include/std/ostream: Same. * include/std/queue: Same. * include/std/set: Same. * include/std/sstream: Same. * include/std/stack: Same. * include/std/stdexcept: Same. * include/std/streambuf: Same. * include/std/string: Same. * include/std/utility: Same. * include/std/valarray: Same. * include/std/vector: Same. * include/std/array: Add. * include/std/random: Add. * include/std/regex: Add. * include/std/tuple: Add. * include/std/type_traits: Add. * include/std/unordered_map: Add. * include/std/unordered_set: Add. * include/std/c++0x_warning.h: Add. * include/tr1/array: Switch namespaces based on _GLIBCXX_TR1. * include/tr1/boost_shared_ptr.h: Same. * include/tr1/cctype: Same. * include/tr1/cfenv: Same. * include/tr1/cinttypes: Same. * include/tr1/cmath: Same. * include/tr1/common.h: Same. * include/tr1/complex: Same. * include/tr1/cstdint: Same. * include/tr1/cstdio: Same. * include/tr1/cstdlib: Same. * include/tr1/cwchar: Same. * include/tr1/cwctype: Same. * include/tr1/functional: Same. * include/tr1/functional_hash.h: Same. * include/tr1/functional_iterate.h: Same. * include/tr1/hashtable: Same. * include/tr1/hashtable_policy.h: Same. * include/tr1/math.h: Same. * include/tr1/memory: Same. * include/tr1/random: Same. * include/tr1/random.tcc: Same. * include/tr1/ref_fwd.h: Same. * include/tr1/repeat.h: Same. * include/tr1/stdlib.h: Same. * include/tr1/tuple: Same. * include/tr1/tuple_iterate.h: Same. * include/tr1/type_traits: Same. * include/tr1/type_traits_fwd.h: Same. * include/tr1/unordered_map: Same. * include/tr1/unordered_set: Same. * include/tr1/utility: Same. * include/tr1/ccomplex: Add. * include/tr1/complex.h: Add. * include/tr1/regex: Add. * include/Makefile.am: Add C++0x headers, "C" compatibility headers. * include/Makefile.in: Regenerate. * testsuite/tr1/headers.cc: Add in regex/complex. * testsuite/17_intro/headers/c++200x/all.cc: New. * testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc: Same. * testsuite/17_intro/using_namespace_std_tr1_neg.cc: Same. * testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/types_std_c++0x.cc: Same. * testsuite/20_util/enable_shared_from_this/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/headers/functional/types_std_c++0x.cc: Same. * testsuite/20_util/headers/functional/ using_namespace_std_placeholders.cc: Same. * testsuite/20_util/headers/memory/types_std_c++0x.cc: Same. * testsuite/20_util/headers/type_traits/std_c++0x_neg.cc: Same. * testsuite/20_util/headers/type_traits/types_std_c++0x.cc: Same. * testsuite/20_util/shared_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/weak_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/array/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/hash/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/headers/array/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/types_std_c++0x.cc: Same. * testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc: Same. * testsuite/23_containers/tuple/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation.cc: Same. * testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cmath/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/types_std_c++0x.cc: Same. * testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc: Same. * testsuite/27_io/headers/cinttypes/types_std_c++0x.cc: Same. * testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types.cc: Rename ... * testsuite/tr1/8_c_compatibility/cinttypes/types.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types_std_tr1.cc: ...to this. * testsuite/tr1/8_c_compatibility/cinttypes/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc: Same. From-SVN: r122533
2007-03-04 23:59:49 +01:00
#pragma GCC system_header
#if __cplusplus < 201103L
hashtable.h: Fold in include/tr1_impl/hashtable.h contents. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/tr1/hashtable.h: Fold in include/tr1_impl/hashtable.h contents. * include/tr1_impl/hashtable.h: Remove. * include/tr1_impl/hashtable_policy.h: Move and rename... * include/tr1/hashtable_policy.h: ... here. * include/tr1_impl/unordered_map: Move and rename... * include/tr1/unordered_map.h: ... here. * include/tr1_impl/unordered_set: Move and rename... * include/tr1/unordered_set.h: ... here. * include/tr1_impl/unordered_map: Move and rename... * include/tr1/unordered_map.h: ... here. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/std/c++0x_warning.h: Move... * include/bits/c++0x_warning.h: ... here. * include/debug/unordered_map: Adjust. * include/debug/unordered_set: Likewise. * include/std/tuple: Likewise. * include/std/system_error: Likewise. * include/std/forward_list: Likewise. * include/std/thread: Likewise. * include/std/type_traits: Likewise. * include/std/future: Likewise. * include/std/regex: Likewise. * include/std/atomic: Likewise. * include/std/ratio: Likewise. * include/std/random: Likewise. * include/std/unordered_map: Likewise. * include/std/chrono: Likewise.: Likewise. * include/std/condition_variable: Likewise. * include/std/mutex: Likewise. * include/std/unordered_set: Likewise. * include/std/array: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * include/c_global/cinttypes: Likewise. * include/c_global/ctgmath: Likewise. * include/c_global/cfenv: Likewise. * include/c_global/cstdint: Likewise. * include/c_global/cstdbool: Likewise. * include/c_global/ccomplex: Likewise. * include/bits/shared_ptr.h: Do not include <bits/c++0x_warning.h> at all, the file is not meant to be included by the users. * include/bits/functional_hash.h: Likewise. * include/bits/unique_ptr.h: Likewise. * include/bits/forward_list.h: Likewise. * testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust dg-* line numbers. * testsuite/29_atomics/atomic/cons/copy_neg.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ assign_neg.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/20_util/unique_ptr/modifiers/reset_neg.cc: Likewise. * testsuite/20_util/unique_ptr/assign/assign_neg.cc: Likewise. From-SVN: r156667
2010-02-10 20:14:33 +01:00
# include <bits/c++0x_warning.h>
#else
acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. * configure.host (c_model): Set default to c_global. * configure: Regenerate. * include/Makefile.am (c_compatibility_headers_extra): Make conditional on GLIBCXX_C_HEADERS_COMPATIBILITY. (c_base_headers_extra): Make conditional on GLIBCXX_C_HEADERS_EXTRA. (c_compatibility_headers): Make conditional on c/c_std/c_global. * include/Makefile.in: Regenerate. * docs/html/configopts.html: Add c_global information to --enable-cheaders. Eventually, "c_std" should mean "C" includes that are in namespace std, with optional C++ "C" compatibility includes to inject into global scope. And "c_global" should mean "C" includes that are in the global namespace, with C++ includes injecting into namespace std and no C++ "C" compatibility includes. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * include/bits/c++config: Add _GLIBCXX_NAMEPACE_C. Add _GLIBCXX_NAMESPACE_ASSOCIATION_CXX200x. Add _GLIBCXX_TR1 as namespace macro. Add namespace associations for std::__cxx200x conditionally. * include/c_compatibility/assert.h: Correct doxygen markup, conditionalize the global injections on _GLIBCXX_NAMESPACE_C. * include/c_compatibility/ctype.h: Same. * include/c_compatibility/errno.h: Same. * include/c_compatibility/float.h: Same. * include/c_compatibility/iso646.h: Same. * include/c_compatibility/limits.h: Same. * include/c_compatibility/locale.h: Same. * include/c_compatibility/math.h: Same. * include/c_compatibility/setjmp.h: Same. * include/c_compatibility/signal.h: Same. * include/c_compatibility/stdarg.h: Same. * include/c_compatibility/stddef.h: Same. * include/c_compatibility/stdio.h: Same. * include/c_compatibility/stdlib.h: Same. * include/c_compatibility/string.h: Same. * include/c_compatibility/time.h: Same. * include/c_compatibility/wchar.h: Same. * include/c_compatibility/wctype.h: Same. * include/c_compatibility/complex.h: Add. * include/c_compatibility/fenv.h: Same. * include/c_compatibility/inttypes.h: Same. * include/c_compatibility/stdbool.h: Same. * include/c_compatibility/stdint.h: Same. * include/c_compatibility/tgmath.h: Same. * include/c_global/cassert: Add, use include_next, use C++0x features if -std=c++0x. * include/c_global/cctype: Same. * include/c_global/cerrno: Same. * include/c_global/cfloat: Same. * include/c_global/ciso646: Same. * include/c_global/climits: Same. * include/c_global/clocale: Same. * include/c_global/cmath: Same. * include/c_global/cmath.tcc: Same. * include/c_global/csetjmp: Same. * include/c_global/csignal: Same. * include/c_global/cstdarg: Same. * include/c_global/cstddef: Same. * include/c_global/cstdio: Same. * include/c_global/cstdlib: Same. * include/c_global/cstring: Same. * include/c_global/ctime: Same. * include/c_global/cwchar: Same. * include/c_global/cwctype: Same. * include/c_global/ccomplex: Add. * include/c_global/cfenv: Add. * include/c_global/cinttypes: Add. * include/c_global/cstdbool: Add. * include/c_global/cstdint: Add. * include/c_global/ctgmath: Add. * include/std/algorithm: Use C++0x features if -std=c++0x. * include/std/bitset: Same. * include/std/complex: Same. * include/std/deque: Same. * include/std/fstream: Same. * include/std/functional: Same. * include/std/iomanip: Same. * include/std/ios: Same. * include/std/iosfwd: Same. * include/std/iostream: Same. * include/std/istream: Same. * include/std/iterator: Same. * include/std/limits: Same. * include/std/list: Same. * include/std/locale: Same. * include/std/map: Same. * include/std/memory: Same. * include/std/numeric: Same. * include/std/ostream: Same. * include/std/queue: Same. * include/std/set: Same. * include/std/sstream: Same. * include/std/stack: Same. * include/std/stdexcept: Same. * include/std/streambuf: Same. * include/std/string: Same. * include/std/utility: Same. * include/std/valarray: Same. * include/std/vector: Same. * include/std/array: Add. * include/std/random: Add. * include/std/regex: Add. * include/std/tuple: Add. * include/std/type_traits: Add. * include/std/unordered_map: Add. * include/std/unordered_set: Add. * include/std/c++0x_warning.h: Add. * include/tr1/array: Switch namespaces based on _GLIBCXX_TR1. * include/tr1/boost_shared_ptr.h: Same. * include/tr1/cctype: Same. * include/tr1/cfenv: Same. * include/tr1/cinttypes: Same. * include/tr1/cmath: Same. * include/tr1/common.h: Same. * include/tr1/complex: Same. * include/tr1/cstdint: Same. * include/tr1/cstdio: Same. * include/tr1/cstdlib: Same. * include/tr1/cwchar: Same. * include/tr1/cwctype: Same. * include/tr1/functional: Same. * include/tr1/functional_hash.h: Same. * include/tr1/functional_iterate.h: Same. * include/tr1/hashtable: Same. * include/tr1/hashtable_policy.h: Same. * include/tr1/math.h: Same. * include/tr1/memory: Same. * include/tr1/random: Same. * include/tr1/random.tcc: Same. * include/tr1/ref_fwd.h: Same. * include/tr1/repeat.h: Same. * include/tr1/stdlib.h: Same. * include/tr1/tuple: Same. * include/tr1/tuple_iterate.h: Same. * include/tr1/type_traits: Same. * include/tr1/type_traits_fwd.h: Same. * include/tr1/unordered_map: Same. * include/tr1/unordered_set: Same. * include/tr1/utility: Same. * include/tr1/ccomplex: Add. * include/tr1/complex.h: Add. * include/tr1/regex: Add. * include/Makefile.am: Add C++0x headers, "C" compatibility headers. * include/Makefile.in: Regenerate. * testsuite/tr1/headers.cc: Add in regex/complex. * testsuite/17_intro/headers/c++200x/all.cc: New. * testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc: Same. * testsuite/17_intro/using_namespace_std_tr1_neg.cc: Same. * testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/types_std_c++0x.cc: Same. * testsuite/20_util/enable_shared_from_this/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/headers/functional/types_std_c++0x.cc: Same. * testsuite/20_util/headers/functional/ using_namespace_std_placeholders.cc: Same. * testsuite/20_util/headers/memory/types_std_c++0x.cc: Same. * testsuite/20_util/headers/type_traits/std_c++0x_neg.cc: Same. * testsuite/20_util/headers/type_traits/types_std_c++0x.cc: Same. * testsuite/20_util/shared_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/weak_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/array/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/hash/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/headers/array/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/types_std_c++0x.cc: Same. * testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc: Same. * testsuite/23_containers/tuple/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation.cc: Same. * testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cmath/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/types_std_c++0x.cc: Same. * testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc: Same. * testsuite/27_io/headers/cinttypes/types_std_c++0x.cc: Same. * testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types.cc: Rename ... * testsuite/tr1/8_c_compatibility/cinttypes/types.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types_std_tr1.cc: ...to this. * testsuite/tr1/8_c_compatibility/cinttypes/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc: Same. From-SVN: r122533
2007-03-04 23:59:49 +01:00
re PR libstdc++/31426 (TR1 includes do not work with -std=c++0x) 2007-05-31 Paolo Carlini <pcarlini@suse.de> PR libstdc++/31426 * include/bits/c++config: Remove namespace association bits from tr1 to std. * include/ext/type_traits.h (__promote, __promote2, __promote3, __promote4): Add. * include/bits/hashtable.h: New. * include/bits/functional_hash.h: Likewise. * include/tr1/hashtable.h: Likewise. * include/tr1_impl/random: New. * include/tr1_impl/cinttypes: Likewise. * include/tr1_impl/cstdlib: Likewise. * include/tr1_impl/unordered_map: Likewise. * include/tr1_impl/cstdio: Likewise. * include/tr1_impl/boost_shared_ptr.h: Likewise. * include/tr1_impl/cctype: Likewise. * include/tr1_impl/random.tcc: Likewise. * include/tr1_impl/tuple: Likewise. * include/tr1_impl/functional_hash.h: Likewise. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/cmath: Likewise. * include/tr1_impl/type_traitsfwd.h: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/cfenv: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/tr1_impl/functional: Likewise. * include/tr1_impl/utility: Likewise. * include/tr1_impl/complex: Likewise. * include/tr1_impl/type_traits: Likewise. * include/tr1_impl/cwchar: Likewise. * include/tr1_impl/cstdint: Likewise. * include/tr1_impl/regex: Likewise. * include/tr1_impl/array: Likewise. * include/tr1_impl/cwctype: Likewise. * include/tr1/type_traitsfwd.h: Remove. * include/tr1/boost_shared_ptr.h: Likewise. * include/tr1/common.h: Likewise. * include/tr1/hashtable: Likewise. * include/tr1/hashtable_policy.h: Likewise. * include/tr1/random.tcc: Likewise. * include/c_global/cinttypes: Include tr1_impl/cinttypes. * include/c_global/cstdlib: Likewise for cstdlib. * include/c_global/cstdio: Likewise for cstdio. * include/c_global/cctype: Likewise for cctype. * include/c_global/cmath: Likewise for cmath. * include/c_global/cfenv: Likewise for cfenv. * include/c_global/cwchar: Likewise for cwchar. * include/c_global/cstdint: Likewise for cstdint. * include/c_global/cwctype: Likewise for cwctype. * include/tr1/cinttypes: Likewise for cinttypes. * include/tr1/cstdlib: Likewise for cstdlib. * include/tr1/cstdio: Likewise for cstdio. * include/tr1/cctype: Likewise for cctype. * include/tr1/cmath: Likewise for cmath. * include/tr1/cfenv: Likewise for cfenv. * include/tr1/cwchar: Likewise for cwchar. * include/tr1/cstdint: Likewise for cstdint. * include/tr1/cwctype: Likewise for cwctype. * include/tr1/functional_hash.h: Likewise for functional_hash. * include/std/tuple: Include tr1_impl/tuple. * include/std/utility: Likewise for utility. * include/std/type_traits: Likewise for type_traits. (is_pod): Just forward to __is_pod. (has_trivial_default_constructor): Just forward to __has_trivial_constructor. (has_trivial_copy_constructor): Just forward to __has_trivial_copy. (has_trivial_assign): Just forward to __has_trivial_assign. (has_trivial_destructor): Just forward to __has_trivial_destructor. (has_nothrow_default_constructor): Just forward to __has_nothrow_constructor. (has_nothrow_copy_constructor): Just forward to __has_nothrow_copy. (has_nothrow_assign): Just forward to __has_nothrow_assign. (is_base_of): Just forward to __is_base_of. (is_signed, is_unsigned): Implement according to the C++0x specifications. * include/std/memory: Likewise for memory. * include/std/regex: Likewise for regex. * include/std/random: Likewise for random. * include/std/unordered_map: Likewise for unordered_map. * include/std/unordered_set: Likewise for unordered_set. * include/std/functional: Likewise for functional. * include/std/complex: Likewise for complex. * include/std/array: Likewise for array. * include/tr1/tuple: Likewise for tuple. * include/tr1/utility: Likewise for utility. * include/tr1/type_traits: Likewise for type_traits * include/tr1/memory: Likewise for memory. * include/tr1/regex: Likewise for regex. * include/tr1/random: Likewise for random. * include/tr1/unordered_map: Likewise for unordered_map. * include/tr1/unordered_set: Likewise for unordered_set. * include/tr1/functional: Likewise for functional. * include/tr1/complex: Likewise for complex. * include/tr1/array: Likewise for array. * include/c_global/ctgmath: Tweak. * include/c_global/cstdarg: Likewise. * include/c_global/ctime: Likewise. * include/c_global/climits: Likewise. * include/c_global/cfloat: Likewise. * include/c_global/ccomplex: Likewise. * include/c_global/cstdbool: Likewise. * include/tr1/poly_laguerre.tcc: Tweak, don't use _GLIBCXX_TR1. * include/tr1/riemann_zeta.tcc: Likewise. * include/tr1/beta_function.tcc: Likewise. * include/tr1/exp_integral.tcc: Likewise. * include/tr1/hypergeometric.tcc: Likewise. * include/tr1/modified_bessel_func.tcc: Likewise. * include/tr1/legendre_function.tcc: Likewise. * include/tr1/special_function_util.h: Likewise. * include/tr1/bessel_function.tcc: Likewise. * include/tr1/poly_hermite.tcc: Likewise. * include/tr1/ell_integral.tcc: Likewise. * include/tr1/gamma.tcc: Likewise. * include/tr1/stdlib.h: Likewise. * include/tr1/math.h: Likewise. * include/tr1/complex.h: Minor tweaks. * include/tr1/wctype.h: Likewise. * include/tr1/wchar.h: Likewise. * include/tr1/inttypes.h: Likewise. * include/tr1/tgmath.h: Likewise. * include/tr1/cstdbool: Likewise. * include/tr1/cfloat: Likewise. * include/tr1/ccomplex: Likewise. * include/tr1/ctime: Likewise. * include/tr1/climits: Likewise. * include/tr1/ctgmath: Likewise. * include/tr1/cstdarg: Likewise. * testsuite/tr1/headers.cc: Move... * testsuite/tr1/headers/all.cc: ... here. * testsuite/tr1/using_namespace_std_tr1.cc: Move... * testsuite/tr1/headers/c++200x/using_namespace_std_tr1.cc: ... here. * testsuite/tr1/headers/using_namespace_std_tr1.cc ... here. * testsuite/tr1/headers/c++200x/using_namespace_std_tr1.cc: New. * testsuite/20_util/tuple/requirements/explicit_instantiation.cc: Adjust namespace. * testsuite/20_util/has_nothrow_copy_constructor/value.cc: Adjust to the C++0x requirements. * testsuite/20_util/has_nothrow_default_constructor/value.cc: Likewise. * testsuite/20_util/has_trivial_copy_constructor/value.cc: Likewise. * testsuite/20_util/has_trivial_default_constructor/value.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust dg-error lines. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc: Un-xfail. * testsuite/20_util/is_signed/value.cc: New. * testsuite/20_util/is_signed/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_signed/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_unsigned/value.cc: Likewise.. * testsuite/20_util/is_unsigned/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_unsigned/requirements/explicit_instantiation.cc: Likewise. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. From-SVN: r125244
2007-06-01 01:37:56 +02:00
#include <utility>
#include <array>
#include <bits/uses_allocator.h>
#include <bits/invoke.h>
re PR libstdc++/31426 (TR1 includes do not work with -std=c++0x) 2007-05-31 Paolo Carlini <pcarlini@suse.de> PR libstdc++/31426 * include/bits/c++config: Remove namespace association bits from tr1 to std. * include/ext/type_traits.h (__promote, __promote2, __promote3, __promote4): Add. * include/bits/hashtable.h: New. * include/bits/functional_hash.h: Likewise. * include/tr1/hashtable.h: Likewise. * include/tr1_impl/random: New. * include/tr1_impl/cinttypes: Likewise. * include/tr1_impl/cstdlib: Likewise. * include/tr1_impl/unordered_map: Likewise. * include/tr1_impl/cstdio: Likewise. * include/tr1_impl/boost_shared_ptr.h: Likewise. * include/tr1_impl/cctype: Likewise. * include/tr1_impl/random.tcc: Likewise. * include/tr1_impl/tuple: Likewise. * include/tr1_impl/functional_hash.h: Likewise. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/cmath: Likewise. * include/tr1_impl/type_traitsfwd.h: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/cfenv: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/tr1_impl/functional: Likewise. * include/tr1_impl/utility: Likewise. * include/tr1_impl/complex: Likewise. * include/tr1_impl/type_traits: Likewise. * include/tr1_impl/cwchar: Likewise. * include/tr1_impl/cstdint: Likewise. * include/tr1_impl/regex: Likewise. * include/tr1_impl/array: Likewise. * include/tr1_impl/cwctype: Likewise. * include/tr1/type_traitsfwd.h: Remove. * include/tr1/boost_shared_ptr.h: Likewise. * include/tr1/common.h: Likewise. * include/tr1/hashtable: Likewise. * include/tr1/hashtable_policy.h: Likewise. * include/tr1/random.tcc: Likewise. * include/c_global/cinttypes: Include tr1_impl/cinttypes. * include/c_global/cstdlib: Likewise for cstdlib. * include/c_global/cstdio: Likewise for cstdio. * include/c_global/cctype: Likewise for cctype. * include/c_global/cmath: Likewise for cmath. * include/c_global/cfenv: Likewise for cfenv. * include/c_global/cwchar: Likewise for cwchar. * include/c_global/cstdint: Likewise for cstdint. * include/c_global/cwctype: Likewise for cwctype. * include/tr1/cinttypes: Likewise for cinttypes. * include/tr1/cstdlib: Likewise for cstdlib. * include/tr1/cstdio: Likewise for cstdio. * include/tr1/cctype: Likewise for cctype. * include/tr1/cmath: Likewise for cmath. * include/tr1/cfenv: Likewise for cfenv. * include/tr1/cwchar: Likewise for cwchar. * include/tr1/cstdint: Likewise for cstdint. * include/tr1/cwctype: Likewise for cwctype. * include/tr1/functional_hash.h: Likewise for functional_hash. * include/std/tuple: Include tr1_impl/tuple. * include/std/utility: Likewise for utility. * include/std/type_traits: Likewise for type_traits. (is_pod): Just forward to __is_pod. (has_trivial_default_constructor): Just forward to __has_trivial_constructor. (has_trivial_copy_constructor): Just forward to __has_trivial_copy. (has_trivial_assign): Just forward to __has_trivial_assign. (has_trivial_destructor): Just forward to __has_trivial_destructor. (has_nothrow_default_constructor): Just forward to __has_nothrow_constructor. (has_nothrow_copy_constructor): Just forward to __has_nothrow_copy. (has_nothrow_assign): Just forward to __has_nothrow_assign. (is_base_of): Just forward to __is_base_of. (is_signed, is_unsigned): Implement according to the C++0x specifications. * include/std/memory: Likewise for memory. * include/std/regex: Likewise for regex. * include/std/random: Likewise for random. * include/std/unordered_map: Likewise for unordered_map. * include/std/unordered_set: Likewise for unordered_set. * include/std/functional: Likewise for functional. * include/std/complex: Likewise for complex. * include/std/array: Likewise for array. * include/tr1/tuple: Likewise for tuple. * include/tr1/utility: Likewise for utility. * include/tr1/type_traits: Likewise for type_traits * include/tr1/memory: Likewise for memory. * include/tr1/regex: Likewise for regex. * include/tr1/random: Likewise for random. * include/tr1/unordered_map: Likewise for unordered_map. * include/tr1/unordered_set: Likewise for unordered_set. * include/tr1/functional: Likewise for functional. * include/tr1/complex: Likewise for complex. * include/tr1/array: Likewise for array. * include/c_global/ctgmath: Tweak. * include/c_global/cstdarg: Likewise. * include/c_global/ctime: Likewise. * include/c_global/climits: Likewise. * include/c_global/cfloat: Likewise. * include/c_global/ccomplex: Likewise. * include/c_global/cstdbool: Likewise. * include/tr1/poly_laguerre.tcc: Tweak, don't use _GLIBCXX_TR1. * include/tr1/riemann_zeta.tcc: Likewise. * include/tr1/beta_function.tcc: Likewise. * include/tr1/exp_integral.tcc: Likewise. * include/tr1/hypergeometric.tcc: Likewise. * include/tr1/modified_bessel_func.tcc: Likewise. * include/tr1/legendre_function.tcc: Likewise. * include/tr1/special_function_util.h: Likewise. * include/tr1/bessel_function.tcc: Likewise. * include/tr1/poly_hermite.tcc: Likewise. * include/tr1/ell_integral.tcc: Likewise. * include/tr1/gamma.tcc: Likewise. * include/tr1/stdlib.h: Likewise. * include/tr1/math.h: Likewise. * include/tr1/complex.h: Minor tweaks. * include/tr1/wctype.h: Likewise. * include/tr1/wchar.h: Likewise. * include/tr1/inttypes.h: Likewise. * include/tr1/tgmath.h: Likewise. * include/tr1/cstdbool: Likewise. * include/tr1/cfloat: Likewise. * include/tr1/ccomplex: Likewise. * include/tr1/ctime: Likewise. * include/tr1/climits: Likewise. * include/tr1/ctgmath: Likewise. * include/tr1/cstdarg: Likewise. * testsuite/tr1/headers.cc: Move... * testsuite/tr1/headers/all.cc: ... here. * testsuite/tr1/using_namespace_std_tr1.cc: Move... * testsuite/tr1/headers/c++200x/using_namespace_std_tr1.cc: ... here. * testsuite/tr1/headers/using_namespace_std_tr1.cc ... here. * testsuite/tr1/headers/c++200x/using_namespace_std_tr1.cc: New. * testsuite/20_util/tuple/requirements/explicit_instantiation.cc: Adjust namespace. * testsuite/20_util/has_nothrow_copy_constructor/value.cc: Adjust to the C++0x requirements. * testsuite/20_util/has_nothrow_default_constructor/value.cc: Likewise. * testsuite/20_util/has_trivial_copy_constructor/value.cc: Likewise. * testsuite/20_util/has_trivial_default_constructor/value.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust dg-error lines. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc: Un-xfail. * testsuite/20_util/is_signed/value.cc: New. * testsuite/20_util/is_signed/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_signed/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_unsigned/value.cc: Likewise.. * testsuite/20_util/is_unsigned/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_unsigned/requirements/explicit_instantiation.cc: Likewise. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. From-SVN: r125244
2007-06-01 01:37:56 +02:00
PR libstdc++/36104 part four 2011-01-30 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 part four * include/bits/c++config (_GLIBCXX_STD): Remove. (_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C. (_GLIBCXX_P): Now _GLIBCXX_STD_A. (_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL, _GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove. (_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL, _GLIBCXX_INLINE_PROFILE): Remove. (_GLIBCXX_BEGIN_NAMESPACE(X)): Remove. (_GLIBCXX_END_NAMESPACE): Remove. (_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove. (_GLIBCXX_END_NESTED_NAMESPACE): Remove. (_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add. (_GLIBCXX_END_NAMESPACE_ALGO): Add. (_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add. (_GLIBCXX_END_NAMESPACE_CONTAINER): Add. (_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add. (_GLIBCXX_END_NAMESPACE_VERSION): Add. (_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL. (_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL. (_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY. * include/*: Use new macros for namespace scope. * config/*: Same. * src/*: Same. * src/Makefile.am (sources): Remove debug_list.cc, add compatibility-debug_list-2.cc. (parallel_sources): Remove parallel_list.cc, add compatibility-parallel_list-2.cc. (compatibility-parallel_list-2.[o,lo]): New rule. * src/Makefile.in: Regenerate. * src/debug_list.cc: Remove. * src/parallel_list.cc: Remove. * src/compatibility-list-2.cc: New. * src/compatibility-debug_list-2.cc: New. * src/compatibility-parallel_list-2.cc: New. * doc/doxygen/user.cfg.in: Adjust macros. * testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros. * testsuite/20_util/declval/requirements/1_neg.cc: Same. * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same. * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same. * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same. * testsuite/20_util/forward/c_neg.cc: Same. * testsuite/20_util/forward/f_neg.cc: Same. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same. * testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same. * testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same. * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same. * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same. * testsuite/23_containers/deque/requirements/dr438/ constructor_1_neg.cc: Same. * testsuite/23_containers/deque/requirements/dr438/ constructor_2_neg.cc: Same. * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same. * testsuite/23_containers/forward_list/capacity/1.cc: Same. * testsuite/23_containers/forward_list/requirements/dr438/ assign_neg.cc: Same. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_1_neg.cc: Same. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_2_neg.cc: Same. * testsuite/23_containers/forward_list/requirements/dr438/ insert_neg.cc: Same. * testsuite/23_containers/list/capacity/29134.cc: Same. * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same. * testsuite/23_containers/list/requirements/dr438/ constructor_1_neg.cc: Same. * testsuite/23_containers/list/requirements/dr438/ constructor_2_neg.cc: Same. * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same. * testsuite/23_containers/vector/bool/capacity/29134.cc: Same. * testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Same. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Same. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same. * testsuite/25_algorithms/sort/35588.cc: Same. * testsuite/27_io/ios_base/cons/assign_neg.cc: Same. * testsuite/27_io/ios_base/cons/copy_neg.cc: Same. * testsuite/ext/profile/mutex_extensions_neg.cc: Same. * testsuite/ext/profile/profiler_algos.cc: Same. * testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same. * testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same. * testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same. * testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same. * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same. From-SVN: r169421
2011-01-30 23:39:36 +01:00
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
cinttypes: Remove, move contents to C++0x and TR1 headers. 2010-11-02 Paolo Carlini <paolo.carlini@oracle.com> * include/tr1_impl/cinttypes: Remove, move contents to C++0x and TR1 headers. * include/tr1_impl/cstdlib: Likewise. * include/tr1_impl/cstdio: Likewise. * include/tr1_impl/cctype: Likewise. * include/tr1_impl/boost_sp_counted_base.h: Likewise. * include/tr1_impl/cmath: Likewise. * include/tr1_impl/cfenv: Likewise. * include/tr1_impl/utility: Likewise. * include/tr1_impl/complex: Likewise. * include/tr1_impl/cwchar: Likewise. * include/tr1_impl/type_traits: Likewise. * include/tr1_impl/cstdint: Likewise. * include/tr1_impl/regex: Likewise. * include/tr1_impl/array: Likewise. * include/tr1_impl/cwctype: Likewise. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * src/condition_variable.cc: Adjust; consistently use _GLIBCXX_BEGIN_NAMESPACE and _GLIBCXX_END_NAMESPACE. * src/mutex.cc: Likewise. * src/future.cc: Likewise. * src/atomic.cc: Likewise. * src/chrono.cc: Likewise. * src/thread.cc: Likewise. * include/std/tuple: Likewise. * include/std/utility: Likewise. * include/std/thread: Likewise.: Likewise. * include/std/type_traits: Likewise. * include/std/memory: Likewise. * include/std/future: Likewise. * include/std/ratio: Likewise. * include/std/chrono: Likewise. * include/std/condition_variable: Likewise. * include/std/mutex: Likewise. * include/std/functional: Likewise. * include/std/complex: Likewise. * include/std/typeindex: Likewise. * include/std/array: Likewise. * include/bits/regex_compiler.h: Likewise. * include/bits/regex_grep_matcher.tcc: Likewise. * include/bits/regex_grep_matcher.h: Likewise. * include/bits/regex_constants.h: Likewise. * include/bits/regex_cursor.h: Likewise. * include/bits/regex_nfa.tcc: Likewise. * include/bits/shared_ptr_base.h: Likewise. * include/bits/regex_nfa.h: Likewise. * include/bits/random.tcc: Likewise. * include/bits/regex.h: Likewise. * include/bits/random.h: Likewise. * include/bits/regex_error.h: Likewise. * include/c_global/cinttypes: Likewise. * include/c_global/cstdlib: Likewise. * include/c_global/cstdio: Likewise. * include/c_global/cctype: Likewise. * include/c_global/cmath: Likewise. * include/c_global/cfenv: Likewise. * include/c_global/cwchar: Likewise. * include/c_global/cstdint: Likewise. * include/c_global/cwctype: Likewise. * include/tr1/shared_ptr.h: Likewise. * include/tr1/cinttypes: Likewise. * include/tr1/cstdio: Likewise. * include/tr1/cfenv: Likewise. * include/tr1/utility: Likewise. * include/tr1/cwchar: Likewise. * include/tr1/type_traits: Likewise. * include/tr1/memory: Likewise. * include/tr1/cstdint: Likewise. * include/tr1/regex: Likewise. * include/tr1/cwctype: Likewise. * include/tr1/cstdlib: Likewise. * include/tr1/cctype: Likewise. * include/tr1/cmath: Likewise. * include/tr1/complex: Likewise. * include/tr1/array: Likewise. * include/c_compatibility/fenv.h: Likewise. * include/c_compatibility/stdint.h: Likewise. * include/c_compatibility/inttypes.h: Likewise. * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc: Adjust dg-error line numbers. * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise. * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise. * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/make_unsigned/requirements/ typedefs_neg.cc: Likewise. * testsuite/20_util/declval/requirements/1_neg.cc: Likewise. * testsuite/20_util/shared_ptr/cons/43820.cc: Likewise. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise. From-SVN: r166211
2010-11-02 19:51:23 +01:00
/**
* @addtogroup utilities
* @{
*/
template<typename... _Elements>
class tuple;
template<typename _Tp>
struct __is_empty_non_tuple : is_empty<_Tp> { };
// Using EBO for elements that are tuples causes ambiguous base errors.
template<typename _El0, typename... _El>
struct __is_empty_non_tuple<tuple<_El0, _El...>> : false_type { };
// Use the Empty Base-class Optimization for empty, non-final types.
template<typename _Tp>
using __empty_not_final
= typename conditional<__is_final(_Tp), false_type,
__is_empty_non_tuple<_Tp>>::type;
template<std::size_t _Idx, typename _Head,
bool = __empty_not_final<_Head>::value>
struct _Head_base;
template<std::size_t _Idx, typename _Head>
struct _Head_base<_Idx, _Head, true>
: public _Head
{
constexpr _Head_base()
: _Head() { }
constexpr _Head_base(const _Head& __h)
: _Head(__h) { }
constexpr _Head_base(const _Head_base&) = default;
constexpr _Head_base(_Head_base&&) = default;
template<typename _UHead>
constexpr _Head_base(_UHead&& __h)
: _Head(std::forward<_UHead>(__h)) { }
_Head_base(allocator_arg_t, __uses_alloc0)
: _Head() { }
template<typename _Alloc>
_Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a)
: _Head(allocator_arg, *__a._M_a) { }
template<typename _Alloc>
_Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a)
: _Head(*__a._M_a) { }
template<typename _UHead>
_Head_base(__uses_alloc0, _UHead&& __uhead)
: _Head(std::forward<_UHead>(__uhead)) { }
template<typename _Alloc, typename _UHead>
_Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead)
: _Head(allocator_arg, *__a._M_a, std::forward<_UHead>(__uhead)) { }
template<typename _Alloc, typename _UHead>
_Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead)
: _Head(std::forward<_UHead>(__uhead), *__a._M_a) { }
static constexpr _Head&
_M_head(_Head_base& __b) noexcept { return __b; }
static constexpr const _Head&
_M_head(const _Head_base& __b) noexcept { return __b; }
};
template<std::size_t _Idx, typename _Head>
struct _Head_base<_Idx, _Head, false>
{
constexpr _Head_base()
: _M_head_impl() { }
constexpr _Head_base(const _Head& __h)
: _M_head_impl(__h) { }
constexpr _Head_base(const _Head_base&) = default;
constexpr _Head_base(_Head_base&&) = default;
template<typename _UHead>
constexpr _Head_base(_UHead&& __h)
: _M_head_impl(std::forward<_UHead>(__h)) { }
_Head_base(allocator_arg_t, __uses_alloc0)
: _M_head_impl() { }
template<typename _Alloc>
_Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a)
: _M_head_impl(allocator_arg, *__a._M_a) { }
template<typename _Alloc>
_Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a)
: _M_head_impl(*__a._M_a) { }
template<typename _UHead>
_Head_base(__uses_alloc0, _UHead&& __uhead)
: _M_head_impl(std::forward<_UHead>(__uhead)) { }
template<typename _Alloc, typename _UHead>
_Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead)
: _M_head_impl(allocator_arg, *__a._M_a, std::forward<_UHead>(__uhead))
{ }
template<typename _Alloc, typename _UHead>
_Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead)
: _M_head_impl(std::forward<_UHead>(__uhead), *__a._M_a) { }
static constexpr _Head&
_M_head(_Head_base& __b) noexcept { return __b._M_head_impl; }
static constexpr const _Head&
_M_head(const _Head_base& __b) noexcept { return __b._M_head_impl; }
_Head _M_head_impl;
};
/**
* Contains the actual implementation of the @c tuple template, stored
* as a recursive inheritance hierarchy from the first element (most
* derived class) to the last (least derived class). The @c Idx
* parameter gives the 0-based index of the element stored at this
* point in the hierarchy; we use it to implement a constant-time
* get() operation.
*/
template<std::size_t _Idx, typename... _Elements>
struct _Tuple_impl;
/**
* Recursive tuple implementation. Here we store the @c Head element
* and derive from a @c Tuple_impl containing the remaining elements
* (which contains the @c Tail).
*/
template<std::size_t _Idx, typename _Head, typename... _Tail>
struct _Tuple_impl<_Idx, _Head, _Tail...>
: public _Tuple_impl<_Idx + 1, _Tail...>,
private _Head_base<_Idx, _Head>
{
template<std::size_t, typename...> friend class _Tuple_impl;
typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited;
typedef _Head_base<_Idx, _Head> _Base;
static constexpr _Head&
_M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
static constexpr const _Head&
_M_head(const _Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
static constexpr _Inherited&
_M_tail(_Tuple_impl& __t) noexcept { return __t; }
static constexpr const _Inherited&
_M_tail(const _Tuple_impl& __t) noexcept { return __t; }
constexpr _Tuple_impl()
: _Inherited(), _Base() { }
explicit
constexpr _Tuple_impl(const _Head& __head, const _Tail&... __tail)
: _Inherited(__tail...), _Base(__head) { }
template<typename _UHead, typename... _UTail, typename = typename
enable_if<sizeof...(_Tail) == sizeof...(_UTail)>::type>
explicit
constexpr _Tuple_impl(_UHead&& __head, _UTail&&... __tail)
: _Inherited(std::forward<_UTail>(__tail)...),
_Base(std::forward<_UHead>(__head)) { }
constexpr _Tuple_impl(const _Tuple_impl&) = default;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2729. Missing SFINAE on std::pair::operator=
_Tuple_impl& operator=(const _Tuple_impl&) = delete;
constexpr
_Tuple_impl(_Tuple_impl&& __in)
noexcept(__and_<is_nothrow_move_constructible<_Head>,
is_nothrow_move_constructible<_Inherited>>::value)
: _Inherited(std::move(_M_tail(__in))),
_Base(std::forward<_Head>(_M_head(__in))) { }
template<typename... _UElements>
constexpr _Tuple_impl(const _Tuple_impl<_Idx, _UElements...>& __in)
: _Inherited(_Tuple_impl<_Idx, _UElements...>::_M_tail(__in)),
_Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { }
template<typename _UHead, typename... _UTails>
constexpr _Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
: _Inherited(std::move
(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
_Base(std::forward<_UHead>
(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))) { }
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a)
: _Inherited(__tag, __a),
_Base(__tag, __use_alloc<_Head>(__a)) { }
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
const _Head& __head, const _Tail&... __tail)
: _Inherited(__tag, __a, __tail...),
_Base(__use_alloc<_Head, _Alloc, _Head>(__a), __head) { }
template<typename _Alloc, typename _UHead, typename... _UTail,
typename = typename enable_if<sizeof...(_Tail)
== sizeof...(_UTail)>::type>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
_UHead&& __head, _UTail&&... __tail)
: _Inherited(__tag, __a, std::forward<_UTail>(__tail)...),
_Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
std::forward<_UHead>(__head)) { }
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
const _Tuple_impl& __in)
: _Inherited(__tag, __a, _M_tail(__in)),
_Base(__use_alloc<_Head, _Alloc, _Head>(__a), _M_head(__in)) { }
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
_Tuple_impl&& __in)
: _Inherited(__tag, __a, std::move(_M_tail(__in))),
_Base(__use_alloc<_Head, _Alloc, _Head>(__a),
std::forward<_Head>(_M_head(__in))) { }
template<typename _Alloc, typename... _UElements>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
const _Tuple_impl<_Idx, _UElements...>& __in)
: _Inherited(__tag, __a,
_Tuple_impl<_Idx, _UElements...>::_M_tail(__in)),
_Base(__use_alloc<_Head, _Alloc, _Head>(__a),
_Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { }
template<typename _Alloc, typename _UHead, typename... _UTails>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
: _Inherited(__tag, __a, std::move
(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
_Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
std::forward<_UHead>
(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))) { }
template<typename... _UElements>
void
_M_assign(const _Tuple_impl<_Idx, _UElements...>& __in)
{
_M_head(*this) = _Tuple_impl<_Idx, _UElements...>::_M_head(__in);
_M_tail(*this)._M_assign(
_Tuple_impl<_Idx, _UElements...>::_M_tail(__in));
}
template<typename _UHead, typename... _UTails>
void
_M_assign(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
{
_M_head(*this) = std::forward<_UHead>
(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in));
_M_tail(*this)._M_assign(
std::move(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)));
}
protected:
void
_M_swap(_Tuple_impl& __in)
{
using std::swap;
swap(_M_head(*this), _M_head(__in));
_Inherited::_M_swap(_M_tail(__in));
}
};
// Basis case of inheritance recursion.
template<std::size_t _Idx, typename _Head>
struct _Tuple_impl<_Idx, _Head>
: private _Head_base<_Idx, _Head>
{
template<std::size_t, typename...> friend class _Tuple_impl;
typedef _Head_base<_Idx, _Head> _Base;
static constexpr _Head&
_M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
static constexpr const _Head&
_M_head(const _Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
constexpr _Tuple_impl()
: _Base() { }
explicit
constexpr _Tuple_impl(const _Head& __head)
: _Base(__head) { }
template<typename _UHead>
explicit
constexpr _Tuple_impl(_UHead&& __head)
: _Base(std::forward<_UHead>(__head)) { }
constexpr _Tuple_impl(const _Tuple_impl&) = default;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2729. Missing SFINAE on std::pair::operator=
_Tuple_impl& operator=(const _Tuple_impl&) = delete;
constexpr
_Tuple_impl(_Tuple_impl&& __in)
noexcept(is_nothrow_move_constructible<_Head>::value)
: _Base(std::forward<_Head>(_M_head(__in))) { }
template<typename _UHead>
constexpr _Tuple_impl(const _Tuple_impl<_Idx, _UHead>& __in)
: _Base(_Tuple_impl<_Idx, _UHead>::_M_head(__in)) { }
template<typename _UHead>
constexpr _Tuple_impl(_Tuple_impl<_Idx, _UHead>&& __in)
: _Base(std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
{ }
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a)
: _Base(__tag, __use_alloc<_Head>(__a)) { }
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
const _Head& __head)
: _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __head) { }
template<typename _Alloc, typename _UHead>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
_UHead&& __head)
: _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
std::forward<_UHead>(__head)) { }
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
const _Tuple_impl& __in)
: _Base(__use_alloc<_Head, _Alloc, _Head>(__a), _M_head(__in)) { }
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
_Tuple_impl&& __in)
: _Base(__use_alloc<_Head, _Alloc, _Head>(__a),
std::forward<_Head>(_M_head(__in))) { }
template<typename _Alloc, typename _UHead>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
const _Tuple_impl<_Idx, _UHead>& __in)
: _Base(__use_alloc<_Head, _Alloc, _Head>(__a),
_Tuple_impl<_Idx, _UHead>::_M_head(__in)) { }
template<typename _Alloc, typename _UHead>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
_Tuple_impl<_Idx, _UHead>&& __in)
: _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
{ }
template<typename _UHead>
void
_M_assign(const _Tuple_impl<_Idx, _UHead>& __in)
{
_M_head(*this) = _Tuple_impl<_Idx, _UHead>::_M_head(__in);
}
template<typename _UHead>
void
_M_assign(_Tuple_impl<_Idx, _UHead>&& __in)
{
_M_head(*this)
= std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in));
}
protected:
void
_M_swap(_Tuple_impl& __in)
{
using std::swap;
swap(_M_head(*this), _M_head(__in));
}
};
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
// Concept utility functions, reused in conditionally-explicit
// constructors.
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<bool, typename... _Types>
struct _TupleConstraints
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
{
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
// Constraint for a non-explicit constructor.
// True iff each Ti in _Types... can be constructed from Ui in _UTypes...
// and every Ui is implicitly convertible to Ti.
template<typename... _UTypes>
static constexpr bool __is_implicitly_constructible()
{
return __and_<is_constructible<_Types, _UTypes>...,
is_convertible<_UTypes, _Types>...
>::value;
}
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
// Constraint for a non-explicit constructor.
// True iff each Ti in _Types... can be constructed from Ui in _UTypes...
// but not every Ui is implicitly convertible to Ti.
template<typename... _UTypes>
static constexpr bool __is_explicitly_constructible()
{
return __and_<is_constructible<_Types, _UTypes>...,
__not_<__and_<is_convertible<_UTypes, _Types>...>>
>::value;
}
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
static constexpr bool __is_implicitly_default_constructible()
{
return __and_<std::__is_implicitly_default_constructible<_Types>...
>::value;
}
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
static constexpr bool __is_explicitly_default_constructible()
{
return __and_<is_default_constructible<_Types>...,
__not_<__and_<
std::__is_implicitly_default_constructible<_Types>...>
>>::value;
}
};
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
// Partial specialization used when a required precondition isn't met,
// e.g. when sizeof...(_Types) != sizeof...(_UTypes).
template<typename... _Types>
struct _TupleConstraints<false, _Types...>
{
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename... _UTypes>
static constexpr bool __is_implicitly_constructible()
{ return false; }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename... _UTypes>
static constexpr bool __is_explicitly_constructible()
{ return false; }
};
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
/// Primary class template, tuple
template<typename... _Elements>
class tuple : public _Tuple_impl<0, _Elements...>
{
typedef _Tuple_impl<0, _Elements...> _Inherited;
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<bool _Cond>
using _TCC = _TupleConstraints<_Cond, _Elements...>;
// Constraint for non-explicit default constructor
template<bool _Dummy>
using _ImplicitDefaultCtor = __enable_if_t<
_TCC<_Dummy>::__is_implicitly_default_constructible(),
bool>;
// Constraint for explicit default constructor
template<bool _Dummy>
using _ExplicitDefaultCtor = __enable_if_t<
_TCC<_Dummy>::__is_explicitly_default_constructible(),
bool>;
// Constraint for non-explicit constructors
template<bool _Cond, typename... _Args>
using _ImplicitCtor = __enable_if_t<
_TCC<_Cond>::template __is_implicitly_constructible<_Args...>(),
bool>;
// Constraint for non-explicit constructors
template<bool _Cond, typename... _Args>
using _ExplicitCtor = __enable_if_t<
_TCC<_Cond>::template __is_explicitly_constructible<_Args...>(),
bool>;
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
template<typename... _UElements>
static constexpr
__enable_if_t<sizeof...(_UElements) == sizeof...(_Elements), bool>
__assignable()
{ return __and_<is_assignable<_Elements&, _UElements>...>::value; }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
// Condition for noexcept-specifier of an assignment operator.
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
template<typename... _UElements>
static constexpr bool __nothrow_assignable()
{
return
__and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
}
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
// Condition for noexcept-specifier of a constructor.
template<typename... _UElements>
static constexpr bool __nothrow_constructible()
{
return
__and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
}
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
// Constraint for tuple(_UTypes&&...) where sizeof...(_UTypes) == 1.
template<typename _Up>
static constexpr bool __valid_args()
{
return sizeof...(_Elements) == 1
&& !is_same<tuple, __remove_cvref_t<_Up>>::value;
}
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
// Constraint for tuple(_UTypes&&...) where sizeof...(_UTypes) > 1.
template<typename, typename, typename... _Tail>
static constexpr bool __valid_args()
{ return (sizeof...(_Tail) + 2) == sizeof...(_Elements); }
/* Constraint for constructors with a tuple<UTypes...> parameter ensures
* that the constructor is only viable when it would not interfere with
* tuple(UTypes&&...) or tuple(const tuple&) or tuple(tuple&&).
* Such constructors are only viable if:
* either sizeof...(Types) != 1,
* or (when Types... expands to T and UTypes... expands to U)
* is_convertible_v<TUPLE, T>, is_constructible_v<T, TUPLE>,
* and is_same_v<T, U> are all false.
*/
template<typename _Tuple, typename = tuple,
typename = __remove_cvref_t<_Tuple>>
struct _UseOtherCtor
: false_type
{ };
// If TUPLE is convertible to the single element in *this,
// then TUPLE should match tuple(UTypes&&...) instead.
template<typename _Tuple, typename _Tp, typename _Up>
struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Up>>
: __or_<is_convertible<_Tuple, _Tp>, is_constructible<_Tp, _Tuple>>
{ };
// If TUPLE and *this each have a single element of the same type,
// then TUPLE should match a copy/move constructor instead.
template<typename _Tuple, typename _Tp>
struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Tp>>
: true_type
{ };
// Return true iff sizeof...(Types) == 1 && tuple_size_v<TUPLE> == 1
// and the single element in Types can be initialized from TUPLE,
// or is the same type as tuple_element_t<0, TUPLE>.
template<typename _Tuple>
static constexpr bool __use_other_ctor()
{ return _UseOtherCtor<_Tuple>::value; }
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
public:
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
template<typename _Dummy = void,
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
_ImplicitDefaultCtor<is_void<_Dummy>::value> = true>
constexpr
tuple()
noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
: _Inherited() { }
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
template<typename _Dummy = void,
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
_ExplicitDefaultCtor<is_void<_Dummy>::value> = false>
explicit constexpr
tuple()
noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
: _Inherited() { }
template<bool _NotEmpty = (sizeof...(_Elements) >= 1),
_ImplicitCtor<_NotEmpty, const _Elements&...> = true>
constexpr
tuple(const _Elements&... __elements)
noexcept(__nothrow_constructible<const _Elements&...>())
: _Inherited(__elements...) { }
template<bool _NotEmpty = (sizeof...(_Elements) >= 1),
_ExplicitCtor<_NotEmpty, const _Elements&...> = false>
explicit constexpr
tuple(const _Elements&... __elements)
noexcept(__nothrow_constructible<const _Elements&...>())
: _Inherited(__elements...) { }
template<typename... _UElements,
bool _Valid = __valid_args<_UElements...>(),
_ImplicitCtor<_Valid, _UElements...> = true>
constexpr
tuple(_UElements&&... __elements)
noexcept(__nothrow_constructible<_UElements...>())
: _Inherited(std::forward<_UElements>(__elements)...) { }
template<typename... _UElements,
bool _Valid = __valid_args<_UElements...>(),
_ExplicitCtor<_Valid, _UElements...> = false>
explicit constexpr
tuple(_UElements&&... __elements)
noexcept(__nothrow_constructible<_UElements...>())
: _Inherited(std::forward<_UElements>(__elements)...) { }
constexpr tuple(const tuple&) = default;
constexpr tuple(tuple&&) = default;
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename... _UElements,
bool _Valid = (sizeof...(_Elements) == sizeof...(_UElements))
&& !__use_other_ctor<const tuple<_UElements...>&>(),
_ImplicitCtor<_Valid, const _UElements&...> = true>
constexpr
tuple(const tuple<_UElements...>& __in)
noexcept(__nothrow_constructible<const _UElements&...>())
: _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
{ }
template<typename... _UElements,
bool _Valid = (sizeof...(_Elements) == sizeof...(_UElements))
&& !__use_other_ctor<const tuple<_UElements...>&>(),
_ExplicitCtor<_Valid, const _UElements&...> = false>
explicit constexpr
tuple(const tuple<_UElements...>& __in)
noexcept(__nothrow_constructible<const _UElements&...>())
: _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
{ }
template<typename... _UElements,
bool _Valid = (sizeof...(_Elements) == sizeof...(_UElements))
&& !__use_other_ctor<tuple<_UElements...>&&>(),
_ImplicitCtor<_Valid, _UElements...> = true>
constexpr
tuple(tuple<_UElements...>&& __in)
noexcept(__nothrow_constructible<_UElements...>())
: _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) { }
template<typename... _UElements,
bool _Valid = (sizeof...(_Elements) == sizeof...(_UElements))
&& !__use_other_ctor<tuple<_UElements...>&&>(),
_ExplicitCtor<_Valid, _UElements...> = false>
explicit constexpr
tuple(tuple<_UElements...>&& __in)
noexcept(__nothrow_constructible<_UElements...>())
: _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) { }
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
// Allocator-extended constructors.
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc,
_ImplicitDefaultCtor<is_object<_Alloc>::value> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a)
: _Inherited(__tag, __a) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, bool _NotEmpty = (sizeof...(_Elements) >= 1),
_ImplicitCtor<_NotEmpty, const _Elements&...> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a,
const _Elements&... __elements)
: _Inherited(__tag, __a, __elements...) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, bool _NotEmpty = (sizeof...(_Elements) >= 1),
_ExplicitCtor<_NotEmpty, const _Elements&...> = false>
explicit
tuple(allocator_arg_t __tag, const _Alloc& __a,
const _Elements&... __elements)
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
: _Inherited(__tag, __a, __elements...) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename... _UElements,
bool _Valid = __valid_args<_UElements...>(),
_ImplicitCtor<_Valid, _UElements...> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a,
_UElements&&... __elements)
: _Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
{ }
template<typename _Alloc, typename... _UElements,
bool _Valid = __valid_args<_UElements...>(),
_ExplicitCtor<_Valid, _UElements...> = false>
explicit
tuple(allocator_arg_t __tag, const _Alloc& __a,
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
_UElements&&... __elements)
: _Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
{ }
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
template<typename _Alloc>
tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in)
: _Inherited(__tag, __a, static_cast<const _Inherited&>(__in)) { }
template<typename _Alloc>
tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in)
: _Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename... _UElements,
bool _Valid = (sizeof...(_Elements) == sizeof...(_UElements))
&& !__use_other_ctor<const tuple<_UElements...>&>(),
_ImplicitCtor<_Valid, const _UElements&...> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a,
const tuple<_UElements...>& __in)
: _Inherited(__tag, __a,
static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
{ }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename... _UElements,
bool _Valid = (sizeof...(_Elements) == sizeof...(_UElements))
&& !__use_other_ctor<const tuple<_UElements...>&>(),
_ExplicitCtor<_Valid, const _UElements&...> = false>
explicit
tuple(allocator_arg_t __tag, const _Alloc& __a,
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
const tuple<_UElements...>& __in)
: _Inherited(__tag, __a,
static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
{ }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename... _UElements,
bool _Valid = (sizeof...(_Elements) == sizeof...(_UElements))
&& !__use_other_ctor<tuple<_UElements...>&&>(),
_ImplicitCtor<_Valid, _UElements...> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a,
tuple<_UElements...>&& __in)
: _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UElements...>&&>(__in))
{ }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename... _UElements,
bool _Valid = (sizeof...(_Elements) == sizeof...(_UElements))
&& !__use_other_ctor<tuple<_UElements...>&&>(),
_ExplicitCtor<_Valid, _UElements...> = false>
explicit
tuple(allocator_arg_t __tag, const _Alloc& __a,
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
tuple<_UElements...>&& __in)
: _Inherited(__tag, __a,
static_cast<_Tuple_impl<0, _UElements...>&&>(__in))
{ }
// tuple assignment
tuple&
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
operator=(typename conditional<__assignable<const _Elements&...>(),
const tuple&,
const __nonesuch&>::type __in)
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
noexcept(__nothrow_assignable<const _Elements&...>())
{
this->_M_assign(__in);
return *this;
}
tuple&
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
operator=(typename conditional<__assignable<_Elements...>(),
tuple&&,
__nonesuch&&>::type __in)
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
noexcept(__nothrow_assignable<_Elements...>())
{
this->_M_assign(std::move(__in));
return *this;
}
template<typename... _UElements>
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
__enable_if_t<__assignable<const _UElements&...>(), tuple&>
operator=(const tuple<_UElements...>& __in)
noexcept(__nothrow_assignable<const _UElements&...>())
{
this->_M_assign(__in);
return *this;
}
template<typename... _UElements>
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
__enable_if_t<__assignable<_UElements...>(), tuple&>
operator=(tuple<_UElements...>&& __in)
noexcept(__nothrow_assignable<_UElements...>())
{
this->_M_assign(std::move(__in));
return *this;
}
// tuple swap
void
stl_pair.h (swap): Do not swap rvalues. 2009-05-18 Jonathan Wakely <jwakely.gcc@gmail.com> * include/bits/stl_pair.h (swap): Do not swap rvalues. * include/bits/stl_deque.h (swap): Likewise. * include/bits/stl_list.h (swap): Likewise. * include/bits/stl_vector.h (swap): Likewise. * include/bits/stl_bvector.h (swap): Likewise. * include/bits/stl_queue.h (swap): Likewise. * include/bits/stl_stack.h (swap): Likewise. * include/bits/stl_tree.h (swap): Likewise. * include/bits/stl_map.h (swap): Likewise. * include/bits/stl_multimap.h (swap): Likewise. * include/bits/stl_set.h (swap): Likewise. * include/bits/stl_multiset.h (swap): Likewise. * include/bits/forward_list.h (swap): Likewise. * include/bits/unique_ptr.h (swap): Likewise. * include/debug/deque (swap): Likewise. * include/debug/list (swap): Likewise. * include/debug/vector (swap): Likewise. * include/debug/map.h (swap): Likewise. * include/debug/multimap.h (swap): Likewise. * include/debug/set.h (swap): Likewise. * include/debug/multiset.h (swap): Likewise. * include/debug/unordered_map (swap): Likewise. * include/debug/unordered_set (swap): Likewise. * include/ext/vstring.h (swap): Likewise. * include/tr1_impl/unordered_map (swap): Likewise. * include/tr1_impl/hashtable (swap): Likewise. * include/tr1_impl/unordered_set (swap): Likewise. * include/std/tuple (swap): Likewise. * include/std/mutex (swap): Likewise. * include/std/thread (swap): Likewise. (operator<<): Only output to lvalue streams. * testsuite/20_util/shared_ptr/modifiers/swap_rvalue.cc: Remove. * testsuite/23_containers/headers/forward_list/synopsis.cc: Adjust. * testsuite/23_containers/deque/requirements/dr438/ assign_neg.cc: Adjust line numbers. * testsuite/23_containers/deque/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ assign_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ assign_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/30_threads/thread/swap/1.cc: Swap with lvalue and also test non-member swap. * testsuite/30_threads/thread/swap/2.cc: Remove. From-SVN: r147678
2009-05-19 00:15:56 +02:00
swap(tuple& __in)
noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value)
{ _Inherited::_M_swap(__in); }
};
Add deduction guides for C++17 (P0433R2, partial) * include/bits/shared_ptr.h (shared_ptr, weak_ptr): Add deduction guides for C++17. * include/bits/std_function.h (function): Likewise. * include/bits/stl_pair.h (pair): Likewise. * include/debug/array (__gnu_debug::array): Likewise. * include/std/array (array): Likewise. * include/std/functional (make_default_searcher) (make_boyer_moore_searcher, make_boyer_moore_horspool_searcher): Remove generator functions. * include/std/tuple (tuple): Add deduction guides. * include/std/valarray (valarray): Likewise. * testsuite/20_util/function_objects/searchers.cc: Adjust to use class template argument deduction instead of generator functions. * testsuite/20_util/function/cons/deduction.cc: New test. * testsuite/20_util/optional/cons/deduction_guide.cc: Rename to ... * testsuite/20_util/optional/cons/deduction.cc: ... here. * testsuite/20_util/pair/cons/deduction.cc: New test. * testsuite/20_util/shared_ptr/cons/deduction.cc: New test. * testsuite/20_util/tuple/cons/deduction.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Adjust dg-error. * testsuite/20_util/unique_ptr/cons/deduction_neg.cc: New test. * testsuite/20_util/weak_ptr/cons/deduction.cc: New test. * testsuite/23_containers/array/cons/deduction.cc: New test. * testsuite/23_containers/array/cons/deduction_neg.cc: New test. * testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adjust dg-error. * testsuite/23_containers/array/tuple_interface/get_neg.cc: Likewise. * testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc: Likewise. * testsuite/26_numerics/valarray/deduction.cc: New test. * testsuite/30_threads/lock_guard/cons/deduction.cc: New test. * testsuite/30_threads/scoped_lock/cons/deduction.cc: New test. * testsuite/30_threads/unique_lock/cons/deduction.cc: New test. From-SVN: r246389
2017-03-22 16:58:35 +01:00
#if __cpp_deduction_guides >= 201606
template<typename... _UTypes>
tuple(_UTypes...) -> tuple<_UTypes...>;
template<typename _T1, typename _T2>
tuple(pair<_T1, _T2>) -> tuple<_T1, _T2>;
template<typename _Alloc, typename... _UTypes>
tuple(allocator_arg_t, _Alloc, _UTypes...) -> tuple<_UTypes...>;
template<typename _Alloc, typename _T1, typename _T2>
tuple(allocator_arg_t, _Alloc, pair<_T1, _T2>) -> tuple<_T1, _T2>;
template<typename _Alloc, typename... _UTypes>
tuple(allocator_arg_t, _Alloc, tuple<_UTypes...>) -> tuple<_UTypes...>;
#endif
// Explicit specialization, zero-element tuple.
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
template<>
class tuple<>
{
public:
void swap(tuple&) noexcept { /* no-op */ }
// We need the default since we're going to define no-op
// allocator constructors.
tuple() = default;
// No-op allocator constructors.
template<typename _Alloc>
tuple(allocator_arg_t, const _Alloc&) noexcept { }
template<typename _Alloc>
tuple(allocator_arg_t, const _Alloc&, const tuple&) noexcept { }
};
run_doxygen: Remove html_output_dir. 2008-03-25 Benjamin Kosnik <bkoz@redhat.com> * scripts/run_doxygen: Remove html_output_dir. Downgrade to Doxygen 1.5.1. * doc/doxygen/style.css: Delete. * doc/doxygen/user.cfg.in: Regenerate with Doxygen 1.5.1. (INPUT): Update. (PREDEFINED): Update. (HTML_OUTPUT): Remove html_output_dir, use html. (HTML_STYLESHEET): Remove style.css. * doc/doxygen/tables.html: Remove style.css use. * doc/doxygen/mainpage.html: Nested lists for Namespaces and Classes. * doc/doxygen/doxygroups.cc: Namespace edits. * doc/doxygen/Intro.3: Correct typo. * doc/xml/api.xml: Add gcc-4.3 links. * doc/html/api.html: Regenerate. * include/debug/debug.h: Document namepaces here. * include/parallel/base.h: Same. * include/ext/typelist.h: Same. * include/ext/pb_ds/tag_and_trait.hpp: Same. * include/tr1_impl/random: Adjust line break. * include/tr1_impl/unordered_map: Correct and or add markup. * include/tr1_impl/boost_shared_ptr.h: Correct and or add markup. * include/tr1_impl/functional_hash.h: Same. * include/tr1_impl/cmath: Same. * include/tr1_impl/functional: Same. * include/tr1_impl/unordered_set: Same. * include/tr1_impl/complex: Same. * include/tr1_impl/type_traits: Same. * include/tr1_impl/regex: Same. * include/tr1_impl/array: Same. * include/std/tuple: Same. * include/std/date_time: Same. * include/std/system_error: Same. * include/std/type_traits: Same. * include/ext/enc_filebuf.h: Same. * include/ext/throw_allocator.h: Same. * include/ext/pool_allocator.h: Same. * include/ext/bitmap_allocator.h: Same. * include/ext/concurrence.h: Same. * include/ext/codecvt_specializations.h: Same. * include/ext/stdio_sync_filebuf.h: Same. * include/ext/array_allocator.h: Same. * include/ext/mt_allocator.h: Same. * include/bits/locale_classes.h: Same. * include/bits/locale_facets.h: Same. * include/bits/codecvt.h: Same. * include/bits/char_traits.h: Same. * include/bits/allocator.h: Same. * include/bits/locale_facets_nonio.h: Same. * include/tr1/poly_laguerre.tcc: Same. * include/tr1/riemann_zeta.tcc: Same. * include/tr1/beta_function.tcc: Same. * include/tr1/tuple: Same. * include/tr1/exp_integral.tcc: Same. * include/tr1/gamma.tcc: Same. * include/tr1/hypergeometric.tcc: Same. * include/tr1/modified_bessel_func.tcc: Same. * include/tr1/legendre_function.tcc: Same. * include/tr1/type_traits: Same. * include/tr1/special_function_util.h: Same. * include/tr1/bessel_function.tcc: Same. * include/tr1/cmath: Same. * include/tr1/poly_hermite.tcc: Same. * include/tr1/ell_integral.tcc: Same. * config/abi/compatibility.h: Adjust file name. * testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Adjust line numbers. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same. From-SVN: r133544
2008-03-26 07:27:35 +01:00
/// Partial specialization, 2-element tuple.
/// Includes construction and assignment from a pair.
template<typename _T1, typename _T2>
class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2>
{
typedef _Tuple_impl<0, _T1, _T2> _Inherited;
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
// Constraint for non-explicit default constructor
template<bool _Dummy, typename _U1, typename _U2>
using _ImplicitDefaultCtor = __enable_if_t<
_TupleConstraints<_Dummy, _U1, _U2>::
__is_implicitly_default_constructible(),
bool>;
// Constraint for explicit default constructor
template<bool _Dummy, typename _U1, typename _U2>
using _ExplicitDefaultCtor = __enable_if_t<
_TupleConstraints<_Dummy, _U1, _U2>::
__is_explicitly_default_constructible(),
bool>;
template<bool _Dummy>
using _TCC = _TupleConstraints<_Dummy, _T1, _T2>;
// Constraint for non-explicit constructors
template<bool _Cond, typename _U1, typename _U2>
using _ImplicitCtor = __enable_if_t<
_TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(),
bool>;
// Constraint for non-explicit constructors
template<bool _Cond, typename _U1, typename _U2>
using _ExplicitCtor = __enable_if_t<
_TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(),
bool>;
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
template<typename _U1, typename _U2>
static constexpr bool __assignable()
{
return __and_<is_assignable<_T1&, _U1>,
is_assignable<_T2&, _U2>>::value;
}
template<typename _U1, typename _U2>
static constexpr bool __nothrow_assignable()
{
return __and_<is_nothrow_assignable<_T1&, _U1>,
is_nothrow_assignable<_T2&, _U2>>::value;
}
template<typename _U1, typename _U2>
static constexpr bool __nothrow_constructible()
{
return __and_<is_nothrow_constructible<_T1, _U1>,
is_nothrow_constructible<_T2, _U2>>::value;
}
static constexpr bool __nothrow_default_constructible()
{
return __and_<is_nothrow_default_constructible<_T1>,
is_nothrow_default_constructible<_T2>>::value;
}
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _U1>
static constexpr bool __is_alloc_arg()
{ return is_same<__remove_cvref_t<_U1>, allocator_arg_t>::value; }
public:
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<bool _Dummy = true,
_ImplicitDefaultCtor<_Dummy, _T1, _T2> = true>
constexpr
tuple()
noexcept(__nothrow_default_constructible())
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
: _Inherited() { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<bool _Dummy = true,
_ExplicitDefaultCtor<_Dummy, _T1, _T2> = false>
explicit constexpr
tuple()
noexcept(__nothrow_default_constructible())
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
: _Inherited() { }
Make the default constructors of tuple and pair conditionally explicit. 2015-11-03 Ville Voutilainen <ville.voutilainen@gmail.com> Make the default constructors of tuple and pair conditionally explicit. * include/std/type_traits (is_unsigned, __is_array_unknown_bounds, __is_default_constructible_atom, __is_default_constructible_safe, __is_direct_constructible_new_safe, __is_direct_constructible_ref_cast, __is_nt_default_constructible_impl, is_nothrow_default_constructible, is_nothrow_constructible, is_nothrow_assignable, is_trivially_constructible, is_trivially_copy_constructible, is_trivially_move_constructible, is_trivially_assignable, is_trivially_copy_assignable, is_trivially_move_assignable, is_trivially_destructible): Simplify. * include/std/type_traits ( __do_is_implicitly_default_constructible_impl, __is_implicitly_default_constructible_impl, __is_implicitly_default_constructible_safe, __is_implicitly_default_constructible): New. * include/bits/stl_pair.h (pair::pair()): Use it. * include/std/tuple (tuple<_T1, _T2>::tuple): Use it. * include/std/tuple (_ImplicitlyDefaultConstructibleTuple): New. * include/std/tuple (tuple<_Types...>::tuple()): Use it. * testsuite/20_util/declval/requirements/1_neg.cc: Adjust. * testsuite/20_util/is_implicitly_default_constructible/requirements/explicit_instantiation.cc: New. * testsuite/20_util/is_implicitly_default_constructible/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_implicitly_default_constructible/value.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/pair/cons/explicit_construct.cc: Likewise. * testsuite/20_util/tuple/cons/explicit_construct.cc: Likewise. From-SVN: r229699
2015-11-03 09:41:40 +01:00
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<bool _Dummy = true,
_ImplicitCtor<_Dummy, const _T1&, const _T2&> = true>
constexpr
tuple(const _T1& __a1, const _T2& __a2)
noexcept(__nothrow_constructible<const _T1&, const _T2&>())
: _Inherited(__a1, __a2) { }
template<bool _Dummy = true,
_ExplicitCtor<_Dummy, const _T1&, const _T2&> = false>
explicit constexpr
tuple(const _T1& __a1, const _T2& __a2)
noexcept(__nothrow_constructible<const _T1&, const _T2&>())
: _Inherited(__a1, __a2) { }
template<typename _U1, typename _U2,
_ImplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> = true>
constexpr
tuple(_U1&& __a1, _U2&& __a2)
noexcept(__nothrow_constructible<_U1, _U2>())
: _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _U1, typename _U2,
_ExplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> = false>
explicit constexpr
tuple(_U1&& __a1, _U2&& __a2)
noexcept(__nothrow_constructible<_U1, _U2>())
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
: _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
constexpr tuple(const tuple&) = default;
constexpr tuple(tuple&&) = default;
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _U1, typename _U2,
_ImplicitCtor<true, const _U1&, const _U2&> = true>
constexpr
tuple(const tuple<_U1, _U2>& __in)
noexcept(__nothrow_constructible<const _U1&, const _U2&>())
: _Inherited(static_cast<const _Tuple_impl<0, _U1, _U2>&>(__in)) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _U1, typename _U2,
_ExplicitCtor<true, const _U1&, const _U2&> = false>
explicit constexpr
tuple(const tuple<_U1, _U2>& __in)
noexcept(__nothrow_constructible<const _U1&, const _U2&>())
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
: _Inherited(static_cast<const _Tuple_impl<0, _U1, _U2>&>(__in)) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _U1, typename _U2,
_ImplicitCtor<true, _U1, _U2> = true>
constexpr
tuple(tuple<_U1, _U2>&& __in)
noexcept(__nothrow_constructible<_U1, _U2>())
: _Inherited(static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in)) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _U1, typename _U2,
_ExplicitCtor<true, _U1, _U2> = false>
explicit constexpr
tuple(tuple<_U1, _U2>&& __in)
noexcept(__nothrow_constructible<_U1, _U2>())
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
: _Inherited(static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in)) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _U1, typename _U2,
_ImplicitCtor<true, const _U1&, const _U2&> = true>
constexpr
tuple(const pair<_U1, _U2>& __in)
noexcept(__nothrow_constructible<const _U1&, const _U2&>())
: _Inherited(__in.first, __in.second) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _U1, typename _U2,
_ExplicitCtor<true, const _U1&, const _U2&> = false>
explicit constexpr
tuple(const pair<_U1, _U2>& __in)
noexcept(__nothrow_constructible<const _U1&, const _U2&>())
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
: _Inherited(__in.first, __in.second) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _U1, typename _U2,
_ImplicitCtor<true, _U1, _U2> = true>
constexpr
tuple(pair<_U1, _U2>&& __in)
noexcept(__nothrow_constructible<_U1, _U2>())
: _Inherited(std::forward<_U1>(__in.first),
std::forward<_U2>(__in.second)) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _U1, typename _U2,
_ExplicitCtor<true, _U1, _U2> = false>
explicit constexpr
tuple(pair<_U1, _U2>&& __in)
noexcept(__nothrow_constructible<_U1, _U2>())
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
: _Inherited(std::forward<_U1>(__in.first),
std::forward<_U2>(__in.second)) { }
// Allocator-extended constructors.
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc,
_ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a)
: _Inherited(__tag, __a) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, bool _Dummy = true,
_ImplicitCtor<_Dummy, const _T1&, const _T2&> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a,
const _T1& __a1, const _T2& __a2)
: _Inherited(__tag, __a, __a1, __a2) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, bool _Dummy = true,
_ExplicitCtor<_Dummy, const _T1&, const _T2&> = false>
explicit
tuple(allocator_arg_t __tag, const _Alloc& __a,
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
const _T1& __a1, const _T2& __a2)
: _Inherited(__tag, __a, __a1, __a2) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename _U1, typename _U2,
_ImplicitCtor<true, _U1, _U2> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a, _U1&& __a1, _U2&& __a2)
: _Inherited(__tag, __a, std::forward<_U1>(__a1),
std::forward<_U2>(__a2)) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename _U1, typename _U2,
_ExplicitCtor<true, _U1, _U2> = false>
explicit
tuple(allocator_arg_t __tag, const _Alloc& __a,
_U1&& __a1, _U2&& __a2)
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
: _Inherited(__tag, __a, std::forward<_U1>(__a1),
std::forward<_U2>(__a2)) { }
template<typename _Alloc>
tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in)
: _Inherited(__tag, __a, static_cast<const _Inherited&>(__in)) { }
template<typename _Alloc>
tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in)
: _Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename _U1, typename _U2,
_ImplicitCtor<true, const _U1&, const _U2&> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a,
const tuple<_U1, _U2>& __in)
: _Inherited(__tag, __a,
static_cast<const _Tuple_impl<0, _U1, _U2>&>(__in))
{ }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename _U1, typename _U2,
_ExplicitCtor<true, const _U1&, const _U2&> = false>
explicit
tuple(allocator_arg_t __tag, const _Alloc& __a,
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
const tuple<_U1, _U2>& __in)
: _Inherited(__tag, __a,
static_cast<const _Tuple_impl<0, _U1, _U2>&>(__in))
{ }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename _U1, typename _U2,
_ImplicitCtor<true, _U1, _U2> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_U1, _U2>&& __in)
: _Inherited(__tag, __a, static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in))
{ }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename _U1, typename _U2,
_ExplicitCtor<true, _U1, _U2> = false>
explicit
tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_U1, _U2>&& __in)
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
: _Inherited(__tag, __a, static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in))
{ }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename _U1, typename _U2,
_ImplicitCtor<true, const _U1&, const _U2&> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a,
const pair<_U1, _U2>& __in)
: _Inherited(__tag, __a, __in.first, __in.second) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename _U1, typename _U2,
_ExplicitCtor<true, const _U1&, const _U2&> = false>
explicit
tuple(allocator_arg_t __tag, const _Alloc& __a,
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
const pair<_U1, _U2>& __in)
: _Inherited(__tag, __a, __in.first, __in.second) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename _U1, typename _U2,
_ImplicitCtor<true, _U1, _U2> = true>
tuple(allocator_arg_t __tag, const _Alloc& __a, pair<_U1, _U2>&& __in)
: _Inherited(__tag, __a, std::forward<_U1>(__in.first),
std::forward<_U2>(__in.second)) { }
Refactor SFINAE constraints on std::tuple constructors Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
2019-06-06 14:13:36 +02:00
template<typename _Alloc, typename _U1, typename _U2,
_ExplicitCtor<true, _U1, _U2> = false>
explicit
tuple(allocator_arg_t __tag, const _Alloc& __a, pair<_U1, _U2>&& __in)
Implement N4387, "Improving pair and tuple", and LWG 2367. 2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com> Implement N4387, "Improving pair and tuple", and LWG 2367. * include/bits/stl_pair.h (_ConstructiblePair, _ImplicitlyConvertiblePair, _MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): New. (pair()): Constrain it. (pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&), pair(pair<_U1, _U2>&&)): Make conditionally explicit. * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New. (tuple()): Constrain it. (tuple(const _UElements&...), tuple(_UElements&&...), tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&), tuple(allocator_arg_t, const _Alloc&, const _UElements&...), tuple(allocator_arg_t, const _Alloc&, _UElements&&...), tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&), tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&), tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&), tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make conditionally explicit. * include/experimental/functional (__boyer_moore_array_base): Name array type explicitly instead of using an empty braced-init-list. * testsuite/20_util/pair/cons/explicit_construct.cc: New. * testsuite/20_util/pair/piecewise.cc: Use piecewise_construct. * testsuite/20_util/pair/requirements/dr2367.cc: New. * testsuite/20_util/tuple/cons/explicit_construct.cc: New. * testsuite/20_util/tuple/requirements/dr2367.cc: New. From-SVN: r225189
2015-06-30 15:26:49 +02:00
: _Inherited(__tag, __a, std::forward<_U1>(__in.first),
std::forward<_U2>(__in.second)) { }
tuple&
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
operator=(typename conditional<__assignable<const _T1&, const _T2&>(),
const tuple&,
const __nonesuch&>::type __in)
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
noexcept(__nothrow_assignable<const _T1&, const _T2&>())
{
this->_M_assign(__in);
return *this;
}
tuple&
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
operator=(typename conditional<__assignable<_T1, _T2>(),
tuple&&,
__nonesuch&&>::type __in)
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
noexcept(__nothrow_assignable<_T1, _T2>())
{
this->_M_assign(std::move(__in));
return *this;
}
template<typename _U1, typename _U2>
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
__enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
operator=(const tuple<_U1, _U2>& __in)
noexcept(__nothrow_assignable<const _U1&, const _U2&>())
{
this->_M_assign(__in);
return *this;
}
template<typename _U1, typename _U2>
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
__enable_if_t<__assignable<_U1, _U2>(), tuple&>
operator=(tuple<_U1, _U2>&& __in)
noexcept(__nothrow_assignable<_U1, _U2>())
{
this->_M_assign(std::move(__in));
return *this;
}
template<typename _U1, typename _U2>
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
__enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
operator=(const pair<_U1, _U2>& __in)
noexcept(__nothrow_assignable<const _U1&, const _U2&>())
{
this->_M_head(*this) = __in.first;
this->_M_tail(*this)._M_head(*this) = __in.second;
return *this;
}
template<typename _U1, typename _U2>
PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment PR libstdc++/86963 * include/std/tuple (__tuple_base): New class template with deleted copy assignment operator. (tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that implicit copy/move assignment operator will be deleted/suppressed. (tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper functions for SFINAE constraints on assignment operators. (tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable): New helper functions for exception specifications. (tuple::operator=(const tuple&), tuple::operator=(tuple&&)) (tuple<_T1, _T2>::operator=(const tuple&)) (tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to __nonesuch_no_braces when the operator should be defined implicitly. Use __nothrow_assignable for exception specifications. (tuple::operator=(const tuple<_UElements...>&)) (tuple::operator=(tuple<_UElements...>&&)) (tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&)) (tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&)) (tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using __assignable and use __nothrow_assignable for exception specifications. * python/libstdcxx/v6/printers.py (is_specialization_of): Accept gdb.Type as first argument, instead of a string. (StdTuplePrinter._iterator._is_nonempty_tuple): New method to check tuple for expected structure. (StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple. * testsuite/20_util/tuple/dr2729.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error to dg-prune-output. From-SVN: r263625
2018-08-17 19:52:49 +02:00
__enable_if_t<__assignable<_U1, _U2>(), tuple&>
operator=(pair<_U1, _U2>&& __in)
noexcept(__nothrow_assignable<_U1, _U2>())
{
this->_M_head(*this) = std::forward<_U1>(__in.first);
this->_M_tail(*this)._M_head(*this) = std::forward<_U2>(__in.second);
return *this;
}
void
stl_pair.h (swap): Do not swap rvalues. 2009-05-18 Jonathan Wakely <jwakely.gcc@gmail.com> * include/bits/stl_pair.h (swap): Do not swap rvalues. * include/bits/stl_deque.h (swap): Likewise. * include/bits/stl_list.h (swap): Likewise. * include/bits/stl_vector.h (swap): Likewise. * include/bits/stl_bvector.h (swap): Likewise. * include/bits/stl_queue.h (swap): Likewise. * include/bits/stl_stack.h (swap): Likewise. * include/bits/stl_tree.h (swap): Likewise. * include/bits/stl_map.h (swap): Likewise. * include/bits/stl_multimap.h (swap): Likewise. * include/bits/stl_set.h (swap): Likewise. * include/bits/stl_multiset.h (swap): Likewise. * include/bits/forward_list.h (swap): Likewise. * include/bits/unique_ptr.h (swap): Likewise. * include/debug/deque (swap): Likewise. * include/debug/list (swap): Likewise. * include/debug/vector (swap): Likewise. * include/debug/map.h (swap): Likewise. * include/debug/multimap.h (swap): Likewise. * include/debug/set.h (swap): Likewise. * include/debug/multiset.h (swap): Likewise. * include/debug/unordered_map (swap): Likewise. * include/debug/unordered_set (swap): Likewise. * include/ext/vstring.h (swap): Likewise. * include/tr1_impl/unordered_map (swap): Likewise. * include/tr1_impl/hashtable (swap): Likewise. * include/tr1_impl/unordered_set (swap): Likewise. * include/std/tuple (swap): Likewise. * include/std/mutex (swap): Likewise. * include/std/thread (swap): Likewise. (operator<<): Only output to lvalue streams. * testsuite/20_util/shared_ptr/modifiers/swap_rvalue.cc: Remove. * testsuite/23_containers/headers/forward_list/synopsis.cc: Adjust. * testsuite/23_containers/deque/requirements/dr438/ assign_neg.cc: Adjust line numbers. * testsuite/23_containers/deque/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ assign_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ assign_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/30_threads/thread/swap/1.cc: Swap with lvalue and also test non-member swap. * testsuite/30_threads/thread/swap/2.cc: Remove. From-SVN: r147678
2009-05-19 00:15:56 +02:00
swap(tuple& __in)
noexcept(__and_<__is_nothrow_swappable<_T1>,
__is_nothrow_swappable<_T2>>::value)
{ _Inherited::_M_swap(__in); }
};
/// class tuple_size
template<typename... _Elements>
struct tuple_size<tuple<_Elements...>>
: public integral_constant<std::size_t, sizeof...(_Elements)> { };
#if __cplusplus > 201402L
template <typename _Tp>
Implement P0607R0 "Inline Variables for Standard Library" for C++17 2017-03-23 Daniel Kruegler <daniel.kruegler@gmail.com> * include/bits/c++config (_GLIBCXX17_INLINE): Define. * include/bits/regex_constants.h (All std::regex_constants constants): Add _GLIBCXX17_INLINE as per P0607R0. * include/bits/std_mutex.h (defer_lock, try_to_lock, adopt_lock): Likewise. * include/bits/stl_pair.h (piecewise_construct): Likewise. * include/bits/uses_allocator.h (allocator_arg, uses_allocator_v) (__is_uses_allocator_constructible_v) (__is_nothrow_uses_allocator_constructible_v): Likewise. * include/std/chrono (treat_as_floating_point_v): Likewise. * include/std/functional (is_bind_expression_v, is_placeholder_v): Likewise. * include/std/optional (nullopt): Likewise. * include/std/ratio (ratio_equal_v, ratio_not_equal_v, ratio_less_v) ratio_less_equal_v, ratio_greater_v, ratio_greater_equal_v): Likewise. * include/std/system_error (is_error_code_enum_v) (is_error_condition_enum_v): Likewise. * include/std/tuple (tuple_size_v, ignore): Likewise. (ignore): Declare ignore constexpr as per LWG 2773, declare assignment constexpr as per LWG 2933. * include/std/type_traits (All variable templates): Add _GLIBCXX17_INLINE as per P0607R0. * include/std/variant (variant_size_v, variant_npos, __index_of_v) (__tuple_count_v, __exactly_once): Likewise. * testsuite/18_support/headers/new/synopsis.cc (hardware_destructive_interference_size) (hardware_constructive_interference_size): Likewise for commented-out variables. * testsuite/20_util/tuple/creation_functions/constexpr.cc: Add new test function for constexpr std::ignore (LWG 2773). * testsuite/20_util/tuple/creation_functions/constexpr_cpp14.cc: New test for LWG 2933. From-SVN: r246423
2017-03-23 20:40:07 +01:00
inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
#endif
/**
* Recursive case for tuple_element: strip off the first element in
* the tuple and retrieve the (i-1)th element of the remaining tuple.
*/
template<std::size_t __i, typename _Head, typename... _Tail>
struct tuple_element<__i, tuple<_Head, _Tail...> >
: tuple_element<__i - 1, tuple<_Tail...> > { };
/**
* Basis case for tuple_element: The first element is the one we're seeking.
*/
template<typename _Head, typename... _Tail>
struct tuple_element<0, tuple<_Head, _Tail...> >
{
typedef _Head type;
};
/**
* Error case for tuple_element: invalid index.
*/
template<size_t __i>
struct tuple_element<__i, tuple<>>
{
static_assert(__i < tuple_size<tuple<>>::value,
"tuple index is in range");
};
Implement C++17 variable templates for type traits. * include/std/chrono (treat_as_floating_point_v): New. * include/std/ratio (ratio_equal_v, ratio_not_equal_v) (ratio_less_v, ratio_less_equal_v, ratio_greater_v) (ratio_greater_equal_v): Likewise. * include/std/system_error (is_error_code_enum_v) (is_error_condition_enum_v): Likewise. * include/std/tuple (tuple_size_v): Likewise. * type_traits (conjunction_v, disjunction_v, negation_v) (is_void_v, is_null_pointer_v, is_integral_v, is_floating_point_v) (is_array_v, is_pointer_v, is_lvalue_reference_v) (is_rvalue_reference_v, is_member_object_pointer_v) (is_member_function_pointer_v, is_enum_v, is_union_v) (is_class_v, is_function_v, is_reference_v, is_arithmetic_v) (is_fundamental_v, is_object_v, is_scalar_v, is_compound_v) (is_member_pointer_v, is_const_v, is_volatile_v, is_trivial_v) (is_trivially_copyable_v, is_standard_layout_v) (is_pod_v, is_literal_type_v, is_empty_v, is_polymorphic_v) (is_abstract_v, is_final_v, is_signed_v, is_unsigned_v) (is_constructible_v, is_default_constructible_v) (is_copy_constructible_v, is_move_constructible_v) (is_assignable_v, is_copy_assignable_v, is_move_assignable_v) (is_destructible_v, is_trivially_constructible_v) (is_trivially_default_constructible_v) (is_trivially_copy_constructible_v, is_trivially_move_constructible_v) (is_trivially_assignable_v, is_trivially_copy_assignable_v) (is_trivially_move_assignable_v, is_trivially_destructible_v) (is_nothrow_constructible_v, is_nothrow_default_constructible_v) (is_nothrow_copy_constructible_v, is_nothrow_move_constructible_v) (is_nothrow_assignable_v, is_nothrow_copy_assignable_v) (is_nothrow_move_assignable_v, is_nothrow_destructible_v) (has_virtual_destructor_v, alignment_of_v, rank_v, extent_v) (is_same_v, is_base_of_v, is_convertible_v): Likewise. * testsuite/19_diagnostics/error_code/is_error_code_v.cc: Likewise. * testsuite/20_util/duration/requirements/treat_as_floating_point_v.cc: Likewise. * testsuite/20_util/ratio/requirements/ratio_equal_v.cc: Likewise. * testsuite/20_util/tuple/tuple_size_v.cc: Likewise. * testsuite/20_util/variable_templates_for_traits.cc: Likewise. From-SVN: r238892
2016-07-29 21:01:39 +02:00
template<std::size_t __i, typename _Head, typename... _Tail>
constexpr _Head&
__get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
{ return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
template<std::size_t __i, typename _Head, typename... _Tail>
constexpr const _Head&
__get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
{ return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
/// Return a reference to the ith element of a tuple.
template<std::size_t __i, typename... _Elements>
constexpr __tuple_element_t<__i, tuple<_Elements...>>&
get(tuple<_Elements...>& __t) noexcept
{ return std::__get_helper<__i>(__t); }
/// Return a const reference to the ith element of a const tuple.
template<std::size_t __i, typename... _Elements>
constexpr const __tuple_element_t<__i, tuple<_Elements...>>&
get(const tuple<_Elements...>& __t) noexcept
{ return std::__get_helper<__i>(__t); }
/// Return an rvalue reference to the ith element of a tuple rvalue.
template<std::size_t __i, typename... _Elements>
constexpr __tuple_element_t<__i, tuple<_Elements...>>&&
get(tuple<_Elements...>&& __t) noexcept
{
typedef __tuple_element_t<__i, tuple<_Elements...>> __element_type;
return std::forward<__element_type&&>(std::get<__i>(__t));
}
/// Return a const rvalue reference to the ith element of a const tuple rvalue.
template<std::size_t __i, typename... _Elements>
constexpr const __tuple_element_t<__i, tuple<_Elements...>>&&
get(const tuple<_Elements...>&& __t) noexcept
{
typedef __tuple_element_t<__i, tuple<_Elements...>> __element_type;
return std::forward<const __element_type&&>(std::get<__i>(__t));
}
#if __cplusplus >= 201402L
Implement SD-6: SG10 Feature Test Recommendations 2014-10-01 Edward Smith-Rowland <3dw4rd@verizon.net> Implement SD-6: SG10 Feature Test Recommendations * internal.h (lexer_state, spec_nodes): Add in__has_include__. * directives.c: Support __has_include__ builtin. * expr.c (parse_has_include): New function to parse __has_include__ builtin; (eval_token()): Use it. * files.c (_cpp_has_header()): New funtion to look for header; (open_file_failed()): Not an error to not find a header file for __has_include__. * identifiers.c (_cpp_init_hashtable()): Add entry for __has_include__. * pch.c (cpp_read_state): Lookup __has_include__. * traditional.c (enum ls, _cpp_scan_out_logical_line()): Walk through __has_include__ statements. 2014-10-01 Edward Smith-Rowland <3dw4rd@verizon.net> Implement SD-6: SG10 Feature Test Recommendations * c-cppbuiltin.c (c_cpp_builtins()): Define language feature macros and the __has_header macro. 2014-10-01 Edward Smith-Rowland <3dw4rd@verizon.net> Implement SD-6: SG10 Feature Test Recommendations * include/bits/basic_string.h: Add __cpp_lib feature test macro. * include/bits/stl_algobase.h: Ditto. * include/bits/stl_function.h: Ditto. * include/bits/unique_ptr.h: Ditto. * include/std/chrono: Ditto. * include/std/complex: Ditto. * include/std/iomanip: Ditto. * include/std/shared_mutex: Ditto. * include/std/tuple: Ditto. * include/std/type_traits: Ditto. * include/std/utility: Ditto. * testsuite/experimental/feat-cxx14.cc: New. * testsuite/experimental/feat-lib-fund.cc: New. * testsuite/20_util/declval/requirements/1_neg.cc: Adjust. * testsuite/20_util/duration/literals/range.cc: Adjust. * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust. * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Adjust. * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Adjust. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Adjust. * testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust. * testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc: Adjust. 2014-10-01 Edward Smith-Rowland <3dw4rd@verizon.net> Implement SD-6: SG10 Feature Test Recommendations * g++.dg/cpp1y/feat-cxx11-neg.C: New. * g++.dg/cpp1y/feat-cxx11.C: New. * g++.dg/cpp1y/feat-cxx14.C: New. * g++.dg/cpp1y/feat-cxx98.C: New. * g++.dg/cpp1y/feat-cxx98-neg.C: New. * g++.dg/cpp1y/phoobhar.h: New. * g++.dg/cpp1y/testinc/phoobhar.h: New. From-SVN: r215752
2014-10-01 13:49:23 +02:00
#define __cpp_lib_tuples_by_type 201304
template<typename _Head, size_t __i, typename... _Tail>
constexpr _Head&
__get_helper2(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
{ return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
template<typename _Head, size_t __i, typename... _Tail>
constexpr const _Head&
__get_helper2(const _Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
{ return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
/// Return a reference to the unique element of type _Tp of a tuple.
template <typename _Tp, typename... _Types>
constexpr _Tp&
get(tuple<_Types...>& __t) noexcept
{ return std::__get_helper2<_Tp>(__t); }
/// Return a reference to the unique element of type _Tp of a tuple rvalue.
template <typename _Tp, typename... _Types>
constexpr _Tp&&
get(tuple<_Types...>&& __t) noexcept
{ return std::forward<_Tp&&>(std::__get_helper2<_Tp>(__t)); }
/// Return a const reference to the unique element of type _Tp of a tuple.
template <typename _Tp, typename... _Types>
constexpr const _Tp&
get(const tuple<_Types...>& __t) noexcept
{ return std::__get_helper2<_Tp>(__t); }
/// Return a const reference to the unique element of type _Tp of
/// a const tuple rvalue.
template <typename _Tp, typename... _Types>
constexpr const _Tp&&
get(const tuple<_Types...>&& __t) noexcept
{ return std::forward<const _Tp&&>(std::__get_helper2<_Tp>(__t)); }
#endif
// This class performs the comparison operations on tuples
template<typename _Tp, typename _Up, size_t __i, size_t __size>
struct __tuple_compare
{
static constexpr bool
__eq(const _Tp& __t, const _Up& __u)
{
return bool(std::get<__i>(__t) == std::get<__i>(__u))
&& __tuple_compare<_Tp, _Up, __i + 1, __size>::__eq(__t, __u);
}
static constexpr bool
__less(const _Tp& __t, const _Up& __u)
{
return bool(std::get<__i>(__t) < std::get<__i>(__u))
|| (!bool(std::get<__i>(__u) < std::get<__i>(__t))
&& __tuple_compare<_Tp, _Up, __i + 1, __size>::__less(__t, __u));
}
};
template<typename _Tp, typename _Up, size_t __size>
struct __tuple_compare<_Tp, _Up, __size, __size>
{
static constexpr bool
__eq(const _Tp&, const _Up&) { return true; }
static constexpr bool
__less(const _Tp&, const _Up&) { return false; }
};
template<typename... _TElements, typename... _UElements>
constexpr bool
operator==(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{
static_assert(sizeof...(_TElements) == sizeof...(_UElements),
"tuple objects can only be compared if they have equal sizes.");
using __compare = __tuple_compare<tuple<_TElements...>,
tuple<_UElements...>,
0, sizeof...(_TElements)>;
return __compare::__eq(__t, __u);
}
template<typename... _TElements, typename... _UElements>
constexpr bool
operator<(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{
static_assert(sizeof...(_TElements) == sizeof...(_UElements),
"tuple objects can only be compared if they have equal sizes.");
using __compare = __tuple_compare<tuple<_TElements...>,
tuple<_UElements...>,
0, sizeof...(_TElements)>;
return __compare::__less(__t, __u);
}
template<typename... _TElements, typename... _UElements>
constexpr bool
operator!=(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{ return !(__t == __u); }
template<typename... _TElements, typename... _UElements>
constexpr bool
operator>(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{ return __u < __t; }
template<typename... _TElements, typename... _UElements>
constexpr bool
operator<=(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{ return !(__u < __t); }
template<typename... _TElements, typename... _UElements>
constexpr bool
operator>=(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{ return !(__t < __u); }
// NB: DR 705.
template<typename... _Elements>
constexpr tuple<typename __decay_and_strip<_Elements>::__type...>
make_tuple(_Elements&&... __args)
{
typedef tuple<typename __decay_and_strip<_Elements>::__type...>
__result_type;
return __result_type(std::forward<_Elements>(__args)...);
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2275. Why is forward_as_tuple not constexpr?
/// std::forward_as_tuple
template<typename... _Elements>
constexpr tuple<_Elements&&...>
forward_as_tuple(_Elements&&... __args) noexcept
{ return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); }
template<size_t, typename, typename, size_t>
struct __make_tuple_impl;
template<size_t _Idx, typename _Tuple, typename... _Tp, size_t _Nm>
struct __make_tuple_impl<_Idx, tuple<_Tp...>, _Tuple, _Nm>
: __make_tuple_impl<_Idx + 1,
tuple<_Tp..., __tuple_element_t<_Idx, _Tuple>>,
_Tuple, _Nm>
{ };
template<std::size_t _Nm, typename _Tuple, typename... _Tp>
struct __make_tuple_impl<_Nm, tuple<_Tp...>, _Tuple, _Nm>
{
typedef tuple<_Tp...> __type;
};
template<typename _Tuple>
struct __do_make_tuple
: __make_tuple_impl<0, tuple<>, _Tuple, std::tuple_size<_Tuple>::value>
{ };
// Returns the std::tuple equivalent of a tuple-like type.
template<typename _Tuple>
struct __make_tuple
: public __do_make_tuple<__remove_cvref_t<_Tuple>>
{ };
// Combines several std::tuple's into a single one.
template<typename...>
struct __combine_tuples;
template<>
struct __combine_tuples<>
{
typedef tuple<> __type;
};
template<typename... _Ts>
struct __combine_tuples<tuple<_Ts...>>
{
typedef tuple<_Ts...> __type;
};
template<typename... _T1s, typename... _T2s, typename... _Rem>
struct __combine_tuples<tuple<_T1s...>, tuple<_T2s...>, _Rem...>
{
typedef typename __combine_tuples<tuple<_T1s..., _T2s...>,
_Rem...>::__type __type;
};
// Computes the result type of tuple_cat given a set of tuple-like types.
template<typename... _Tpls>
struct __tuple_cat_result
{
typedef typename __combine_tuples
<typename __make_tuple<_Tpls>::__type...>::__type __type;
};
// Helper to determine the index set for the first tuple-like
// type of a given set.
template<typename...>
struct __make_1st_indices;
template<>
struct __make_1st_indices<>
{
typedef std::_Index_tuple<> __type;
};
template<typename _Tp, typename... _Tpls>
struct __make_1st_indices<_Tp, _Tpls...>
{
typedef typename std::_Build_index_tuple<std::tuple_size<
typename std::remove_reference<_Tp>::type>::value>::__type __type;
};
// Performs the actual concatenation by step-wise expanding tuple-like
// objects into the elements, which are finally forwarded into the
// result tuple.
template<typename _Ret, typename _Indices, typename... _Tpls>
struct __tuple_concater;
template<typename _Ret, std::size_t... _Is, typename _Tp, typename... _Tpls>
struct __tuple_concater<_Ret, std::_Index_tuple<_Is...>, _Tp, _Tpls...>
{
template<typename... _Us>
static constexpr _Ret
_S_do(_Tp&& __tp, _Tpls&&... __tps, _Us&&... __us)
{
typedef typename __make_1st_indices<_Tpls...>::__type __idx;
typedef __tuple_concater<_Ret, __idx, _Tpls...> __next;
return __next::_S_do(std::forward<_Tpls>(__tps)...,
std::forward<_Us>(__us)...,
std::get<_Is>(std::forward<_Tp>(__tp))...);
}
};
template<typename _Ret>
struct __tuple_concater<_Ret, std::_Index_tuple<>>
{
template<typename... _Us>
static constexpr _Ret
_S_do(_Us&&... __us)
{
return _Ret(std::forward<_Us>(__us)...);
}
};
/// tuple_cat
template<typename... _Tpls, typename = typename
enable_if<__and_<__is_tuple_like<_Tpls>...>::value>::type>
constexpr auto
tuple_cat(_Tpls&&... __tpls)
-> typename __tuple_cat_result<_Tpls...>::__type
{
typedef typename __tuple_cat_result<_Tpls...>::__type __ret;
typedef typename __make_1st_indices<_Tpls...>::__type __idx;
typedef __tuple_concater<__ret, __idx, _Tpls...> __concater;
return __concater::_S_do(std::forward<_Tpls>(__tpls)...);
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2301. Why is tie not constexpr?
/// tie
template<typename... _Elements>
constexpr tuple<_Elements&...>
tie(_Elements&... __args) noexcept
{ return tuple<_Elements&...>(__args...); }
/// swap
template<typename... _Elements>
Provide swappable traits (p0185r1) 2016-06-16 Daniel Kruegler <daniel.kruegler@gmail.com> Provide swappable traits (p0185r1) * include/std/type_traits (is_swappable, is_nothrow_swappable, is_swappable_with, is_nothrow_swappable_with, is_swappable_v, is_nothrow_swappable_v, is_swappable_with_v, is_nothrow_swappable_with_v): New. * include/bits/stl_pair.h: Use it as per p0185r1. * include/bits/stl_queue.h: Likewise. * include/bits/stl_stack.h: Likewise. * include/bits/unique_ptr.h: Likewise. * include/std/tuple: Likewise. * include/std/array: Likewise. Fix zero-size member swap. * include/bits/hashtable.h: Use __and_. * testsuite/20_util/is_nothrow_swappable/requirements/ explicit_instantiation.cc: Change test options to std=gnu++17. * testsuite/20_util/is_nothrow_swappable/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_nothrow_swappable/value.cc: Likewise. * testsuite/20_util/is_swappable/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_swappable/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_swappable/value.cc: Likewise. * testsuite/20_util/is_nothrow_swappable/requirements/ explicit_instantiation_ext.cc: New. * testsuite/20_util/is_nothrow_swappable/requirements/typedefs_ext.cc: New. * testsuite/20_util/is_nothrow_swappable/value.h: New. * testsuite/20_util/is_nothrow_swappable/value_ext.cc: New. * testsuite/20_util/is_nothrow_swappable_with/requirements/ explicit_instantiation.cc: New. * testsuite/20_util/is_nothrow_swappable_with/requirements/typedefs.cc: New. * testsuite/20_util/is_nothrow_swappable_with/value.cc: New. * testsuite/20_util/is_swappable/requirements/ explicit_instantiation_ext.cc: New. * testsuite/20_util/is_swappable/requirements/typedefs_ext.cc: New. * testsuite/20_util/is_swappable/value.h: New. * testsuite/20_util/is_swappable/value_ext.cc: New. * testsuite/20_util/is_swappable_with/requirements/ explicit_instantiation.cc: New. * testsuite/20_util/is_swappable_with/requirements/typedefs.cc: New. * testsuite/20_util/is_swappable_with/value.cc: New. * testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust dg-error line numbers. * testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc: Likewise. From-SVN: r237531
2016-06-16 17:07:19 +02:00
inline
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
// Constrained free swap overload, see p0185r1
typename enable_if<__and_<__is_swappable<_Elements>...>::value
>::type
#else
void
#endif
swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); }
Implement LWG 2766, Swapping non-swappable types and LWG 2749, swappable traits for variants. * include/bits/move.h (swap(_Tp&, _Tp&)): Constrain with __is_tuple_like. * include/bits/stl_pair.h (swap(pair<_T1, _T2>&, pair<_T1, _T2>&)): Add a deleted overload. * include/bits/unique_ptr.h (swap(unique_ptr<_Tp, _Dp>&, unique_ptr<_Tp, _Dp>&)): Likewise. * include/std/array (swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&)): Likewise. * include/std/optional (swap(optional<_Tp>&, optional<_Tp>&)): Likewise. * include/std/tuple (__is_tuple_like_impl, __is_tuple_like): Move to type_traits. (swap(tuple<_Elements...>&, tuple<_Elements...>&)): Add a deleted overload. * include/std/type_traits (__is_tuple_like_impl, __is_tuple_like): New. (swap(_Tp&, _Tp&)): Constrain with __is_tuple_like. * include/std/utility (__is_tuple_like_impl): Move to type_traits. * include/std/variant (swap(variant<_Types...>&, variant<_Types...>&)): Add a deleted overload. * testsuite/20_util/optional/swap/2.cc: Add tests for disabled swaps. * testsuite/20_util/pair/swap_cxx17.cc: New. * testsuite/20_util/tuple/swap_cxx17.cc: Likewise. * testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc: Likewise. * testsuite/20_util/variant/compile.cc: Add tests for disabled swaps. * testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc: New. * testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust. * testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc: Likewise. From-SVN: r243120
2016-12-01 17:23:21 +01:00
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
template<typename... _Elements>
typename enable_if<!__and_<__is_swappable<_Elements>...>::value>::type
swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
#endif
// A class (and instance) which can be used in 'tie' when an element
Implement P0607R0 "Inline Variables for Standard Library" for C++17 2017-03-23 Daniel Kruegler <daniel.kruegler@gmail.com> * include/bits/c++config (_GLIBCXX17_INLINE): Define. * include/bits/regex_constants.h (All std::regex_constants constants): Add _GLIBCXX17_INLINE as per P0607R0. * include/bits/std_mutex.h (defer_lock, try_to_lock, adopt_lock): Likewise. * include/bits/stl_pair.h (piecewise_construct): Likewise. * include/bits/uses_allocator.h (allocator_arg, uses_allocator_v) (__is_uses_allocator_constructible_v) (__is_nothrow_uses_allocator_constructible_v): Likewise. * include/std/chrono (treat_as_floating_point_v): Likewise. * include/std/functional (is_bind_expression_v, is_placeholder_v): Likewise. * include/std/optional (nullopt): Likewise. * include/std/ratio (ratio_equal_v, ratio_not_equal_v, ratio_less_v) ratio_less_equal_v, ratio_greater_v, ratio_greater_equal_v): Likewise. * include/std/system_error (is_error_code_enum_v) (is_error_condition_enum_v): Likewise. * include/std/tuple (tuple_size_v, ignore): Likewise. (ignore): Declare ignore constexpr as per LWG 2773, declare assignment constexpr as per LWG 2933. * include/std/type_traits (All variable templates): Add _GLIBCXX17_INLINE as per P0607R0. * include/std/variant (variant_size_v, variant_npos, __index_of_v) (__tuple_count_v, __exactly_once): Likewise. * testsuite/18_support/headers/new/synopsis.cc (hardware_destructive_interference_size) (hardware_constructive_interference_size): Likewise for commented-out variables. * testsuite/20_util/tuple/creation_functions/constexpr.cc: Add new test function for constexpr std::ignore (LWG 2773). * testsuite/20_util/tuple/creation_functions/constexpr_cpp14.cc: New test for LWG 2933. From-SVN: r246423
2017-03-23 20:40:07 +01:00
// of a tuple is not required.
// _GLIBCXX14_CONSTEXPR
// 2933. PR for LWG 2773 could be clearer
struct _Swallow_assign
{
template<class _Tp>
Implement P0607R0 "Inline Variables for Standard Library" for C++17 2017-03-23 Daniel Kruegler <daniel.kruegler@gmail.com> * include/bits/c++config (_GLIBCXX17_INLINE): Define. * include/bits/regex_constants.h (All std::regex_constants constants): Add _GLIBCXX17_INLINE as per P0607R0. * include/bits/std_mutex.h (defer_lock, try_to_lock, adopt_lock): Likewise. * include/bits/stl_pair.h (piecewise_construct): Likewise. * include/bits/uses_allocator.h (allocator_arg, uses_allocator_v) (__is_uses_allocator_constructible_v) (__is_nothrow_uses_allocator_constructible_v): Likewise. * include/std/chrono (treat_as_floating_point_v): Likewise. * include/std/functional (is_bind_expression_v, is_placeholder_v): Likewise. * include/std/optional (nullopt): Likewise. * include/std/ratio (ratio_equal_v, ratio_not_equal_v, ratio_less_v) ratio_less_equal_v, ratio_greater_v, ratio_greater_equal_v): Likewise. * include/std/system_error (is_error_code_enum_v) (is_error_condition_enum_v): Likewise. * include/std/tuple (tuple_size_v, ignore): Likewise. (ignore): Declare ignore constexpr as per LWG 2773, declare assignment constexpr as per LWG 2933. * include/std/type_traits (All variable templates): Add _GLIBCXX17_INLINE as per P0607R0. * include/std/variant (variant_size_v, variant_npos, __index_of_v) (__tuple_count_v, __exactly_once): Likewise. * testsuite/18_support/headers/new/synopsis.cc (hardware_destructive_interference_size) (hardware_constructive_interference_size): Likewise for commented-out variables. * testsuite/20_util/tuple/creation_functions/constexpr.cc: Add new test function for constexpr std::ignore (LWG 2773). * testsuite/20_util/tuple/creation_functions/constexpr_cpp14.cc: New test for LWG 2933. From-SVN: r246423
2017-03-23 20:40:07 +01:00
_GLIBCXX14_CONSTEXPR const _Swallow_assign&
operator=(const _Tp&) const
{ return *this; }
};
Implement P0607R0 "Inline Variables for Standard Library" for C++17 2017-03-23 Daniel Kruegler <daniel.kruegler@gmail.com> * include/bits/c++config (_GLIBCXX17_INLINE): Define. * include/bits/regex_constants.h (All std::regex_constants constants): Add _GLIBCXX17_INLINE as per P0607R0. * include/bits/std_mutex.h (defer_lock, try_to_lock, adopt_lock): Likewise. * include/bits/stl_pair.h (piecewise_construct): Likewise. * include/bits/uses_allocator.h (allocator_arg, uses_allocator_v) (__is_uses_allocator_constructible_v) (__is_nothrow_uses_allocator_constructible_v): Likewise. * include/std/chrono (treat_as_floating_point_v): Likewise. * include/std/functional (is_bind_expression_v, is_placeholder_v): Likewise. * include/std/optional (nullopt): Likewise. * include/std/ratio (ratio_equal_v, ratio_not_equal_v, ratio_less_v) ratio_less_equal_v, ratio_greater_v, ratio_greater_equal_v): Likewise. * include/std/system_error (is_error_code_enum_v) (is_error_condition_enum_v): Likewise. * include/std/tuple (tuple_size_v, ignore): Likewise. (ignore): Declare ignore constexpr as per LWG 2773, declare assignment constexpr as per LWG 2933. * include/std/type_traits (All variable templates): Add _GLIBCXX17_INLINE as per P0607R0. * include/std/variant (variant_size_v, variant_npos, __index_of_v) (__tuple_count_v, __exactly_once): Likewise. * testsuite/18_support/headers/new/synopsis.cc (hardware_destructive_interference_size) (hardware_constructive_interference_size): Likewise for commented-out variables. * testsuite/20_util/tuple/creation_functions/constexpr.cc: Add new test function for constexpr std::ignore (LWG 2773). * testsuite/20_util/tuple/creation_functions/constexpr_cpp14.cc: New test for LWG 2933. From-SVN: r246423
2017-03-23 20:40:07 +01:00
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2773. Making std::ignore constexpr
_GLIBCXX17_INLINE constexpr _Swallow_assign ignore{};
/// Partial specialization for tuples
template<typename... _Types, typename _Alloc>
struct uses_allocator<tuple<_Types...>, _Alloc> : true_type { };
// See stl_pair.h...
/** "piecewise construction" using a tuple of arguments for each member.
*
* @param __first Arguments for the first member of the pair.
* @param __second Arguments for the second member of the pair.
*
* The elements of each tuple will be used as the constructor arguments
* for the data members of the pair.
*/
template<class _T1, class _T2>
template<typename... _Args1, typename... _Args2>
inline
pair<_T1, _T2>::
pair(piecewise_construct_t,
tuple<_Args1...> __first, tuple<_Args2...> __second)
: pair(__first, __second,
typename _Build_index_tuple<sizeof...(_Args1)>::__type(),
typename _Build_index_tuple<sizeof...(_Args2)>::__type())
{ }
template<class _T1, class _T2>
template<typename... _Args1, std::size_t... _Indexes1,
typename... _Args2, std::size_t... _Indexes2>
inline
pair<_T1, _T2>::
pair(tuple<_Args1...>& __tuple1, tuple<_Args2...>& __tuple2,
_Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>)
: first(std::forward<_Args1>(std::get<_Indexes1>(__tuple1))...),
second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...)
{ }
cinttypes: Remove, move contents to C++0x and TR1 headers. 2010-11-02 Paolo Carlini <paolo.carlini@oracle.com> * include/tr1_impl/cinttypes: Remove, move contents to C++0x and TR1 headers. * include/tr1_impl/cstdlib: Likewise. * include/tr1_impl/cstdio: Likewise. * include/tr1_impl/cctype: Likewise. * include/tr1_impl/boost_sp_counted_base.h: Likewise. * include/tr1_impl/cmath: Likewise. * include/tr1_impl/cfenv: Likewise. * include/tr1_impl/utility: Likewise. * include/tr1_impl/complex: Likewise. * include/tr1_impl/cwchar: Likewise. * include/tr1_impl/type_traits: Likewise. * include/tr1_impl/cstdint: Likewise. * include/tr1_impl/regex: Likewise. * include/tr1_impl/array: Likewise. * include/tr1_impl/cwctype: Likewise. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * src/condition_variable.cc: Adjust; consistently use _GLIBCXX_BEGIN_NAMESPACE and _GLIBCXX_END_NAMESPACE. * src/mutex.cc: Likewise. * src/future.cc: Likewise. * src/atomic.cc: Likewise. * src/chrono.cc: Likewise. * src/thread.cc: Likewise. * include/std/tuple: Likewise. * include/std/utility: Likewise. * include/std/thread: Likewise.: Likewise. * include/std/type_traits: Likewise. * include/std/memory: Likewise. * include/std/future: Likewise. * include/std/ratio: Likewise. * include/std/chrono: Likewise. * include/std/condition_variable: Likewise. * include/std/mutex: Likewise. * include/std/functional: Likewise. * include/std/complex: Likewise. * include/std/typeindex: Likewise. * include/std/array: Likewise. * include/bits/regex_compiler.h: Likewise. * include/bits/regex_grep_matcher.tcc: Likewise. * include/bits/regex_grep_matcher.h: Likewise. * include/bits/regex_constants.h: Likewise. * include/bits/regex_cursor.h: Likewise. * include/bits/regex_nfa.tcc: Likewise. * include/bits/shared_ptr_base.h: Likewise. * include/bits/regex_nfa.h: Likewise. * include/bits/random.tcc: Likewise. * include/bits/regex.h: Likewise. * include/bits/random.h: Likewise. * include/bits/regex_error.h: Likewise. * include/c_global/cinttypes: Likewise. * include/c_global/cstdlib: Likewise. * include/c_global/cstdio: Likewise. * include/c_global/cctype: Likewise. * include/c_global/cmath: Likewise. * include/c_global/cfenv: Likewise. * include/c_global/cwchar: Likewise. * include/c_global/cstdint: Likewise. * include/c_global/cwctype: Likewise. * include/tr1/shared_ptr.h: Likewise. * include/tr1/cinttypes: Likewise. * include/tr1/cstdio: Likewise. * include/tr1/cfenv: Likewise. * include/tr1/utility: Likewise. * include/tr1/cwchar: Likewise. * include/tr1/type_traits: Likewise. * include/tr1/memory: Likewise. * include/tr1/cstdint: Likewise. * include/tr1/regex: Likewise. * include/tr1/cwctype: Likewise. * include/tr1/cstdlib: Likewise. * include/tr1/cctype: Likewise. * include/tr1/cmath: Likewise. * include/tr1/complex: Likewise. * include/tr1/array: Likewise. * include/c_compatibility/fenv.h: Likewise. * include/c_compatibility/stdint.h: Likewise. * include/c_compatibility/inttypes.h: Likewise. * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc: Adjust dg-error line numbers. * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise. * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise. * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/make_unsigned/requirements/ typedefs_neg.cc: Likewise. * testsuite/20_util/declval/requirements/1_neg.cc: Likewise. * testsuite/20_util/shared_ptr/cons/43820.cc: Likewise. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise. From-SVN: r166211
2010-11-02 19:51:23 +01:00
#if __cplusplus >= 201703L
# define __cpp_lib_apply 201603
template <typename _Fn, typename _Tuple, size_t... _Idx>
constexpr decltype(auto)
__apply_impl(_Fn&& __f, _Tuple&& __t, index_sequence<_Idx...>)
{
return std::__invoke(std::forward<_Fn>(__f),
std::get<_Idx>(std::forward<_Tuple>(__t))...);
}
template <typename _Fn, typename _Tuple>
constexpr decltype(auto)
apply(_Fn&& __f, _Tuple&& __t)
{
using _Indices
= make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>;
return std::__apply_impl(std::forward<_Fn>(__f),
std::forward<_Tuple>(__t),
_Indices{});
}
#define __cpp_lib_make_from_tuple 201606
template <typename _Tp, typename _Tuple, size_t... _Idx>
constexpr _Tp
__make_from_tuple_impl(_Tuple&& __t, index_sequence<_Idx...>)
{ return _Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...); }
template <typename _Tp, typename _Tuple>
constexpr _Tp
make_from_tuple(_Tuple&& __t)
{
return __make_from_tuple_impl<_Tp>(
std::forward<_Tuple>(__t),
make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>{});
}
#endif // C++17
/// @}
PR libstdc++/36104 part four 2011-01-30 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 part four * include/bits/c++config (_GLIBCXX_STD): Remove. (_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C. (_GLIBCXX_P): Now _GLIBCXX_STD_A. (_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL, _GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove. (_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL, _GLIBCXX_INLINE_PROFILE): Remove. (_GLIBCXX_BEGIN_NAMESPACE(X)): Remove. (_GLIBCXX_END_NAMESPACE): Remove. (_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove. (_GLIBCXX_END_NESTED_NAMESPACE): Remove. (_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add. (_GLIBCXX_END_NAMESPACE_ALGO): Add. (_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add. (_GLIBCXX_END_NAMESPACE_CONTAINER): Add. (_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add. (_GLIBCXX_END_NAMESPACE_VERSION): Add. (_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL. (_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL. (_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY. * include/*: Use new macros for namespace scope. * config/*: Same. * src/*: Same. * src/Makefile.am (sources): Remove debug_list.cc, add compatibility-debug_list-2.cc. (parallel_sources): Remove parallel_list.cc, add compatibility-parallel_list-2.cc. (compatibility-parallel_list-2.[o,lo]): New rule. * src/Makefile.in: Regenerate. * src/debug_list.cc: Remove. * src/parallel_list.cc: Remove. * src/compatibility-list-2.cc: New. * src/compatibility-debug_list-2.cc: New. * src/compatibility-parallel_list-2.cc: New. * doc/doxygen/user.cfg.in: Adjust macros. * testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros. * testsuite/20_util/declval/requirements/1_neg.cc: Same. * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same. * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same. * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same. * testsuite/20_util/forward/c_neg.cc: Same. * testsuite/20_util/forward/f_neg.cc: Same. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same. * testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same. * testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same. * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same. * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same. * testsuite/23_containers/deque/requirements/dr438/ constructor_1_neg.cc: Same. * testsuite/23_containers/deque/requirements/dr438/ constructor_2_neg.cc: Same. * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same. * testsuite/23_containers/forward_list/capacity/1.cc: Same. * testsuite/23_containers/forward_list/requirements/dr438/ assign_neg.cc: Same. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_1_neg.cc: Same. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_2_neg.cc: Same. * testsuite/23_containers/forward_list/requirements/dr438/ insert_neg.cc: Same. * testsuite/23_containers/list/capacity/29134.cc: Same. * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same. * testsuite/23_containers/list/requirements/dr438/ constructor_1_neg.cc: Same. * testsuite/23_containers/list/requirements/dr438/ constructor_2_neg.cc: Same. * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same. * testsuite/23_containers/vector/bool/capacity/29134.cc: Same. * testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Same. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Same. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same. * testsuite/25_algorithms/sort/35588.cc: Same. * testsuite/27_io/ios_base/cons/assign_neg.cc: Same. * testsuite/27_io/ios_base/cons/copy_neg.cc: Same. * testsuite/ext/profile/mutex_extensions_neg.cc: Same. * testsuite/ext/profile/profiler_algos.cc: Same. * testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same. * testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same. * testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same. * testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same. * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same. From-SVN: r169421
2011-01-30 23:39:36 +01:00
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Add c_global. * configure.host (c_model): Set default to c_global. * configure: Regenerate. * include/Makefile.am (c_compatibility_headers_extra): Make conditional on GLIBCXX_C_HEADERS_COMPATIBILITY. (c_base_headers_extra): Make conditional on GLIBCXX_C_HEADERS_EXTRA. (c_compatibility_headers): Make conditional on c/c_std/c_global. * include/Makefile.in: Regenerate. * docs/html/configopts.html: Add c_global information to --enable-cheaders. Eventually, "c_std" should mean "C" includes that are in namespace std, with optional C++ "C" compatibility includes to inject into global scope. And "c_global" should mean "C" includes that are in the global namespace, with C++ includes injecting into namespace std and no C++ "C" compatibility includes. 2007-03-04 Benjamin Kosnik <bkoz@redhat.com> * include/bits/c++config: Add _GLIBCXX_NAMEPACE_C. Add _GLIBCXX_NAMESPACE_ASSOCIATION_CXX200x. Add _GLIBCXX_TR1 as namespace macro. Add namespace associations for std::__cxx200x conditionally. * include/c_compatibility/assert.h: Correct doxygen markup, conditionalize the global injections on _GLIBCXX_NAMESPACE_C. * include/c_compatibility/ctype.h: Same. * include/c_compatibility/errno.h: Same. * include/c_compatibility/float.h: Same. * include/c_compatibility/iso646.h: Same. * include/c_compatibility/limits.h: Same. * include/c_compatibility/locale.h: Same. * include/c_compatibility/math.h: Same. * include/c_compatibility/setjmp.h: Same. * include/c_compatibility/signal.h: Same. * include/c_compatibility/stdarg.h: Same. * include/c_compatibility/stddef.h: Same. * include/c_compatibility/stdio.h: Same. * include/c_compatibility/stdlib.h: Same. * include/c_compatibility/string.h: Same. * include/c_compatibility/time.h: Same. * include/c_compatibility/wchar.h: Same. * include/c_compatibility/wctype.h: Same. * include/c_compatibility/complex.h: Add. * include/c_compatibility/fenv.h: Same. * include/c_compatibility/inttypes.h: Same. * include/c_compatibility/stdbool.h: Same. * include/c_compatibility/stdint.h: Same. * include/c_compatibility/tgmath.h: Same. * include/c_global/cassert: Add, use include_next, use C++0x features if -std=c++0x. * include/c_global/cctype: Same. * include/c_global/cerrno: Same. * include/c_global/cfloat: Same. * include/c_global/ciso646: Same. * include/c_global/climits: Same. * include/c_global/clocale: Same. * include/c_global/cmath: Same. * include/c_global/cmath.tcc: Same. * include/c_global/csetjmp: Same. * include/c_global/csignal: Same. * include/c_global/cstdarg: Same. * include/c_global/cstddef: Same. * include/c_global/cstdio: Same. * include/c_global/cstdlib: Same. * include/c_global/cstring: Same. * include/c_global/ctime: Same. * include/c_global/cwchar: Same. * include/c_global/cwctype: Same. * include/c_global/ccomplex: Add. * include/c_global/cfenv: Add. * include/c_global/cinttypes: Add. * include/c_global/cstdbool: Add. * include/c_global/cstdint: Add. * include/c_global/ctgmath: Add. * include/std/algorithm: Use C++0x features if -std=c++0x. * include/std/bitset: Same. * include/std/complex: Same. * include/std/deque: Same. * include/std/fstream: Same. * include/std/functional: Same. * include/std/iomanip: Same. * include/std/ios: Same. * include/std/iosfwd: Same. * include/std/iostream: Same. * include/std/istream: Same. * include/std/iterator: Same. * include/std/limits: Same. * include/std/list: Same. * include/std/locale: Same. * include/std/map: Same. * include/std/memory: Same. * include/std/numeric: Same. * include/std/ostream: Same. * include/std/queue: Same. * include/std/set: Same. * include/std/sstream: Same. * include/std/stack: Same. * include/std/stdexcept: Same. * include/std/streambuf: Same. * include/std/string: Same. * include/std/utility: Same. * include/std/valarray: Same. * include/std/vector: Same. * include/std/array: Add. * include/std/random: Add. * include/std/regex: Add. * include/std/tuple: Add. * include/std/type_traits: Add. * include/std/unordered_map: Add. * include/std/unordered_set: Add. * include/std/c++0x_warning.h: Add. * include/tr1/array: Switch namespaces based on _GLIBCXX_TR1. * include/tr1/boost_shared_ptr.h: Same. * include/tr1/cctype: Same. * include/tr1/cfenv: Same. * include/tr1/cinttypes: Same. * include/tr1/cmath: Same. * include/tr1/common.h: Same. * include/tr1/complex: Same. * include/tr1/cstdint: Same. * include/tr1/cstdio: Same. * include/tr1/cstdlib: Same. * include/tr1/cwchar: Same. * include/tr1/cwctype: Same. * include/tr1/functional: Same. * include/tr1/functional_hash.h: Same. * include/tr1/functional_iterate.h: Same. * include/tr1/hashtable: Same. * include/tr1/hashtable_policy.h: Same. * include/tr1/math.h: Same. * include/tr1/memory: Same. * include/tr1/random: Same. * include/tr1/random.tcc: Same. * include/tr1/ref_fwd.h: Same. * include/tr1/repeat.h: Same. * include/tr1/stdlib.h: Same. * include/tr1/tuple: Same. * include/tr1/tuple_iterate.h: Same. * include/tr1/type_traits: Same. * include/tr1/type_traits_fwd.h: Same. * include/tr1/unordered_map: Same. * include/tr1/unordered_set: Same. * include/tr1/utility: Same. * include/tr1/ccomplex: Add. * include/tr1/complex.h: Add. * include/tr1/regex: Add. * include/Makefile.am: Add C++0x headers, "C" compatibility headers. * include/Makefile.in: Regenerate. * testsuite/tr1/headers.cc: Add in regex/complex. * testsuite/17_intro/headers/c++200x/all.cc: New. * testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc: Same. * testsuite/17_intro/using_namespace_std_tr1_neg.cc: Same. * testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/std_c++0x_neg.cc: Same. * testsuite/18_support/headers/cstdint/types_std_c++0x.cc: Same. * testsuite/20_util/enable_shared_from_this/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/headers/functional/types_std_c++0x.cc: Same. * testsuite/20_util/headers/functional/ using_namespace_std_placeholders.cc: Same. * testsuite/20_util/headers/memory/types_std_c++0x.cc: Same. * testsuite/20_util/headers/type_traits/std_c++0x_neg.cc: Same. * testsuite/20_util/headers/type_traits/types_std_c++0x.cc: Same. * testsuite/20_util/shared_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/20_util/weak_ptr/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/array/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/hash/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/headers/array/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/tuple/types_std_c++0x.cc: Same. * testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc: Same. * testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc: Same. * testsuite/23_containers/tuple/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation.cc: Same. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation.cc: Same. * testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/cfenv/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cmath/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc: Same. * testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/std_c++0x_neg.cc: Same. * testsuite/26_numerics/headers/random/types_std_c++0x.cc: Same. * testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc: Same. * testsuite/27_io/headers/cinttypes/types_std_c++0x.cc: Same. * testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types.cc: Rename ... * testsuite/tr1/8_c_compatibility/cinttypes/types.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types.cc: Same. * testsuite/tr1/8_c_compatibility/cfenv/types_std_tr1.cc: ...to this. * testsuite/tr1/8_c_compatibility/cinttypes/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cmath/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc: Same. * testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc: Same. From-SVN: r122533
2007-03-04 23:59:49 +01:00
#endif // C++11
#endif // _GLIBCXX_TUPLE