libstdc++: Simplify n-ary arithmetic promotion traits
The std::complex partial specializations have been unnecessary since
774c3d8647
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/ext/type_traits.h (__promote_2, __promote_3)
(__promote_4): Redfine as alias templates using __promoted_t.
* include/std/complex (__promote_2): Remove partial
specializations for std::complex.
This commit is contained in:
parent
de44eee5d5
commit
37620d5751
|
@ -189,9 +189,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
{ typedef float __type; };
|
{ typedef float __type; };
|
||||||
|
|
||||||
#if __cpp_fold_expressions
|
#if __cpp_fold_expressions
|
||||||
|
|
||||||
template<typename... _Tp>
|
template<typename... _Tp>
|
||||||
using __promoted_t = decltype((typename __promote<_Tp>::__type(0) + ...));
|
using __promoted_t = decltype((typename __promote<_Tp>::__type(0) + ...));
|
||||||
#endif
|
|
||||||
|
// Deducing the promoted type is done by __promoted_t<_Tp...>,
|
||||||
|
// then __promote is used to provide the nested __type member.
|
||||||
|
template<typename _Tp, typename _Up>
|
||||||
|
using __promote_2 = __promote<__promoted_t<_Tp, _Up>>;
|
||||||
|
|
||||||
|
template<typename _Tp, typename _Up, typename _Vp>
|
||||||
|
using __promote_3 = __promote<__promoted_t<_Tp, _Up, _Vp>>;
|
||||||
|
|
||||||
|
template<typename _Tp, typename _Up, typename _Vp, typename _Wp>
|
||||||
|
using __promote_4 = __promote<__promoted_t<_Tp, _Up, _Vp, _Wp>>;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
template<typename _Tp, typename _Up,
|
template<typename _Tp, typename _Up,
|
||||||
typename _Tp2 = typename __promote<_Tp>::__type,
|
typename _Tp2 = typename __promote<_Tp>::__type,
|
||||||
|
@ -219,6 +232,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
{
|
{
|
||||||
typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type;
|
typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
_GLIBCXX_END_NAMESPACE_VERSION
|
_GLIBCXX_END_NAMESPACE_VERSION
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -1557,35 +1557,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
_GLIBCXX_END_NAMESPACE_VERSION
|
_GLIBCXX_END_NAMESPACE_VERSION
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
|
|
||||||
{
|
|
||||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|
||||||
|
|
||||||
// See ext/type_traits.h for the primary template.
|
|
||||||
template<typename _Tp, typename _Up>
|
|
||||||
struct __promote_2<std::complex<_Tp>, _Up>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename _Tp, typename _Up>
|
|
||||||
struct __promote_2<_Tp, std::complex<_Up> >
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename _Tp, typename _Up>
|
|
||||||
struct __promote_2<std::complex<_Tp>, std::complex<_Up> >
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
|
|
||||||
};
|
|
||||||
|
|
||||||
_GLIBCXX_END_NAMESPACE_VERSION
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
|
|
||||||
namespace std _GLIBCXX_VISIBILITY(default)
|
namespace std _GLIBCXX_VISIBILITY(default)
|
||||||
|
|
Loading…
Reference in New Issue