xref: /openbsd-src/gnu/llvm/libcxx/include/__tuple_dir/apply_cv.h (revision 4bdff4bed0e3d54e55670334c7d0077db4170f86)
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 
26 template <bool _ApplyLV, bool _ApplyConst, bool _ApplyVolatile>
27 struct __apply_cv_mf;
28 template <>
29 struct __apply_cv_mf<false, false, false> {
30   template <class _Tp> using __apply = _Tp;
31 };
32 template <>
33 struct __apply_cv_mf<false, true, false> {
34   template <class _Tp> using __apply _LIBCPP_NODEBUG = const _Tp;
35 };
36 template <>
37 struct __apply_cv_mf<false, false, true> {
38   template <class _Tp> using __apply _LIBCPP_NODEBUG = volatile _Tp;
39 };
40 template <>
41 struct __apply_cv_mf<false, true, true> {
42   template <class _Tp> using __apply _LIBCPP_NODEBUG = const volatile _Tp;
43 };
44 template <>
45 struct __apply_cv_mf<true, false, false> {
46   template <class _Tp> using __apply _LIBCPP_NODEBUG = _Tp&;
47 };
48 template <>
49 struct __apply_cv_mf<true, true, false> {
50   template <class _Tp> using __apply _LIBCPP_NODEBUG = const _Tp&;
51 };
52 template <>
53 struct __apply_cv_mf<true, false, true> {
54   template <class _Tp> using __apply _LIBCPP_NODEBUG = volatile _Tp&;
55 };
56 template <>
57 struct __apply_cv_mf<true, true, true> {
58   template <class _Tp> using __apply _LIBCPP_NODEBUG = const volatile _Tp&;
59 };
60 template <class _Tp, class _RawTp = __libcpp_remove_reference_t<_Tp> >
61 using __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