Add experimental container alias templates for PMRs

llvm-svn: 268841
This commit is contained in:
Eric Fiselier 2016-05-07 03:09:55 +00:00
parent 4b30c79723
commit 522a7f9535
30 changed files with 1346 additions and 0 deletions

View File

@ -0,0 +1,47 @@
// -*- C++ -*-
//===--------------------------- deque ------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_DEQUE
#define _LIBCPP_EXPERIMENTAL_DEQUE
/*
experimental/deque synopsis
// C++1z
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
namespace pmr {
template <class T>
using deque = std::deque<T,polymorphic_allocator<T>>;
} // namespace pmr
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <deque>
#include <experimental/memory_resource>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
template <class _ValueT>
using deque = _VSTD::deque<_ValueT, polymorphic_allocator<_ValueT>>;
_LIBCPP_END_NAMESPACE_LFTS_PMR
#endif /* _LIBCPP_EXPERIMENTAL_DEQUE */

View File

@ -0,0 +1,47 @@
// -*- C++ -*-
//===--------------------------- forward_list -----------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_FORWARD_LIST
#define _LIBCPP_EXPERIMENTAL_FORWARD_LIST
/*
experimental/forward_list synopsis
// C++1z
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
namespace pmr {
template <class T>
using forward_list = std::forward_list<T,polymorphic_allocator<T>>;
} // namespace pmr
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <forward_list>
#include <experimental/memory_resource>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
template <class _ValueT>
using forward_list = _VSTD::forward_list<_ValueT, polymorphic_allocator<_ValueT>>;
_LIBCPP_END_NAMESPACE_LFTS_PMR
#endif /* _LIBCPP_EXPERIMENTAL_FORWARD_LIST */

View File

@ -0,0 +1,47 @@
// -*- C++ -*-
//===--------------------------- list ------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_LIST
#define _LIBCPP_EXPERIMENTAL_LIST
/*
experimental/list synopsis
// C++1z
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
namespace pmr {
template <class T>
using list = std::list<T,polymorphic_allocator<T>>;
} // namespace pmr
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <list>
#include <experimental/memory_resource>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
template <class _ValueT>
using list = _VSTD::list<_ValueT, polymorphic_allocator<_ValueT>>;
_LIBCPP_END_NAMESPACE_LFTS_PMR
#endif /* _LIBCPP_EXPERIMENTAL_LIST */

View File

@ -0,0 +1,57 @@
// -*- C++ -*-
//===----------------------------- map ------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_MAP
#define _LIBCPP_EXPERIMENTAL_MAP
/*
experimental/map synopsis
// C++1z
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
namespace pmr {
template <class Key, class T, class Compare = less<Key>>
using map = std::map<Key, T, Compare,
polymorphic_allocator<pair<const Key,T>>>;
template <class Key, class T, class Compare = less<Key>>
using multimap = std::multimap<Key, T, Compare,
polymorphic_allocator<pair<const Key,T>>>;
} // namespace pmr
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <map>
#include <experimental/memory_resource>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
template <class _Key, class _Value, class _Compare = less<_Key>>
using map = _VSTD::map<_Key, _Value, _Compare,
polymorphic_allocator<pair<const _Key, _Value>>>;
template <class _Key, class _Value, class _Compare = less<_Key>>
using multimap = _VSTD::multimap<_Key, _Value, _Compare,
polymorphic_allocator<pair<const _Key, _Value>>>;
_LIBCPP_END_NAMESPACE_LFTS_PMR
#endif /* _LIBCPP_EXPERIMENTAL_MAP */

View File

@ -0,0 +1,62 @@
// -*- C++ -*-
//===----------------------------- regex ----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_REGEX
#define _LIBCPP_EXPERIMENTAL_REGEX
/*
experimental/regex synopsis
// C++1z
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
namespace pmr {
template <class 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;
} // namespace pmr
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <regex>
#include <experimental/string>
#include <experimental/memory_resource>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
template <class _BiDirIter>
using match_results =
_VSTD::match_results<_BiDirIter,
polymorphic_allocator<_VSTD::sub_match<_BiDirIter>>>;
typedef match_results<const char*> cmatch;
typedef match_results<const wchar_t*> wcmatch;
typedef match_results<_VSTD_LFTS_PMR::string::const_iterator> smatch;
typedef match_results<_VSTD_LFTS_PMR::wstring::const_iterator> wsmatch;
_LIBCPP_END_NAMESPACE_LFTS_PMR
#endif /* _LIBCPP_EXPERIMENTAL_REGEX */

View File

@ -0,0 +1,57 @@
// -*- C++ -*-
//===--------------------------- list ------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_SET
#define _LIBCPP_EXPERIMENTAL_SET
/*
experimental/set synopsis
// C++1z
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
namespace pmr {
template <class Key, class T, class Compare = less<Key>>
using set = std::set<Key, T, Compare,
polymorphic_allocator<pair<const Key,T>>>;
template <class Key, class T, class Compare = less<Key>>
using multiset = std::multiset<Key, T, Compare,
polymorphic_allocator<pair<const Key,T>>>;
} // namespace pmr
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <set>
#include <experimental/memory_resource>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
template <class _Value, class _Compare = less<_Value>>
using set = _VSTD::set<_Value, _Compare,
polymorphic_allocator<_Value>>;
template <class _Value, class _Compare = less<_Value>>
using multiset = _VSTD::multiset<_Value, _Compare,
polymorphic_allocator<_Value>>;
_LIBCPP_END_NAMESPACE_LFTS_PMR
#endif /* _LIBCPP_EXPERIMENTAL_SET */

View File

@ -0,0 +1,62 @@
// -*- C++ -*-
//===--------------------------- string ----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_STRING
#define _LIBCPP_EXPERIMENTAL_STRING
/*
experimental/string synopsis
// C++1z
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
namespace pmr {
// basic_string using polymorphic allocator in namespace pmr
template <class charT, class 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;
} // namespace pmr
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <string>
#include <experimental/memory_resource>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
template <class _CharT, class _Traits = char_traits<_CharT>>
using basic_string =
_VSTD::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>;
typedef basic_string<char> string;
typedef basic_string<char16_t> u16string;
typedef basic_string<char32_t> u32string;
typedef basic_string<wchar_t> wstring;
_LIBCPP_END_NAMESPACE_LFTS_PMR
#endif /* _LIBCPP_EXPERIMENTAL_STRING */

View File

@ -0,0 +1,65 @@
// -*- C++ -*-
//===------------------------- unordered_map ------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_UNORDERED_MAP
#define _LIBCPP_EXPERIMENTAL_UNORDERED_MAP
/*
experimental/unordered_map synopsis
// C++1z
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
namespace pmr {
template <class Key, class T,
class Hash = hash<Key>,
class Pred = equal_to<Key>>
using unordered_map =
std::unordered_map<Key, T, Hash, Pred,
polymorphic_allocator<pair<const Key,T>>>;
template <class Key, class T,
class Hash = hash<Key>,
class Pred = equal_to<Key>>
using unordered_multimap =
std::unordered_multimap<Key, T, Hash, Pred,
polymorphic_allocator<pair<const Key,T>>>;
} // namespace pmr
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <unordered_map>
#include <experimental/memory_resource>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
template <class _Key, class _Value,
class _Hash = hash<_Key>, class _Pred = equal_to<_Key>>
using unordered_map = _VSTD::unordered_map<_Key, _Value, _Hash, _Pred,
polymorphic_allocator<pair<const _Key, _Value>>>;
template <class _Key, class _Value,
class _Hash = hash<_Key>, class _Pred = equal_to<_Key>>
using unordered_multimap = _VSTD::unordered_multimap<_Key, _Value, _Hash, _Pred,
polymorphic_allocator<pair<const _Key, _Value>>>;
_LIBCPP_END_NAMESPACE_LFTS_PMR
#endif /* _LIBCPP_EXPERIMENTAL_UNORDERED_MAP */

View File

@ -0,0 +1,59 @@
// -*- C++ -*-
//===------------------------- unordered_set ------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_UNORDERED_SET
#define _LIBCPP_EXPERIMENTAL_UNORDERED_SET
/*
experimental/unordered_set synopsis
// C++1z
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
namespace pmr {
template <class T, class Hash = hash<T>, class Pred = equal_to<T>>
using unordered_set = std::unordered_set<T, Hash, Pred,
polymorphic_allocator<T>>;
template <class T, class Hash = hash<T>, class Pred = equal_to<T>>
using unordered_multiset = std::unordered_multiset<T, Hash, Pred,
polymorphic_allocator<T>>;
} // namespace pmr
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <unordered_set>
#include <experimental/memory_resource>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
template <class _Value,
class _Hash = hash<_Value>, class _Pred = equal_to<_Value>>
using unordered_set = _VSTD::unordered_set<_Value, _Hash, _Pred,
polymorphic_allocator<_Value>>;
template <class _Value,
class _Hash = hash<_Value>, class _Pred = equal_to<_Value>>
using unordered_multiset = _VSTD::unordered_multiset<_Value, _Hash, _Pred,
polymorphic_allocator<_Value>>;
_LIBCPP_END_NAMESPACE_LFTS_PMR
#endif /* _LIBCPP_EXPERIMENTAL_UNORDERED_SET */

View File

@ -0,0 +1,47 @@
// -*- C++ -*-
//===--------------------------- vector ------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_VECTOR
#define _LIBCPP_EXPERIMENTAL_VECTOR
/*
experimental/vector synopsis
// C++1z
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
namespace pmr {
template <class T>
using vector = std::vector<T, polymorphic_allocator<T>>;
} // namespace pmr
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <vector>
#include <experimental/memory_resource>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
template <class _ValueT>
using vector = _VSTD::vector<_ValueT, polymorphic_allocator<_ValueT>>;
_LIBCPP_END_NAMESPACE_LFTS_PMR
#endif /* _LIBCPP_EXPERIMENTAL_VECTOR */

View File

@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/deque>
#include <experimental/deque>
#ifndef _LIBCPP_VERSION
#error header must provide _LIBCPP_VERSION
#endif
int main()
{
}

View File

@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/forward_list>
#include <experimental/forward_list>
#ifndef _LIBCPP_VERSION
#error header must provide _LIBCPP_VERSION
#endif
int main()
{
}

View File

@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/list>
#include <experimental/list>
#ifndef _LIBCPP_VERSION
#error header must provide _LIBCPP_VERSION
#endif
int main()
{
}

View File

@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/map>
#include <experimental/map>
#ifndef _LIBCPP_VERSION
#error header must provide _LIBCPP_VERSION
#endif
int main()
{
}

View File

@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/regex>
#include <experimental/regex>
#ifndef _LIBCPP_VERSION
#error header must provide _LIBCPP_VERSION
#endif
int main()
{
}

View File

@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/set>
#include <experimental/set>
#ifndef _LIBCPP_VERSION
#error header must provide _LIBCPP_VERSION
#endif
int main()
{
}

View File

@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/string>
#include <experimental/string>
#ifndef _LIBCPP_VERSION
#error header must provide _LIBCPP_VERSION
#endif
int main()
{
}

View File

@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/unordered_map>
#include <experimental/unordered_map>
#ifndef _LIBCPP_VERSION
#error header must provide _LIBCPP_VERSION
#endif
int main()
{
}

View File

@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/unordered_set>
#include <experimental/unordered_set>
#ifndef _LIBCPP_VERSION
#error header must provide _LIBCPP_VERSION
#endif
int main()
{
}

View File

@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/vector>
#include <experimental/vector>
#ifndef _LIBCPP_VERSION
#error header must provide _LIBCPP_VERSION
#endif
int main()
{
}

View File

@ -0,0 +1,36 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/deque>
// namespace std { namespace experimental { namespace pmr {
// template <class T>
// using deque =
// ::std::deque<T, polymorphic_allocator<T>>
//
// }}} // namespace std::experimental::pmr
#include <experimental/deque>
#include <experimental/memory_resource>
#include <type_traits>
#include <cassert>
namespace pmr = std::experimental::pmr;
int main()
{
using StdDeque = std::deque<int, pmr::polymorphic_allocator<int>>;
using PmrDeque = pmr::deque<int>;
static_assert(std::is_same<StdDeque, PmrDeque>::value, "");
PmrDeque d;
assert(d.get_allocator().resource() == pmr::get_default_resource());
}

View File

@ -0,0 +1,36 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/forward_list>
// namespace std { namespace experimental { namespace pmr {
// template <class T>
// using forward_list =
// ::std::forward_list<T, polymorphic_allocator<T>>
//
// }}} // namespace std::experimental::pmr
#include <experimental/forward_list>
#include <experimental/memory_resource>
#include <type_traits>
#include <cassert>
namespace pmr = std::experimental::pmr;
int main()
{
using StdForwardList = std::forward_list<int, pmr::polymorphic_allocator<int>>;
using PmrForwardList = pmr::forward_list<int>;
static_assert(std::is_same<StdForwardList, PmrForwardList>::value, "");
PmrForwardList d;
assert(d.get_allocator().resource() == pmr::get_default_resource());
}

View File

@ -0,0 +1,36 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/list>
// namespace std { namespace experimental { namespace pmr {
// template <class T>
// using list =
// ::std::list<T, polymorphic_allocator<T>>
//
// }}} // namespace std::experimental::pmr
#include <experimental/list>
#include <experimental/memory_resource>
#include <type_traits>
#include <cassert>
namespace pmr = std::experimental::pmr;
int main()
{
using StdList = std::list<int, pmr::polymorphic_allocator<int>>;
using PmrList = pmr::list<int>;
static_assert(std::is_same<StdList, PmrList>::value, "");
PmrList d;
assert(d.get_allocator().resource() == pmr::get_default_resource());
}

View File

@ -0,0 +1,68 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/map>
// namespace std { namespace experimental { namespace pmr {
// template <class K, class V, class Compare = less<Key> >
// using map =
// ::std::map<K, V, Compare, polymorphic_allocator<pair<const K, V>>>
//
// template <class K, class V, class Compare = less<Key> >
// using multimap =
// ::std::multimap<K, V, Compare, polymorphic_allocator<pair<const K, V>>>
//
// }}} // namespace std::experimental::pmr
#include <experimental/map>
#include <experimental/memory_resource>
#include <type_traits>
#include <cassert>
namespace pmr = std::experimental::pmr;
int main()
{
using K = int;
using V = char;
using DC = std::less<int>;
using OC = std::greater<int>;
using P = std::pair<const K, V>;
{
using StdMap = std::map<K, V, DC, pmr::polymorphic_allocator<P>>;
using PmrMap = pmr::map<K, V>;
static_assert(std::is_same<StdMap, PmrMap>::value, "");
}
{
using StdMap = std::map<K, V, OC, pmr::polymorphic_allocator<P>>;
using PmrMap = pmr::map<K, V, OC>;
static_assert(std::is_same<StdMap, PmrMap>::value, "");
}
{
pmr::map<int, int> m;
assert(m.get_allocator().resource() == pmr::get_default_resource());
}
{
using StdMap = std::multimap<K, V, DC, pmr::polymorphic_allocator<P>>;
using PmrMap = pmr::multimap<K, V>;
static_assert(std::is_same<StdMap, PmrMap>::value, "");
}
{
using StdMap = std::multimap<K, V, OC, pmr::polymorphic_allocator<P>>;
using PmrMap = pmr::multimap<K, V, OC>;
static_assert(std::is_same<StdMap, PmrMap>::value, "");
}
{
pmr::multimap<int, int> m;
assert(m.get_allocator().resource() == pmr::get_default_resource());
}
}

View File

@ -0,0 +1,56 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/regex>
// namespace std { namespace experimental { namespace pmr {
//
// template <class 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;
//
// }}} // namespace std::experimental::pmr
#include <experimental/regex>
#include <type_traits>
#include <cassert>
namespace pmr = std::experimental::pmr;
template <class Iter, class PmrTypedef>
void test_match_result_typedef() {
using StdMR = std::match_results<Iter, pmr::polymorphic_allocator<std::sub_match<Iter>>>;
using PmrMR = pmr::match_results<Iter>;
static_assert(std::is_same<StdMR, PmrMR>::value, "");
static_assert(std::is_same<PmrMR, PmrTypedef>::value, "");
}
int main()
{
{
test_match_result_typedef<const char*, pmr::cmatch>();
test_match_result_typedef<const wchar_t*, pmr::wcmatch>();
test_match_result_typedef<pmr::string::const_iterator, pmr::smatch>();
test_match_result_typedef<pmr::wstring::const_iterator, pmr::wsmatch>();
}
{
// Check that std::match_results has been included and is complete.
pmr::smatch s;
assert(s.get_allocator().resource() == pmr::get_default_resource());
}
}

View File

@ -0,0 +1,66 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/set>
// namespace std { namespace experimental { namespace pmr {
// template <class V, class Compare = less<V> >
// using set =
// ::std::set<V, Compare, polymorphic_allocator<V>>
//
// template <class V, class Compare = less<V> >
// using multiset =
// ::std::multiset<V, Compare, polymorphic_allocator<V>>
//
// }}} // namespace std::experimental::pmr
#include <experimental/set>
#include <experimental/memory_resource>
#include <type_traits>
#include <cassert>
namespace pmr = std::experimental::pmr;
int main()
{
using V = char;
using DC = std::less<V>;
using OC = std::greater<V>;
{
using StdSet = std::set<V, DC, pmr::polymorphic_allocator<V>>;
using PmrSet = pmr::set<V>;
static_assert(std::is_same<StdSet, PmrSet>::value, "");
}
{
using StdSet = std::set<V, OC, pmr::polymorphic_allocator<V>>;
using PmrSet = pmr::set<V, OC>;
static_assert(std::is_same<StdSet, PmrSet>::value, "");
}
{
pmr::set<int> m;
assert(m.get_allocator().resource() == pmr::get_default_resource());
}
{
using StdSet = std::multiset<V, DC, pmr::polymorphic_allocator<V>>;
using PmrSet = pmr::multiset<V>;
static_assert(std::is_same<StdSet, PmrSet>::value, "");
}
{
using StdSet = std::multiset<V, OC, pmr::polymorphic_allocator<V>>;
using PmrSet = pmr::multiset<V, OC>;
static_assert(std::is_same<StdSet, PmrSet>::value, "");
}
{
pmr::multiset<int> m;
assert(m.get_allocator().resource() == pmr::get_default_resource());
}
}

View File

@ -0,0 +1,72 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/string>
// namespace std { namespace experimental { namespace pmr {
// template <class Char, class Traits = ...>
// using basic_string =
// ::std::basic_string<Char, Traits, polymorphic_allocator<Char>>
//
// typedef ... string
// typedef ... u16string
// typedef ... u32string
// typedef ... wstring
//
// }}} // namespace std::experimental::pmr
#include <experimental/string>
#include <experimental/memory_resource>
#include <type_traits>
#include <cassert>
#include "constexpr_char_traits.hpp"
namespace pmr = std::experimental::pmr;
template <class Char, class PmrTypedef>
void test_string_typedef() {
using StdStr = std::basic_string<Char, std::char_traits<Char>,
pmr::polymorphic_allocator<Char>>;
using PmrStr = pmr::basic_string<Char>;
static_assert(std::is_same<StdStr, PmrStr>::value, "");
static_assert(std::is_same<PmrStr, PmrTypedef>::value, "");
}
template <class Char, class Traits>
void test_basic_string_alias() {
using StdStr = std::basic_string<Char, Traits,
pmr::polymorphic_allocator<Char>>;
using PmrStr = pmr::basic_string<Char, Traits>;
static_assert(std::is_same<StdStr, PmrStr>::value, "");
}
int main()
{
{
test_string_typedef<char, pmr::string>();
test_string_typedef<wchar_t, pmr::wstring>();
test_string_typedef<char16_t, pmr::u16string>();
test_string_typedef<char32_t, pmr::u32string>();
}
{
test_basic_string_alias<char, constexpr_char_traits<char>>();
test_basic_string_alias<wchar_t, constexpr_char_traits<wchar_t>>();
test_basic_string_alias<char16_t, constexpr_char_traits<char16_t>>();
test_basic_string_alias<char32_t, constexpr_char_traits<char32_t>>();
}
{
// Check that std::basic_string has been included and is complete.
pmr::string s;
assert(s.get_allocator().resource() == pmr::get_default_resource());
}
}

View File

@ -0,0 +1,86 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/unordered_map>
// namespace std { namespace experimental { namespace pmr {
// template <class K, class V, class H = hash<K>, class P = equal_to<K> >
// using unordered_map =
// ::std::unordered_map<K, V, H, P, polymorphic_allocator<pair<const K, V>>>
//
// template <class K, class V, class H = hash<K>, class P = equal_to<K> >
// using unordered_multimap =
// ::std::unordered_multimap<K, V, H, P, polymorphic_allocator<pair<const K, V>>>
//
// }}} // namespace std::experimental::pmr
#include <experimental/unordered_map>
#include <experimental/memory_resource>
#include <type_traits>
#include <cassert>
namespace pmr = std::experimental::pmr;
template <class T>
struct MyHash : std::hash<T> {};
template <class T>
struct MyPred : std::equal_to<T> {};
int main()
{
using K = int;
using V = char;
using DH = std::hash<K>;
using MH = MyHash<K>;
using DP = std::equal_to<K>;
using MP = MyPred<K>;
using P = std::pair<const K, V>;
{
using StdMap = std::unordered_map<K, V, DH, DP, pmr::polymorphic_allocator<P>>;
using PmrMap = pmr::unordered_map<K, V>;
static_assert(std::is_same<StdMap, PmrMap>::value, "");
}
{
using StdMap = std::unordered_map<K, V, MH, DP, pmr::polymorphic_allocator<P>>;
using PmrMap = pmr::unordered_map<K, V, MH>;
static_assert(std::is_same<StdMap, PmrMap>::value, "");
}
{
using StdMap = std::unordered_map<K, V, MH, MP, pmr::polymorphic_allocator<P>>;
using PmrMap = pmr::unordered_map<K, V, MH, MP>;
static_assert(std::is_same<StdMap, PmrMap>::value, "");
}
{
pmr::unordered_map<int, int> m;
assert(m.get_allocator().resource() == pmr::get_default_resource());
}
{
using StdMap = std::unordered_multimap<K, V, DH, DP, pmr::polymorphic_allocator<P>>;
using PmrMap = pmr::unordered_multimap<K, V>;
static_assert(std::is_same<StdMap, PmrMap>::value, "");
}
{
using StdMap = std::unordered_multimap<K, V, MH, DP, pmr::polymorphic_allocator<P>>;
using PmrMap = pmr::unordered_multimap<K, V, MH>;
static_assert(std::is_same<StdMap, PmrMap>::value, "");
}
{
using StdMap = std::unordered_multimap<K, V, MH, MP, pmr::polymorphic_allocator<P>>;
using PmrMap = pmr::unordered_multimap<K, V, MH, MP>;
static_assert(std::is_same<StdMap, PmrMap>::value, "");
}
{
pmr::unordered_multimap<int, int> m;
assert(m.get_allocator().resource() == pmr::get_default_resource());
}
}

View File

@ -0,0 +1,84 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/unordered_set>
// namespace std { namespace experimental { namespace pmr {
// template <class V, class H = hash<V>, class P = equal_to<V> >
// using unordered_set =
// ::std::unordered_set<V, H, P, polymorphic_allocator<V>>
//
// template <class V, class H = hash<V>, class P = equal_to<V> >
// using unordered_multiset =
// ::std::unordered_multiset<V, H, P, polymorphic_allocator<V>>
//
// }}} // namespace std::experimental::pmr
#include <experimental/unordered_set>
#include <experimental/memory_resource>
#include <type_traits>
#include <cassert>
namespace pmr = std::experimental::pmr;
template <class T>
struct MyHash : std::hash<T> {};
template <class T>
struct MyPred : std::equal_to<T> {};
int main()
{
using V = char;
using DH = std::hash<V>;
using MH = MyHash<V>;
using DP = std::equal_to<V>;
using MP = MyPred<V>;
{
using StdSet = std::unordered_set<V, DH, DP, pmr::polymorphic_allocator<V>>;
using PmrSet = pmr::unordered_set<V>;
static_assert(std::is_same<StdSet, PmrSet>::value, "");
}
{
using StdSet = std::unordered_set<V, MH, DP, pmr::polymorphic_allocator<V>>;
using PmrSet = pmr::unordered_set<V, MH>;
static_assert(std::is_same<StdSet, PmrSet>::value, "");
}
{
using StdSet = std::unordered_set<V, MH, MP, pmr::polymorphic_allocator<V>>;
using PmrSet = pmr::unordered_set<V, MH, MP>;
static_assert(std::is_same<StdSet, PmrSet>::value, "");
}
{
pmr::unordered_set<int, int> m;
assert(m.get_allocator().resource() == pmr::get_default_resource());
}
{
using StdSet = std::unordered_multiset<V, DH, DP, pmr::polymorphic_allocator<V>>;
using PmrSet = pmr::unordered_multiset<V>;
static_assert(std::is_same<StdSet, PmrSet>::value, "");
}
{
using StdSet = std::unordered_multiset<V, MH, DP, pmr::polymorphic_allocator<V>>;
using PmrSet = pmr::unordered_multiset<V, MH>;
static_assert(std::is_same<StdSet, PmrSet>::value, "");
}
{
using StdSet = std::unordered_multiset<V, MH, MP, pmr::polymorphic_allocator<V>>;
using PmrSet = pmr::unordered_multiset<V, MH, MP>;
static_assert(std::is_same<StdSet, PmrSet>::value, "");
}
{
pmr::unordered_multiset<int, int> m;
assert(m.get_allocator().resource() == pmr::get_default_resource());
}
}

View File

@ -0,0 +1,36 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/vector>
// namespace std { namespace experimental { namespace pmr {
// template <class T>
// using vector =
// ::std::vector<T, polymorphic_allocator<T>>
//
// }}} // namespace std::experimental::pmr
#include <experimental/vector>
#include <experimental/memory_resource>
#include <type_traits>
#include <cassert>
namespace pmr = std::experimental::pmr;
int main()
{
using StdVector = std::vector<int, pmr::polymorphic_allocator<int>>;
using PmrVector = pmr::vector<int>;
static_assert(std::is_same<StdVector, PmrVector>::value, "");
PmrVector d;
assert(d.get_allocator().resource() == pmr::get_default_resource());
}