diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2015-11-13 10:01:05 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2015-11-13 10:01:05 +0000 |
commit | 8014404589079fd5a775d0e3eeafa5fc65d1162b (patch) | |
tree | 4cac8c98f5106f28bc667469783d37a3a5426db3 | |
parent | bfeffbd1ae0d682c660d13cdc526ae83235cdd14 (diff) | |
download | gcc-8014404589079fd5a775d0e3eeafa5fc65d1162b.tar.gz |
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
-rw-r--r-- | libstdc++-v3/ChangeLog | 16 | ||||
-rw-r--r-- | libstdc++-v3/include/Makefile.am | 1 | ||||
-rw-r--r-- | libstdc++-v3/include/Makefile.in | 1 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/deque | 11 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/forward_list | 11 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/list | 11 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/map | 18 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/memory_resource | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/regex | 72 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/set | 15 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/string | 22 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/unordered_map | 20 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/unordered_set | 19 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/vector | 11 |
14 files changed, 230 insertions, 0 deletions
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 <jwakely@redhat.com> + + * 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 <youfan.noey@gmail.com> * 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 <deque> #include <algorithm> +#include <experimental/memory_resource> namespace std _GLIBCXX_VISIBILITY(default) { @@ -63,6 +64,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template<typename _Tp> + 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 <forward_list> +#include <experimental/memory_resource> namespace std _GLIBCXX_VISIBILITY(default) { @@ -59,6 +60,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template<typename _Tp> + 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 <list> +#include <experimental/memory_resource> namespace std _GLIBCXX_VISIBILITY(default) { @@ -59,6 +60,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template<typename _Tp> + 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 <map> #include <experimental/bits/erase_if.h> +#include <experimental/memory_resource> 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<typename _Key, typename _Tp, typename _Compare = less<_Key>> + using map + = std::map<_Key, _Tp, _Compare, + polymorphic_allocator<pair<const _Key, _Tp>>>; + + template<typename _Key, typename _Tp, typename _Compare = less<_Key>> + using multimap + = std::multimap<_Key, _Tp, _Compare, + polymorphic_allocator<pair<const _Key, _Tp>>>; + +_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 <typename _Tp> 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 @@ +// <experimental/regex> -*- 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 +// <http://www.gnu.org/licenses/>. + +/** @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 <bits/c++14_warning.h> +#else + +#include <regex> +#include <experimental/string> + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +inline namespace fundamentals_v2 +{ +namespace pmr +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + template<typename _BidirectionalIterator> + using match_results + = std::match_results<_BidirectionalIterator, polymorphic_allocator< + sub_match<_BidirectionalIterator>>>; + + typedef match_results<const char*> cmatch; + typedef match_results<const wchar_t*> wcmatch; + typedef match_results<string::const_iterator> smatch; + typedef match_results<wstring::const_iterator> 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 <set> #include <experimental/bits/erase_if.h> +#include <experimental/memory_resource> 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<typename _Key, typename _Compare = less<_Key>> + using set = std::set<_Key, _Compare, polymorphic_allocator<_Key>>; + + template<typename _Key, typename _Compare = less<_Key>> + 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 <string> #include <algorithm> +#include <experimental/memory_resource> 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<typename _CharT, typename _Traits = char_traits<_CharT>> + 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<char> string; + typedef basic_string<char16_t> u16string; + typedef basic_string<char32_t> u32string; + typedef basic_string<wchar_t> 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 <unordered_map> #include <experimental/bits/erase_if.h> +#include <experimental/memory_resource> 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 _Key, typename _Tp, typename _Hash = hash<_Key>, + typename _Pred = equal_to<_Key>> + using unordered_map + = std::unordered_map<_Key, _Tp, _Hash, _Pred, + polymorphic_allocator<pair<const _Key, _Tp>>>; + + template<typename _Key, typename _Tp, typename _Hash = hash<_Key>, + typename _Pred = equal_to<_Key>> + using unordered_multimap + = std::unordered_multimap<_Key, _Tp, _Hash, _Pred, + polymorphic_allocator<pair<const _Key, _Tp>>>; + +_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 <unordered_set> #include <experimental/bits/erase_if.h> +#include <experimental/memory_resource> 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 _Key, typename _Hash = hash<_Key>, + typename _Pred = equal_to<_Key>> + using unordered_set + = std::unordered_set<_Key, _Hash, _Pred, polymorphic_allocator<_Key>>; + + template<typename _Key, typename _Hash = hash<_Key>, + 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 <vector> #include <algorithm> +#include <experimental/memory_resource> namespace std _GLIBCXX_VISIBILITY(default) { @@ -65,6 +66,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _GLIBCXX_END_NAMESPACE_VERSION + +namespace pmr { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template<typename _Tp> + using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace pmr + } // namespace fundamentals_v2 } // namespace experimental } // namespace std |