File indexing completed on 2025-12-16 10:27:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef RANGES_V3_FUNCTIONAL_ARITHMETIC_HPP
0014 #define RANGES_V3_FUNCTIONAL_ARITHMETIC_HPP
0015
0016 #include <concepts/concepts.hpp>
0017
0018 #include <range/v3/detail/prologue.hpp>
0019
0020 namespace ranges
0021 {
0022
0023
0024 struct plus
0025 {
0026 template<typename T, typename U>
0027 constexpr auto operator()(T && t, U && u) const -> decltype((T &&) t + (U &&) u)
0028 {
0029 return (T &&) t + (U &&) u;
0030 }
0031 using is_transparent = void;
0032 };
0033
0034 struct minus
0035 {
0036 template<typename T, typename U>
0037 constexpr auto operator()(T && t, U && u) const -> decltype((T &&) t - (U &&) u)
0038 {
0039 return (T &&) t - (U &&) u;
0040 }
0041 using is_transparent = void;
0042 };
0043
0044 struct multiplies
0045 {
0046 template<typename T, typename U>
0047 constexpr auto operator()(T && t, U && u) const -> decltype((T &&) t * (U &&) u)
0048 {
0049 return (T &&) t * (U &&) u;
0050 }
0051 using is_transparent = void;
0052 };
0053
0054 struct bitwise_or
0055 {
0056 template<typename T, typename U>
0057 constexpr auto operator()(T && t, U && u) const -> decltype((T &&) t | (U &&) u)
0058 {
0059 return (T &&) t | (U &&) u;
0060 }
0061 using is_transparent = void;
0062 };
0063
0064 template<typename T>
0065 struct convert_to
0066 {
0067
0068 template<typename U>
0069 constexpr auto CPP_auto_fun(operator())(U &&u)(const)
0070 (
0071 return static_cast<T>((U &&) u)
0072 )
0073
0074 };
0075
0076 template<typename T>
0077 struct coerce
0078 {
0079 constexpr T & operator()(T & t) const
0080 {
0081 return t;
0082 }
0083
0084 constexpr T const & operator()(T const & t) const
0085 {
0086 return t;
0087 }
0088
0089 constexpr T operator()(T && t) const
0090 {
0091 return (T &&) t;
0092 }
0093 T operator()(T const &&) const = delete;
0094 };
0095
0096 template<typename T>
0097 struct coerce<T const> : coerce<T>
0098 {};
0099
0100 template<typename T>
0101 struct coerce<T &> : coerce<T>
0102 {};
0103
0104 template<typename T>
0105 struct coerce<T &&> : coerce<T>
0106 {};
0107
0108 }
0109
0110 #include <range/v3/detail/epilogue.hpp>
0111
0112 #endif