1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TUPLE_APPLY_CV_H
10#define _LIBCPP___TUPLE_APPLY_CV_H
11
12#include <__config>
13#include <__type_traits/is_const.h>
14#include <__type_traits/is_reference.h>
15#include <__type_traits/is_volatile.h>
16#include <__type_traits/remove_reference.h>
17
18#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19#  pragma GCC system_header
20#endif
21
22#ifndef _LIBCPP_CXX03_LANG
23
24_LIBCPP_BEGIN_NAMESPACE_STD
25
26template <bool _ApplyLV, bool _ApplyConst, bool _ApplyVolatile>
27struct __apply_cv_mf;
28template <>
29struct __apply_cv_mf<false, false, false> {
30  template <class _Tp> using __apply = _Tp;
31};
32template <>
33struct __apply_cv_mf<false, true, false> {
34  template <class _Tp> using __apply _LIBCPP_NODEBUG = const _Tp;
35};
36template <>
37struct __apply_cv_mf<false, false, true> {
38  template <class _Tp> using __apply _LIBCPP_NODEBUG = volatile _Tp;
39};
40template <>
41struct __apply_cv_mf<false, true, true> {
42  template <class _Tp> using __apply _LIBCPP_NODEBUG = const volatile _Tp;
43};
44template <>
45struct __apply_cv_mf<true, false, false> {
46  template <class _Tp> using __apply _LIBCPP_NODEBUG = _Tp&;
47};
48template <>
49struct __apply_cv_mf<true, true, false> {
50  template <class _Tp> using __apply _LIBCPP_NODEBUG = const _Tp&;
51};
52template <>
53struct __apply_cv_mf<true, false, true> {
54  template <class _Tp> using __apply _LIBCPP_NODEBUG = volatile _Tp&;
55};
56template <>
57struct __apply_cv_mf<true, true, true> {
58  template <class _Tp> using __apply _LIBCPP_NODEBUG = const volatile _Tp&;
59};
60template <class _Tp, class _RawTp = __libcpp_remove_reference_t<_Tp> >
61using __apply_cv_t _LIBCPP_NODEBUG = __apply_cv_mf<
62    is_lvalue_reference<_Tp>::value,
63    is_const<_RawTp>::value,
64    is_volatile<_RawTp>::value>;
65
66_LIBCPP_END_NAMESPACE_STD
67
68#endif // _LIBCPP_CXX03_LANG
69
70#endif // _LIBCPP___TUPLE_APPLY_CV_H
71