xref: /freebsd-src/contrib/llvm-project/libcxx/include/__concepts/arithmetic.h (revision 972a253a57b6f144b0e4a3e2080a2a0076ec55a0)
1349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
2349cc55cSDimitry Andric //
3349cc55cSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4349cc55cSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5349cc55cSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6349cc55cSDimitry Andric //
7349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
8349cc55cSDimitry Andric 
9349cc55cSDimitry Andric #ifndef _LIBCPP___CONCEPTS_ARITHMETIC_H
10349cc55cSDimitry Andric #define _LIBCPP___CONCEPTS_ARITHMETIC_H
11349cc55cSDimitry Andric 
12349cc55cSDimitry Andric #include <__config>
13*972a253aSDimitry Andric #include <__type_traits/is_signed_integer.h>
14*972a253aSDimitry Andric #include <__type_traits/is_unsigned_integer.h>
15349cc55cSDimitry Andric #include <type_traits>
16349cc55cSDimitry Andric 
17349cc55cSDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
18349cc55cSDimitry Andric #  pragma GCC system_header
19349cc55cSDimitry Andric #endif
20349cc55cSDimitry Andric 
21349cc55cSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD
22349cc55cSDimitry Andric 
2381ad6265SDimitry Andric #if _LIBCPP_STD_VER > 17
24349cc55cSDimitry Andric 
25349cc55cSDimitry Andric // [concepts.arithmetic], arithmetic concepts
26349cc55cSDimitry Andric 
27349cc55cSDimitry Andric template<class _Tp>
28349cc55cSDimitry Andric concept integral = is_integral_v<_Tp>;
29349cc55cSDimitry Andric 
30349cc55cSDimitry Andric template<class _Tp>
31349cc55cSDimitry Andric concept signed_integral = integral<_Tp> && is_signed_v<_Tp>;
32349cc55cSDimitry Andric 
33349cc55cSDimitry Andric template<class _Tp>
34349cc55cSDimitry Andric concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
35349cc55cSDimitry Andric 
36349cc55cSDimitry Andric template<class _Tp>
37349cc55cSDimitry Andric concept floating_point = is_floating_point_v<_Tp>;
38349cc55cSDimitry Andric 
39349cc55cSDimitry Andric // Concept helpers for the internal type traits for the fundamental types.
40349cc55cSDimitry Andric 
41349cc55cSDimitry Andric template <class _Tp>
42349cc55cSDimitry Andric concept __libcpp_unsigned_integer = __libcpp_is_unsigned_integer<_Tp>::value;
43349cc55cSDimitry Andric template <class _Tp>
44349cc55cSDimitry Andric concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value;
45349cc55cSDimitry Andric 
4681ad6265SDimitry Andric #endif // _LIBCPP_STD_VER > 17
47349cc55cSDimitry Andric 
48349cc55cSDimitry Andric _LIBCPP_END_NAMESPACE_STD
49349cc55cSDimitry Andric 
50349cc55cSDimitry Andric #endif // _LIBCPP___CONCEPTS_ARITHMETIC_H
51