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
This commit is contained in:
Jonathan Wakely 2015-11-13 10:01:05 +00:00 committed by Jonathan Wakely
parent bfeffbd1ae
commit 8014404589
14 changed files with 230 additions and 0 deletions

View 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.

View 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 \

View 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 \

View 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

View 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

View 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

View 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

View 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>

View File

@ -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

View 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

View 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

View 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

View 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

View 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