[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / libcxx / include / __memory / uses_allocator.h
blob2e186207408be91e786aafdbfaa44ff1ff3dda2c
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___MEMORY_USES_ALLOCATOR_H
11 #define _LIBCPP___MEMORY_USES_ALLOCATOR_H
13 #include <__config>
14 #include <cstddef>
15 #include <type_traits>
17 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
18 #pragma GCC system_header
19 #endif
21 _LIBCPP_BEGIN_NAMESPACE_STD
23 template <class _Tp>
24 struct __has_allocator_type
26 private:
27 struct __two {char __lx; char __lxx;};
28 template <class _Up> static __two __test(...);
29 template <class _Up> static char __test(typename _Up::allocator_type* = 0);
30 public:
31 static const bool value = sizeof(__test<_Tp>(0)) == 1;
34 template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
35 struct __uses_allocator
36 : public integral_constant<bool,
37 is_convertible<_Alloc, typename _Tp::allocator_type>::value>
41 template <class _Tp, class _Alloc>
42 struct __uses_allocator<_Tp, _Alloc, false>
43 : public false_type
47 template <class _Tp, class _Alloc>
48 struct _LIBCPP_TEMPLATE_VIS uses_allocator
49 : public __uses_allocator<_Tp, _Alloc>
53 #if _LIBCPP_STD_VER > 14
54 template <class _Tp, class _Alloc>
55 inline constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value;
56 #endif
58 _LIBCPP_END_NAMESPACE_STD
60 #endif // _LIBCPP___MEMORY_USES_ALLOCATOR_H