From 8014404589079fd5a775d0e3eeafa5fc65d1162b Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 13 Nov 2015 10:01:05 +0000 Subject: [PATCH] Define alias templates using polymorphic memory resources * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/experimental/memory_resource: Add feature-test macro. * include/experimental/regex: New. * include/experimental/deque: Add alias template using PMR. * include/experimental/forward_list: Likewise. * include/experimental/list: Likewise. * include/experimental/map: Likewise. * include/experimental/set: Likewise. * include/experimental/string: Likewise. * include/experimental/unordered_map: Likewise. * include/experimental/unordered_set: Likewise. * include/experimental/vector: Likewise. From-SVN: r230295 --- libstdc++-v3/ChangeLog | 16 +++++ libstdc++-v3/include/Makefile.am | 1 + libstdc++-v3/include/Makefile.in | 1 + libstdc++-v3/include/experimental/deque | 11 +++ .../include/experimental/forward_list | 11 +++ libstdc++-v3/include/experimental/list | 11 +++ libstdc++-v3/include/experimental/map | 18 +++++ .../include/experimental/memory_resource | 2 + libstdc++-v3/include/experimental/regex | 72 +++++++++++++++++++ libstdc++-v3/include/experimental/set | 15 ++++ libstdc++-v3/include/experimental/string | 22 ++++++ .../include/experimental/unordered_map | 20 ++++++ .../include/experimental/unordered_set | 19 +++++ libstdc++-v3/include/experimental/vector | 11 +++ 14 files changed, 230 insertions(+) create mode 100644 libstdc++-v3/include/experimental/regex diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f52bfef65d5..bae1b962cc3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,19 @@ +2015-11-13 Jonathan Wakely + + * include/Makefile.am: Add new header. + * include/Makefile.in: Regenerate. + * include/experimental/memory_resource: Add feature-test macro. + * include/experimental/regex: New. + * include/experimental/deque: Add alias template using PMR. + * include/experimental/forward_list: Likewise. + * include/experimental/list: Likewise. + * include/experimental/map: Likewise. + * include/experimental/set: Likewise. + * include/experimental/string: Likewise. + * include/experimental/unordered_map: Likewise. + * include/experimental/unordered_set: Likewise. + * include/experimental/vector: Likewise. + 2015-11-13 Fan You * include/Makefile.am: Add new headers. diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index ee9b6d8c246..67d83790207 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -661,6 +661,7 @@ experimental_headers = \ ${experimental_srcdir}/optional \ ${experimental_srcdir}/propagate_const \ ${experimental_srcdir}/ratio \ + ${experimental_srcdir}/regex \ ${experimental_srcdir}/set \ ${experimental_srcdir}/string \ ${experimental_srcdir}/string_view \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 482fdb406a7..519c6be663c 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -950,6 +950,7 @@ experimental_headers = \ ${experimental_srcdir}/optional \ ${experimental_srcdir}/propagate_const \ ${experimental_srcdir}/ratio \ + ${experimental_srcdir}/regex \ ${experimental_srcdir}/set \ ${experimental_srcdir}/string \ ${experimental_srcdir}/string_view \ diff --git a/libstdc++-v3/include/experimental/deque b/libstdc++-v3/include/experimental/deque index 8d3d8951e3a..72149939a25 100644 --- a/libstdc++-v3/include/experimental/deque +++ b/libstdc++-v3/include/experimental/deque @@ -37,6 +37,7 @@ #include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { @@ -63,6 +64,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + using deque = std::deque<_Tp, polymorphic_allocator<_Tp>>; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace pmr + } // namespace fundamentals_v2 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/forward_list b/libstdc++-v3/include/experimental/forward_list index e7e6b33bd00..bceaccc96b1 100644 --- a/libstdc++-v3/include/experimental/forward_list +++ b/libstdc++-v3/include/experimental/forward_list @@ -36,6 +36,7 @@ #else #include +#include namespace std _GLIBCXX_VISIBILITY(default) { @@ -59,6 +60,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + using forward_list = std::forward_list<_Tp, polymorphic_allocator<_Tp>>; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace pmr + } // namespace fundamentals_v2 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/list b/libstdc++-v3/include/experimental/list index 41d6e1dcbdc..4209d0e9eb4 100644 --- a/libstdc++-v3/include/experimental/list +++ b/libstdc++-v3/include/experimental/list @@ -36,6 +36,7 @@ #else #include +#include namespace std _GLIBCXX_VISIBILITY(default) { @@ -59,6 +60,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + using list = std::list<_Tp, polymorphic_allocator<_Tp>>; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace pmr + } // namespace fundamentals_v2 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/map b/libstdc++-v3/include/experimental/map index 89bf2605091..757065acf5a 100644 --- a/libstdc++-v3/include/experimental/map +++ b/libstdc++-v3/include/experimental/map @@ -37,6 +37,7 @@ #include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { @@ -59,6 +60,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { __detail::__erase_nodes_if(__cont, __pred); } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template> + using map + = std::map<_Key, _Tp, _Compare, + polymorphic_allocator>>; + + template> + using multimap + = std::multimap<_Key, _Tp, _Compare, + polymorphic_allocator>>; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace pmr + } // namespace fundamentals_v2 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/memory_resource b/libstdc++-v3/include/experimental/memory_resource index 5c8cbd6f133..983b21108e2 100644 --- a/libstdc++-v3/include/experimental/memory_resource +++ b/libstdc++-v3/include/experimental/memory_resource @@ -41,6 +41,8 @@ inline namespace fundamentals_v2 { namespace pmr { _GLIBCXX_BEGIN_NAMESPACE_VERSION +#define __cpp_lib_experimental_memory_resources 201402L + class memory_resource; template diff --git a/libstdc++-v3/include/experimental/regex b/libstdc++-v3/include/experimental/regex new file mode 100644 index 00000000000..44ebf68ffc8 --- /dev/null +++ b/libstdc++-v3/include/experimental/regex @@ -0,0 +1,72 @@ +// -*- C++ -*- + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/regex + * This is a TS C++ Library header. + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_REGEX +#define _GLIBCXX_EXPERIMENTAL_REGEX 1 + +#pragma GCC system_header + +#if __cplusplus <= 201103L +# include +#else + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +inline namespace fundamentals_v2 +{ +namespace pmr +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + template + using match_results + = std::match_results<_BidirectionalIterator, polymorphic_allocator< + sub_match<_BidirectionalIterator>>>; + + typedef match_results cmatch; + typedef match_results wcmatch; + typedef match_results smatch; + typedef match_results wsmatch; + +_GLIBCXX_END_NAMESPACE_CXX11 +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace pmr + +} // namespace fundamentals_v2 +} // namespace experimental +} // namespace std + +#endif // C++14 + +#endif // _GLIBCXX_EXPERIMENTAL_REGEX diff --git a/libstdc++-v3/include/experimental/set b/libstdc++-v3/include/experimental/set index 709fe327475..be2f213f9d6 100644 --- a/libstdc++-v3/include/experimental/set +++ b/libstdc++-v3/include/experimental/set @@ -37,6 +37,7 @@ #include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { @@ -59,6 +60,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { __detail::__erase_nodes_if(__cont, __pred); } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template> + using set = std::set<_Key, _Compare, polymorphic_allocator<_Key>>; + + template> + using multiset = std::multiset<_Key, _Compare, + polymorphic_allocator<_Key>>; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace pmr + } // namespace fundamentals_v2 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/string b/libstdc++-v3/include/experimental/string index 2a04ce0d72d..3549c0933b3 100644 --- a/libstdc++-v3/include/experimental/string +++ b/libstdc++-v3/include/experimental/string @@ -37,6 +37,7 @@ #include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { @@ -64,6 +65,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + // basic_string using polymorphic allocator in namespace pmr + template> + using basic_string = + std::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>; + + // basic_string typedef names using polymorphic allocator in namespace + // std::experimental::pmr + typedef basic_string string; + typedef basic_string u16string; + typedef basic_string u32string; + typedef basic_string wstring; + +_GLIBCXX_END_NAMESPACE_CXX11 +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace pmr + } // namespace fundamentals_v2 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/unordered_map b/libstdc++-v3/include/experimental/unordered_map index c80c3828ded..9fb14e7d2ce 100644 --- a/libstdc++-v3/include/experimental/unordered_map +++ b/libstdc++-v3/include/experimental/unordered_map @@ -37,6 +37,7 @@ #include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { @@ -61,6 +62,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { __detail::__erase_nodes_if(__cont, __pred); } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template, + typename _Pred = equal_to<_Key>> + using unordered_map + = std::unordered_map<_Key, _Tp, _Hash, _Pred, + polymorphic_allocator>>; + + template, + typename _Pred = equal_to<_Key>> + using unordered_multimap + = std::unordered_multimap<_Key, _Tp, _Hash, _Pred, + polymorphic_allocator>>; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace pmr + } // namespace fundamentals_v2 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/unordered_set b/libstdc++-v3/include/experimental/unordered_set index 8461f9ccb91..038d23498aa 100644 --- a/libstdc++-v3/include/experimental/unordered_set +++ b/libstdc++-v3/include/experimental/unordered_set @@ -37,6 +37,7 @@ #include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { @@ -61,6 +62,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { __detail::__erase_nodes_if(__cont, __pred); } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template, + typename _Pred = equal_to<_Key>> + using unordered_set + = std::unordered_set<_Key, _Hash, _Pred, polymorphic_allocator<_Key>>; + + template, + typename _Pred = equal_to<_Key>> + using unordered_multiset + = std::unordered_multiset<_Key, _Hash, _Pred, + polymorphic_allocator<_Key>>; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace pmr + } // namespace fundamentals_v2 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/vector b/libstdc++-v3/include/experimental/vector index 37645a144ca..cddb7473939 100644 --- a/libstdc++-v3/include/experimental/vector +++ b/libstdc++-v3/include/experimental/vector @@ -37,6 +37,7 @@ #include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { @@ -65,6 +66,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace pmr + } // namespace fundamentals_v2 } // namespace experimental } // namespace std -- 2.30.2