xref: /llvm-project/libc/src/__support/CPP/type_traits/integral_constant.h (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
1 //===-- integral_constant type_traits ---------------------------*- C++ -*-===//
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 #ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INTEGRAL_CONSTANT_H
9 #define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INTEGRAL_CONSTANT_H
10 
11 #include "src/__support/macros/attributes.h" // LIBC_INLINE_VAR
12 #include "src/__support/macros/config.h"
13 
14 namespace LIBC_NAMESPACE_DECL {
15 namespace cpp {
16 
17 // integral_constant
18 template <typename T, T v> struct integral_constant {
19   using value_type = T;
20   LIBC_INLINE_VAR static constexpr T value = v;
21 };
22 
23 } // namespace cpp
24 } // namespace LIBC_NAMESPACE_DECL
25 
26 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INTEGRAL_CONSTANT_H
27