From dba23b499be925f98fba2345eaacb99b88eba9ea Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 7 May 2016 03:09:55 +0000 Subject: [PATCH] Add experimental container alias templates for PMRs git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@268841 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/deque | 47 ++++++++++ include/experimental/forward_list | 47 ++++++++++ include/experimental/list | 47 ++++++++++ include/experimental/map | 57 ++++++++++++ include/experimental/regex | 62 +++++++++++++ include/experimental/set | 57 ++++++++++++ include/experimental/string | 62 +++++++++++++ include/experimental/unordered_map | 65 ++++++++++++++ include/experimental/unordered_set | 59 +++++++++++++ include/experimental/vector | 47 ++++++++++ .../header_deque_libcpp_version.pass.cpp | 22 +++++ ...eader_forward_list_libcpp_version.pass.cpp | 22 +++++ .../header_list_libcpp_version.pass.cpp | 22 +++++ .../header_map_libcpp_version.pass.cpp | 22 +++++ .../header_regex_libcpp_version.pass.cpp | 22 +++++ .../header_set_libcpp_version.pass.cpp | 22 +++++ .../header_string_libcpp_version.pass.cpp | 22 +++++ ...ader_unordered_map_libcpp_version.pass.cpp | 22 +++++ ...ader_unordered_set_libcpp_version.pass.cpp | 22 +++++ .../header_vector_libcpp_version.pass.cpp | 22 +++++ .../header_deque_synop.pass.cpp | 36 ++++++++ .../header_forward_list_synop.pass.cpp | 36 ++++++++ .../header_list_synop.pass.cpp | 36 ++++++++ .../header_map_synop.pass.cpp | 68 +++++++++++++++ .../header_regex_synop.pass.cpp | 56 ++++++++++++ .../header_set_synop.pass.cpp | 66 ++++++++++++++ .../header_string_synop.pass.cpp | 72 ++++++++++++++++ .../header_unordered_map_synop.pass.cpp | 86 +++++++++++++++++++ .../header_unordered_set_synop.pass.cpp | 84 ++++++++++++++++++ .../header_vector_synop.pass.cpp | 36 ++++++++ 30 files changed, 1346 insertions(+) create mode 100644 include/experimental/deque create mode 100644 include/experimental/forward_list create mode 100644 include/experimental/list create mode 100644 include/experimental/map create mode 100644 include/experimental/regex create mode 100644 include/experimental/set create mode 100644 include/experimental/string create mode 100644 include/experimental/unordered_map create mode 100644 include/experimental/unordered_set create mode 100644 include/experimental/vector create mode 100644 test/libcxx/experimental/memory/memory.resource.aliases/header_deque_libcpp_version.pass.cpp create mode 100644 test/libcxx/experimental/memory/memory.resource.aliases/header_forward_list_libcpp_version.pass.cpp create mode 100644 test/libcxx/experimental/memory/memory.resource.aliases/header_list_libcpp_version.pass.cpp create mode 100644 test/libcxx/experimental/memory/memory.resource.aliases/header_map_libcpp_version.pass.cpp create mode 100644 test/libcxx/experimental/memory/memory.resource.aliases/header_regex_libcpp_version.pass.cpp create mode 100644 test/libcxx/experimental/memory/memory.resource.aliases/header_set_libcpp_version.pass.cpp create mode 100644 test/libcxx/experimental/memory/memory.resource.aliases/header_string_libcpp_version.pass.cpp create mode 100644 test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_map_libcpp_version.pass.cpp create mode 100644 test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_set_libcpp_version.pass.cpp create mode 100644 test/libcxx/experimental/memory/memory.resource.aliases/header_vector_libcpp_version.pass.cpp create mode 100644 test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp create mode 100644 test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp create mode 100644 test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp create mode 100644 test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp create mode 100644 test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp create mode 100644 test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp create mode 100644 test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp create mode 100644 test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp create mode 100644 test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp create mode 100644 test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp diff --git a/include/experimental/deque b/include/experimental/deque new file mode 100644 index 000000000..f8495743c --- /dev/null +++ b/include/experimental/deque @@ -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 + using deque = std::deque>; + +} // namespace pmr +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +#include +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR + +template +using deque = _VSTD::deque<_ValueT, polymorphic_allocator<_ValueT>>; + +_LIBCPP_END_NAMESPACE_LFTS_PMR + +#endif /* _LIBCPP_EXPERIMENTAL_DEQUE */ diff --git a/include/experimental/forward_list b/include/experimental/forward_list new file mode 100644 index 000000000..55e195f44 --- /dev/null +++ b/include/experimental/forward_list @@ -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 + using forward_list = std::forward_list>; + +} // namespace pmr +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +#include +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR + +template +using forward_list = _VSTD::forward_list<_ValueT, polymorphic_allocator<_ValueT>>; + +_LIBCPP_END_NAMESPACE_LFTS_PMR + +#endif /* _LIBCPP_EXPERIMENTAL_FORWARD_LIST */ diff --git a/include/experimental/list b/include/experimental/list new file mode 100644 index 000000000..1678ee3e9 --- /dev/null +++ b/include/experimental/list @@ -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 + using list = std::list>; + +} // namespace pmr +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +#include +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR + +template +using list = _VSTD::list<_ValueT, polymorphic_allocator<_ValueT>>; + +_LIBCPP_END_NAMESPACE_LFTS_PMR + +#endif /* _LIBCPP_EXPERIMENTAL_LIST */ diff --git a/include/experimental/map b/include/experimental/map new file mode 100644 index 000000000..cff2c5e52 --- /dev/null +++ b/include/experimental/map @@ -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 > + using map = std::map>>; + + template > + using multimap = std::multimap>>; + +} // namespace pmr +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +#include +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR + +template > +using map = _VSTD::map<_Key, _Value, _Compare, + polymorphic_allocator>>; + +template > +using multimap = _VSTD::multimap<_Key, _Value, _Compare, + polymorphic_allocator>>; + +_LIBCPP_END_NAMESPACE_LFTS_PMR + +#endif /* _LIBCPP_EXPERIMENTAL_MAP */ diff --git a/include/experimental/regex b/include/experimental/regex new file mode 100644 index 000000000..d38891c37 --- /dev/null +++ b/include/experimental/regex @@ -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 + using match_results = + std::match_results>>; + + typedef match_results cmatch; + typedef match_results wcmatch; + typedef match_results smatch; + typedef match_results wsmatch; + +} // namespace pmr +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +#include +#include +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR + +template +using match_results = + _VSTD::match_results<_BiDirIter, + polymorphic_allocator<_VSTD::sub_match<_BiDirIter>>>; + +typedef match_results cmatch; +typedef match_results 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 */ diff --git a/include/experimental/set b/include/experimental/set new file mode 100644 index 000000000..20cf6d4a3 --- /dev/null +++ b/include/experimental/set @@ -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 > + using set = std::set>>; + + template > + using multiset = std::multiset>>; + +} // namespace pmr +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +#include +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR + +template > +using set = _VSTD::set<_Value, _Compare, + polymorphic_allocator<_Value>>; + +template > +using multiset = _VSTD::multiset<_Value, _Compare, + polymorphic_allocator<_Value>>; + +_LIBCPP_END_NAMESPACE_LFTS_PMR + +#endif /* _LIBCPP_EXPERIMENTAL_SET */ diff --git a/include/experimental/string b/include/experimental/string new file mode 100644 index 000000000..8b8545128 --- /dev/null +++ b/include/experimental/string @@ -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 > + using basic_string = + std::basic_string>; + + // basic_string typedef names using polymorphic allocator in namespace + // std::experimental::pmr + typedef basic_string string; + typedef basic_string u16string; + typedef basic_string u32string; + typedef basic_string wstring; + +} // namespace pmr +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +#include +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR + +template > +using basic_string = + _VSTD::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>; + +typedef basic_string string; +typedef basic_string u16string; +typedef basic_string u32string; +typedef basic_string wstring; + +_LIBCPP_END_NAMESPACE_LFTS_PMR + +#endif /* _LIBCPP_EXPERIMENTAL_STRING */ diff --git a/include/experimental/unordered_map b/include/experimental/unordered_map new file mode 100644 index 000000000..1f998c2d4 --- /dev/null +++ b/include/experimental/unordered_map @@ -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 Pred = equal_to> + using unordered_map = + std::unordered_map>>; + + template , + class Pred = equal_to> + using unordered_multimap = + std::unordered_multimap>>; + +} // namespace pmr +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +#include +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR + +template , class _Pred = equal_to<_Key>> +using unordered_map = _VSTD::unordered_map<_Key, _Value, _Hash, _Pred, + polymorphic_allocator>>; + +template , class _Pred = equal_to<_Key>> +using unordered_multimap = _VSTD::unordered_multimap<_Key, _Value, _Hash, _Pred, + polymorphic_allocator>>; + +_LIBCPP_END_NAMESPACE_LFTS_PMR + +#endif /* _LIBCPP_EXPERIMENTAL_UNORDERED_MAP */ diff --git a/include/experimental/unordered_set b/include/experimental/unordered_set new file mode 100644 index 000000000..d00a83753 --- /dev/null +++ b/include/experimental/unordered_set @@ -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 Pred = equal_to> + using unordered_set = std::unordered_set>; + + template , class Pred = equal_to> + using unordered_multiset = std::unordered_multiset>; + +} // namespace pmr +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +#include +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR + +template , class _Pred = equal_to<_Value>> +using unordered_set = _VSTD::unordered_set<_Value, _Hash, _Pred, + polymorphic_allocator<_Value>>; + +template , 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 */ diff --git a/include/experimental/vector b/include/experimental/vector new file mode 100644 index 000000000..bd10492bf --- /dev/null +++ b/include/experimental/vector @@ -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 + using vector = std::vector>; + +} // namespace pmr +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +#include +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR + +template +using vector = _VSTD::vector<_ValueT, polymorphic_allocator<_ValueT>>; + +_LIBCPP_END_NAMESPACE_LFTS_PMR + +#endif /* _LIBCPP_EXPERIMENTAL_VECTOR */ diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_deque_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_deque_libcpp_version.pass.cpp new file mode 100644 index 000000000..04b361dfe --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_deque_libcpp_version.pass.cpp @@ -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 + +// + +#include + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_forward_list_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_forward_list_libcpp_version.pass.cpp new file mode 100644 index 000000000..11fc21b3b --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_forward_list_libcpp_version.pass.cpp @@ -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 + +// + +#include + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_list_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_list_libcpp_version.pass.cpp new file mode 100644 index 000000000..9a72979e0 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_list_libcpp_version.pass.cpp @@ -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 + +// + +#include + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_map_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_map_libcpp_version.pass.cpp new file mode 100644 index 000000000..24a1bf304 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_map_libcpp_version.pass.cpp @@ -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 + +// + +#include + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_regex_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_regex_libcpp_version.pass.cpp new file mode 100644 index 000000000..ff81bc09b --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_regex_libcpp_version.pass.cpp @@ -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 + +// + +#include + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_set_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_set_libcpp_version.pass.cpp new file mode 100644 index 000000000..6b02f46b4 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_set_libcpp_version.pass.cpp @@ -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 + +// + +#include + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_string_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_string_libcpp_version.pass.cpp new file mode 100644 index 000000000..b4b7fdf10 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_string_libcpp_version.pass.cpp @@ -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 + +// + +#include + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_map_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_map_libcpp_version.pass.cpp new file mode 100644 index 000000000..ab9cc189b --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_map_libcpp_version.pass.cpp @@ -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 + +// + +#include + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_set_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_set_libcpp_version.pass.cpp new file mode 100644 index 000000000..37533c7fd --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_set_libcpp_version.pass.cpp @@ -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 + +// + +#include + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_vector_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_vector_libcpp_version.pass.cpp new file mode 100644 index 000000000..103d32bec --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_vector_libcpp_version.pass.cpp @@ -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 + +// + +#include + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp new file mode 100644 index 000000000..b41fbf733 --- /dev/null +++ b/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp @@ -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 + +// + +// namespace std { namespace experimental { namespace pmr { +// template +// using deque = +// ::std::deque> +// +// }}} // namespace std::experimental::pmr + +#include +#include +#include +#include + +namespace pmr = std::experimental::pmr; + +int main() +{ + using StdDeque = std::deque>; + using PmrDeque = pmr::deque; + static_assert(std::is_same::value, ""); + PmrDeque d; + assert(d.get_allocator().resource() == pmr::get_default_resource()); +} diff --git a/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp new file mode 100644 index 000000000..ab588b8ef --- /dev/null +++ b/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp @@ -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 + +// + +// namespace std { namespace experimental { namespace pmr { +// template +// using forward_list = +// ::std::forward_list> +// +// }}} // namespace std::experimental::pmr + +#include +#include +#include +#include + +namespace pmr = std::experimental::pmr; + +int main() +{ + using StdForwardList = std::forward_list>; + using PmrForwardList = pmr::forward_list; + static_assert(std::is_same::value, ""); + PmrForwardList d; + assert(d.get_allocator().resource() == pmr::get_default_resource()); +} diff --git a/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp new file mode 100644 index 000000000..9c2c91789 --- /dev/null +++ b/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp @@ -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 + +// + +// namespace std { namespace experimental { namespace pmr { +// template +// using list = +// ::std::list> +// +// }}} // namespace std::experimental::pmr + +#include +#include +#include +#include + +namespace pmr = std::experimental::pmr; + +int main() +{ + using StdList = std::list>; + using PmrList = pmr::list; + static_assert(std::is_same::value, ""); + PmrList d; + assert(d.get_allocator().resource() == pmr::get_default_resource()); +} diff --git a/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp new file mode 100644 index 000000000..37e9cf68c --- /dev/null +++ b/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp @@ -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 + +// + +// namespace std { namespace experimental { namespace pmr { +// template > +// using map = +// ::std::map>> +// +// template > +// using multimap = +// ::std::multimap>> +// +// }}} // namespace std::experimental::pmr + +#include +#include +#include +#include + +namespace pmr = std::experimental::pmr; + +int main() +{ + using K = int; + using V = char; + using DC = std::less; + using OC = std::greater; + using P = std::pair; + { + using StdMap = std::map>; + using PmrMap = pmr::map; + static_assert(std::is_same::value, ""); + } + { + using StdMap = std::map>; + using PmrMap = pmr::map; + static_assert(std::is_same::value, ""); + } + { + pmr::map m; + assert(m.get_allocator().resource() == pmr::get_default_resource()); + } + { + using StdMap = std::multimap>; + using PmrMap = pmr::multimap; + static_assert(std::is_same::value, ""); + } + { + using StdMap = std::multimap>; + using PmrMap = pmr::multimap; + static_assert(std::is_same::value, ""); + } + { + pmr::multimap m; + assert(m.get_allocator().resource() == pmr::get_default_resource()); + } +} diff --git a/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp new file mode 100644 index 000000000..706a76399 --- /dev/null +++ b/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp @@ -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 + +// + +// namespace std { namespace experimental { namespace pmr { +// +// template +// using match_results = +// std::match_results>>; +// +// typedef match_results cmatch; +// typedef match_results wcmatch; +// typedef match_results smatch; +// typedef match_results wsmatch; +// +// }}} // namespace std::experimental::pmr + +#include +#include +#include + +namespace pmr = std::experimental::pmr; + +template +void test_match_result_typedef() { + using StdMR = std::match_results>>; + using PmrMR = pmr::match_results; + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); +} + +int main() +{ + { + test_match_result_typedef(); + test_match_result_typedef(); + test_match_result_typedef(); + test_match_result_typedef(); + } + { + // Check that std::match_results has been included and is complete. + pmr::smatch s; + assert(s.get_allocator().resource() == pmr::get_default_resource()); + } +} diff --git a/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp new file mode 100644 index 000000000..682300639 --- /dev/null +++ b/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp @@ -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 + +// + +// namespace std { namespace experimental { namespace pmr { +// template > +// using set = +// ::std::set> +// +// template > +// using multiset = +// ::std::multiset> +// +// }}} // namespace std::experimental::pmr + +#include +#include +#include +#include + +namespace pmr = std::experimental::pmr; + +int main() +{ + using V = char; + using DC = std::less; + using OC = std::greater; + { + using StdSet = std::set>; + using PmrSet = pmr::set; + static_assert(std::is_same::value, ""); + } + { + using StdSet = std::set>; + using PmrSet = pmr::set; + static_assert(std::is_same::value, ""); + } + { + pmr::set m; + assert(m.get_allocator().resource() == pmr::get_default_resource()); + } + { + using StdSet = std::multiset>; + using PmrSet = pmr::multiset; + static_assert(std::is_same::value, ""); + } + { + using StdSet = std::multiset>; + using PmrSet = pmr::multiset; + static_assert(std::is_same::value, ""); + } + { + pmr::multiset m; + assert(m.get_allocator().resource() == pmr::get_default_resource()); + } +} diff --git a/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp new file mode 100644 index 000000000..c160a09e4 --- /dev/null +++ b/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp @@ -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 + +// + +// namespace std { namespace experimental { namespace pmr { +// template +// using basic_string = +// ::std::basic_string> +// +// typedef ... string +// typedef ... u16string +// typedef ... u32string +// typedef ... wstring +// +// }}} // namespace std::experimental::pmr + +#include +#include +#include +#include + +#include "constexpr_char_traits.hpp" + +namespace pmr = std::experimental::pmr; + +template +void test_string_typedef() { + using StdStr = std::basic_string, + pmr::polymorphic_allocator>; + using PmrStr = pmr::basic_string; + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); +} + +template +void test_basic_string_alias() { + using StdStr = std::basic_string>; + using PmrStr = pmr::basic_string; + static_assert(std::is_same::value, ""); +} + +int main() +{ + { + test_string_typedef(); + test_string_typedef(); + test_string_typedef(); + test_string_typedef(); + } + { + test_basic_string_alias>(); + test_basic_string_alias>(); + test_basic_string_alias>(); + test_basic_string_alias>(); + } + { + // Check that std::basic_string has been included and is complete. + pmr::string s; + assert(s.get_allocator().resource() == pmr::get_default_resource()); + } +} diff --git a/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp new file mode 100644 index 000000000..77f44a9b8 --- /dev/null +++ b/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp @@ -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 + +// + +// namespace std { namespace experimental { namespace pmr { +// template , class P = equal_to > +// using unordered_map = +// ::std::unordered_map>> +// +// template , class P = equal_to > +// using unordered_multimap = +// ::std::unordered_multimap>> +// +// }}} // namespace std::experimental::pmr + +#include +#include +#include +#include + +namespace pmr = std::experimental::pmr; + +template +struct MyHash : std::hash {}; + +template +struct MyPred : std::equal_to {}; + +int main() +{ + using K = int; + using V = char; + using DH = std::hash; + using MH = MyHash; + using DP = std::equal_to; + using MP = MyPred; + using P = std::pair; + { + using StdMap = std::unordered_map>; + using PmrMap = pmr::unordered_map; + static_assert(std::is_same::value, ""); + } + { + using StdMap = std::unordered_map>; + using PmrMap = pmr::unordered_map; + static_assert(std::is_same::value, ""); + } + { + using StdMap = std::unordered_map>; + using PmrMap = pmr::unordered_map; + static_assert(std::is_same::value, ""); + } + { + pmr::unordered_map m; + assert(m.get_allocator().resource() == pmr::get_default_resource()); + } + { + using StdMap = std::unordered_multimap>; + using PmrMap = pmr::unordered_multimap; + static_assert(std::is_same::value, ""); + } + { + using StdMap = std::unordered_multimap>; + using PmrMap = pmr::unordered_multimap; + static_assert(std::is_same::value, ""); + } + { + using StdMap = std::unordered_multimap>; + using PmrMap = pmr::unordered_multimap; + static_assert(std::is_same::value, ""); + } + { + pmr::unordered_multimap m; + assert(m.get_allocator().resource() == pmr::get_default_resource()); + } +} diff --git a/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp new file mode 100644 index 000000000..214c7dca4 --- /dev/null +++ b/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp @@ -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 + +// + +// namespace std { namespace experimental { namespace pmr { +// template , class P = equal_to > +// using unordered_set = +// ::std::unordered_set> +// +// template , class P = equal_to > +// using unordered_multiset = +// ::std::unordered_multiset> +// +// }}} // namespace std::experimental::pmr + +#include +#include +#include +#include + +namespace pmr = std::experimental::pmr; + +template +struct MyHash : std::hash {}; + +template +struct MyPred : std::equal_to {}; + +int main() +{ + using V = char; + using DH = std::hash; + using MH = MyHash; + using DP = std::equal_to; + using MP = MyPred; + { + using StdSet = std::unordered_set>; + using PmrSet = pmr::unordered_set; + static_assert(std::is_same::value, ""); + } + { + using StdSet = std::unordered_set>; + using PmrSet = pmr::unordered_set; + static_assert(std::is_same::value, ""); + } + { + using StdSet = std::unordered_set>; + using PmrSet = pmr::unordered_set; + static_assert(std::is_same::value, ""); + } + { + pmr::unordered_set m; + assert(m.get_allocator().resource() == pmr::get_default_resource()); + } + { + using StdSet = std::unordered_multiset>; + using PmrSet = pmr::unordered_multiset; + static_assert(std::is_same::value, ""); + } + { + using StdSet = std::unordered_multiset>; + using PmrSet = pmr::unordered_multiset; + static_assert(std::is_same::value, ""); + } + { + using StdSet = std::unordered_multiset>; + using PmrSet = pmr::unordered_multiset; + static_assert(std::is_same::value, ""); + } + { + pmr::unordered_multiset m; + assert(m.get_allocator().resource() == pmr::get_default_resource()); + } +} diff --git a/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp new file mode 100644 index 000000000..814ade6d0 --- /dev/null +++ b/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp @@ -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 + +// + +// namespace std { namespace experimental { namespace pmr { +// template +// using vector = +// ::std::vector> +// +// }}} // namespace std::experimental::pmr + +#include +#include +#include +#include + +namespace pmr = std::experimental::pmr; + +int main() +{ + using StdVector = std::vector>; + using PmrVector = pmr::vector; + static_assert(std::is_same::value, ""); + PmrVector d; + assert(d.get_allocator().resource() == pmr::get_default_resource()); +}