aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-08-10 00:25:53 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-08-10 00:25:53 +0100
commit1fc9d0b0e4657b29ff140fa03dca1711aa5a1198 (patch)
treede7d6dd8a1e2e274f4feb0b9d819fd3f00b6f82e /libstdc++-v3/include/std
parent093f71dbec040e07161888cc30a923599f38ac95 (diff)
downloadgcc-1fc9d0b0e4657b29ff140fa03dca1711aa5a1198.zip
gcc-1fc9d0b0e4657b29ff140fa03dca1711aa5a1198.tar.gz
gcc-1fc9d0b0e4657b29ff140fa03dca1711aa5a1198.tar.bz2
Define aliases for containers using polymorphic_allocator
These aliases are placed in the top-level header, e.g. <vector> not <bits/stl_vector.h>. This ensures that they refer to whichever of std::vector or __debug::vector or __profile::vector is in use when the header is included. * include/std/deque (std::pmr::deque): Declare alias. * include/std/forward_list (std::pmr::forward_list): Likewise. * include/std/list (std::pmr::list): Likewise. * include/std/map (std::pmr::map, std::pmr::multimap): Likewise. * include/std/regex (std::pmr::match_results, std::pmr::cmatch) (std::pmr::smatch, std::pmr::wcmatch, std::pmr::wsmatch): Likewise. * include/std/set (std::pmr::set, std::pmr::multiset): Likewise. * include/std/string (std::pmr::basic_string, std::pmr::string) (std::pmr::u16string, std::pmr::u32string, std::pmr::wstring): Likewise. * include/std/unordered_map (std::pmr::unordered_map) (std::pmr::unordered_multimap): Likewise. * include/std/unordered_set (std::pmr::unordered_set) (std::pmr::unordered_multiset): Likewise. * include/std/vector (std::pmr::vector): Likewise. * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: New test. * testsuite/23_containers/deque/types/pmr_typedefs.cc: New test. * testsuite/23_containers/forward_list/pmr_typedefs.cc: New test. * testsuite/23_containers/list/pmr_typedefs.cc: New test. * testsuite/23_containers/map/pmr_typedefs.cc: New test. * testsuite/23_containers/multimap/pmr_typedefs.cc: New test. * testsuite/23_containers/multiset/pmr_typedefs.cc: New test. * testsuite/23_containers/set/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_map/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_multimap/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_multiset/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_set/pmr_typedefs.cc: New test. * testsuite/23_containers/vector/pmr_typedefs.cc: New test. * testsuite/28_regex/match_results/pmr_typedefs.cc: New test. From-SVN: r263456
Diffstat (limited to 'libstdc++-v3/include/std')
-rw-r--r--libstdc++-v3/include/std/deque14
-rw-r--r--libstdc++-v3/include/std/forward_list13
-rw-r--r--libstdc++-v3/include/std/list14
-rw-r--r--libstdc++-v3/include/std/map20
-rw-r--r--libstdc++-v3/include/std/regex21
-rw-r--r--libstdc++-v3/include/std/set16
-rw-r--r--libstdc++-v3/include/std/string20
-rw-r--r--libstdc++-v3/include/std/unordered_map21
-rw-r--r--libstdc++-v3/include/std/unordered_set22
-rw-r--r--libstdc++-v3/include/std/vector14
10 files changed, 173 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque
index 896ec8a..d2c75f1 100644
--- a/libstdc++-v3/include/std/deque
+++ b/libstdc++-v3/include/std/deque
@@ -73,4 +73,18 @@
# include <profile/deque>
#endif
+#if __cplusplus >= 201703L
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ namespace pmr
+ {
+ template<typename _Tp> class polymorphic_allocator;
+ template<typename _Tp>
+ using deque = std::deque<_Tp, polymorphic_allocator<_Tp>>;
+ } // namespace pmr
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++17
+
#endif /* _GLIBCXX_DEQUE */
diff --git a/libstdc++-v3/include/std/forward_list b/libstdc++-v3/include/std/forward_list
index fd4cfe5..00b4135 100644
--- a/libstdc++-v3/include/std/forward_list
+++ b/libstdc++-v3/include/std/forward_list
@@ -47,6 +47,19 @@
# include <profile/forward_list>
#endif
+#if __cplusplus >= 201703L
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ namespace pmr
+ {
+ template<typename _Tp> class polymorphic_allocator;
+ template<typename _Tp>
+ using forward_list = std::forward_list<_Tp, polymorphic_allocator<_Tp>>;
+ } // namespace pmr
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++17
#endif // C++11
#endif // _GLIBCXX_FORWARD_LIST
diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list
index 6ba1363..555371f 100644
--- a/libstdc++-v3/include/std/list
+++ b/libstdc++-v3/include/std/list
@@ -71,5 +71,17 @@
# include <profile/list>
#endif
+#if __cplusplus >= 201703L
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ namespace pmr
+ {
+ template<typename _Tp> class polymorphic_allocator;
+ template<typename _Tp>
+ using list = std::list<_Tp, polymorphic_allocator<_Tp>>;
+ } // namespace pmr
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++17
#endif /* _GLIBCXX_LIST */
-
diff --git a/libstdc++-v3/include/std/map b/libstdc++-v3/include/std/map
index 5c429f0..84f8cdb 100644
--- a/libstdc++-v3/include/std/map
+++ b/libstdc++-v3/include/std/map
@@ -70,4 +70,24 @@
# include <profile/map>
#endif
+#if __cplusplus >= 201703L
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ namespace pmr
+ {
+ template<typename _Tp> class polymorphic_allocator;
+ template<typename _Key, typename _Tp, typename _Cmp = std::less<_Key>>
+ using map
+ = std::map<_Key, _Tp, _Cmp,
+ polymorphic_allocator<pair<const _Key, _Tp>>>;
+ template<typename _Key, typename _Tp, typename _Cmp = std::less<_Key>>
+ using multimap
+ = std::multimap<_Key, _Tp, _Cmp,
+ polymorphic_allocator<pair<const _Key, _Tp>>>;
+ } // namespace pmr
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++17
+
#endif /* _GLIBCXX_MAP */
diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex
index 7e4564a..f0dfa3f 100644
--- a/libstdc++-v3/include/std/regex
+++ b/libstdc++-v3/include/std/regex
@@ -62,6 +62,27 @@
#include <bits/regex.h>
#include <bits/regex_executor.h>
+#if __cplusplus >= 201703L
+#include <memory_resource>
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ namespace pmr {
+ template<typename _Tp> class polymorphic_allocator;
+ template<typename _BidirectionalIterator>
+ using match_results
+ = std::match_results<_BidirectionalIterator, polymorphic_allocator<
+ sub_match<_BidirectionalIterator>>>;
+ using cmatch = match_results<const char*>;
+ using smatch = match_results<string::const_iterator>;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ using wcmatch = match_results<const wchar_t*>;
+ using wsmatch = match_results<wstring::const_iterator>;
+#endif
+ } // namespace pmr
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++17
#endif // C++11
#endif // _GLIBCXX_REGEX
diff --git a/libstdc++-v3/include/std/set b/libstdc++-v3/include/std/set
index 732c6d3..dd41b2f 100644
--- a/libstdc++-v3/include/std/set
+++ b/libstdc++-v3/include/std/set
@@ -70,4 +70,20 @@
# include <profile/set>
#endif
+#if __cplusplus >= 201703L
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ namespace pmr
+ {
+ template<typename _Tp> class polymorphic_allocator;
+ template<typename _Key, typename _Cmp = std::less<_Key>>
+ using set = std::set<_Key, _Cmp, polymorphic_allocator<_Key>>;
+ template<typename _Key, typename _Cmp = std::less<_Key>>
+ using multiset = std::multiset<_Key, _Cmp, polymorphic_allocator<_Key>>;
+ } // namespace pmr
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++17
+
#endif /* _GLIBCXX_SET */
diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string
index 2fceead..d3cc03a 100644
--- a/libstdc++-v3/include/std/string
+++ b/libstdc++-v3/include/std/string
@@ -52,4 +52,24 @@
#include <bits/basic_string.h>
#include <bits/basic_string.tcc>
+#if __cplusplus >= 201703L
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ namespace pmr {
+ template<typename _Tp> class polymorphic_allocator;
+ template<typename _CharT, typename _Traits = char_traits<_CharT>>
+ using basic_string = std::basic_string<_CharT, _Traits,
+ polymorphic_allocator<_CharT>>;
+ using string = basic_string<char>;
+ using u16string = basic_string<char16_t>;
+ using u32string = basic_string<char32_t>;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ using wstring = basic_string<wchar_t>;
+#endif
+ } // namespace pmr
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++17
+
#endif /* _GLIBCXX_STRING */
diff --git a/libstdc++-v3/include/std/unordered_map b/libstdc++-v3/include/std/unordered_map
index 85840fc..fc1b1e3 100644
--- a/libstdc++-v3/include/std/unordered_map
+++ b/libstdc++-v3/include/std/unordered_map
@@ -55,6 +55,27 @@
# include <profile/unordered_map>
#endif
+#if __cplusplus >= 201703L
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ namespace pmr
+ {
+ template<typename _Tp> class polymorphic_allocator;
+ template<typename _Key, typename _Tp, typename _Hash = std::hash<_Key>,
+ typename _Pred = std::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 = std::hash<_Key>,
+ typename _Pred = std::equal_to<_Key>>
+ using unordered_multimap
+ = std::unordered_multimap<_Key, _Tp, _Hash, _Pred,
+ polymorphic_allocator<pair<const _Key, _Tp>>>;
+ } // namespace pmr
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++17
#endif // C++11
#endif // _GLIBCXX_UNORDERED_MAP
diff --git a/libstdc++-v3/include/std/unordered_set b/libstdc++-v3/include/std/unordered_set
index 0593fbd..8c04669 100644
--- a/libstdc++-v3/include/std/unordered_set
+++ b/libstdc++-v3/include/std/unordered_set
@@ -54,6 +54,28 @@
#ifdef _GLIBCXX_PROFILE
# include <profile/unordered_set>
#endif
+
+#if __cplusplus >= 201703L
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ namespace pmr
+ {
+ template<typename _Tp> class polymorphic_allocator;
+ template<typename _Key, typename _Hash = std::hash<_Key>,
+ typename _Pred = std::equal_to<_Key>>
+ using unordered_set
+ = std::unordered_set<_Key, _Hash, _Pred,
+ polymorphic_allocator<_Key>>;
+ template<typename _Key, typename _Hash = std::hash<_Key>,
+ typename _Pred = std::equal_to<_Key>>
+ using unordered_multiset
+ = std::unordered_multiset<_Key, _Hash, _Pred,
+ polymorphic_allocator<_Key>>;
+ } // namespace pmr
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++17
#endif // C++11
#endif // _GLIBCXX_UNORDERED_SET
diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector
index e03e50f..2a421c6 100644
--- a/libstdc++-v3/include/std/vector
+++ b/libstdc++-v3/include/std/vector
@@ -77,5 +77,17 @@
# include <profile/vector>
#endif
-#endif /* _GLIBCXX_VECTOR */
+#if __cplusplus >= 201703L
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ namespace pmr {
+ template<typename _Tp> class polymorphic_allocator;
+ template<typename _Tp>
+ using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
+ } // namespace pmr
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++17
+#endif /* _GLIBCXX_VECTOR */