brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · bbba85a Raw
53 lines · c
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-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP___MEMORY_USES_ALLOCATOR_H11#define _LIBCPP___MEMORY_USES_ALLOCATOR_H12 13#include <__config>14#include <__type_traits/integral_constant.h>15#include <__type_traits/is_convertible.h>16 17#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)18#  pragma GCC system_header19#endif20 21_LIBCPP_BEGIN_NAMESPACE_STD22 23template <class _Tp>24struct __has_allocator_type {25private:26  template <class _Up>27  static false_type __test(...);28  template <class _Up>29  static true_type __test(typename _Up::allocator_type* = 0);30 31public:32  static const bool value = decltype(__test<_Tp>(0))::value;33};34 35template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>36struct __uses_allocator : public integral_constant<bool, is_convertible<_Alloc, typename _Tp::allocator_type>::value> {37};38 39template <class _Tp, class _Alloc>40struct __uses_allocator<_Tp, _Alloc, false> : public false_type {};41 42template <class _Tp, class _Alloc>43struct uses_allocator : public __uses_allocator<_Tp, _Alloc> {};44 45#if _LIBCPP_STD_VER >= 1746template <class _Tp, class _Alloc>47inline constexpr bool uses_allocator_v = uses_allocator<_Tp, _Alloc>::value;48#endif49 50_LIBCPP_END_NAMESPACE_STD51 52#endif // _LIBCPP___MEMORY_USES_ALLOCATOR_H53