File indexing completed on 2025-01-18 09:40:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_MATH_TOOLS_COMPLEX_HPP
0011 #define BOOST_MATH_TOOLS_COMPLEX_HPP
0012
0013 #include <utility>
0014 #include <boost/math/tools/is_detected.hpp>
0015
0016 namespace boost {
0017 namespace math {
0018 namespace tools {
0019
0020 namespace detail {
0021 template <typename T, typename = void>
0022 struct is_complex_type_impl
0023 {
0024 static constexpr bool value = false;
0025 };
0026
0027 template <typename T>
0028 struct is_complex_type_impl<T, void_t<decltype(std::declval<T>().real()),
0029 decltype(std::declval<T>().imag())>>
0030 {
0031 static constexpr bool value = true;
0032 };
0033 }
0034
0035 template <typename T>
0036 struct is_complex_type : public detail::is_complex_type_impl<T> {};
0037
0038
0039
0040
0041
0042 template <class T, bool = is_complex_type<T>::value>
0043 struct integer_scalar_type
0044 {
0045 typedef int type;
0046 };
0047 template <class T>
0048 struct integer_scalar_type<T, true>
0049 {
0050 typedef typename T::value_type type;
0051 };
0052 template <class T, bool = is_complex_type<T>::value>
0053 struct unsigned_scalar_type
0054 {
0055 typedef unsigned type;
0056 };
0057 template <class T>
0058 struct unsigned_scalar_type<T, true>
0059 {
0060 typedef typename T::value_type type;
0061 };
0062 template <class T, bool = is_complex_type<T>::value>
0063 struct scalar_type
0064 {
0065 typedef T type;
0066 };
0067 template <class T>
0068 struct scalar_type<T, true>
0069 {
0070 typedef typename T::value_type type;
0071 };
0072
0073
0074 } } }
0075
0076 #endif