Warning: This file is not a C or C++ file. It does not have highlighting.

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
20template <class _Tp, _Tp __v>
21struct _LIBCPP_NO_SPECIALIZATIONS integral_constant {
22 static inline _LIBCPP_CONSTEXPR const _Tp value = __v;
23 typedef _Tp value_type;
24 typedef integral_constant type;
25 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT { return value; }
26#if _LIBCPP_STD_VER >= 14
27 _LIBCPP_HIDE_FROM_ABI constexpr value_type operator()() const _NOEXCEPT { return value; }
28#endif
29};
30
31typedef integral_constant<bool, true> true_type;
32typedef integral_constant<bool, false> false_type;
33
34template <bool _Val>
35using _BoolConstant _LIBCPP_NODEBUG = integral_constant<bool, _Val>;
36
37#if _LIBCPP_STD_VER >= 17
38template <bool __b>
39using bool_constant = integral_constant<bool, __b>;
40#endif
41
42_LIBCPP_END_NAMESPACE_STD
43
44#endif // _LIBCPP___TYPE_TRAITS_INTEGRAL_CONSTANT_H
45

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of libcxx/include/__type_traits/integral_constant.h