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___TYPE_TRAITS_INTEGRAL_CONSTANT_H
10 #define _LIBCPP___TYPE_TRAITS_INTEGRAL_CONSTANT_H
11 
12 #include <__config>
13 
14 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
15 #  pragma GCC system_header
16 #endif
17 
18 _LIBCPP_BEGIN_NAMESPACE_STD
19 
20 template <class _Tp, _Tp __v>
21 struct _LIBCPP_TEMPLATE_VIS integral_constant {
22   static _LIBCPP_CONSTEXPR const _Tp value = __v;
23   typedef _Tp value_type;
24   typedef integral_constant type;
25   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT { return value; }
26 #if _LIBCPP_STD_VER >= 14
27   _LIBCPP_INLINE_VISIBILITY constexpr value_type operator()() const _NOEXCEPT { return value; }
28 #endif
29 };
30 
31 template <class _Tp, _Tp __v>
32 _LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
33 
34 typedef integral_constant<bool, true> true_type;
35 typedef integral_constant<bool, false> false_type;
36 
37 template <bool _Val>
38 using _BoolConstant _LIBCPP_NODEBUG = integral_constant<bool, _Val>;
39 
40 #if _LIBCPP_STD_VER >= 17
41 template <bool __b>
42 using bool_constant = integral_constant<bool, __b>;
43 #endif
44 
45 _LIBCPP_END_NAMESPACE_STD
46 
47 #endif // _LIBCPP___TYPE_TRAITS_INTEGRAL_CONSTANT_H
48