Define alias templates using polymorphic memory resources
authorJonathan Wakely <jwakely@redhat.com>
Fri, 13 Nov 2015 10:01:05 +0000 (10:01 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 13 Nov 2015 10:01:05 +0000 (10:01 +0000)
* 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

14 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/experimental/deque
libstdc++-v3/include/experimental/forward_list
libstdc++-v3/include/experimental/list
libstdc++-v3/include/experimental/map
libstdc++-v3/include/experimental/memory_resource
libstdc++-v3/include/experimental/regex [new file with mode: 0644]
libstdc++-v3/include/experimental/set
libstdc++-v3/include/experimental/string
libstdc++-v3/include/experimental/unordered_map
libstdc++-v3/include/experimental/unordered_set
libstdc++-v3/include/experimental/vector

index f52bfef65d5622e92d9a5629320958de83d400ca..bae1b962cc3cc3df2d8e0e8199b042493d6b17d1 100644 (file)
@@ -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.
index ee9b6d8c246292c195114e50c96a6286f8766bfd..67d8379020743e642fde9daf7df17204617f0285 100644 (file)
@@ -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 \
index 482fdb406a79d0e547831037aa3e07683cd810e9..519c6be663cd62248de895b64b81f95ced37a1e1 100644 (file)
@@ -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 \
index 8d3d8951e3a0be3f669b8c0aa8599dbe32e6ce68..72149939a25477f91e520a64bf9c1e003dc12ad9 100644 (file)
@@ -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
index e7e6b33bd0010d1c192f2c981e539c571ba16a6b..bceaccc96b18ee7e66632c01ccc95cd0b56af9e3 100644 (file)
@@ -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
index 41d6e1dcbdcad6415b45645760673e365f691d33..4209d0e9eb4d7ff479a6664348bcd19fe07f76bc 100644 (file)
@@ -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
index 89bf2605091e90561b86bed0492982079ecd3f0f..757065acf5a2d0aa02ce72cdc8dc1e4bcbaf3366 100644 (file)
@@ -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
index 5c8cbd6f133a13bddd62dd4f4ccebf7f3b6f1b87..983b21108e2b39ce1c51fcf931deae1e24c185af 100644 (file)
@@ -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 (file)
index 0000000..44ebf68
--- /dev/null
@@ -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
index 709fe327475ea434c7fdf754030364d0cb11b972..be2f213f9d6c722aec20c08129674dd0c83de1e5 100644 (file)
@@ -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
index 2a04ce0d72d985034026bab8af56210552ac98e1..3549c0933b392c6712a0c53d7dc662856eea0626 100644 (file)
@@ -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
index c80c3828dedfed59f624b0dc93823e5b2f125296..9fb14e7d2ced802a48d6d12b617bdc61387b535a 100644 (file)
@@ -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
index 8461f9ccb915018261fd4f9cf3826fe7fd9bd43d..038d23498aa629e9043848dd1b15dd0964d598e2 100644 (file)
@@ -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
index 37645a144ca869a72e661b060d5e98f5cd61c2a9..cddb7473939912555bfc2deb820f4e92d38d5c68 100644 (file)
@@ -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