00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MATH_INTRINSIC_CONCEPT_MAPS_INCLUDE
00013 #define MATH_INTRINSIC_CONCEPT_MAPS_INCLUDE
00014
00015 #include <concepts>
00016
00017 namespace math {
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 concept IntrinsicSignedIntegral<typename T>
00030 : std::SignedIntegralLike<T>
00031 {}
00032
00033 concept IntrinsicUnsignedIntegral<typename T>
00034 : std::UnsignedIntegralLike<T>
00035 {}
00036
00037 concept IntrinsicFloatingPoint<typename T>
00038 : std::FloatingPointLike<T>
00039 {}
00040
00041
00042
00043
00044
00045 concept_map IntrinsicSignedIntegral<signed char> {};
00046 concept_map IntrinsicUnsignedIntegral<unsigned char> {};
00047 concept_map IntrinsicSignedIntegral<short> {};
00048 concept_map IntrinsicUnsignedIntegral<unsigned short> {};
00049 concept_map IntrinsicSignedIntegral<int> {};
00050 concept_map IntrinsicUnsignedIntegral<unsigned int> {};
00051 concept_map IntrinsicSignedIntegral<long> {};
00052 concept_map IntrinsicUnsignedIntegral<unsigned long> {};
00053 concept_map IntrinsicSignedIntegral<long long> {};
00054 concept_map IntrinsicUnsignedIntegral<unsigned long long> {};
00055
00056 concept_map IntrinsicFloatingPoint<float> { }
00057 concept_map IntrinsicFloatingPoint<double> { }
00058
00059 concept Integral<typename T> : std::CopyAssignable<T>
00060 {
00061 requires std::HasPlus<T> && std::HasMinus<T> && std::HasMultiply<T> && std::HasDivide<T>
00062 && std::HasUnaryPlus<T> && std::HasNegate<T>;
00063
00064
00065 T& operator++(T&);
00066 T operator++(T& t, int) { T tmp(t); ++t; return tmp; }
00067 T& operator--(T&);
00068 T operator--(T& t, int) { T tmp(t); --t; return tmp; }
00069
00070 requires std::Convertible<std::HasUnaryPlus<T>::result_type, T>
00071 && std::Convertible<std::HasNegate<T>::result_type, T>
00072 && std::Convertible<std::HasPlus<T>::result_type, T>
00073 && std::Convertible<std::HasMinus<T>::result_type, T>
00074 && std::Convertible<std::HasMultiply<T>::result_type, T>
00075 && std::Convertible<std::HasDivide<T>::result_type, T>;
00076
00077 T& operator*=(T&, T);
00078 T& operator/=(T&, T);
00079 T& operator+=(T&, T);
00080 T& operator-=(T&, T);
00081
00082 requires std::HasComplement<T> && std::HasModulus<T> && std::HasBitAnd<T>
00083 && std::HasBitOr<T> && std::HasBitXor<T> && std::HasLeftShift<T>
00084 && std::HasRightShift<T>;
00085
00086 requires std::Convertible<std::HasComplement<T>::result_type, T>
00087 && std::Convertible<std::HasModulus<T>::result_type, T>
00088 && std::Convertible<std::HasBitAnd<T>::result_type, T>
00089 && std::Convertible<std::HasBitOr<T>::result_type, T>
00090 && std::Convertible<std::HasBitXor<T>::result_type, T>
00091 && std::Convertible<std::HasLeftShift<T>::result_type, T>
00092 && std::Convertible<std::HasRightShift<T>::result_type, T>;
00093
00094 requires std::LessThanComparable<T> && std::EqualityComparable<T>;
00095
00096 T& operator%=(T&, T);
00097 T& operator&=(T&, T);
00098 T& operator|=(T&, T);
00099 T& operator^=(T&, T);
00100 T& operator<<=(T&, T);
00101 T& operator>>=(T&, T);
00102 }
00103
00104
00105 template <typename T>
00106 requires IntrinsicUnsignedIntegral<T>
00107 concept_map Integral<T> {typedef T result_type;}
00108
00109 template <IntrinsicSignedIntegral T>
00110 concept_map Integral<T> {typedef T result_type;}
00111
00112
00113 }
00114
00115 #endif // MATH_INTRINSIC_CONCEPT_MAPS_INCLUDE