xref: /freebsd-src/contrib/llvm-project/libcxx/include/__concepts/arithmetic.h (revision 81ad626541db97eb356e2c1d4a20eb2a26a766ab)
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>
13349cc55cSDimitry Andric #include <type_traits>
14349cc55cSDimitry Andric 
15349cc55cSDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16349cc55cSDimitry Andric #  pragma GCC system_header
17349cc55cSDimitry Andric #endif
18349cc55cSDimitry Andric 
19349cc55cSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD
20349cc55cSDimitry Andric 
21*81ad6265SDimitry Andric #if _LIBCPP_STD_VER > 17
22349cc55cSDimitry Andric 
23349cc55cSDimitry Andric // [concepts.arithmetic], arithmetic concepts
24349cc55cSDimitry Andric 
25349cc55cSDimitry Andric template<class _Tp>
26349cc55cSDimitry Andric concept integral = is_integral_v<_Tp>;
27349cc55cSDimitry Andric 
28349cc55cSDimitry Andric template<class _Tp>
29349cc55cSDimitry Andric concept signed_integral = integral<_Tp> && is_signed_v<_Tp>;
30349cc55cSDimitry Andric 
31349cc55cSDimitry Andric template<class _Tp>
32349cc55cSDimitry Andric concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
33349cc55cSDimitry Andric 
34349cc55cSDimitry Andric template<class _Tp>
35349cc55cSDimitry Andric concept floating_point = is_floating_point_v<_Tp>;
36349cc55cSDimitry Andric 
37349cc55cSDimitry Andric // Concept helpers for the internal type traits for the fundamental types.
38349cc55cSDimitry Andric 
39349cc55cSDimitry Andric template <class _Tp>
40349cc55cSDimitry Andric concept __libcpp_unsigned_integer = __libcpp_is_unsigned_integer<_Tp>::value;
41349cc55cSDimitry Andric template <class _Tp>
42349cc55cSDimitry Andric concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value;
43349cc55cSDimitry Andric 
44*81ad6265SDimitry Andric #endif // _LIBCPP_STD_VER > 17
45349cc55cSDimitry Andric 
46349cc55cSDimitry Andric _LIBCPP_END_NAMESPACE_STD
47349cc55cSDimitry Andric 
48349cc55cSDimitry Andric #endif // _LIBCPP___CONCEPTS_ARITHMETIC_H
49